diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-13 16:58:01 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-15 08:47:04 +0800 |
commit | f8e13a24b7a19d0076ac6a9a621891f54128156b (patch) | |
tree | 54306e95d8f42197b45b22efa84f988373905b97 /NetworkPkg | |
parent | 09cddd088ced31a99d3b0e4ea2f18a77f2582cd2 (diff) | |
download | edk2-f8e13a24b7a19d0076ac6a9a621891f54128156b.tar.gz edk2-f8e13a24b7a19d0076ac6a9a621891f54128156b.tar.bz2 edk2-f8e13a24b7a19d0076ac6a9a621891f54128156b.zip |
NetworkPkg/UefiPxeBcDxe: Allow the NULL configuration for NewStationIP/NewSubnetMask
According the UEFI Spec for PxeBc.SetStationIP():
If NewStationIP is NULL, then the current IP address will not be modified.
...
If NewSubnetMask is NULL, then the current subnet mask will not be modified.
Currently, EfiPxeBcSetStationIP() doesn't comply with UEFI Spec. This patch is
to fix the issue.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 24 | ||||
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h | 4 |
2 files changed, 16 insertions, 12 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index 9f5be15ce6..dfc79a067b 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -30,22 +30,22 @@ EFI_STATUS
PxeBcFlushStationIp (
PXEBC_PRIVATE_DATA *Private,
- EFI_IP_ADDRESS *StationIp,
+ EFI_IP_ADDRESS *StationIp, OPTIONAL
EFI_IP_ADDRESS *SubnetMask OPTIONAL
)
{
EFI_PXE_BASE_CODE_MODE *Mode;
EFI_STATUS Status;
- ASSERT (StationIp != NULL);
-
Mode = Private->PxeBc.Mode;
Status = EFI_SUCCESS;
if (Mode->UsingIpv6) {
- CopyMem (&Private->Udp6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
- CopyMem (&Private->Ip6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
+ if (StationIp != NULL) {
+ CopyMem (&Private->Udp6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
+ CopyMem (&Private->Ip6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
+ }
//
// Reconfigure the Ip6 instance to capture background ICMP6 packets with new station Ip address.
@@ -60,11 +60,15 @@ PxeBcFlushStationIp ( Status = Private->Ip6->Receive (Private->Ip6, &Private->Icmp6Token);
} else {
- ASSERT (SubnetMask != NULL);
- CopyMem (&Private->Udp4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Private->Udp4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Private->Ip4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Private->Ip4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
+ if (StationIp != NULL) {
+ CopyMem (&Private->Udp4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Private->Ip4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
+ }
+
+ if (SubnetMask != NULL) {
+ CopyMem (&Private->Udp4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Private->Ip4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
+ }
//
// Reconfigure the Ip4 instance to capture background ICMP packets with new station Ip address.
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h index b8519ae8c8..17bee5c279 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h @@ -1,7 +1,7 @@ /** @file
Support functions declaration for UefiPxeBc Driver.
- Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -40,7 +40,7 @@ EFI_STATUS
PxeBcFlushStationIp (
PXEBC_PRIVATE_DATA *Private,
- EFI_IP_ADDRESS *StationIp,
+ EFI_IP_ADDRESS *StationIp, OPTIONAL
EFI_IP_ADDRESS *SubnetMask OPTIONAL
);
|