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

index 89977e6690b91c5b612e59587c5de2f44edcecec..cf7b7b566e67ad923d7b3485fb45beb19f6e3fee 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Interface routines for PxeBc.\r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1435,7 +1435,9 @@ EfiPxeBcUdpWrite (
              &Private->StationIp.v4,\r
              &Private->SubnetMask.v4,\r
              &Private->GatewayIp.v4,\r
-             &Private->CurrentUdpSrcPort\r
+             &Private->CurrentUdpSrcPort,\r
+             Private->Mode.TTL,\r
+             Private->Mode.ToS\r
              );\r
   if (EFI_ERROR (Status)) {\r
     Private->CurrentUdpSrcPort = 0;\r
index 3016da73241134e16903823dd52cd8e6a7c47dd3..79c9a67f9e59fb07facc6940d69293a6abaf860e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for PxeBc.\r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -42,6 +42,8 @@ PxeBcCommonNotify (
   @param  SubnetMask Pointer to the subnetmask of the station ip address.\r
   @param  Gateway    Pointer to the gateway ip address.\r
   @param  SrcPort    Pointer to the srouce port of the station.\r
+  @param  TTL        The time to live field of the IP header. \r
+  @param  ToS        The type of service field of the IP header.\r
 \r
   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
@@ -65,7 +67,9 @@ PxeBcConfigureUdpWriteInstance (
   IN EFI_IPv4_ADDRESS   *StationIp,\r
   IN EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN EFI_IPv4_ADDRESS   *Gateway,\r
-  IN OUT UINT16         *SrcPort\r
+  IN OUT UINT16         *SrcPort,\r
+  IN     UINT8          TTL,\r
+  IN     UINT8          ToS\r
   )\r
 {\r
   EFI_UDP4_CONFIG_DATA  Udp4CfgData;\r
@@ -74,8 +78,8 @@ PxeBcConfigureUdpWriteInstance (
   ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData));\r
 \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
 \r
   CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));\r
index 6f41aa671d21a6e0c32793cdb024d1bd20488766..1082b3aa2ecc0d82329fe7c39c60a8cc6b2fdfe6 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
   Support routines for PxeBc.\r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -32,13 +32,15 @@ PxeBcCommonNotify (
 \r
 /**\r
   This function initialize(or configure) the Udp4Write instance.\r
-  \r
+\r
   @param  Udp4       Pointer to the EFI_UDP4_PROTOCOL instance.\r
   @param  StationIp  Pointer to the station ip address.\r
   @param  SubnetMask Pointer to the subnetmask of the station ip address.\r
   @param  Gateway    Pointer to the gateway ip address.\r
   @param  SrcPort    Pointer to the srouce port of the station.\r
-  \r
+  @param  TTL        The time to live field of the IP header. \r
+  @param  ToS        The type of service field of the IP header.\r
+\r
   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
                                 RARP, etc.) is not finished yet.\r
@@ -53,7 +55,7 @@ PxeBcCommonNotify (
   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance\r
                                 was not opened.\r
   @retval Others                Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 PxeBcConfigureUdpWriteInstance (\r
@@ -61,7 +63,9 @@ PxeBcConfigureUdpWriteInstance (
   IN EFI_IPv4_ADDRESS   *StationIp,\r
   IN EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN EFI_IPv4_ADDRESS   *Gateway,\r
-  IN OUT UINT16         *SrcPort\r
+  IN OUT UINT16         *SrcPort,\r
+  IN     UINT8          TTL,\r
+  IN     UINT8          ToS\r
   );\r
 /**\r
   Convert number to ASCII value.\r