From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 3/3] NetworkPkg/UefiPxeBcDxe: Allow the NULL configuration for NewStationIP/NewSubnetMask
Date: Thu, 14 Dec 2017 13:50:07 +0800 [thread overview]
Message-ID: <1513230607-1832-4-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1513230607-1832-1-git-send-email-jiaxin.wu@intel.com>
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>
---
NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 24 ++++++++++++++----------
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 538cb59..52f1e92 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -28,26 +28,26 @@
**/
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.
//
Private->Ip6->Cancel (Private->Ip6, &Private->Icmp6Token);
@@ -58,15 +58,19 @@ PxeBcFlushStationIp (
goto ON_EXIT;
}
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.
//
Private->Ip4->Cancel (Private->Ip4, &Private->IcmpToken);
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h
index b8519ae..17bee5c 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h
@@ -1,9 +1,9 @@
/** @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
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
@@ -38,11 +38,11 @@
**/
EFI_STATUS
PxeBcFlushStationIp (
PXEBC_PRIVATE_DATA *Private,
- EFI_IP_ADDRESS *StationIp,
+ EFI_IP_ADDRESS *StationIp, OPTIONAL
EFI_IP_ADDRESS *SubnetMask OPTIONAL
);
/**
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2017-12-14 5:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 5:50 [Patch 0/3] Fix the series issues in UefiPxeBcDxe Jiaxin Wu
2017-12-14 5:50 ` [Patch 1/3] NetworkPkg/UefiPxeBcDxe: Fix Pxe.Dhcp() return status code Jiaxin Wu
2017-12-14 5:50 ` [Patch 2/3] NetworkPkg/UefiPxeBcDxe: Correct the handle for PXE Base Code Callback Protocol Jiaxin Wu
2017-12-14 5:50 ` Jiaxin Wu [this message]
2017-12-14 5:52 ` [Patch 0/3] Fix the series issues in UefiPxeBcDxe Wu, Jiaxin
2017-12-14 6:06 ` Fu, Siyuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513230607-1832-4-git-send-email-jiaxin.wu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox