public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* VFR validation of IP address and iSCSI IQN
@ 2018-01-11  6:51 Atul Gupta
  2018-01-11  7:31 ` Bi, Dandan
  0 siblings, 1 reply; 3+ messages in thread
From: Atul Gupta @ 2018-01-11  6:51 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hi,

I want to validate IP address and iSCSI IQN within the vfr form. Want to avoid callback hence removed the INTERACTIVE flags, tried few things but none seems to work except for input length check, how to validate the input buffer.

Eg:

string  name    = iqn,
            varid   = UD_CONFIG_IFR_NVDATA.InitiatorName,
            prompt  = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME),
            help    = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME_HELP),
            flags   = 0,
            key     = KEY_INITIATOR_NAME2,
            minsize = 8,
            maxsize = ISCSI_NAME_IFR_MAX_SIZE,
                                             inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
                                             NOT
                                             pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
                                             endif
    endstring;

also tried
span (flags = LAST_NON_MATCH, pushthis, stringref(STRING_TOKEN(STR_STRING_CHECK)), 0) != 0, but did not help.

Any reference to validate the input buffer?

Thanks
Atul


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VFR validation of IP address and iSCSI IQN
  2018-01-11  6:51 VFR validation of IP address and iSCSI IQN Atul Gupta
@ 2018-01-11  7:31 ` Bi, Dandan
  2018-01-11  7:57   ` Atul Gupta
  0 siblings, 1 reply; 3+ messages in thread
From: Bi, Dandan @ 2018-01-11  7:31 UTC (permalink / raw)
  To: Atul Gupta, edk2-devel@lists.01.org

Hi,

(1) If you want the string can only be set with the one in STR_STRING_CHECK, you can add  following codes within the string opcode: 

       inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
           pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
       endif;

(2) If you want the string only cannot be set with the one in STR_STRING_CHECK, you can add following codes within the string opcode:

       inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
           pushthis == stringref(STRING_TOKEN(STR_STRING_CHECK))
       endif;

For more examples you can refer to the vfr file in: edk2\MdeModulePkg\Universal\DriverSampleDxe\ Vfr.vfr.


Thanks,
Dandan

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Atul Gupta
Sent: Thursday, January 11, 2018 2:52 PM
To: edk2-devel@lists.01.org
Subject: [edk2] VFR validation of IP address and iSCSI IQN

Hi,

I want to validate IP address and iSCSI IQN within the vfr form. Want to avoid callback hence removed the INTERACTIVE flags, tried few things but none seems to work except for input length check, how to validate the input buffer.

Eg:

string  name    = iqn,
            varid   = UD_CONFIG_IFR_NVDATA.InitiatorName,
            prompt  = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME),
            help    = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME_HELP),
            flags   = 0,
            key     = KEY_INITIATOR_NAME2,
            minsize = 8,
            maxsize = ISCSI_NAME_IFR_MAX_SIZE,
                                             inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
                                             NOT
                                             pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
                                             endif
    endstring;

also tried
span (flags = LAST_NON_MATCH, pushthis, stringref(STRING_TOKEN(STR_STRING_CHECK)), 0) != 0, but did not help.

Any reference to validate the input buffer?

Thanks
Atul
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VFR validation of IP address and iSCSI IQN
  2018-01-11  7:31 ` Bi, Dandan
@ 2018-01-11  7:57   ` Atul Gupta
  0 siblings, 0 replies; 3+ messages in thread
From: Atul Gupta @ 2018-01-11  7:57 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Thanks for the reply,

My code works if INTERACTIVE flag is used and iqn validated using IScsiNormalizeName. I was looking for a way to validate iqn/ip-address within the vfr i.e use " flags   = 0" and have appropriate expression included in vfr.

Thanks
Atul

-----Original Message-----
From: Bi, Dandan [mailto:dandan.bi@intel.com] 
Sent: Thursday, January 11, 2018 1:02 PM
To: Atul Gupta <atul.gupta@chelsio.com>; edk2-devel@lists.01.org
Subject: RE: VFR validation of IP address and iSCSI IQN

Hi,

(1) If you want the string can only be set with the one in STR_STRING_CHECK, you can add  following codes within the string opcode: 

       inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
           pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
       endif;

(2) If you want the string only cannot be set with the one in STR_STRING_CHECK, you can add following codes within the string opcode:

       inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
           pushthis == stringref(STRING_TOKEN(STR_STRING_CHECK))
       endif;

For more examples you can refer to the vfr file in: edk2\MdeModulePkg\Universal\DriverSampleDxe\ Vfr.vfr.


Thanks,
Dandan

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Atul Gupta
Sent: Thursday, January 11, 2018 2:52 PM
To: edk2-devel@lists.01.org
Subject: [edk2] VFR validation of IP address and iSCSI IQN

Hi,

I want to validate IP address and iSCSI IQN within the vfr form. Want to avoid callback hence removed the INTERACTIVE flags, tried few things but none seems to work except for input length check, how to validate the input buffer.

Eg:

string  name    = iqn,
            varid   = UD_CONFIG_IFR_NVDATA.InitiatorName,
            prompt  = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME),
            help    = STRING_TOKEN(STR_ISCSI_CONFIG_INIT_NAME_HELP),
            flags   = 0,
            key     = KEY_INITIATOR_NAME2,
            minsize = 8,
            maxsize = ISCSI_NAME_IFR_MAX_SIZE,
                                             inconsistentif prompt = STRING_TOKEN(STR_INVALID_IQN),
                                             NOT
                                             pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
                                             endif
    endstring;

also tried
span (flags = LAST_NON_MATCH, pushthis, stringref(STRING_TOKEN(STR_STRING_CHECK)), 0) != 0, but did not help.

Any reference to validate the input buffer?

Thanks
Atul
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-11  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11  6:51 VFR validation of IP address and iSCSI IQN Atul Gupta
2018-01-11  7:31 ` Bi, Dandan
2018-01-11  7:57   ` Atul Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox