summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-16 06:45:46 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-16 06:45:46 +0000
commit319075ff6e1d1fb470667453ec24a2ba685f60a0 (patch)
tree77af8a0b6469271062fe219e3b45eb2727667fae /MdeModulePkg/Universal/Network
parentfe9591c5b423387ca96ceab938013b172e61fed5 (diff)
downloadedk2-platforms-319075ff6e1d1fb470667453ec24a2ba685f60a0.tar.xz
1. sync PXE boot trackers for Windows 2008 server.
2. fixed one bug for SetIpfilter(). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7886 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network')
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c22
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c2
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c65
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c1
4 files changed, 54 insertions, 36 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index db19d15ead..59bd95f13a 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -277,20 +277,26 @@ PxeBcTryBinl (
ASSERT (Private->Dhcp4Offers[Index].OfferType == DHCP4_PACKET_TYPE_BINL);
Offer = &Private->Dhcp4Offers[Index].Packet.Offer;
- if (Offer->Dhcp4.Header.ServerAddr.Addr[0] == 0) {
- //
- // next server ip address is zero, use server id option instead.
- //
+
+ //
+ // use option 54, if zero, use siaddr in header
+ //
+ ZeroMem (&ServerIp, sizeof(EFI_IP_ADDRESS));
+ if (Private->Dhcp4Offers[Index].Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID] != NULL) {
CopyMem (
&ServerIp.Addr[0],
Private->Dhcp4Offers[Index].Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data,
sizeof (EFI_IPv4_ADDRESS)
);
} else {
- //
- // use next server ip address.
- //
- CopyMem (&ServerIp.Addr[0], &Offer->Dhcp4.Header.ServerAddr, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (
+ &ServerIp.Addr[0],
+ &Offer->Dhcp4.Header.ServerAddr,
+ sizeof (EFI_IPv4_ADDRESS)
+ );
+ }
+ if (ServerIp.Addr[0] == 0) {
+ return FALSE;
}
CachedPacket = &Private->ProxyOffer;
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c
index 82a19d7517..77c3077b5e 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c
@@ -336,7 +336,7 @@ PxeBcDriverBindingStart (
Private->Udp4CfgData.TypeOfService = DEFAULT_ToS;
Private->Udp4CfgData.TimeToLive = DEFAULT_TTL;
Private->Udp4CfgData.DoNotFragment = FALSE;
- Private->Udp4CfgData.ReceiveTimeout = 10000; // 10 milliseconds
+ Private->Udp4CfgData.ReceiveTimeout = 50000; // 50 milliseconds
Private->Udp4CfgData.UseDefaultAddress = FALSE;
PxeBcInitSeedPacket (&Private->SeedPacket, Private->Udp4Read);
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index bed82ae21c..5a17537b12 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -642,21 +642,12 @@ EfiPxeBcDhcp (
ASSERT (Dhcp4Mode.State == Dhcp4Bound);
- 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)
- );
+ 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));
+
+ CopyMem (&Mode->StationIp, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Mode->SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS));
//
// Check the selected offer to see whether BINL is required, if no or BINL is
@@ -1138,10 +1129,6 @@ EfiPxeBcMtftp (
BufferSize
);
- if (!EFI_ERROR (Status)) {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
break;
case EFI_PXE_BASE_CODE_TFTP_READ_FILE:
@@ -1603,9 +1590,10 @@ TRY_AGAIN:
RxData = Token.Packet.RxData;
Session = &RxData->UdpSession;
- Matched = FALSE;
+ Matched = TRUE;
if ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER) != 0) {
+ Matched = FALSE;
//
// Check UDP package by IP filter settings
//
@@ -2509,16 +2497,24 @@ DiscoverBootFile (
Packet = &Private->Dhcp4Ack;
}
- 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
- //
+ //
+ // use option 54, if zero, use siaddr in header
+ //
+ if (Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID] != NULL) {
CopyMem (
&Private->ServerIp,
Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data,
sizeof (EFI_IPv4_ADDRESS)
);
+ } else {
+ CopyMem (
+ &Private->ServerIp,
+ &Packet->Packet.Offer.Dhcp4.Header.ServerAddr,
+ sizeof (EFI_IPv4_ADDRESS)
+ );
+ }
+ if (Private->ServerIp.Addr[0] == 0) {
+ return EFI_DEVICE_ERROR;
}
ASSERT (Packet->Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL);
@@ -2658,10 +2654,25 @@ EfiPxeLoadFile (
if (sizeof (UINTN) < sizeof (UINT64) && (TmpBufSize > 0xFFFFFFFF)) {
Status = EFI_DEVICE_ERROR;
- } else {
+ } else if (*BufferSize >= (UINTN) TmpBufSize && Buffer != NULL) {
+ *BufferSize = (UINTN) TmpBufSize;
+ Status = PxeBc->Mtftp (
+ PxeBc,
+ EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ Buffer,
+ FALSE,
+ &TmpBufSize,
+ &BlockSize,
+ &Private->ServerIp,
+ (UINT8 *) Private->BootFileName,
+ NULL,
+ FALSE
+ );
+ } else {
*BufferSize = (UINTN) TmpBufSize;
+ Status = EFI_BUFFER_TOO_SMALL;
}
- } else if (Buffer == NULL) {
+ } else if (Buffer == NULL || Private->FileSize > *BufferSize) {
*BufferSize = Private->FileSize;
Status = EFI_BUFFER_TOO_SMALL;
} else {
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
index 296861f12d..f30898730e 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
@@ -197,6 +197,7 @@ PxeBcConfigureUdpWriteInstance (
Udp4CfgData.ReceiveTimeout = 1000;
Udp4CfgData.TypeOfService = DEFAULT_ToS;
Udp4CfgData.TimeToLive = DEFAULT_TTL;
+ Udp4CfgData.AllowDuplicatePort = TRUE;
CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));
CopyMem (&Udp4CfgData.SubnetMask, SubnetMask, sizeof (*SubnetMask));