Discussion:
[edk2] [PATCH v2] NetworkPkg: Locate IpSec protocol on IP4/IP6 packet processing only if it is installed
Samer El-Haj-Mahmoud
2015-07-11 14:51:24 UTC
Permalink
From: Sriram Subramanian <sriram-***@hp.com>

Modified the logic in Ip4Dxe and Ip6Dxe to not locate EFI_IPSEC2_PROTOCOL on each message transmit/receive. Instead, register a callback in the drivers entry points on the IpSec protocol installation, and process only if the protocol is installed. This speeds up the network stacks when IpSec is not installed since there is a penalty associated with searching the entire handle database on each packet processing.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-***@hp.com>
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 36 +++++++++++++++++++++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 4 +++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c | 7 +++++
NetworkPkg/Ip6Dxe/Ip6Driver.c | 38 +++++++++++++++++++++++
NetworkPkg/Ip6Dxe/Ip6Impl.h | 3 ++
NetworkPkg/Ip6Dxe/Ip6Input.c | 6 ++++
6 files changed, 94 insertions(+)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 101390c..d70380f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -2,6 +2,8 @@
The driver binding and service binding protocol for IP4 driver.

Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -23,6 +25,30 @@ EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding = {
NULL
};

+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+ @param[in] Event Event whose notification function is being invoked
+ @param[in] Context Pointer to the notification function's context
+
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
@@ -45,6 +71,16 @@ Ip4DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index 84dfa80..48728e5 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -2,6 +2,8 @@
Ip4 internal functions and type defintions.

Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -388,4 +390,6 @@ Ip4FreeTxToken (

extern EFI_IPSEC2_PROTOCOL *mIpSec;

+extern BOOLEAN mIpSec2Installed;
+
#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
index 38ad1c3..51ded68 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
@@ -2,6 +2,8 @@
IP4 input process.

Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -512,6 +514,11 @@ Ip4IpSecProcessPacket (
IP4_HEAD ZeroHead;

Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 6958784..4fde476 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -2,6 +2,7 @@
The driver binding and service binding protocol for IP6 driver.

Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -24,6 +25,33 @@ EFI_DRIVER_BINDING_PROTOCOL gIp6DriverBinding = {
NULL
};

+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+ @param[in] Event Event whose notification function is being invoked
+ @param[in] Context Pointer to the notification function's context
+
+ @retval EFI_SUCCESS Callback successful.
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+
+ return;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
@@ -46,6 +74,16 @@ Ip6DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/NetworkPkg/Ip6Dxe/Ip6Impl.h b/NetworkPkg/Ip6Dxe/Ip6Impl.h
index 8f114bb..8796ebb 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Impl.h
+++ b/NetworkPkg/Ip6Dxe/Ip6Impl.h
@@ -2,6 +2,7 @@
Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.

Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -90,6 +91,8 @@

extern EFI_IPSEC2_PROTOCOL *mIpSec;

+extern BOOLEAN mIpSec2Installed;
+
//
// IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is
diff --git a/NetworkPkg/Ip6Dxe/Ip6Input.c b/NetworkPkg/Ip6Dxe/Ip6Input.c
index cf88884..cbc6439 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Input.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Input.c
@@ -2,6 +2,7 @@
IP6 internal functions to process the incoming packets.

Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -525,6 +526,11 @@ Ip6IpSecProcessPacket (
EFI_IP6_HEADER ZeroHead;

Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
--
1.9.5.msysgit.1
Jordan Justen
2015-07-12 02:02:22 UTC
Permalink
Your subject line is too long. (86 characters)

NetworkPkg/Contributions.txt

https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format
Post by Samer El-Haj-Mahmoud
Modified the logic in Ip4Dxe and Ip6Dxe to not locate EFI_IPSEC2_PROTOCOL on each message transmit/receive. Instead, register a callback in the drivers entry points on the IpSec protocol installation, and process only if the protocol is installed. This speeds up the network stacks when IpSec is not installed since there is a penalty associated with searching the entire handle database on each packet processing.
This commit message line it too long (414 characters.)
Post by Samer El-Haj-Mahmoud
Contributed-under: TianoCore Contribution Agreement 1.0
Once again, consider Cc'ing the package owner here in the commit
message. (Then git send-email will automatically Cc them when sending
the patch.)
Post by Samer El-Haj-Mahmoud
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 36 +++++++++++++++++++++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 4 +++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c | 7 +++++
NetworkPkg/Ip6Dxe/Ip6Driver.c | 38 +++++++++++++++++++++++
NetworkPkg/Ip6Dxe/Ip6Impl.h | 3 ++
NetworkPkg/Ip6Dxe/Ip6Input.c | 6 ++++
I think this probably should be 2 patches. At least one for
MdeModulePkg and one for NetworkPkg.

-Jordan
Post by Samer El-Haj-Mahmoud
6 files changed, 94 insertions(+)
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 101390c..d70380f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -2,6 +2,8 @@
The driver binding and service binding protocol for IP4 driver.
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -23,6 +25,30 @@ EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding = {
NULL
};
+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
@@ -45,6 +71,16 @@ Ip4DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index 84dfa80..48728e5 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -2,6 +2,8 @@
Ip4 internal functions and type defintions.
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -388,4 +390,6 @@ Ip4FreeTxToken (
extern EFI_IPSEC2_PROTOCOL *mIpSec;
+extern BOOLEAN mIpSec2Installed;
+
#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
index 38ad1c3..51ded68 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
@@ -2,6 +2,8 @@
IP4 input process.
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 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
@@ -512,6 +514,11 @@ Ip4IpSecProcessPacket (
IP4_HEAD ZeroHead;
Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 6958784..4fde476 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -2,6 +2,7 @@
The driver binding and service binding protocol for IP6 driver.
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -24,6 +25,33 @@ EFI_DRIVER_BINDING_PROTOCOL gIp6DriverBinding = {
NULL
};
+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+
+ return;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
@@ -46,6 +74,16 @@ Ip6DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/NetworkPkg/Ip6Dxe/Ip6Impl.h b/NetworkPkg/Ip6Dxe/Ip6Impl.h
index 8f114bb..8796ebb 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Impl.h
+++ b/NetworkPkg/Ip6Dxe/Ip6Impl.h
@@ -2,6 +2,7 @@
Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -90,6 +91,8 @@
extern EFI_IPSEC2_PROTOCOL *mIpSec;
+extern BOOLEAN mIpSec2Installed;
+
//
// IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is
diff --git a/NetworkPkg/Ip6Dxe/Ip6Input.c b/NetworkPkg/Ip6Dxe/Ip6Input.c
index cf88884..cbc6439 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Input.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Input.c
@@ -2,6 +2,7 @@
IP6 internal functions to process the incoming packets.
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 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
@@ -525,6 +526,11 @@ Ip6IpSecProcessPacket (
EFI_IP6_HEADER ZeroHead;
Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
--
1.9.5.msysgit.1
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
El-Haj-Mahmoud, Samer
2015-07-13 15:34:51 UTC
Permalink
Thanks Jordan. I will submit ver 2 to address your concerns.



-----Original Message-----
From: Jordan Justen [mailto:***@intel.com]
Sent: Saturday, July 11, 2015 9:02 PM
To: El-Haj-Mahmoud, Samer; edk2-***@lists.sourceforge.net
Cc: Subramanian, Sriram (System FW, HP Servers)
Subject: Re: [edk2] [PATCH v2] NetworkPkg: Locate IpSec protocol on IP4/IP6 packet processing only if it is installed

Your subject line is too long. (86 characters)

NetworkPkg/Contributions.txt

https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format
Post by Samer El-Haj-Mahmoud
Modified the logic in Ip4Dxe and Ip6Dxe to not locate EFI_IPSEC2_PROTOCOL on each message transmit/receive. Instead, register a callback in the drivers entry points on the IpSec protocol installation, and process only if the protocol is installed. This speeds up the network stacks when IpSec is not installed since there is a penalty associated with searching the entire handle database on each packet processing.
This commit message line it too long (414 characters.)
Post by Samer El-Haj-Mahmoud
Contributed-under: TianoCore Contribution Agreement 1.0
Once again, consider Cc'ing the package owner here in the commit message. (Then git send-email will automatically Cc them when sending the patch.)
Post by Samer El-Haj-Mahmoud
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 36 +++++++++++++++++++++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h | 4 +++
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c | 7 +++++
NetworkPkg/Ip6Dxe/Ip6Driver.c | 38 +++++++++++++++++++++++
NetworkPkg/Ip6Dxe/Ip6Impl.h | 3 ++
NetworkPkg/Ip6Dxe/Ip6Input.c | 6 ++++
I think this probably should be 2 patches. At least one for MdeModulePkg and one for NetworkPkg.

-Jordan
Post by Samer El-Haj-Mahmoud
6 files changed, 94 insertions(+)
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 101390c..d70380f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -2,6 +2,8 @@
The driver binding and service binding protocol for IP4 driver.
Copyright (c) 2005 - 2015, Intel Corporation. All rights
reserved.<BR>
+(C) Copyright 2015 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
NULL
};
+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index 84dfa80..48728e5 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -2,6 +2,8 @@
Ip4 internal functions and type defintions.
Copyright (c) 2005 - 2015, Intel Corporation. All rights
reserved.<BR>
+(C) Copyright 2015 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
extern EFI_IPSEC2_PROTOCOL *mIpSec;
+extern BOOLEAN mIpSec2Installed;
+
#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
index 38ad1c3..51ded68 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
@@ -2,6 +2,8 @@
IP4 input process.
Copyright (c) 2005 - 2014, Intel Corporation. All rights
reserved.<BR>
+(C) Copyright 2015 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
IP4_HEAD ZeroHead;
Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c
b/NetworkPkg/Ip6Dxe/Ip6Driver.c index 6958784..4fde476 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -2,6 +2,7 @@
The driver binding and service binding protocol for IP6 driver.
Copyright (c) 2009 - 2014, Intel Corporation. All rights
reserved.<BR>
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of
NULL
};
+BOOLEAN mIpSec2Installed = FALSE;
+
+/**
+ Callback function for IpSec2 Protocol install.
+
+
+**/
+VOID
+EFIAPI
+IpSec2InstalledCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Close the event so it does not get called again.
+ //
+ gBS->CloseEvent (Event);
+
+ mIpSec2Installed = TRUE;
+
+ return;
+}
+
/**
This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ VOID *Registration;
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiIpSec2ProtocolGuid,
+ TPL_CALLBACK,
+ IpSec2InstalledCallback,
+ NULL,
+ &Registration
+ );
+
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
diff --git a/NetworkPkg/Ip6Dxe/Ip6Impl.h b/NetworkPkg/Ip6Dxe/Ip6Impl.h
index 8f114bb..8796ebb 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Impl.h
+++ b/NetworkPkg/Ip6Dxe/Ip6Impl.h
@@ -2,6 +2,7 @@
Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.
Copyright (c) 2009 - 2012, Intel Corporation. All rights
reserved.<BR>
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of
extern EFI_IPSEC2_PROTOCOL *mIpSec;
+extern BOOLEAN mIpSec2Installed;
+
//
// IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is diff --git
a/NetworkPkg/Ip6Dxe/Ip6Input.c b/NetworkPkg/Ip6Dxe/Ip6Input.c index
cf88884..cbc6439 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Input.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Input.c
@@ -2,6 +2,7 @@
IP6 internal functions to process the incoming packets.
Copyright (c) 2009 - 2014, Intel Corporation. All rights
reserved.<BR>
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of
EFI_IP6_HEADER ZeroHead;
Status = EFI_SUCCESS;
+
+ if (!mIpSec2Installed) {
+ goto ON_EXIT;
+ }
+
Packet = *Netbuf;
RecycleEvent = NULL;
IpSecWrap = NULL;
--
1.9.5.msysgit.1
----------------------------------------------------------------------
-------- Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Loading...