]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/Ikev2/Exchange.c
NetworkPkg: Fix hang issue after system reconnected when IPSec has set up
[mirror_edk2.git] / NetworkPkg / IpSecDxe / Ikev2 / Exchange.c
index ffa53824d0f98f3df5293b0aa8bce1c126ed51a5..9d58ab0a46f6b46bb2f58fb3e257a19d042e07a5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The general interfaces of the IKEv2.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, 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
@@ -330,7 +330,7 @@ Ikev2NegotiateInfo (
     //\r
     // Send out the Packet\r
     //\r
-    if (UdpService != NULL) {\r
+    if (UdpService != NULL && UdpService->Output != NULL) {\r
       Status = Ikev2SendIkePacket (UdpService, (UINT8 *) SaCommon, IkePacket, 0);\r
 \r
       if (EFI_ERROR (Status)) {\r
@@ -357,7 +357,7 @@ Ikev2NegotiateInfo (
       //\r
       // Send out the Packet\r
       //\r
-      if (UdpService != NULL) {\r
+      if (UdpService != NULL && UdpService->Output != NULL) {\r
         Status = Ikev2SendIkePacket (UdpService, (UINT8 *) &ChildSaSession->SessionCommon, IkePacket, 0);\r
 \r
         if (EFI_ERROR (Status)) {\r
@@ -467,8 +467,7 @@ Ikev2HandleSa (
   //\r
   // Validate the IKE packet header.\r
   //\r
-  Status = Ikev2ValidateHeader (IkeSaSession, IkePacket->Header);\r
-  if (EFI_ERROR (Status)) {\r
+  if (!Ikev2ValidateHeader (IkeSaSession, IkePacket->Header)) {\r
     //\r
     // Drop the packet if invalid IKE header.\r
     //\r
@@ -780,11 +779,11 @@ Ikev2HandleInfo (
   }\r
 }\r
 \r
-IKE_EXCHANGE_INTERFACE  mIkev1Exchange = {
-  1,
+IKE_EXCHANGE_INTERFACE  mIkev1Exchange = {\r
+  1,\r
   NULL, //Ikev1NegotiateSa\r
   NULL, //Ikev1NegotiateChildSa\r
-  NULL,
+  NULL,\r
   NULL, //Ikev1HandleSa,\r
   NULL, //Ikev1HandleChildSa\r
   NULL, //Ikev1HandleInfo\r