Re: [edk2] VFR validation of IP address and iSCSI IQN

2018-01-10 Thread Atul Gupta
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...@intel.com] 
Sent: Thursday, January 11, 2018 1:02 PM
To: Atul Gupta <atul.gu...@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-boun...@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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] VFR validation of IP address and iSCSI IQN

2018-01-10 Thread Bi, Dandan
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-boun...@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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] VFR validation of IP address and iSCSI IQN

2018-01-10 Thread Atul Gupta
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