Revision: 17075
          http://sourceforge.net/p/edk2/code/17075
Author:   sfu5
Date:     2015-03-26 04:49:30 +0000 (Thu, 26 Mar 2015)
Log Message:
-----------
PXE driver bug fix.

1. Update the parameter check of PXE.UdpRead() to align with spec definition.
2. Update PXE driver to use EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP when 
calling UdpRead to receive server discovery message. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Wu Jiaxin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
    trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c

Modified: trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
===================================================================
--- trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c     2015-03-25 21:13:26 UTC 
(rev 17074)
+++ trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c     2015-03-26 04:49:30 UTC 
(rev 17075)
@@ -2,7 +2,7 @@
   Functions implementation related with DHCPv6 for UefiPxeBc Driver.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2015, 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
@@ -793,8 +793,8 @@
     
   Status = PxeBc->UdpRead (
                     PxeBc,
-                    EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP,
-                    &Private->StationIp,
+                    EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | 
EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP,
+                    NULL,
                     &SrcPort,
                     &Private->ServerIp,
                     &DestPort,
@@ -1807,7 +1807,6 @@
   UINT8                               *RequestOpt;
   UINT8                               *DiscoverOpt;
   UINTN                               ReadSize;
-  UINT16                              OpFlags;
   UINT16                              OpCode;
   UINT16                              OpLen;
   UINT32                              Xid;
@@ -1818,7 +1817,6 @@
   Request     = Private->Dhcp6Request;
   SrcPort     = PXEBC_BS_DISCOVER_PORT;
   DestPort    = PXEBC_BS_DISCOVER_PORT;
-  OpFlags     = 0;
 
   if (!UseBis && Layer != NULL) {
     *Layer &= EFI_PXE_BASE_CODE_BOOT_LAYER_MASK;
@@ -1862,7 +1860,7 @@
 
   Status = PxeBc->UdpWrite (
                     PxeBc,
-                    OpFlags,
+                    0,
                     &Private->ServerIp,
                     &DestPort,
                     NULL,
@@ -1899,8 +1897,8 @@
   
   Status = PxeBc->UdpRead (
                     PxeBc,
-                    OpFlags,
-                    &Private->StationIp,
+                    EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP,
+                    NULL,
                     &SrcPort,
                     &Private->ServerIp,
                     &DestPort,

Modified: trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
===================================================================
--- trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c      2015-03-25 21:13:26 UTC 
(rev 17074)
+++ trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c      2015-03-26 04:49:30 UTC 
(rev 17075)
@@ -1265,7 +1265,7 @@
   UINTN                       FragmentIndex;
   UINT8                       *FragmentBuffer;
 
-  if (This == NULL || DestIp == NULL || DestPort == NULL) {
+  if (This == NULL) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -1276,9 +1276,9 @@
   Udp4Rx    = NULL;
   Udp6Rx    = NULL;
 
-  if (((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) != 0 && 
DestPort == NULL) ||
-      ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) != 0 && SrcIp == 
NULL) ||
-      ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) != 0 && SrcPort 
== NULL)) {
+  if (((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) == 0 && 
DestPort == NULL) ||
+      ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) == 0 && SrcIp == 
NULL) ||
+      ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) == 0 && SrcPort 
== NULL)) {
     return EFI_INVALID_PARAMETER;
   }
 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to