]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
NetworkPkg: Correct the proxy DHCP offer handing
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcSupport.c
index eb0f395e3c64ec2d5f649ac69a69691a83e1e6a7..568360de0fbc96ad0909c71c10ececd796387efe 100644 (file)
@@ -258,7 +258,9 @@ PxeBcIcmpErrorDpcHandle (
   }\r
 \r
   if (EFI_IP4 (RxData->Header->SourceAddress) != 0 &&\r
-      !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), 0)) {\r
+      (NTOHL (Mode->SubnetMask.Addr[0]) != 0) &&\r
+      IP4_NET_EQUAL (NTOHL(Mode->StationIp.Addr[0]), EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0])) &&\r
+      !NetIp4IsUnicast (EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0]))) {\r
     //\r
     // The source address of the received packet should be a valid unicast address.\r
     //\r
@@ -489,7 +491,7 @@ PxeBcIcmp6ErrorUpdate (
   @param[in, out]  SrcPort              The pointer to the source port.\r
   @param[in]       DoNotFragment        If TRUE, fragment is not enabled.\r
                                         Otherwise, fragment is enabled.\r
-  @param[in]       TTL                  The time to live field of the IP header. \r
+  @param[in]       Ttl                  The time to live field of the IP header. \r
   @param[in]       ToS                  The type of service field of the IP header.\r
 \r
   @retval          EFI_SUCCESS          Successfully configured this instance.\r
@@ -504,7 +506,7 @@ PxeBcConfigUdp4Write (
   IN     EFI_IPv4_ADDRESS   *Gateway,\r
   IN OUT UINT16             *SrcPort,\r
   IN     BOOLEAN            DoNotFragment,\r
-  IN     UINT8              TTL,\r
+  IN     UINT8              Ttl,\r
   IN     UINT8              ToS\r
   )\r
 {\r
@@ -516,7 +518,7 @@ PxeBcConfigUdp4Write (
   Udp4CfgData.TransmitTimeout    = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.ReceiveTimeout     = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.TypeOfService      = ToS;\r
-  Udp4CfgData.TimeToLive         = TTL;\r
+  Udp4CfgData.TimeToLive         = Ttl;\r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r
   Udp4CfgData.DoNotFragment      = DoNotFragment;\r
 \r
@@ -1381,11 +1383,10 @@ PxeBcUintnToAscDecWithFormat (
 {\r
   UINTN                          Remainder;\r
 \r
-  while (Length > 0) {\r
-    Length--;\r
+  for (; Length > 0; Length--) {\r
     Remainder      = Number % 10;\r
     Number        /= 10;\r
-    Buffer[Length] = (UINT8) ('0' + Remainder);\r
+    Buffer[Length - 1] = (UINT8) ('0' + Remainder);\r
   }\r
 }\r
 \r