]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
MdeModulePkg: Update IP4 stack to support point-to-point link with 31-bit mask.
[mirror_edk2.git] / MdeModulePkg / Library / DxeNetLib / DxeNetLib.c
index 1ee77fe03694475a81b07b8d627d6c3c72ec1ea2..b8544b89ab8d3f5bee7b5e94c1eb12f615b170c2 100644 (file)
@@ -637,7 +637,9 @@ NetGetIpClass (
 \r
   ASSERT if NetMask is zero.\r
   \r
-  If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address.\r
+  If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address,\r
+  except when the originator is one of the endpoints of a point-to-point link with a 31-bit\r
+  mask (RFC3021).\r
 \r
   @param[in]  Ip                    The IP to check against.\r
   @param[in]  NetMask               The mask of the IP.\r
@@ -657,9 +659,13 @@ NetIp4IsUnicast (
   if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {\r
     return FALSE;\r
   }\r
-  \r
-  if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {\r
-    return FALSE;\r
+\r
+  if (NetGetMaskLength (NetMask) != 31) {\r
+    if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {\r
+      return FALSE;\r
+    }\r
+  } else {\r
+    return TRUE;\r
   }\r
 \r
   return TRUE;\r