public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4
@ 2016-11-18  7:40 Jiaxin Wu
  2016-11-22 13:08 ` Fu, Siyuan
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2016-11-18  7:40 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Ye Ting, Zhang Lubo

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



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

end of thread, other threads:[~2016-11-22 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18  7:40 [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4 Jiaxin Wu
2016-11-22 13:08 ` Fu, Siyuan

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