Use siaddr in DHCP packet, if zero, use option 54 instead.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcDhcp.c
index 1d5557f7a9fc88bded9b3cf429ffbc3aba38c874..5e86cf5779e6cc10e2789bc221dcaaad79820c5e 100644 (file)
@@ -275,10 +275,11 @@ PxeBcTryBinl (
   Offer = &Private->Dhcp4Offers[Index].Packet.Offer;\r
 \r
   //\r
   Offer = &Private->Dhcp4Offers[Index].Packet.Offer;\r
 \r
   //\r
-  // use option 54, if zero, use siaddr in header\r
+  // Use siaddr(next server) in DHCPOFFER packet header, if zero, use option 54(server identifier)\r
+  // in DHCPOFFER packet.\r
+  // (It does not comply with PXE Spec, Ver2.1)\r
   //\r
   //\r
-  ZeroMem (&ServerIp, sizeof(EFI_IP_ADDRESS));\r
-  if (Private->Dhcp4Offers[Index].Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID] != NULL) {\r
+  if (EFI_IP4_EQUAL (&Offer->Dhcp4.Header.ServerAddr.Addr, &mZeroIp4Addr)) {\r
     CopyMem (\r
       &ServerIp.Addr[0],\r
       Private->Dhcp4Offers[Index].Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data,\r
     CopyMem (\r
       &ServerIp.Addr[0],\r
       Private->Dhcp4Offers[Index].Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data,\r