]> git.proxmox.com Git - mirror_edk2.git/commitdiff
[Description]:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 27 May 2008 03:34:39 +0000 (03:34 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 27 May 2008 03:34:39 +0000 (03:34 +0000)
 Problem with PXE boot to Windows Server 2008 install. The reason is that UdpRead and UdpWrite interfaces cannot work well with the same UDP instance.
[Solution]
 Use separate instances for UDP Read and UDP write in UefiPxeBC module.
[Impaction]:
 UefiPxeBcDxe and Udp4Dxe module.
[Reference Info]:
 EDK tracker 1133 - Problem with PXE boot to Windows Server 2008 install.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5303 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcMtftp.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h

index c190a1df80f1a758a152f7c87ed6439bf5c8cc3a..4b281bb283fc6de41c2e590c8bf2e9a9e37c2681 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -306,7 +306,7 @@ Udp4CheckTimeout (
       //\r
       // Iterate all the rxdatas belonging to this udp instance.\r
       //\r
-      Wrap = NET_LIST_USER_STRUCT (Entry, UDP4_RXDATA_WRAP, Link);\r
+      Wrap = NET_LIST_USER_STRUCT (WrapEntry, UDP4_RXDATA_WRAP, Link);\r
 \r
       if (Wrap->TimeoutTick <= UDP4_TIMEOUT_INTERVAL / 1000) {\r
         //\r
index 9d26b135f5140baae1abe1fc522d0d2c1d0cc660..845b7c0fd67dfb652853967d699de10adbb9371b 100644 (file)
@@ -270,17 +270,20 @@ PxeBcDriverBindingStart (
              ControllerHandle,\r
              This->DriverBindingHandle,\r
              &gEfiUdp4ServiceBindingProtocolGuid,\r
-             &Private->Udp4Child\r
+             &Private->Udp4ReadChild\r
              );\r
 \r
   if (EFI_ERROR (Status)) {\r
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // The UDP instance for EfiPxeBcUdpRead\r
+  //\r
   Status = gBS->OpenProtocol (\r
-                  Private->Udp4Child,\r
+                  Private->Udp4ReadChild,\r
                   &gEfiUdp4ProtocolGuid,\r
-                  (VOID **) &Private->Udp4,\r
+                  (VOID **) &Private->Udp4Read,\r
                   This->DriverBindingHandle,\r
                   ControllerHandle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -290,18 +293,42 @@ PxeBcDriverBindingStart (
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // The UDP instance for EfiPxeBcUdpWrite\r
+  //\r
+  Status = NetLibCreateServiceChild (\r
+             ControllerHandle, \r
+             This->DriverBindingHandle,\r
+             &gEfiUdp4ServiceBindingProtocolGuid,\r
+             &Private->Udp4WriteChild\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  Private->Udp4WriteChild,\r
+                  &gEfiUdp4ProtocolGuid,\r
+                  (VOID **) &Private->Udp4Write,\r
+                  This->DriverBindingHandle,\r
+                  ControllerHandle,\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
   ZeroMem (&Private->Udp4CfgData, sizeof (EFI_UDP4_CONFIG_DATA));\r
   Private->Udp4CfgData.AcceptBroadcast    = FALSE;\r
   Private->Udp4CfgData.AcceptPromiscuous  = FALSE;\r
-  Private->Udp4CfgData.AcceptAnyPort      = FALSE;\r
+  Private->Udp4CfgData.AcceptAnyPort      = TRUE;\r
   Private->Udp4CfgData.AllowDuplicatePort = TRUE;\r
   Private->Udp4CfgData.TypeOfService      = DEFAULT_ToS;\r
   Private->Udp4CfgData.TimeToLive         = DEFAULT_TTL;\r
   Private->Udp4CfgData.DoNotFragment      = FALSE;\r
-  Private->Udp4CfgData.ReceiveTimeout     = 10000;  // 10 milliseconds\r
+  Private->Udp4CfgData.ReceiveTimeout     = 50000;  // 50 milliseconds\r
   Private->Udp4CfgData.UseDefaultAddress  = FALSE;\r
 \r
-  PxeBcInitSeedPacket (&Private->SeedPacket, Private->Udp4);\r
+  PxeBcInitSeedPacket (&Private->SeedPacket, Private->Udp4Read);\r
   Private->MacLen = Private->SeedPacket.Dhcp4.Header.HwAddrLen;\r
   CopyMem (&Private->Mac, &Private->SeedPacket.Dhcp4.Header.ClientHwAddr[0], Private->MacLen);\r
 \r
@@ -330,9 +357,24 @@ PxeBcDriverBindingStart (
 \r
 ON_ERROR:\r
 \r
-  if (Private->Udp4Child != NULL) {\r
+  if (Private->Udp4WriteChild != NULL) {\r
+    gBS->CloseProtocol (\r
+           Private->Udp4WriteChild,\r
+           &gEfiUdp4ProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           ControllerHandle\r
+           );\r
+    NetLibDestroyServiceChild (\r
+      ControllerHandle,\r
+      This->DriverBindingHandle,\r
+      &gEfiUdp4ServiceBindingProtocolGuid,\r
+      Private->Udp4WriteChild\r
+      );\r
+  }\r
+\r
+  if (Private->Udp4ReadChild != NULL) {\r
     gBS->CloseProtocol (\r
-          Private->Udp4Child,\r
+          Private->Udp4ReadChild,\r
           &gEfiUdp4ProtocolGuid,\r
           This->DriverBindingHandle,\r
           ControllerHandle\r
@@ -341,7 +383,7 @@ ON_ERROR:
       ControllerHandle,\r
       This->DriverBindingHandle,\r
       &gEfiUdp4ServiceBindingProtocolGuid,\r
-      Private->Udp4Child\r
+      Private->Udp4ReadChild\r
       );\r
   }\r
 \r
@@ -491,7 +533,20 @@ PxeBcDriverBindingStop (
   if (!EFI_ERROR (Status)) {\r
 \r
     gBS->CloseProtocol (\r
-          Private->Udp4Child,\r
+           Private->Udp4WriteChild,\r
+           &gEfiUdp4ProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           NicHandle\r
+           );\r
+    NetLibDestroyServiceChild (\r
+      ControllerHandle,\r
+      This->DriverBindingHandle,\r
+      &gEfiUdp4ServiceBindingProtocolGuid,\r
+      Private->Udp4WriteChild\r
+      );\r
+\r
+    gBS->CloseProtocol (\r
+          Private->Udp4ReadChild,\r
           &gEfiUdp4ProtocolGuid,\r
           This->DriverBindingHandle,\r
           NicHandle\r
@@ -500,7 +555,7 @@ PxeBcDriverBindingStop (
       NicHandle,\r
       This->DriverBindingHandle,\r
       &gEfiUdp4ServiceBindingProtocolGuid,\r
-      Private->Udp4Child\r
+      Private->Udp4ReadChild\r
       );\r
 \r
     gBS->CloseProtocol (\r
index c0fff3d5479b61af02d6ee2584df17459c42bc2b..8fc528f3161adb6f6d24ebd15b02749f4db6d1b3 100644 (file)
@@ -272,7 +272,7 @@ EfiPxeBcStart (
   //\r
   // Configure the udp4 instance to let it receive data\r
   //\r
-  Status = Private->Udp4->Configure (Private->Udp4, &Private->Udp4CfgData);\r
+  Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -421,13 +421,9 @@ EfiPxeBcStop (
 \r
   Mode->Started = FALSE;\r
 \r
-\r
-  //\r
-  // Reset and leave joined groups\r
-  //\r
-  Private->Udp4->Groups (Private->Udp4, FALSE, NULL);\r
-\r
-  Private->Udp4->Configure (Private->Udp4, NULL);\r
+  Private->CurrentUdpSrcPort = 0;\r
+  Private->Udp4Write->Configure (Private->Udp4Write, NULL);\r
+  Private->Udp4Read->Configure (Private->Udp4Read, NULL);\r
 \r
   Private->Dhcp4->Stop (Private->Dhcp4);\r
   Private->Dhcp4->Configure (Private->Dhcp4, NULL);\r
@@ -1076,7 +1072,6 @@ EfiPxeBcUdpWrite (
   EFI_UDP4_SESSION_DATA     Udp4Session;\r
   EFI_STATUS                Status;\r
   BOOLEAN                   IsDone;\r
-  UINT16                    RandomSrcPort;\r
   EFI_PXE_BASE_CODE_MODE    *Mode;\r
   EFI_MAC_ADDRESS           TempMacAddr;\r
 \r
@@ -1106,8 +1101,11 @@ EfiPxeBcUdpWrite (
   }\r
 \r
   Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);\r
-  Udp4    = Private->Udp4;\r
+  Udp4    = Private->Udp4Write;\r
   Mode    = &Private->Mode;\r
+  if (!Mode->Started) {\r
+    return EFI_NOT_STARTED;\r
+  }\r
 \r
   if (!Private->AddressIsOk && (SrcIp == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -1125,23 +1123,25 @@ EfiPxeBcUdpWrite (
 \r
   Mode->IcmpErrorReceived = FALSE;\r
 \r
-  if (SrcIp == NULL) {\r
-    SrcIp = &Private->StationIp;\r
-\r
-    if (GatewayIp == NULL) {\r
-      GatewayIp = &Private->GatewayIp;\r
+  if ((Private->CurrentUdpSrcPort == 0) ||\r
+    ((SrcPort != NULL) && (*SrcPort != Private->CurrentUdpSrcPort))) {\r
+    //\r
+    // Port is changed, (re)configure the Udp4Write instance\r
+    //\r
+    if (SrcPort != NULL) {\r
+      Private->CurrentUdpSrcPort = *SrcPort;\r
     }\r
-  }\r
-\r
-  if ((SrcPort == NULL) || (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT)) {\r
-    RandomSrcPort = (UINT16) (NET_RANDOM (NetRandomInitSeed ()) % 10000 + 1024);\r
-\r
-    if (SrcPort == NULL) {\r
 \r
-      SrcPort  = &RandomSrcPort;\r
-    } else {\r
-\r
-      *SrcPort = RandomSrcPort;\r
+    Status = PxeBcConfigureUdpWriteInstance (\r
+               Udp4,\r
+               &Private->StationIp.v4,\r
+               &Private->SubnetMask.v4,\r
+               &Private->GatewayIp.v4,\r
+               &Private->CurrentUdpSrcPort\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
+      Private->CurrentUdpSrcPort = 0;\r
+      return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
 \r
@@ -1150,8 +1150,12 @@ EfiPxeBcUdpWrite (
 \r
   CopyMem (&Udp4Session.DestinationAddress, DestIp, sizeof (EFI_IPv4_ADDRESS));\r
   Udp4Session.DestinationPort = *DestPort;\r
-  CopyMem (&Udp4Session.SourceAddress, SrcIp, sizeof (EFI_IPv4_ADDRESS));\r
-  Udp4Session.SourcePort = *SrcPort;\r
+  if (SrcIp != NULL) {\r
+    CopyMem (&Udp4Session.SourceAddress, SrcIp, sizeof (EFI_IPv4_ADDRESS));\r
+  }\r
+  if (SrcPort != NULL) {\r
+    Udp4Session.SourcePort = *SrcPort;\r
+  }\r
 \r
   FragCount = (HeaderSize != NULL) ? 2 : 1;\r
   Udp4TxData = (EFI_UDP4_TRANSMIT_DATA *) AllocatePool (sizeof (EFI_UDP4_TRANSMIT_DATA) + (FragCount - 1) * sizeof (EFI_UDP4_FRAGMENT_DATA));\r
@@ -1171,7 +1175,9 @@ EfiPxeBcUdpWrite (
     DataLength += (UINT32) *HeaderSize;\r
   }\r
 \r
-  Udp4TxData->GatewayAddress  = (EFI_IPv4_ADDRESS *) GatewayIp;\r
+  if (GatewayIp != NULL) {\r
+    Udp4TxData->GatewayAddress  = (EFI_IPv4_ADDRESS *) GatewayIp;\r
+  }\r
   Udp4TxData->UdpSessionData  = &Udp4Session;\r
   Udp4TxData->DataLength      = DataLength;\r
   Token.Packet.TxData         = Udp4TxData;\r
@@ -1344,7 +1350,7 @@ EfiPxeBcUdpRead (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (((HeaderSize != NULL) && (*HeaderSize == 0)) || ((HeaderPtr == NULL) && (*HeaderSize != 0))) {\r
+  if (((HeaderSize != NULL) && (*HeaderSize == 0)) || ((HeaderSize != NULL) && (HeaderPtr == NULL))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -1354,7 +1360,7 @@ EfiPxeBcUdpRead (
 \r
   Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);\r
   Mode    = Private->PxeBc.Mode;\r
-  Udp4    = Private->Udp4;\r
+  Udp4    = Private->Udp4Read;\r
 \r
   if (!Mode->Started) {\r
     return EFI_NOT_STARTED;\r
@@ -1373,6 +1379,8 @@ EfiPxeBcUdpRead (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
+TRY_AGAIN:\r
+\r
   IsDone = FALSE;\r
   Status = Udp4->Receive (Udp4, &Token);\r
   if (EFI_ERROR (Status)) {\r
@@ -1410,6 +1418,8 @@ EfiPxeBcUdpRead (
     }\r
 \r
     if (Matched) {\r
+      Matched = FALSE;\r
+\r
       //\r
       // Match the destination ip of the received udp dgram\r
       //\r
@@ -1510,6 +1520,10 @@ EfiPxeBcUdpRead (
     // Recycle the RxData\r
     //\r
     gBS->SignalEvent (RxData->RecycleSignal);\r
+\r
+    if (!Matched) {\r
+      goto TRY_AGAIN;\r
+    }\r
   }\r
 \r
 ON_EXIT:\r
@@ -1594,7 +1608,7 @@ EfiPxeBcSetIpFilter (
   // Clear the UDP instance configuration, all joined groups will be left\r
   // during the operation.\r
   //\r
-  Private->Udp4->Configure (Private->Udp4, NULL);\r
+  Private->Udp4Read->Configure (Private->Udp4Read, NULL);\r
   Private->Udp4CfgData.AcceptPromiscuous  = FALSE;\r
   Private->Udp4CfgData.AcceptBroadcast    = FALSE;\r
 \r
@@ -1610,7 +1624,7 @@ EfiPxeBcSetIpFilter (
     //\r
     // Configure the UDP instance with the new configuration.\r
     //\r
-    Status = Private->Udp4->Configure (Private->Udp4, &Private->Udp4CfgData);\r
+    Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -1627,7 +1641,7 @@ EfiPxeBcSetIpFilter (
     //\r
     // Configure the UDP instance with the new configuration.\r
     //\r
-    Status = Private->Udp4->Configure (Private->Udp4, &Private->Udp4CfgData);\r
+    Status = Private->Udp4Read->Configure (Private->Udp4Read, &Private->Udp4CfgData);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -1639,7 +1653,7 @@ EfiPxeBcSetIpFilter (
           //\r
           // Join the mutilcast group\r
           //\r
-          Status = Private->Udp4->Groups (Private->Udp4, TRUE, &NewFilter->IpList[Index].v4);\r
+          Status = Private->Udp4Read->Groups (Private->Udp4Read, TRUE, &NewFilter->IpList[Index].v4);\r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
@@ -2448,7 +2462,7 @@ EfiPxeLoadFile (
   switch (Status) {\r
 \r
   case EFI_SUCCESS:\r
-    break;\r
+    return EFI_SUCCESS;\r
 \r
   case EFI_BUFFER_TOO_SMALL:\r
     if (Buffer != NULL) {\r
index 4fbdcad5eb588b2c6f5fe2ba5dce0c290e8baacf..df77c5da49c13ceb83597b59686b45b1ae0a0480 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2007, Intel Corporation
+Copyright (c) 2007 - 2008, Intel Corporation                                                         
 All rights reserved. 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
@@ -64,8 +64,8 @@ struct _PXEBC_PRIVATE_DATA {
   EFI_HANDLE                                Dhcp4Child;
   EFI_HANDLE                                Ip4Child;
   EFI_HANDLE                                Mtftp4Child;
-  EFI_HANDLE                                Udp4Child;
-
+  EFI_HANDLE                                Udp4ReadChild;
+  EFI_HANDLE                                Udp4WriteChild;
 
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;
 
@@ -78,7 +78,9 @@ struct _PXEBC_PRIVATE_DATA {
   EFI_IP4_PROTOCOL                          *Ip4;
   EFI_IP4_CONFIG_DATA                       Ip4ConfigData;
   EFI_MTFTP4_PROTOCOL                       *Mtftp4;
-  EFI_UDP4_PROTOCOL                         *Udp4;
+  EFI_UDP4_PROTOCOL                         *Udp4Read;
+  EFI_UDP4_PROTOCOL                         *Udp4Write;
+  UINT16                                    CurrentUdpSrcPort;
   EFI_UDP4_CONFIG_DATA                      Udp4CfgData;
 
 
index 3b2eb5b42226e26748c3fe3087e07bf0eaf15350..b49ff2d52ca53d2868dff387a650950d1819e51e 100644 (file)
@@ -254,7 +254,7 @@ PxeBcTftpReadFile (
 \r
   if (BlockSize != NULL) {\r
 \r
-    ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
+    ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
     UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
     OptCnt++;\r
@@ -336,7 +336,7 @@ PxeBcTftpWriteFile (
 \r
   if (BlockSize != NULL) {\r
 \r
-    ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
+    ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
     UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
     OptCnt++;\r
@@ -410,7 +410,7 @@ PxeBcTftpReadDirectory (
 \r
   if (BlockSize != NULL) {\r
 \r
-    ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
+    ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
     UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
     OptCnt++;\r
index 200d43141eba035ba54aef418a54c947fdaa220b..0e42b5c69bef4de9c5885de0d49e0d1bf34520e6 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2008, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -162,6 +162,56 @@ PxeBcCommonNotify (
   *((BOOLEAN *) Context) = TRUE;\r
 }\r
 \r
+EFI_STATUS\r
+PxeBcConfigureUdpWriteInstance (\r
+  IN EFI_UDP4_PROTOCOL  *Udp4,\r
+  IN EFI_IPv4_ADDRESS   *StationIp,\r
+  IN EFI_IPv4_ADDRESS   *SubnetMask,\r
+  IN EFI_IPv4_ADDRESS   *Gateway,\r
+  IN OUT UINT16         *SrcPort\r
+  )\r
+{\r
+  EFI_UDP4_CONFIG_DATA  Udp4CfgData;\r
+  EFI_STATUS            Status;\r
+\r
+  ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData));\r
+\r
+  Udp4CfgData.ReceiveTimeout = 1000;\r
+  Udp4CfgData.TypeOfService  = DEFAULT_ToS;\r
+  Udp4CfgData.TimeToLive     = DEFAULT_TTL;\r
+\r
+  CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));\r
+  CopyMem (&Udp4CfgData.SubnetMask, SubnetMask, sizeof (*SubnetMask));\r
+\r
+  Udp4CfgData.StationPort    = *SrcPort;\r
+\r
+  //\r
+  // Reset the instance.\r
+  //\r
+  Udp4->Configure (Udp4, NULL);\r
+\r
+  Status = Udp4->Configure (Udp4, &Udp4CfgData);\r
+  if (!EFI_ERROR (Status) && (Gateway->Addr[0] != 0)) {\r
+    //\r
+    // basic configuration OK, need to add the default route entry\r
+    //\r
+    Status = Udp4->Routes (Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway);\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // roll back\r
+      //\r
+      Udp4->Configure (Udp4, NULL);\r
+    }\r
+  }\r
+\r
+  if (!EFI_ERROR (Status) && (*SrcPort == 0)) {\r
+    Udp4->GetModeData (Udp4, &Udp4CfgData, NULL, NULL, NULL);\r
+    *SrcPort = Udp4CfgData.StationPort;\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
 \r
 /**\r
   Convert number to ASCII value\r
index 202f115516f22de49777256fbe1537d0727ee0bf..47c2a068899bc7262febac03d3d14dd4ef077394 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2007, Intel Corporation
+Copyright (c) 2007 - 2008, Intel Corporation                                                         
 All rights reserved. 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
@@ -46,6 +46,14 @@ PxeBcCommonNotify (
   )
 ;
 
+EFI_STATUS
+PxeBcConfigureUdpWriteInstance (
+  IN EFI_UDP4_PROTOCOL  *Udp4,
+  IN EFI_IPv4_ADDRESS   *StationIp,
+  IN EFI_IPv4_ADDRESS   *SubnetMask,
+  IN EFI_IPv4_ADDRESS   *Gateway,
+  IN OUT UINT16         *SrcPort
+  );
 VOID
 CvtNum (
   IN UINTN  Number,