mirror of https://github.com/acidanthera/audk.git
To comply w/ UEFI spec , In Dhcp(), Discover(), and Mtftp() interfaces, set the IP filter to use StationIp.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10829 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1aa8ced11e
commit
8730386e6d
|
@ -570,6 +570,7 @@ EfiPxeBcDhcp (
|
||||||
UINT32 OptCount;
|
UINT32 OptCount;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_ARP_CONFIG_DATA ArpConfigData;
|
EFI_ARP_CONFIG_DATA ArpConfigData;
|
||||||
|
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
|
||||||
|
|
||||||
if (This == NULL) {
|
if (This == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -588,6 +589,11 @@ EfiPxeBcDhcp (
|
||||||
|
|
||||||
Mode->IcmpErrorReceived = FALSE;
|
Mode->IcmpErrorReceived = FALSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stop Udp4Read instance
|
||||||
|
//
|
||||||
|
Private->Udp4Read->Configure (Private->Udp4Read, NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the DHCP options and build the option list
|
// Initialize the DHCP options and build the option list
|
||||||
//
|
//
|
||||||
|
@ -694,8 +700,40 @@ ON_EXIT:
|
||||||
Mode->RouteTable[1].SubnetMask.Addr[0] = 0;
|
Mode->RouteTable[1].SubnetMask.Addr[0] = 0;
|
||||||
Mode->RouteTable[1].GwAddr.Addr[0] = Private->GatewayIp.Addr[0];
|
Mode->RouteTable[1].GwAddr.Addr[0] = Private->GatewayIp.Addr[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flush new station IP address into Udp4CfgData and Ip4ConfigData
|
||||||
|
//
|
||||||
|
CopyMem (&Private->Udp4CfgData.StationAddress, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
CopyMem (&Private->Udp4CfgData.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
CopyMem (&Private->Ip4ConfigData.StationAddress, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
CopyMem (&Private->Ip4ConfigData.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reconfigure the Ip4 instance to capture background ICMP packets with new station Ip address.
|
||||||
|
//
|
||||||
|
Private->Ip4->Cancel (Private->Ip4, &Private->IcmpErrorRcvToken);
|
||||||
|
Private->Ip4->Configure (Private->Ip4, NULL);
|
||||||
|
|
||||||
|
Status = Private->Ip4->Configure (Private->Ip4, &Private->Ip4ConfigData);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpErrorRcvToken);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
ZeroMem(&IpFilter, sizeof (EFI_PXE_BASE_CODE_IP_FILTER));
|
||||||
|
IpFilter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
|
||||||
|
This->SetIpFilter (This, &IpFilter);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -765,6 +803,7 @@ EfiPxeBcDiscover (
|
||||||
UINT16 Index;
|
UINT16 Index;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PXEBC_BOOT_SVR_ENTRY *BootSvrEntry;
|
PXEBC_BOOT_SVR_ENTRY *BootSvrEntry;
|
||||||
|
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
|
||||||
|
|
||||||
if (This == NULL) {
|
if (This == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -786,6 +825,11 @@ EfiPxeBcDiscover (
|
||||||
return EFI_NOT_STARTED;
|
return EFI_NOT_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stop Udp4Read instance
|
||||||
|
//
|
||||||
|
Private->Udp4Read->Configure (Private->Udp4Read, NULL);
|
||||||
|
|
||||||
Mode->IcmpErrorReceived = FALSE;
|
Mode->IcmpErrorReceived = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -798,7 +842,8 @@ EfiPxeBcDiscover (
|
||||||
|
|
||||||
if (!Mode->PxeDiscoverValid || !Mode->PxeReplyReceived || (!Mode->PxeBisReplyReceived && UseBis)) {
|
if (!Mode->PxeDiscoverValid || !Mode->PxeReplyReceived || (!Mode->PxeBisReplyReceived && UseBis)) {
|
||||||
|
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultInfo.IpCnt = 1;
|
DefaultInfo.IpCnt = 1;
|
||||||
|
@ -821,7 +866,8 @@ EfiPxeBcDiscover (
|
||||||
//
|
//
|
||||||
// Address is not acquired or no discovery options.
|
// Address is not acquired or no discovery options.
|
||||||
//
|
//
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultInfo.UseMCast = (BOOLEAN)!IS_DISABLE_MCAST_DISCOVER (VendorOpt->DiscoverCtrl);
|
DefaultInfo.UseMCast = (BOOLEAN)!IS_DISABLE_MCAST_DISCOVER (VendorOpt->DiscoverCtrl);
|
||||||
|
@ -859,7 +905,7 @@ EfiPxeBcDiscover (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultInfo.IpCnt = BootSvrEntry->IpCnt;
|
DefaultInfo.IpCnt = BootSvrEntry->IpCnt;
|
||||||
|
@ -867,7 +913,9 @@ EfiPxeBcDiscover (
|
||||||
if (DefaultInfo.IpCnt >= 1) {
|
if (DefaultInfo.IpCnt >= 1) {
|
||||||
CreatedInfo = AllocatePool (sizeof (DefaultInfo) + (DefaultInfo.IpCnt - 1) * sizeof (*SrvList));
|
CreatedInfo = AllocatePool (sizeof (DefaultInfo) + (DefaultInfo.IpCnt - 1) * sizeof (*SrvList));
|
||||||
if (CreatedInfo == NULL) {
|
if (CreatedInfo == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto ON_EXIT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (CreatedInfo, &DefaultInfo, sizeof (DefaultInfo));
|
CopyMem (CreatedInfo, &DefaultInfo, sizeof (DefaultInfo));
|
||||||
|
@ -895,14 +943,16 @@ EfiPxeBcDiscover (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index != Info->IpCnt) {
|
if (Index != Info->IpCnt) {
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!Info->UseUCast && !Info->UseBCast && !Info->UseMCast) || (Info->MustUseList && Info->IpCnt == 0)) {
|
if ((!Info->UseUCast && !Info->UseBCast && !Info->UseMCast) || (Info->MustUseList && Info->IpCnt == 0)) {
|
||||||
|
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Execute discover by UniCast/BroadCast/MultiCast
|
// Execute discover by UniCast/BroadCast/MultiCast
|
||||||
|
@ -988,6 +1038,16 @@ EfiPxeBcDiscover (
|
||||||
FreePool (CreatedInfo);
|
FreePool (CreatedInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ON_EXIT:
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
ZeroMem(&IpFilter, sizeof (EFI_PXE_BASE_CODE_IP_FILTER));
|
||||||
|
IpFilter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
|
||||||
|
This->SetIpFilter (This, &IpFilter);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,6 +1143,7 @@ EfiPxeBcMtftp (
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PXE_BASE_CODE_MODE *Mode;
|
EFI_PXE_BASE_CODE_MODE *Mode;
|
||||||
EFI_MAC_ADDRESS TempMacAddr;
|
EFI_MAC_ADDRESS TempMacAddr;
|
||||||
|
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
|
||||||
|
|
||||||
if ((This == NULL) ||
|
if ((This == NULL) ||
|
||||||
(Filename == NULL) ||
|
(Filename == NULL) ||
|
||||||
|
@ -1108,6 +1169,11 @@ EfiPxeBcMtftp (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stop Udp4Read instance
|
||||||
|
//
|
||||||
|
Private->Udp4Read->Configure (Private->Udp4Read, NULL);
|
||||||
|
|
||||||
Mode->TftpErrorReceived = FALSE;
|
Mode->TftpErrorReceived = FALSE;
|
||||||
Mode->IcmpErrorReceived = FALSE;
|
Mode->IcmpErrorReceived = FALSE;
|
||||||
|
|
||||||
|
@ -1208,6 +1274,14 @@ EfiPxeBcMtftp (
|
||||||
Mode->IcmpErrorReceived = TRUE;
|
Mode->IcmpErrorReceived = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
ZeroMem(&IpFilter, sizeof (EFI_PXE_BASE_CODE_IP_FILTER));
|
||||||
|
IpFilter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
|
||||||
|
This->SetIpFilter (This, &IpFilter);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue