Index: MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
===================================================================
--- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c	(revision 15878)
+++ MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c	(working copy)
@@ -2,6 +2,7 @@
   IP4 input process.
   
 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
 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
@@ -14,6 +15,7 @@
 
 #include "Ip4Impl.h"
 
+STATIC BOOLEAN mIpSecLocated = FALSE;
 
 /**
   Create an empty assemble entry for the packet identified by
@@ -521,8 +523,17 @@
 
   ZeroMem (&ZeroHead, sizeof (IP4_HEAD));
   
+  //
+  // Check whether the ipsec protocol is available.
+  //
+  if (mIpSecLocated && (mIpSec == NULL)) {
+    goto ON_EXIT;
+  }
+
   if (mIpSec == NULL) {
     gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **) &mIpSec);
+    mIpSecLocated = TRUE;
+	
     if (mIpSec == NULL) {
       goto ON_EXIT;
     }
Index: NetworkPkg/Ip6Dxe/Ip6Input.c
===================================================================
--- NetworkPkg/Ip6Dxe/Ip6Input.c	(revision 15878)
+++ NetworkPkg/Ip6Dxe/Ip6Input.c	(working copy)
@@ -2,6 +2,7 @@
   IP6 internal functions to process the incoming packets.
 
   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -15,6 +16,8 @@
 
 #include "Ip6Impl.h"
 
+STATIC BOOLEAN mIpSecLocated = FALSE;
+
 /**
   Create an empty assemble entry for the packet identified by
   (Dst, Src, Id). The default life for the packet is 60 seconds.
@@ -535,8 +538,13 @@
   FragmentCount = Packet->BlockOpNum;
   ZeroMem (&ZeroHead, sizeof (EFI_IP6_HEADER));
 
+  if (mIpSecLocated && (mIpSec == NULL)) {
+    goto ON_EXIT;
+  }
+  
   if (mIpSec == NULL) {
     gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **) &mIpSec);
+    mIpSecLocated = TRUE;
 
     //
     // Check whether the ipsec protocol is available.
