X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FUefiPxeBcDxe%2FPxeBcImpl.c;h=193daf1f869636fb421c83d2b801fecf2b30fefd;hb=4965dd562e2d858c5085145de9c6a89f1c7bc020;hp=8d7b3d03ef2600e9c18314242759a81fc305a921;hpb=dc361cc5a04657ddc8c74bd8f044f7ad30c4118a;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 8d7b3d03ef..193daf1f86 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2007, Intel Corporation +Copyright (c) 2007 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -128,6 +128,11 @@ EfiPxeBcStop ( Mode->Started = FALSE; + // + // Reset and leave joined groups + // + Private->Udp4->Groups (Private->Udp4, FALSE, NULL); + Private->Udp4->Configure (Private->Udp4, NULL); Private->Dhcp4->Stop (Private->Dhcp4); @@ -170,6 +175,7 @@ EfiPxeBcDhcp ( UINT32 DiscoverTimeout; UINTN Index; EFI_STATUS Status; + EFI_ARP_CONFIG_DATA ArpConfigData; if (This == NULL) { return EFI_INVALID_PARAMETER; @@ -193,7 +199,7 @@ EfiPxeBcDhcp ( // // Set the DHCP4 config data. // - NetZeroMem (&Dhcp4CfgData, sizeof (EFI_DHCP4_CONFIG_DATA)); + ZeroMem (&Dhcp4CfgData, sizeof (EFI_DHCP4_CONFIG_DATA)); Dhcp4CfgData.OptionCount = OptCount; Dhcp4CfgData.OptionList = OptList; Dhcp4CfgData.Dhcp4Callback = PxeBcDhcpCallBack; @@ -216,8 +222,8 @@ EfiPxeBcDhcp ( // Private->NumOffers = 0; Private->BootpIndex = 0; - NetZeroMem (Private->ServerCount, sizeof (Private->ServerCount)); - NetZeroMem (Private->ProxyIndex, sizeof (Private->ProxyIndex)); + ZeroMem (Private->ServerCount, sizeof (Private->ServerCount)); + ZeroMem (Private->ProxyIndex, sizeof (Private->ProxyIndex)); Status = Dhcp4->Start (Dhcp4, NULL); if (EFI_ERROR (Status)) { @@ -241,9 +247,9 @@ EfiPxeBcDhcp ( ASSERT (Dhcp4Mode.State == Dhcp4Bound); - NetCopyMem (&Private->StationIp, &Dhcp4Mode.ClientAddress, sizeof (EFI_IPv4_ADDRESS)); - NetCopyMem (&Private->SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS)); - NetCopyMem (&Private->GatewayIp, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->StationIp, &Dhcp4Mode.ClientAddress, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->GatewayIp, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS)); // // Check the selected offer to see whether BINL is required, if no or BINL is @@ -262,10 +268,25 @@ EfiPxeBcDhcp ( // // Remove the previously configured option list and callback function // - NetZeroMem (&Dhcp4CfgData, sizeof (EFI_DHCP4_CONFIG_DATA)); + ZeroMem (&Dhcp4CfgData, sizeof (EFI_DHCP4_CONFIG_DATA)); Dhcp4->Configure (Dhcp4, &Dhcp4CfgData); Private->AddressIsOk = TRUE; + + if (!Mode->UsingIpv6) { + // + // If in IPv4 mode, configure the corresponding ARP with this new + // station IP address. + // + ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA)); + + ArpConfigData.SwAddressType = 0x0800; + ArpConfigData.SwAddressLength = sizeof (EFI_IPv4_ADDRESS); + ArpConfigData.StationAddress = &Private->StationIp.v4; + + Private->Arp->Configure (Private->Arp, NULL); + Private->Arp->Configure (Private->Arp, &ArpConfigData); + } } return Status; @@ -385,7 +406,7 @@ EfiPxeBcDiscover ( // // Get the multicast discover ip address from vendor option. // - NetCopyMem (&DefaultInfo.ServerMCastIp.Addr, &VendorOpt->DiscoverMcastIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&DefaultInfo.ServerMCastIp.Addr, &VendorOpt->DiscoverMcastIp, sizeof (EFI_IPv4_ADDRESS)); } DefaultInfo.IpCnt = 0; @@ -444,7 +465,7 @@ EfiPxeBcDiscover ( if (BootSvrEntry == NULL) { Private->ServerIp.Addr[0] = SrvList[Index].IpAddr.Addr[0]; } else { - NetCopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS)); } Status = PxeBcDiscvBootService ( @@ -497,7 +518,7 @@ EfiPxeBcDiscover ( } if (Mode->PxeBisReplyReceived) { - NetCopyMem (&Private->ServerIp, &Mode->PxeReply.Dhcpv4.BootpSiAddr, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->ServerIp, &Mode->PxeReply.Dhcpv4.BootpSiAddr, sizeof (EFI_IPv4_ADDRESS)); } return Status; @@ -568,10 +589,10 @@ EfiPxeBcMtftp ( Mtftp4Config.TimeoutValue = PXEBC_MTFTP_TIMEOUT; Mtftp4Config.TryCount = PXEBC_MTFTP_RETRIES; - NetCopyMem (&Mtftp4Config.StationIp, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS)); - NetCopyMem (&Mtftp4Config.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS)); - NetCopyMem (&Mtftp4Config.GatewayIp, &Private->GatewayIp, sizeof (EFI_IPv4_ADDRESS)); - NetCopyMem (&Mtftp4Config.ServerIp, ServerIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Mtftp4Config.StationIp, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Mtftp4Config.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Mtftp4Config.GatewayIp, &Private->GatewayIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Mtftp4Config.ServerIp, ServerIp, sizeof (EFI_IPv4_ADDRESS)); switch (Operation) { @@ -769,13 +790,13 @@ EfiPxeBcUdpWrite ( ZeroMem (&Token, sizeof (EFI_UDP4_COMPLETION_TOKEN)); ZeroMem (&Udp4Session, sizeof (EFI_UDP4_SESSION_DATA)); - NetCopyMem (&Udp4Session.DestinationAddress, DestIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Udp4Session.DestinationAddress, DestIp, sizeof (EFI_IPv4_ADDRESS)); Udp4Session.DestinationPort = *DestPort; - NetCopyMem (&Udp4Session.SourceAddress, SrcIp, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Udp4Session.SourceAddress, SrcIp, sizeof (EFI_IPv4_ADDRESS)); Udp4Session.SourcePort = *SrcPort; FragCount = (HeaderSize != NULL) ? 2 : 1; - Udp4TxData = (EFI_UDP4_TRANSMIT_DATA *) NetAllocatePool (sizeof (EFI_UDP4_TRANSMIT_DATA) + (FragCount - 1) * sizeof (EFI_UDP4_FRAGMENT_DATA)); + Udp4TxData = (EFI_UDP4_TRANSMIT_DATA *) AllocatePool (sizeof (EFI_UDP4_TRANSMIT_DATA) + (FragCount - 1) * sizeof (EFI_UDP4_FRAGMENT_DATA)); if (Udp4TxData == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -799,7 +820,7 @@ EfiPxeBcUdpWrite ( Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, - NET_TPL_EVENT, + TPL_NOTIFY, PxeBcCommonNotify, &IsDone, &Token.Event @@ -826,11 +847,67 @@ ON_EXIT: gBS->CloseEvent (Token.Event); } - NetFreePool (Udp4TxData); + gBS->FreePool (Udp4TxData); return Status; } +/** + Validate IP packages by IP filter settings + + @param PxeBcMode Pointer to EFI_PXEBC_MODE + + @param Session Received UDP session + + @retval TRUE The UDP package matches IP filters + + @retval FLASE The UDP package doesn't matches IP filters + +**/ +STATIC +BOOLEAN +CheckIpByFilter ( + EFI_PXE_BASE_CODE_MODE *PxeBcMode, + EFI_UDP4_SESSION_DATA *Session + ) +{ + UINTN Index; + EFI_IPv4_ADDRESS Ip4Address; + EFI_IPv4_ADDRESS DestIp4Address; + + if (PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) { + return TRUE; + } + + CopyMem (&DestIp4Address, &Session->DestinationAddress, sizeof (DestIp4Address)); + if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) && + IP4_IS_MULTICAST (NTOHL (EFI_IP4 (DestIp4Address))) + ) { + return TRUE; + } + + if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) && + IP4_IS_LOCAL_BROADCAST (EFI_NTOHL (DestIp4Address)) + ) { + return TRUE; + } + + CopyMem (&Ip4Address, &PxeBcMode->StationIp.v4, sizeof (Ip4Address)); + if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) && + EFI_IP4_EQUAL (&PxeBcMode->StationIp.v4, &DestIp4Address) + ) { + return TRUE; + } + + for (Index = 0; Index < PxeBcMode->IpFilter.IpCnt; ++Index) { + CopyMem (&Ip4Address, &PxeBcMode->IpFilter.IpList[Index].v4, sizeof (Ip4Address)); + if (EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)) { + return TRUE; + } + } + + return FALSE; +} /** GC_NOTO: Add function description @@ -900,10 +977,6 @@ EfiPxeBcUdpRead ( return EFI_INVALID_PARAMETER; } - if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER) { - return EFI_UNSUPPORTED; - } - if ((!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) && (DestPort == NULL)) || (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) && (SrcIp == NULL)) || (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) && (SrcPort == NULL))) { @@ -928,7 +1001,7 @@ EfiPxeBcUdpRead ( Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, - NET_TPL_EVENT, + TPL_NOTIFY, PxeBcCommonNotify, &IsDone, &Token.Event @@ -961,23 +1034,34 @@ EfiPxeBcUdpRead ( Matched = FALSE; - // - // Match the destination ip of the received udp dgram - // - if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP) { - Matched = TRUE; - - if (DestIp != NULL) { - NetCopyMem (DestIp, &Session->DestinationAddress, sizeof (EFI_IPv4_ADDRESS)); + if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER) { + // + // Check UDP package by IP filter settings + // + if (CheckIpByFilter (Mode, Session)) { + Matched = TRUE; } - } else { - if (DestIp != NULL) { - if (EFI_IP4_EQUAL (DestIp, &Session->DestinationAddress)) { - Matched = TRUE; + } + + if (Matched) { + // + // Match the destination ip of the received udp dgram + // + if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP) { + Matched = TRUE; + + if (DestIp != NULL) { + CopyMem (DestIp, &Session->DestinationAddress, sizeof (EFI_IPv4_ADDRESS)); } } else { - if (EFI_IP4_EQUAL (&Private->StationIp, &Session->DestinationAddress)) { - Matched = TRUE; + if (DestIp != NULL) { + if (EFI_IP4_EQUAL (DestIp, &Session->DestinationAddress)) { + Matched = TRUE; + } + } else { + if (EFI_IP4_EQUAL (&Private->StationIp, &Session->DestinationAddress)) { + Matched = TRUE; + } } } } @@ -1006,7 +1090,7 @@ EfiPxeBcUdpRead ( if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) { if (SrcIp != NULL) { - NetCopyMem (SrcIp, &Session->SourceAddress, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (SrcIp, &Session->SourceAddress, sizeof (EFI_IPv4_ADDRESS)); } } else { @@ -1039,7 +1123,7 @@ EfiPxeBcUdpRead ( if (HeaderSize != NULL) { CopyLen = MIN (*HeaderSize, RxData->DataLength); - NetCopyMem (HeaderPtr, RxData->FragmentTable[0].FragmentBuffer, CopyLen); + CopyMem (HeaderPtr, RxData->FragmentTable[0].FragmentBuffer, CopyLen); *HeaderSize = CopyLen; } @@ -1049,7 +1133,7 @@ EfiPxeBcUdpRead ( } else { *BufferSize = RxData->DataLength - CopyLen; - NetCopyMem (BufferPtr, (UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen, *BufferSize); + CopyMem (BufferPtr, (UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen, *BufferSize); } } else { @@ -1091,7 +1175,120 @@ EfiPxeBcSetIpFilter ( IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter ) { - return EFI_UNSUPPORTED; + EFI_STATUS Status; + PXEBC_PRIVATE_DATA *Private; + EFI_PXE_BASE_CODE_MODE *Mode; + UINTN Index; + BOOLEAN PromiscuousNeed; + + if (This == NULL) { + DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL.\n")); + return EFI_INVALID_PARAMETER; + } + + Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This); + Mode = Private->PxeBc.Mode; + + if (Private == NULL) { + DEBUG ((EFI_D_ERROR, "PXEBC_PRIVATE_DATA poiner == NULL.\n")); + return EFI_INVALID_PARAMETER; + } + + if (NewFilter == NULL) { + DEBUG ((EFI_D_ERROR, "IP Filter *NewFilter == NULL.\n")); + return EFI_INVALID_PARAMETER; + } + + if (!Mode->Started) { + DEBUG ((EFI_D_ERROR, "BC was not started.\n")); + return EFI_NOT_STARTED; + } + + PromiscuousNeed = FALSE; + for (Index = 0; Index < NewFilter->IpCnt; ++Index) { + if (IP4_IS_LOCAL_BROADCAST (EFI_IP4 (NewFilter->IpList[Index].v4))) { + // + // The IP is a broadcast address. + // + DEBUG ((EFI_D_ERROR, "There is broadcast address in NewFilter.\n")); + return EFI_INVALID_PARAMETER; + } + if (Ip4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) && + (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) + ) { + // + // If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList, + // promiscuous mode is needed. + // + PromiscuousNeed = TRUE; + } + } + + // + // Clear the UDP instance configuration, all joined groups will be left + // during the operation. + // + Private->Udp4->Configure (Private->Udp4, NULL); + Private->Udp4CfgData.AcceptPromiscuous = FALSE; + Private->Udp4CfgData.AcceptBroadcast = FALSE; + + if (PromiscuousNeed || + NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS || + NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST + ) { + // + // Configure the udp4 filter to receive all packages + // + Private->Udp4CfgData.AcceptPromiscuous = TRUE; + + // + // Configure the UDP instance with the new configuration. + // + Status = Private->Udp4->Configure (Private->Udp4, &Private->Udp4CfgData); + if (EFI_ERROR (Status)) { + return Status; + } + + } else { + + if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) { + // + // Configure the udp4 filter to receive all broadcast packages + // + Private->Udp4CfgData.AcceptBroadcast = TRUE; + } + + // + // Configure the UDP instance with the new configuration. + // + Status = Private->Udp4->Configure (Private->Udp4, &Private->Udp4CfgData); + if (EFI_ERROR (Status)) { + return Status; + } + + if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) { + + for (Index = 0; Index < NewFilter->IpCnt; ++Index) { + if (IP4_IS_MULTICAST (EFI_NTOHL (NewFilter->IpList[Index].v4))) { + // + // Join the mutilcast group + // + Status = Private->Udp4->Groups (Private->Udp4, TRUE, &NewFilter->IpList[Index].v4); + if (EFI_ERROR (Status)) { + return Status; + } + } + } + } + } + + + // + // Save the new filter. + // + CopyMem (&Mode->IpFilter, NewFilter, sizeof (Mode->IpFilter)); + + return EFI_SUCCESS; } @@ -1117,10 +1314,44 @@ EfiPxeBcArp ( IN EFI_MAC_ADDRESS * MacAddr OPTIONAL ) { - return EFI_UNSUPPORTED; + PXEBC_PRIVATE_DATA *Private; + EFI_PXE_BASE_CODE_MODE *Mode; + EFI_STATUS Status; + EFI_MAC_ADDRESS TempMacAddr; + + if (This == NULL || IpAddr == NULL) { + return EFI_INVALID_PARAMETER; + } + + Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This); + Mode = Private->PxeBc.Mode; + + if (!Mode->Started) { + return EFI_NOT_STARTED; + } + + if (!Private->AddressIsOk || Mode->UsingIpv6) { + // + // We can't resolve the IP address if we don't have a local address now. + // Don't have ARP for IPv6. + // + return EFI_INVALID_PARAMETER; + } + + Status = Private->Arp->Request (Private->Arp, &IpAddr->v4, NULL, &TempMacAddr); + if (EFI_ERROR (Status)) { + return Status; + } + + if (MacAddr != NULL) { + CopyMem (MacAddr, &TempMacAddr, sizeof (EFI_MAC_ADDRESS)); + } + + return EFI_SUCCESS; } + /** GC_NOTO: Add function description @@ -1266,6 +1497,7 @@ EfiPxeBcSetStationIP ( { PXEBC_PRIVATE_DATA *Private; EFI_PXE_BASE_CODE_MODE *Mode; + EFI_ARP_CONFIG_DATA ArpConfigData; if (This == NULL) { return EFI_INVALID_PARAMETER; @@ -1296,6 +1528,21 @@ EfiPxeBcSetStationIP ( Private->AddressIsOk = TRUE; + if (!Mode->UsingIpv6) { + // + // If in IPv4 mode, configure the corresponding ARP with this new + // station IP address. + // + ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA)); + + ArpConfigData.SwAddressType = 0x0800; + ArpConfigData.SwAddressLength = sizeof (EFI_IPv4_ADDRESS); + ArpConfigData.StationAddress = &Private->StationIp.v4; + + Private->Arp->Configure (Private->Arp, NULL); + Private->Arp->Configure (Private->Arp, &ArpConfigData); + } + return EFI_SUCCESS; } @@ -1397,27 +1644,27 @@ EfiPxeBcSetPackets ( } if (NewDhcpDiscover != NULL) { - NetCopyMem (&Mode->DhcpDiscover, NewDhcpDiscover, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->DhcpDiscover, NewDhcpDiscover, sizeof (EFI_PXE_BASE_CODE_PACKET)); } if (NewDhcpAck != NULL) { - NetCopyMem (&Mode->DhcpAck, NewDhcpAck, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->DhcpAck, NewDhcpAck, sizeof (EFI_PXE_BASE_CODE_PACKET)); } if (NewProxyOffer != NULL) { - NetCopyMem (&Mode->ProxyOffer, NewProxyOffer, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->ProxyOffer, NewProxyOffer, sizeof (EFI_PXE_BASE_CODE_PACKET)); } if (NewPxeDiscover != NULL) { - NetCopyMem (&Mode->PxeDiscover, NewPxeDiscover, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->PxeDiscover, NewPxeDiscover, sizeof (EFI_PXE_BASE_CODE_PACKET)); } if (NewPxeReply != NULL) { - NetCopyMem (&Mode->PxeReply, NewPxeReply, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->PxeReply, NewPxeReply, sizeof (EFI_PXE_BASE_CODE_PACKET)); } if (NewPxeBisReply != NULL) { - NetCopyMem (&Mode->PxeBisReply, NewPxeBisReply, sizeof (EFI_PXE_BASE_CODE_PACKET)); + CopyMem (&Mode->PxeBisReply, NewPxeBisReply, sizeof (EFI_PXE_BASE_CODE_PACKET)); } return EFI_SUCCESS; @@ -1623,12 +1870,12 @@ DiscoverBootFile ( Packet = &Private->Dhcp4Ack; } - NetCopyMem (&Private->ServerIp, &Packet->Packet.Offer.Dhcp4.Header.ServerAddr, sizeof (EFI_IPv4_ADDRESS)); + CopyMem (&Private->ServerIp, &Packet->Packet.Offer.Dhcp4.Header.ServerAddr, sizeof (EFI_IPv4_ADDRESS)); if (Private->ServerIp.Addr[0] == 0) { // // next server ip address is zero, use option 54 instead // - NetCopyMem ( + CopyMem ( &Private->ServerIp, Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data, sizeof (EFI_IPv4_ADDRESS) @@ -1646,7 +1893,7 @@ DiscoverBootFile ( // // Already have the bootfile length option, compute the file size // - NetCopyMem (&Value, Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN]->Data, sizeof (Value)); + CopyMem (&Value, Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN]->Data, sizeof (Value)); Value = NTOHS (Value); *BufferSize = 512 * Value; Status = EFI_BUFFER_TOO_SMALL;