summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/UefiPxeBcDxe
Commit message (Collapse)AuthorAgeFilesLines
* NetworkPkg/UefiPxeBcDxe: handle competing DHCP servers (more) gracefullyLaszlo Ersek2020-04-011-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When DHCP is misconfigured on a network segment, such that two DHCP servers attempt to reply to requests (and therefore race with each other), the edk2 PXE client can confuse itself. In PxeBcDhcp4BootInfo() / PxeBcDhcp6BootInfo(), the client may refer to a DHCP reply packet as an "earlier" packet from the "same" DHCP server, when in reality both packets are unrelated, and arrive from different DHCP servers. While the edk2 PXE client can do nothing to fix this, it should at least not ASSERT() -- ASSERT() is for catching programming errors (violations of invariants that are under the control of the programmer). ASSERT()s should in particular not refer to external data (such as network packets). What's more, in RELEASE builds, we get NULL pointer references. Check the problem conditions with actual "if"s, and return EFI_PROTOCOL_ERROR. This will trickle out to PxeBcLoadBootFile(), and be reported as "PXE-E99: Unexpected network error". Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200331004749.16128-1-lersek@redhat.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
* NetworkPkg/UefiPxeBcDxe: Fix various typosAntoine Coeur2020-02-1011-48/+48
| | | | | | | | | | | | Fix various typos in comments and documentation. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Maciej Rabeda <maciej.rabeda@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-53-philmd@redhat.com>
* NetworkPkg: Remove unnecessary MdeModulePkg/MdeModulePkg.dec dependency in INFLiming Gao2019-10-081-1/+0
| | | | | | | Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg UefiPxeBcDxe: Consume PcdTftpBlockSize defined in NetworkPkg.decLiming Gao2019-10-081-1/+1
| | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2195 Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg/UefiPxeBcDxe:Add two PCD to control PXE.Xue, ShengfengX2019-04-223-3/+18
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1695 Setup need provide an item for user to control IPV46 PXE boot. Origin UefiPxeBcDxe driver doesn't have such interface. This change added two PCD to control IPV4/6 PXE in PxeBcSupported(). Platform code should override this two PCD according to Setup value. code change no side effect on current PXE function with default PCD. Signed-off-by: Xue ShengfengX <shengfengx.xue@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-0918-126/+18
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg: Protocol Uninstallation CleanupAshish Singhal2019-01-141-10/+5
| | | | | | | | | | | Use UEFILib provided protocol uninstallation abstraction instead of direct API for a proper cleanup. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1444 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Remove some clarification from UefiPxeBcDxe.infSiyuan Fu2018-12-241-6/+0
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1278 This patch is to remove the clarification about usage/difference between those drivers in MdeModulePkg and NetworkPkg, since the MdeModulePkg one have been deleted. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Correct the time stamp and fix the integer overflow issue.Jiaxin Wu2018-10-221-8/+8
| | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=883. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg/UefiPxeBcDxe: Correct comments to align with the input parameter.Jiaxin Wu2018-10-092-2/+14
| | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1230 Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Bi Dandan <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg/UefiPxeBcDxe: Add the clarification compared to UefiPxeBcDxe in ↵Jiaxin Wu2018-09-271-2/+7
| | | | | | | | | | | | | | | | MdeModulePkg. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1205 This patch is to add the driver usage/difference clarification compared to UefiPxeBcDxe in MdeModulePkg. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.Jiaxin Wu2018-09-274-35/+121
| | | | | | | | | | | | | | | | | | | | | *v2: Since the new PCD (PcdPxeTftpWindowSize) was renamed/defined in NetworkPkg instead of MdeModulePkg, this new version is to update the consuming PXE driver. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886 This patch is to use the specified MTFTP windowsize to benefit the PXE download performance. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Shao Ming <ming.shao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol ↵edk2-devel-bounces@lists.01.org2018-09-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | installed by PXE. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152 v2: Sync the same logic to Ipv6 and update code comments. The PXE driver installs a SNP and open this SNP with attribute BY_DRIVER to avoid it being opened by MNP driver, this SNP is also expected not to be opened by other drivers with EXCLUSIVE attribute. In some cases, other drivers may happen to do this by error, and thus cause a system crash. This patch adds EXCLUSIVE attribute when opening SNP in PXE driver, and will reject all OpenProtocol requests by EXCLUSIVE. Cc: Subramanian, Sriram <sriram-s@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: UefiPxeBcDxe: Remove the redundant code.Songpeng Li2018-08-232-33/+0
| | | | | | | | | | | | | | The function PxeBcFreeBootFileOption that is never called have been removed. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1064 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Songpeng Li <songpeng.li@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Removing ipf which is no longer supported from edk2.chenc22018-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing rules for Ipf sources file: * Remove the source file which path with "ipf" and also listed in [Sources.IPF] section of INF file. * Remove the source file which listed in [Components.IPF] section of DSC file and not listed in any other [Components] section. * Remove the embedded Ipf code for MDE_CPU_IPF. Removing rules for Inf file: * Remove IPF from VALID_ARCHITECTURES comments. * Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section. * Remove the INF which only listed in [Components.IPF] section in DSC. * Remove statements from [BuildOptions] that provide IPF specific flags. * Remove any IPF sepcific sections. Removing rules for Dec file: * Remove [Includes.IPF] section from Dec. Removing rules for Dsc file: * Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC. * Remove any IPF specific sections. * Remove statements from [BuildOptions] that provide IPF specific flags. Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Clean up source filesLiming Gao2018-06-2814-117/+117
| | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* NetworkPkg/UefiPxeBcDxe: Configure the ARP Instance/RouteTable with new addressJiaxin Wu2018-03-222-40/+52
| | | | | | | | | | | After completed a DHCP D.O.R.A process and got the new address, the ARP Instance and RouteTable should be configured so as to avoid the later Pxe.Arp failure. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Add warning message for PXE if failed to read system GUID from ↵Fu Siyuan2018-02-052-0/+4
| | | | | | | | | | | | SMBIOS. Current PXE driver uses zero GUID if failed to get the system GUID from smbios table, and some OS PXE boot may fail in such case. This patch is to add a warning message to inform user that smbios table is missed on the platform. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
* NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() function.Fu Siyuan2018-01-151-1/+9
| | | | | | | | | | According to UEFI spec, the PXE.Mtftp() should return invalid parameter if the BufferPtr parameter was NULL and the DontUseBuffer parameter was FALSE. The DontUseBuffer is only used when perform MTFTP/TFTP read operation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Update PXE driver to check for NULL pointer before use it.Fu Siyuan2018-01-041-12/+8
| | | | | | | | | | This patch is to fix the issue that dereferencing of "This" (EFI_LOAD_FILE_PROTOCOL) in EfiPxeLoadFile() is happening before the NULL check. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Add assert for buffer pointer from DHCP driver.Fu Siyuan2018-01-041-0/+4
| | | | | | | | | | | The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check during DHCP process, the DHCP driver should make sure Packet and NewPacket has meaningful value. This patch adds assert for this. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Fix memory leak problem in PXE driver.Fu Siyuan2018-01-042-7/+25
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Check allocated buffer pointer before use.Fu Siyuan2018-01-041-1/+4
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Abort the PXE process if DHCP has been started by other instance.Fu Siyuan2018-01-041-7/+2
| | | | | | | | | | | PXE need to use extended DHCP options and check received offers in callback function, so there is no need to continue the PXE process if DHCP driver has been started by other instance but not PXE driver itself. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Recycle the ICMP error message in PXE driver.Fu Siyuan2017-12-221-16/+14
| | | | | | | | | This patch updates PxeBcIcmpErrorDpcHandle() and PxeBcIcmp6ErrorDpcHandle() to recycle the ICMP packet after copy it to PXE mode data. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Remove redundant check in PXE driver.Fu Siyuan2017-12-221-15/+9
| | | | | | | | | | The IP protocol has been configured to only receive ICMP packet in PXE driver. So this patch removes the unnecessary check for NextHeader field and replace it with ASSERT. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.fanwang22017-12-182-4/+6
| | | | | | | | | | | | | | | | Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting state handling, and it is forward compatible. So apply this Api in NetworkPkg. V2: *Define time period in a macro instead of hard code. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: fanwang2 <fan.wang@intel.com>
* NetworkPkg/UefiPxeBcDxe: Allow the NULL configuration for ↵Jiaxin Wu2017-12-152-12/+16
| | | | | | | | | | | | | | | | | | 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>
* NetworkPkg/UefiPxeBcDxe: Correct the handle for PXE Base Code Callback Protocol.Jiaxin Wu2017-12-152-4/+4
| | | | | | | | | | | | | | According UEFI Spec: The PXE Base Code Callback Protocol must be on the same handle as the PXE Base Code Protocol. But current implementation doesn't follow that. This patch is fix that 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>
* NetworkPkg/UefiPxeBcDxe: Fix Pxe.Dhcp() return status code.Jiaxin Wu2017-12-152-1/+6
| | | | | | | | | | | | | | According UEFI Spec, if valid PXE offer is not received, Pxe.Dhcp() should return EFI_NO_RESPONSE, but currently, EFI_TIMEOUT is returned from Pxe.Dhcp(). This patch is to fix the above 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>
* NetworkPkg/UefiPxeBcDxe: Fix the redundant condition checkJiaxin Wu2017-09-291-2/+2
| | | | | | | | | | Cc: Santhapur Naveen <naveens@amiindia.co.in> 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> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Fix PXEv6 boot failure when DhcpBinl offer received.Jiaxin Wu2017-05-031-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of the DHCP and PXE services on different servers,PXEv6 boot will failure when DhcpBinl offer received. The issue is caused by the following reasons: * PXE Client doesn't append VENDOR_CLASS request parameter, so the offer replied from DHCP service will not contain VENDOR_CLASS option (16). * Once the DhcpBinl offer is selected, the boot discover message should be sent out to request the bootfile by this offer. Current implementation always use servers multi-cast address instead of BootFileUrl address in dhcp6 offer. we should check it first, then decide whether use multi-cast address or not. * If DhcpBinl offer is selected, the boot discover message shouldn't find server ID Option from DhcpBinl offer. That's incorrect because DHCP service and PXE service on different servers. In such a case, we can ignore the Server ID Option. With the above fix in the patch, PXEv6 can boot successfully when DhcpBinl offer received. 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> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Correct the proxy DHCP offer handingJiaxin Wu2017-04-212-4/+6
| | | | | | | | | | | | | | When PXE10/WFM11a offer received, we should only cache the first PXE10/WFM11a offer, and discard the others. But Current we discard all PXE10/WFM11a offer. This patch is to fix this issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Fix potential ASSERT if NetIp4IsUnicast is calledJiaxin Wu2017-03-231-2/+3
| | | | | | | | | | | | | Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: Zhang Lubo <lubo.zhang@intel.com> 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: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
* NetworkPkg: Refine casting expression result to bigger sizeHao Wu2017-03-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are cases that the operands of an expression are all with rank less than UINT64/INT64 and the result of the expression is explicitly cast to UINT64/INT64 to fit the target size. An example will be: UINT32 a,b; // a and b can be any unsigned int type with rank less than UINT64, like // UINT8, UINT16, etc. UINT64 c; c = (UINT64) (a + b); Some static code checkers may warn that the expression result might overflow within the rank of "int" (integer promotions) and the result is then cast to a bigger size. The commit refines codes by the following rules: 1). When the expression is possible to overflow the range of unsigned int/ int: c = (UINT64)a + b; 2). When the expression will not overflow within the rank of "int", remove the explicit type casts: c = a + b; 3). When the expression will be cast to pointer of possible greater size: UINT32 a,b; VOID *c; c = (VOID *)(UINTN)(a + b); --> c = (VOID *)((UINTN)a + b); 4). When one side of a comparison expression contains only operands with rank less than UINT32: UINT8 a; UINT16 b; UINTN c; if ((UINTN)(a + b) > c) {...} --> if (((UINT32)a + b) > c) {...} For rule 4), if we remove the 'UINTN' type cast like: if (a + b > c) {...} The VS compiler will complain with warning C4018 (signed/unsigned mismatch, level 3 warning) due to promoting 'a + b' to type 'int'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Refine UintnToAscDecWithFormat functions logicHao Wu2016-12-221-3/+2
| | | | | | | | | | | | This commit refines the logic for HttpBootUintnToAscDecWithFormat and PxeBcUintnToAscDecWithFormat. It avoids using the decrement operator '--' for array index to prevent possible mis-reports by static code checkers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Replace ASSERT with error return code in PXE and HTTP boot driver.Fu Siyuan2016-12-192-55/+134
| | | | | | | | | | This patch remove the ASSERT when receive a DHCP packet large than the maximum cache buffer size. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Check for the max DHCP packet length before use it.Fu Siyuan2016-11-185-14/+77
| | | | | | | | | This patch updates the PXE and HTTP boot driver to drop the input DHCP packet if it exceed the maximum length. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Check for NULL pointer before dereference it.Fu Siyuan2016-10-311-3/+7
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Add error handling logic when using AllocateZeroPoolZhang Lubo2016-10-311-2/+6
| | | | | | | | | | | Add error handling logic if failed to apply new memory. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Update IP4 stack drivers for classless address unicast check.Fu Siyuan2016-10-282-14/+30
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Add dns support for pxe boot based on IPv6.Zhang Lubo2016-10-265-38/+261
| | | | | | | | | | | | | | | The BootFileURL option (59) in dhcpv6 is used to deliver the next server address with bootfile name, as an example "tftp://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/BOOTFILE_NAME; mode=octet", it can also be “tftp://domain_name/BOOTFILE_NAME; mode=octet”, this patch is to support this case. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg UefiPxeBcDxe: Fix build error for lastest VS2015 compilerHao Wu2016-07-261-2/+2
| | | | | | | | | | | | | | | | | | | The UefiPxeBcDxe module encounters a build error for IA32 arch using the latest version of VS2015: UefiPxeBcDxe.lib(PxeBcBoot.obj) : error LNK2001: unresolved external symbol __allmul The cause is line 148 in file NetworkPkg\UefiPxeBcDxe\PxeBcBoot.c. The third parameter for gBS->SetTimer() function is of type UINT64, so the multiplication should use the MultU64x32() function now. Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* NetworkPkg: Update PXE driver to follow edk2 coding standards.Fu Siyuan2016-07-122-5/+5
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <smahmoud@lenovo.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.Zhang Lubo2016-06-235-129/+67
| | | | | | | | | | | | | | | | | v2: *Since we have redefined the name of arch types in Dhcp.h for http boot, it need to change corresponding codes. Add a new head file Dhcp.h in Mde/Include/IndustryStandard, normalize the universal option numbers and other network number tags. Cc: Sriram Subramanian <sriram-s@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Ignore BootFileName if it is overloaded.Fu Siyuan2016-05-061-2/+5
| | | | | | | | | | Make sure "File" field is not overloaded to carry other DHCP options before use it in PXE driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Do not use hard coded TTL/ToS in PXE driver.Fu Siyuan2016-05-053-15/+25
| | | | | | | | | | | | | EFI_PXE_BASE_CODE_PROTOCOL has interface to set the TTL and ToS value, but not used by the UdpWrite() interface. The code always use a hard coded 16 for the TTL and 0 for ToS. This patch update the UpdWrite() to use the TTL and ToS which have been set by the SetParameters(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Samer El-Haj-Mahmoud <elhaj@hpe.com>
* NetworkPkg: Reword PXE download messageSamer El-Haj-Mahmoud2016-02-141-1/+2
| | | | | | | | Fix a minor grammatical error in the PXE boot message. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Fix suspicious dereference of pointer 'Mode.Ia'Zhang Lubo2016-02-031-1/+1
| | | | | | | | | | | | | This patch is used to fix suspicious dereference of pointer 'Mode.Ia' before NULL check. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg:Fix Network memory leak when calling GetModeData interfaceZhang Lubo2016-01-282-3/+32
| | | | | | | | | | | | | Multiple network protocols have a GetModeData() interface, which may allocate memory resource in the return mode data structure. It's callers responsibility to free these buffers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19758 6f19259b-4bc3-4df7-8a09-765794883524