From 4701d96534f2228b6f4aa925606566d2c2bb55be Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Wed, 11 Feb 2015 08:26:36 +0000
Subject: [PATCH] DHCP6 bug fix:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

DHCP6 won’t process more message if one message’s Xid is mismatched.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16832 6f19259b-4bc3-4df7-8a09-765794883524
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
index b231479525..063605e609 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -2,7 +2,7 @@
   Dhcp6 internal functions implementation.
 
   (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
@@ -2812,6 +2812,7 @@ Dhcp6ReceivePacket (
   LIST_ENTRY                *Next1;
   LIST_ENTRY                *Entry2;
   LIST_ENTRY                *Next2;
+  EFI_STATUS                Status;
 
   ASSERT (Udp6Wrap != NULL);
   ASSERT (Context != NULL);
@@ -2891,6 +2892,18 @@ Dhcp6ReceivePacket (
 
 ON_CONTINUE:
 
+  if (!IsDispatched) {
+    Status = UdpIoRecvDatagram (
+             Service->UdpIo,
+             Dhcp6ReceivePacket,
+             Service,
+             0
+             );
+    if (EFI_ERROR (Status)) {
+      Dhcp6CleanupRetry (Instance, DHCP6_PACKET_ALL);
+    }
+  }
+
   NetbufFree (Udp6Wrap);
 
   if (Packet != NULL) {