Reconfigure the UdpRead instance if an error occurred in Dhcp, Discover and Mtftp process.

Signed-off-by: sfu5
Reviewed-by: qianouyang
Reviewed-by: tye

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12884 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
sfu5 2011-12-16 09:00:47 +00:00
parent 9508d0fa4f
commit 357af28525
3 changed files with 35 additions and 26 deletions

View File

@ -727,7 +727,7 @@ ON_EXIT:
} }
} }
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
// //
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP
@ -1024,7 +1024,7 @@ EfiPxeBcDiscover (
} else { } else {
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
} }
return Status; goto ON_EXIT;
} else { } else {
PxeBcParseCachedDhcpPacket (&Private->PxeReply); PxeBcParseCachedDhcpPacket (&Private->PxeReply);
} }
@ -1043,7 +1043,7 @@ EfiPxeBcDiscover (
ON_EXIT: ON_EXIT:
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
// //
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP
@ -1280,10 +1280,11 @@ EfiPxeBcMtftp (
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ON_EXIT;
} }
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); ON_EXIT:
Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
// //
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP
// receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP. // receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.

View File

@ -1626,6 +1626,14 @@ PxeBcDhcp6Discover (
} }
ReadSize = (UINTN) Reply->Size; ReadSize = (UINTN) Reply->Size;
//
// Start Udp6Read instance
//
Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
if (EFI_ERROR (Status)) {
return Status;
}
Status = PxeBc->UdpRead ( Status = PxeBc->UdpRead (
PxeBc, PxeBc,
OpFlags, OpFlags,
@ -1638,6 +1646,10 @@ PxeBcDhcp6Discover (
&ReadSize, &ReadSize,
(VOID *) &Reply->Dhcp6 (VOID *) &Reply->Dhcp6
); );
//
// Stop Udp6Read instance
//
Private->Udp6Read->Configure (Private->Udp6Read, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }

View File

@ -430,13 +430,8 @@ EfiPxeBcDhcp (
Status = PxeBcDhcp6Sarr (Private, Private->Dhcp6); Status = PxeBcDhcp6Sarr (Private, Private->Dhcp6);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ON_EXIT;
} }
//
// Configure Udp6Read instance
//
Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else { } else {
// //
@ -450,15 +445,16 @@ EfiPxeBcDhcp (
Status = PxeBcDhcp4Dora (Private, Private->Dhcp4); Status = PxeBcDhcp4Dora (Private, Private->Dhcp4);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ON_EXIT;
}
} }
// ON_EXIT:
// Configure Udp4Read instance if (Mode->UsingIpv6) {
// Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); } else {
Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
} }
// //
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP
// receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP. // receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.
@ -692,7 +688,7 @@ EfiPxeBcDiscover (
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ON_EXIT;
} else { } else {
// //
// Parse the cached PXE reply packet, and store it into mode data if valid. // Parse the cached PXE reply packet, and store it into mode data if valid.
@ -725,9 +721,9 @@ EfiPxeBcDiscover (
ON_EXIT: ON_EXIT:
if (Mode->UsingIpv6) { if (Mode->UsingIpv6) {
Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else { } else {
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
} }
// //
@ -962,15 +958,15 @@ EfiPxeBcMtftp (
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ON_EXIT;
} }
ON_EXIT:
if (Mode->UsingIpv6) { if (Mode->UsingIpv6) {
Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData); Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else { } else {
Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData); Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);
} }
// //
// Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP // Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP
// receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP. // receive filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.