summaryrefslogtreecommitdiff
path: root/NetworkPkg/UefiPxeBcDxe
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2016-04-29 15:08:58 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-05-05 09:08:24 +0800
commit6f2f4116ebe4d3881757d0a08c8a660524775247 (patch)
tree5f74d8616a77d5fd85f1d82cab3fdb7f696e4a80 /NetworkPkg/UefiPxeBcDxe
parenta2cc5fea44b5b5a28dcf6448eafe61aa5ebb42c7 (diff)
downloadedk2-platforms-6f2f4116ebe4d3881757d0a08c8a660524775247.tar.xz
NetworkPkg: Do not use hard coded TTL/ToS in PXE driver.
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>
Diffstat (limited to 'NetworkPkg/UefiPxeBcDxe')
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c6
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c12
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h22
3 files changed, 25 insertions, 15 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 12e5566a79..c7c5bd625f 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
/** @file
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
- Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2016, 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
@@ -1125,7 +1125,9 @@ EfiPxeBcUdpWrite (
&Private->SubnetMask.v4,
&Private->GatewayIp.v4,
&Private->CurSrcPort,
- DoNotFragment
+ DoNotFragment,
+ Private->Mode.TTL,
+ Private->Mode.ToS
);
}
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index 36b0665a96..eb0f395e3c 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,7 +1,7 @@
/** @file
Support functions implementation for UefiPxeBc Driver.
- Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2016, 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
@@ -489,6 +489,8 @@ PxeBcIcmp6ErrorUpdate (
@param[in, out] SrcPort The pointer to the source port.
@param[in] DoNotFragment If TRUE, fragment is not enabled.
Otherwise, fragment is enabled.
+ @param[in] TTL The time to live field of the IP header.
+ @param[in] ToS The type of service field of the IP header.
@retval EFI_SUCCESS Successfully configured this instance.
@retval Others Failed to configure this instance.
@@ -501,7 +503,9 @@ PxeBcConfigUdp4Write (
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *Gateway,
IN OUT UINT16 *SrcPort,
- IN BOOLEAN DoNotFragment
+ IN BOOLEAN DoNotFragment,
+ IN UINT8 TTL,
+ IN UINT8 ToS
)
{
EFI_UDP4_CONFIG_DATA Udp4CfgData;
@@ -511,8 +515,8 @@ PxeBcConfigUdp4Write (
Udp4CfgData.TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
- Udp4CfgData.TypeOfService = DEFAULT_ToS;
- Udp4CfgData.TimeToLive = DEFAULT_TTL;
+ Udp4CfgData.TypeOfService = ToS;
+ Udp4CfgData.TimeToLive = TTL;
Udp4CfgData.AllowDuplicatePort = TRUE;
Udp4CfgData.DoNotFragment = DoNotFragment;
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h
index 0a43aeb79b..5d611b55c9 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 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2016, 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
@@ -128,13 +128,15 @@ PxeBcIcmp6ErrorUpdate (
/**
This function is to configure a UDPv4 instance for UdpWrite.
- @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
- @param[in] StationIp Pointer to the station address.
- @param[in] SubnetMask Pointer to the subnet mask.
- @param[in] Gateway Pointer to the gateway address.
- @param[in, out] SrcPort Pointer to the source port.
- @param[in] DoNotFragment The flag of DoNotFragment bit in the IPv4
- packet.
+ @param[in] Udp4 The pointer to EFI_UDP4_PROTOCOL.
+ @param[in] StationIp The pointer to the station address.
+ @param[in] SubnetMask The pointer to the subnet mask.
+ @param[in] Gateway The pointer to the gateway address.
+ @param[in, out] SrcPort The pointer to the source port.
+ @param[in] DoNotFragment If TRUE, fragment is not enabled.
+ Otherwise, fragment is enabled.
+ @param[in] TTL The time to live field of the IP header.
+ @param[in] ToS The type of service field of the IP header.
@retval EFI_SUCCESS Successfully configured this instance.
@retval Others Failed to configure this instance.
@@ -147,7 +149,9 @@ PxeBcConfigUdp4Write (
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *Gateway,
IN OUT UINT16 *SrcPort,
- IN BOOLEAN DoNotFragment
+ IN BOOLEAN DoNotFragment,
+ IN UINT8 TTL,
+ IN UINT8 ToS
);