]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Do not use hard coded TTL/ToS in PXE driver.
authorFu Siyuan <siyuan.fu@intel.com>
Fri, 29 Apr 2016 07:08:58 +0000 (15:08 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Thu, 5 May 2016 01:08:24 +0000 (09:08 +0800)
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/UefiPxeBcDxe/PxeBcImpl.c
NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
NetworkPkg/UefiPxeBcDxe/PxeBcSupport.h

index 12e5566a7913b1804551f69b23c970935758c0c0..c7c5bd625f39ddbbe61e9b7b982d62da681390c7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
 \r
 /** @file\r
   This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
 \r
-  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -1125,7 +1125,9 @@ EfiPxeBcUdpWrite (
                &Private->SubnetMask.v4,\r
                &Private->GatewayIp.v4,\r
                &Private->CurSrcPort,\r
                &Private->SubnetMask.v4,\r
                &Private->GatewayIp.v4,\r
                &Private->CurSrcPort,\r
-               DoNotFragment\r
+               DoNotFragment,\r
+               Private->Mode.TTL,\r
+               Private->Mode.ToS\r
                );\r
   }\r
 \r
                );\r
   }\r
 \r
index 36b0665a96b888a9753ffa493d3c1b5d6d34a12e..eb0f395e3c64ec2d5f649ac69a69691a83e1e6a7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support functions implementation for UefiPxeBc Driver.\r
 \r
 /** @file\r
   Support functions implementation for UefiPxeBc Driver.\r
 \r
-  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -489,6 +489,8 @@ PxeBcIcmp6ErrorUpdate (
   @param[in, out]  SrcPort              The pointer to the source port.\r
   @param[in]       DoNotFragment        If TRUE, fragment is not enabled.\r
                                         Otherwise, fragment is enabled.\r
   @param[in, out]  SrcPort              The pointer to the source port.\r
   @param[in]       DoNotFragment        If TRUE, fragment is not enabled.\r
                                         Otherwise, fragment is enabled.\r
+  @param[in]       TTL                  The time to live field of the IP header. \r
+  @param[in]       ToS                  The type of service field of the IP header.\r
 \r
   @retval          EFI_SUCCESS          Successfully configured this instance.\r
   @retval          Others               Failed to configure this instance.\r
 \r
   @retval          EFI_SUCCESS          Successfully configured this instance.\r
   @retval          Others               Failed to configure this instance.\r
@@ -501,7 +503,9 @@ PxeBcConfigUdp4Write (
   IN     EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN     EFI_IPv4_ADDRESS   *Gateway,\r
   IN OUT UINT16             *SrcPort,\r
   IN     EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN     EFI_IPv4_ADDRESS   *Gateway,\r
   IN OUT UINT16             *SrcPort,\r
-  IN     BOOLEAN            DoNotFragment\r
+  IN     BOOLEAN            DoNotFragment,\r
+  IN     UINT8              TTL,\r
+  IN     UINT8              ToS\r
   )\r
 {\r
   EFI_UDP4_CONFIG_DATA  Udp4CfgData;\r
   )\r
 {\r
   EFI_UDP4_CONFIG_DATA  Udp4CfgData;\r
@@ -511,8 +515,8 @@ PxeBcConfigUdp4Write (
 \r
   Udp4CfgData.TransmitTimeout    = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.ReceiveTimeout     = PXEBC_DEFAULT_LIFETIME;\r
 \r
   Udp4CfgData.TransmitTimeout    = PXEBC_DEFAULT_LIFETIME;\r
   Udp4CfgData.ReceiveTimeout     = PXEBC_DEFAULT_LIFETIME;\r
-  Udp4CfgData.TypeOfService      = DEFAULT_ToS;\r
-  Udp4CfgData.TimeToLive         = DEFAULT_TTL;\r
+  Udp4CfgData.TypeOfService      = ToS;\r
+  Udp4CfgData.TimeToLive         = TTL;\r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r
   Udp4CfgData.DoNotFragment      = DoNotFragment;\r
 \r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r
   Udp4CfgData.DoNotFragment      = DoNotFragment;\r
 \r
index 0a43aeb79b3e47be8754f2b4e09044e452b03984..5d611b55c9f6dc54fc6b231c935df27c472d23fe 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support functions declaration for UefiPxeBc Driver.\r
 \r
 /** @file\r
   Support functions declaration for UefiPxeBc Driver.\r
 \r
-  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -128,13 +128,15 @@ PxeBcIcmp6ErrorUpdate (
 /**\r
   This function is to configure a UDPv4 instance for UdpWrite.\r
 \r
 /**\r
   This function is to configure a UDPv4 instance for UdpWrite.\r
 \r
-  @param[in]       Udp4                 Pointer to EFI_UDP4_PROTOCOL.\r
-  @param[in]       StationIp            Pointer to the station address.\r
-  @param[in]       SubnetMask           Pointer to the subnet mask.\r
-  @param[in]       Gateway              Pointer to the gateway address.\r
-  @param[in, out]  SrcPort              Pointer to the source port.\r
-  @param[in]       DoNotFragment        The flag of DoNotFragment bit in the IPv4\r
-                                        packet.\r
+  @param[in]       Udp4                 The pointer to EFI_UDP4_PROTOCOL.\r
+  @param[in]       StationIp            The pointer to the station address.\r
+  @param[in]       SubnetMask           The pointer to the subnet mask.\r
+  @param[in]       Gateway              The pointer to the gateway address.\r
+  @param[in, out]  SrcPort              The pointer to the source port.\r
+  @param[in]       DoNotFragment        If TRUE, fragment is not enabled.\r
+                                        Otherwise, fragment is enabled.\r
+  @param[in]       TTL                  The time to live field of the IP header. \r
+  @param[in]       ToS                  The type of service field of the IP header.\r
 \r
   @retval          EFI_SUCCESS          Successfully configured this instance.\r
   @retval          Others               Failed to configure this instance.\r
 \r
   @retval          EFI_SUCCESS          Successfully configured this instance.\r
   @retval          Others               Failed to configure this instance.\r
@@ -147,7 +149,9 @@ PxeBcConfigUdp4Write (
   IN     EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN     EFI_IPv4_ADDRESS   *Gateway,\r
   IN OUT UINT16             *SrcPort,\r
   IN     EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN     EFI_IPv4_ADDRESS   *Gateway,\r
   IN OUT UINT16             *SrcPort,\r
-  IN     BOOLEAN            DoNotFragment\r
+  IN     BOOLEAN            DoNotFragment,\r
+  IN     UINT8              TTL,\r
+  IN     UINT8              ToS\r
   );\r
 \r
 \r
   );\r
 \r
 \r