/** @file\r
The driver binding and service binding protocol for IP6 driver.\r
\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
Status = Ip6LeaveGroup (IpSb, &AllNodes);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
- } \r
+ }\r
}\r
\r
if (IpSb->DefaultInterface != NULL) {\r
NULL\r
);\r
if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
+ goto FREE_SERVICE;\r
}\r
\r
//\r
- // Read the config data from NV variable again. \r
+ // Read the config data from NV variable again.\r
// The default data can be changed by other drivers.\r
//\r
Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);\r
if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
+ goto UNINSTALL_PROTOCOL;\r
}\r
- \r
+\r
//\r
// If there is any default manual address, set it.\r
//\r
DataItem->DataSize,\r
DataItem->Data.Ptr\r
);\r
- if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {\r
- goto ON_ERROR;\r
+ if (Status == EFI_INVALID_PARAMETER || Status == EFI_BAD_BUFFER_SIZE) {\r
+ //\r
+ // Clean the invalid ManualAddress configuration.\r
+ //\r
+ Status = Ip6Cfg->SetData (\r
+ Ip6Cfg,\r
+ Ip6ConfigDataTypeManualAddress,\r
+ 0,\r
+ NULL\r
+ );\r
+ DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid ManualAddress configuration.\n"));\r
}\r
}\r
\r
DataItem->DataSize,\r
DataItem->Data.Ptr\r
);\r
- if (EFI_ERROR(Status)) {\r
- goto ON_ERROR;\r
+ if (Status == EFI_INVALID_PARAMETER || Status == EFI_BAD_BUFFER_SIZE) {\r
+ //\r
+ // Clean the invalid Gateway configuration.\r
+ //\r
+ Status = Ip6Cfg->SetData (\r
+ Ip6Cfg,\r
+ Ip6ConfigDataTypeGateway,\r
+ 0,\r
+ NULL\r
+ );\r
+ DEBUG ((EFI_D_WARN, "Ip6DriverBindingStart: Clean the invalid Gateway configuration.\n"));\r
}\r
}\r
\r
//\r
Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);\r
if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
+ goto UNINSTALL_PROTOCOL;\r
}\r
\r
//\r
TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS\r
);\r
if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
+ goto UNINSTALL_PROTOCOL;\r
}\r
\r
//\r
TICKS_PER_MS * IP6_ONE_SECOND_IN_MS\r
);\r
if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
- } \r
+ goto UNINSTALL_PROTOCOL;\r
+ }\r
\r
//\r
// Initialize the IP6 ID\r
\r
return EFI_SUCCESS;\r
\r
-ON_ERROR:\r
+UNINSTALL_PROTOCOL:\r
+ gBS->UninstallMultipleProtocolInterfaces (\r
+ ControllerHandle,\r
+ &gEfiIp6ServiceBindingProtocolGuid,\r
+ &IpSb->ServiceBinding,\r
+ &gEfiIp6ConfigProtocolGuid,\r
+ Ip6Cfg,\r
+ NULL\r
+ );\r
+\r
+FREE_SERVICE:\r
Ip6CleanService (IpSb);\r
FreePool (IpSb);\r
return Status;\r
\r
/**\r
Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
- \r
+\r
@param[in] Entry The entry to be removed.\r
@param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
\r
FreePool (IpSb);\r
Status = EFI_SUCCESS;\r
}\r
- \r
+\r
Exit:\r
return Status;\r
}\r