enhanced UefiPxeBcDxe to support

1. AutoArp. 2. SendGuid. 3 TftpError. 4. IcmpError. 5. RouteTable. 6. ArpCache.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4981 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2008-04-02 08:45:36 +00:00
parent 4965dd562e
commit 982a9eaea2
11 changed files with 551 additions and 30 deletions

View File

@@ -754,11 +754,14 @@ PxeBcDhcpCallBack (
UINT16 Value;
EFI_STATUS Status;
BOOLEAN Received;
CHAR8 *SystemSerialNumber;
EFI_DHCP4_HEADER *DhcpHeader;
if ((Dhcp4Event != Dhcp4RcvdOffer) &&
(Dhcp4Event != Dhcp4SelectOffer) &&
(Dhcp4Event != Dhcp4SendDiscover) &&
(Dhcp4Event != Dhcp4RcvdAck)) {
(Dhcp4Event != Dhcp4RcvdAck) &&
(Dhcp4Event != Dhcp4SendRequest)) {
return EFI_SUCCESS;
}
@@ -798,10 +801,32 @@ PxeBcDhcpCallBack (
switch (Dhcp4Event) {
case Dhcp4SendDiscover:
//
// Cache the dhcp discover packet, of which some information will be used later.
//
CopyMem (Mode->DhcpDiscover.Raw, &Packet->Dhcp4, Packet->Length);
case Dhcp4SendRequest:
if (Mode->SendGUID) {
//
// send the system GUID instead of the MAC address as the hardware address
// in the DHCP packet header.
//
DhcpHeader = &Packet->Dhcp4.Header;
if (EFI_ERROR (GetSmbiosSystemGuidAndSerialNumber ((EFI_GUID *) DhcpHeader->ClientHwAddr, &SystemSerialNumber))) {
//
// GUID not yet set - send all 0xff's to show programable (via SetVariable)
// SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);
// GUID not yet set - send all 0's to show not programable
//
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));
}
DhcpHeader->HwAddrLen = sizeof (EFI_GUID);
}
if (Dhcp4Event == Dhcp4SendDiscover) {
//
// Cache the dhcp discover packet, of which some information will be used later.
//
CopyMem (Mode->DhcpDiscover.Raw, &Packet->Dhcp4, Packet->Length);
}
break;
@@ -1044,6 +1069,9 @@ PxeBcDiscvBootService (
EFI_DHCP4_PACKET_OPTION *PxeOpt;
PXEBC_OPTION_BOOT_ITEM *PxeBootItem;
UINT8 VendorOptLen;
CHAR8 *SystemSerialNumber;
EFI_DHCP4_HEADER *DhcpHeader;
Mode = Private->PxeBc.Mode;
Dhcp4 = Private->Dhcp4;
@@ -1098,6 +1126,18 @@ PxeBcDiscvBootService (
return Status;
}
DhcpHeader = &Token.Packet->Dhcp4.Header;
if (Mode->SendGUID) {
if (EFI_ERROR (GetSmbiosSystemGuidAndSerialNumber ((EFI_GUID *) DhcpHeader->ClientHwAddr, &SystemSerialNumber))) {
//
// GUID not yet set - send all 0's to show not programable
//
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));
}
DhcpHeader->HwAddrLen = sizeof (EFI_GUID);
}
Token.Packet->Dhcp4.Header.Xid = NET_RANDOM (NetRandomInitSeed ());
Token.Packet->Dhcp4.Header.Reserved = (UINT16) ((IsBCast) ? 0xf000 : 0x0);
CopyMem (&Token.Packet->Dhcp4.Header.ClientAddr, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));