summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/Ip6Dxe/Ip6Driver.c
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2016-02-25 10:52:13 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-03-02 15:43:52 +0800
commit4720106b99f76d32f71ad52f77bf79b60e070128 (patch)
treeb3a41b3ed4e2cbd65810e8ecb390331880ffce52 /NetworkPkg/Ip6Dxe/Ip6Driver.c
parent7648748e99eeeadec38fda7568adb260c4acc861 (diff)
downloadedk2-4720106b99f76d32f71ad52f77bf79b60e070128.tar.gz
edk2-4720106b99f76d32f71ad52f77bf79b60e070128.tar.bz2
edk2-4720106b99f76d32f71ad52f77bf79b60e070128.zip
NetworkPkg: Change the default IPv6 config policy
The default policy for Ip6Config is Ip6ConfigPolicyAutomatic, which results in all NIC ports starting SARR process when it receives RA message with M flag from IPv6 router. So, this patch is used to changes the the default IPv6 config policy to Ip6ConfigPolicyManualand also defer the SetData operation after Ip6ConfigProtocol installed. This update let the other platform drivers have chance to change the default config data by consume Ip6ConfigProtocol. Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Subramanian Sriram <sriram-s@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
Diffstat (limited to 'NetworkPkg/Ip6Dxe/Ip6Driver.c')
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6Driver.c81
1 files changed, 54 insertions, 27 deletions
diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c
index 076dc605e6..ba702904b5 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -1,7 +1,7 @@
/** @file
The driver binding and service binding protocol for IP6 driver.
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
@@ -262,7 +262,6 @@ Ip6CreateService (
EFI_STATUS Status;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN *MnpToken;
EFI_MANAGED_NETWORK_CONFIG_DATA *Config;
- IP6_CONFIG_DATA_ITEM *DataItem;
ASSERT (Service != NULL);
@@ -476,30 +475,6 @@ Ip6CreateService (
goto ON_ERROR;
}
- //
- // If there is any manual address, set it.
- //
- DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];
- if (DataItem->Data.Ptr != NULL) {
- DataItem->SetData (
- &IpSb->Ip6ConfigInstance,
- DataItem->DataSize,
- DataItem->Data.Ptr
- );
- }
-
- //
- // If there is any gateway address, set it.
- //
- DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];
- if (DataItem->Data.Ptr != NULL) {
- DataItem->SetData (
- &IpSb->Ip6ConfigInstance,
- DataItem->DataSize,
- DataItem->Data.Ptr
- );
- }
-
InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);
*Service = IpSb;
@@ -535,6 +510,12 @@ Ip6DriverBindingStart (
{
IP6_SERVICE *IpSb;
EFI_STATUS Status;
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
+ IP6_CONFIG_DATA_ITEM *DataItem;
+
+ IpSb = NULL;
+ Ip6Cfg = NULL;
+ DataItem = NULL;
//
// Test for the Ip6 service binding protocol
@@ -560,6 +541,8 @@ Ip6DriverBindingStart (
ASSERT (IpSb != NULL);
+ Ip6Cfg = &IpSb->Ip6ConfigInstance.Ip6Config;
+
//
// Install the Ip6ServiceBinding Protocol onto ControlerHandle
//
@@ -568,9 +551,53 @@ Ip6DriverBindingStart (
&gEfiIp6ServiceBindingProtocolGuid,
&IpSb->ServiceBinding,
&gEfiIp6ConfigProtocolGuid,
- &IpSb->Ip6ConfigInstance.Ip6Config,
+ Ip6Cfg,
NULL
);
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
+
+ //
+ // Read the config data from NV variable again.
+ // The default data can be changed by other drivers.
+ //
+ Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
+
+ //
+ // If there is any default manual address, set it.
+ //
+ DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];
+ if (DataItem->Data.Ptr != NULL) {
+ Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeManualAddress,
+ DataItem->DataSize,
+ DataItem->Data.Ptr
+ );
+ if (EFI_ERROR(Status)) {
+ goto ON_ERROR;
+ }
+ }
+
+ //
+ // If there is any default gateway address, set it.
+ //
+ DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];
+ if (DataItem->Data.Ptr != NULL) {
+ Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeGateway,
+ DataItem->DataSize,
+ DataItem->Data.Ptr
+ );
+ if (EFI_ERROR(Status)) {
+ goto ON_ERROR;
+ }
+ }
if (!EFI_ERROR (Status)) {
//