- //\r
- // All IPv6 children that use global unicast address as it's source address\r
- // should be destryoed now. The survivers are those use the link-local address\r
- // or the unspecified address as the source address.\r
- // TODO: Conduct a check here.\r
- Ip6RemoveAddr (\r
- IpSb,\r
- &IpSb->DefaultInterface->AddressList,\r
- &IpSb->DefaultInterface->AddressCount,\r
- NULL,\r
- 0\r
- );\r
+ if (!IsListEmpty (&IpSb->DefaultInterface->AddressList) && IpSb->DefaultInterface->AddressCount > 0) {\r
+ // \r
+ // If any IPv6 children (Instance) in configured state and use global unicast address, it will be \r
+ // destroyed in Ip6RemoveAddr() function later. Then, the upper layer driver's Stop() function will be \r
+ // called, which may break the upper layer network stacks. So, the driver should take the responsibility \r
+ // for the recovery by using ConnectController() after Ip6RemoveAddr(). \r
+ // Here, just check whether need to recover the upper layer network stacks later.\r
+ //\r
+ NET_LIST_FOR_EACH (Entry, &IpSb->DefaultInterface->AddressList) { \r
+ AddrInfo = NET_LIST_USER_STRUCT_S (Entry, IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);\r
+ if (!IsListEmpty (&IpSb->Children)) {\r
+ NET_LIST_FOR_EACH (Entry2, &IpSb->Children) {\r
+ Instance = NET_LIST_USER_STRUCT_S (Entry2, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);\r
+ if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, &AddrInfo->Address)) {\r
+ Recovery = TRUE;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ //\r
+ // All IPv6 children that use global unicast address as it's source address\r
+ // should be destroyed now. The survivers are those use the link-local address\r
+ // or the unspecified address as the source address.\r
+ // TODO: Conduct a check here.\r
+ Ip6RemoveAddr (\r
+ IpSb,\r
+ &IpSb->DefaultInterface->AddressList,\r
+ &IpSb->DefaultInterface->AddressCount,\r
+ NULL,\r
+ 0\r
+ );\r
+ \r
+ if (IpSb->Controller != NULL && Recovery) {\r
+ //\r
+ // ConnectController() to recover the upper layer network stacks.\r
+ //\r
+ gBS->ConnectController (IpSb->Controller, NULL, NULL, TRUE);\r
+ }\r
+ }\r
+\r