public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Fu Siyuan <siyuan.fu@intel.com>, Ye Ting <ting.ye@intel.com>,
	Zhang Lubo <lubo.zhang@intel.com>
Subject: [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4
Date: Fri, 18 Nov 2016 15:40:15 +0800	[thread overview]
Message-ID: <1479454815-140484-1-git-send-email-jiaxin.wu@intel.com> (raw)

This patch is used to allow the IPv4 with prefix case.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 04d8345..0804052 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -2722,13 +2722,21 @@ NetLibAsciiStrToIp4 (
 
   for (Index = 0; Index < 4; Index++) {
     TempStr = Ip4Str;
 
     while ((*Ip4Str != '\0') && (*Ip4Str != '.')) {
-      if (!NET_IS_DIGIT (*Ip4Str)) {
+      if (Index != 3 && !NET_IS_DIGIT (*Ip4Str)) {
         return EFI_INVALID_PARAMETER;
       }
+      
+      //
+      // Allow the IPv4 with prefix case, e.g. 192.168.10.10/24 
+      //
+      if (Index == 3 && !NET_IS_DIGIT (*Ip4Str) && *Ip4Str != '/') {
+        return EFI_INVALID_PARAMETER;
+      }
+      
       Ip4Str++;
     }
 
     //
     // The IPv4 address is X.X.X.X
-- 
1.9.5.msysgit.1



             reply	other threads:[~2016-11-18  7:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18  7:40 Jiaxin Wu [this message]
2016-11-22 13:08 ` [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4 Fu, Siyuan

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=1479454815-140484-1-git-send-email-jiaxin.wu@intel.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