public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Atul Gupta <atul.gupta@chelsio.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: VFR validation of IP address and iSCSI IQN
Date: Thu, 11 Jan 2018 07:57:23 +0000	[thread overview]
Message-ID: <CY4PR1201MB023099391DF08DC19C0BE83D97160@CY4PR1201MB0230.namprd12.prod.outlook.com> (raw)
In-Reply-To: <3C0D5C461C9E904E8F62152F6274C0BB3BA0B5F3@shsmsx102.ccr.corp.intel.com>

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


      reply	other threads:[~2018-01-11  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR1201MB023099391DF08DC19C0BE83D97160@CY4PR1201MB0230.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox