diff options
author | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-24 08:25:42 +0000 |
---|---|---|
committer | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-24 08:25:42 +0000 |
commit | 9063c328dff827ef9deb1ce0dde75112c496e072 (patch) | |
tree | 7d85ebcbfb48d005ea03a252d351fc662888249d /NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | |
parent | db999bd39b90f3515ac66c33534bd6ac95113e4d (diff) | |
download | edk2-platforms-9063c328dff827ef9deb1ce0dde75112c496e072.tar.xz |
Fix bugs in PXE driver when using option 43 for boot server list and boot menu prompt.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13676 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c')
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index ba7f948594..5f693729d6 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -529,6 +529,7 @@ EfiPxeBcDiscover ( UINT16 Index;
EFI_STATUS Status;
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
+ EFI_PXE_BASE_CODE_DISCOVER_INFO *NewCreatedInfo;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -541,6 +542,7 @@ EfiPxeBcDiscover ( SrvList = NULL;
Status = EFI_DEVICE_ERROR;
Private->Function = EFI_PXE_BASE_CODE_FUNCTION_DISCOVER;
+ NewCreatedInfo = NULL;
if (!Mode->Started) {
return EFI_NOT_STARTED;
@@ -594,12 +596,12 @@ EfiPxeBcDiscover ( //
// 2. Extract the discover information from the cached packets if unspecified.
//
- Info = &DefaultInfo;
- Status = PxeBcExtractDiscoverInfo (Private, Type, Info, &BootSvrEntry, &SrvList);
+ NewCreatedInfo = &DefaultInfo;
+ Status = PxeBcExtractDiscoverInfo (Private, Type, &NewCreatedInfo, &BootSvrEntry, &SrvList);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
-
+ Info = NewCreatedInfo;
} else {
//
// 3. Take the pass-in information as the discover info, and validate the server list.
@@ -634,30 +636,7 @@ EfiPxeBcDiscover ( Private->IsDoDiscover = TRUE;
- if (Info->UseUCast) {
- //
- // Do discover by unicast.
- //
- for (Index = 0; Index < Info->IpCnt; Index++) {
- if (BootSvrEntry == NULL) {
- CopyMem (&Private->ServerIp, &SrvList[Index].IpAddr, sizeof (EFI_IP_ADDRESS));
- } else {
- ASSERT (!Mode->UsingIpv6);
- ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS));
- CopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS));
- }
-
- Status = PxeBcDiscoverBootServer (
- Private,
- Type,
- Layer,
- UseBis,
- &SrvList[Index].IpAddr,
- 0,
- NULL
- );
- }
- } else if (Info->UseMCast) {
+ if (Info->UseMCast) {
//
// Do discover by multicast.
//
@@ -667,8 +646,8 @@ EfiPxeBcDiscover ( Layer,
UseBis,
&Info->ServerMCastIp,
- 0,
- NULL
+ Info->IpCnt,
+ SrvList
);
} else if (Info->UseBCast) {
@@ -685,6 +664,30 @@ EfiPxeBcDiscover ( Info->IpCnt,
SrvList
);
+
+ } else if (Info->UseUCast) {
+ //
+ // Do discover by unicast.
+ //
+ for (Index = 0; Index < Info->IpCnt; Index++) {
+ if (BootSvrEntry == NULL) {
+ CopyMem (&Private->ServerIp, &SrvList[Index].IpAddr, sizeof (EFI_IP_ADDRESS));
+ } else {
+ ASSERT (!Mode->UsingIpv6);
+ ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS));
+ CopyMem (&Private->ServerIp, &BootSvrEntry->IpAddr[Index], sizeof (EFI_IPv4_ADDRESS));
+ }
+
+ Status = PxeBcDiscoverBootServer (
+ Private,
+ Type,
+ Layer,
+ UseBis,
+ &Private->ServerIp,
+ Info->IpCnt,
+ SrvList
+ );
+ }
}
if (EFI_ERROR (Status)) {
@@ -698,8 +701,8 @@ EfiPxeBcDiscover ( if (!EFI_ERROR (Status)) {
CopyMem (
&Mode->PxeReply.Dhcpv6,
- &Private->PxeReply.Dhcp6.Packet.Offer,
- Private->PxeReply.Dhcp6.Packet.Offer.Length
+ &Private->PxeReply.Dhcp6.Packet.Ack.Dhcp6,
+ Private->PxeReply.Dhcp6.Packet.Ack.Length
);
Mode->PxeReplyReceived = TRUE;
Mode->PxeDiscoverValid = TRUE;
@@ -709,8 +712,8 @@ EfiPxeBcDiscover ( if (!EFI_ERROR (Status)) {
CopyMem (
&Mode->PxeReply.Dhcpv4,
- &Private->PxeReply.Dhcp4.Packet.Offer,
- Private->PxeReply.Dhcp4.Packet.Offer.Length
+ &Private->PxeReply.Dhcp4.Packet.Ack.Dhcp4,
+ Private->PxeReply.Dhcp4.Packet.Ack.Length
);
Mode->PxeReplyReceived = TRUE;
Mode->PxeDiscoverValid = TRUE;
@@ -720,6 +723,10 @@ EfiPxeBcDiscover ( ON_EXIT:
+ if (NewCreatedInfo != NULL && NewCreatedInfo != &DefaultInfo) {
+ FreePool (NewCreatedInfo);
+ }
+
if (Mode->UsingIpv6) {
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else {
|