From nobody Mon May 6 02:30:25 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1501423620914633.0736307760076; Sun, 30 Jul 2017 07:07:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D670D21DFE920; Sun, 30 Jul 2017 07:04:50 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 04CA821DF9687 for ; Sun, 30 Jul 2017 07:04:50 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2017 07:06:57 -0700 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.254.210.26]) by orsmga002.jf.intel.com with ESMTP; 30 Jul 2017 07:06:55 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,436,1496127600"; d="scan'208";a="117382986" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Sun, 30 Jul 2017 22:06:47 +0800 Message-Id: <1501423607-28280-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [Patch] NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ni Ruiyu , Ye Ting , Wu Jiaxin , Fu Siyuan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch is to fix the potential issue recorded at Bugzilla 636: https://bugzilla.tianocore.org/show_bug.cgi?id=3D636 The issue is caused by the IPv6 policy switching after PXEv6 boot. When IP policy is changing, the IPv6 children used by PXE.UdpRead() will be destroy= ed. Then, PXE Stop() function is called to uninstall the devicePath protocol, which leads to the IPv6 PXE boot option goes missing. Through the above analysis, the IP driver should take the responsibility for the upper layer network stacks recovery by using ConnectController(). Cc: Hegde Nagaraj P Cc: Subramanian Sriram Cc: Ni Ruiyu Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Hegde, Nagaraj P Reviewed-by: Sriram Subramanian Tested-by: Hegde, Nagaraj P --- NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 72 ++++++++++++++++++++++++++++-------= ---- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6Confi= gImpl.c index 7c7acc7..f170716 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c @@ -45,16 +45,21 @@ VOID Ip6ConfigOnPolicyChanged ( IN IP6_SERVICE *IpSb, IN EFI_IP6_CONFIG_POLICY NewPolicy ) { - LIST_ENTRY *Entry; - LIST_ENTRY *Entry2; - LIST_ENTRY *Next; - IP6_INTERFACE *IpIf; - IP6_DAD_ENTRY *DadEntry; - IP6_DELAY_JOIN_LIST *DelayNode; + LIST_ENTRY *Entry; + LIST_ENTRY *Entry2; + LIST_ENTRY *Next; + IP6_INTERFACE *IpIf; + IP6_DAD_ENTRY *DadEntry; + IP6_DELAY_JOIN_LIST *DelayNode; + IP6_ADDRESS_INFO *AddrInfo; + IP6_PROTOCOL *Instance; + BOOLEAN Recovery; + + Recovery =3D FALSE; =20 // // Currently there are only two policies: Manual and Automatic. Regardle= ss of // what transition is going on, i.e., Manual -> Automatic and Automatic = -> // Manual, we have to free default router list, on-link prefix list, aut= onomous @@ -78,22 +83,52 @@ Ip6ConfigOnPolicyChanged ( IP6_LINK_LOCAL_PREFIX_LENGTH, &IpSb->LinkLocalAddr ); } =20 - // - // All IPv6 children that use global unicast address as it's source addr= ess - // should be destryoed now. The survivers are those use the link-local a= ddress - // or the unspecified address as the source address. - // TODO: Conduct a check here. - Ip6RemoveAddr ( - IpSb, - &IpSb->DefaultInterface->AddressList, - &IpSb->DefaultInterface->AddressCount, - NULL, - 0 - ); + if (!IsListEmpty (&IpSb->DefaultInterface->AddressList) && IpSb->Default= Interface->AddressCount > 0) { + // =20 + // If any IPv6 children (Instance) in configured state and use global = unicast address, it will be=20 + // destroyed in Ip6RemoveAddr() function later. Then, the upper layer = driver's Stop() function will be=20 + // called, which may break the upper layer network stacks. So, the dri= ver should take the responsibility=20 + // for the recovery by using ConnectController() after Ip6RemoveAddr()= .=20 + // Here, just check whether need to recover the upper layer network st= acks later. + // + NET_LIST_FOR_EACH (Entry, &IpSb->DefaultInterface->AddressList) {=20 + AddrInfo =3D NET_LIST_USER_STRUCT_S (Entry, IP6_ADDRESS_INFO, Link, = IP6_ADDR_INFO_SIGNATURE); + if (!IsListEmpty (&IpSb->Children)) { + NET_LIST_FOR_EACH (Entry2, &IpSb->Children) { + Instance =3D NET_LIST_USER_STRUCT_S (Entry2, IP6_PROTOCOL, Link,= IP6_PROTOCOL_SIGNATURE); + if ((Instance->State =3D=3D IP6_STATE_CONFIGED) && EFI_IP6_EQUAL= (&Instance->ConfigData.StationAddress, &AddrInfo->Address)) { + Recovery =3D TRUE; + break; + } + } + } + } + =20 + // + // All IPv6 children that use global unicast address as it's source ad= dress + // should be destroyed now. The survivers are those use the link-local= address + // or the unspecified address as the source address. + // TODO: Conduct a check here. + Ip6RemoveAddr ( + IpSb, + &IpSb->DefaultInterface->AddressList, + &IpSb->DefaultInterface->AddressCount, + NULL, + 0 + ); + =20 + if (IpSb->Controller !=3D NULL && Recovery) { + // + // ConnectController() to recover the upper layer network stacks. + // + gBS->ConnectController (IpSb->Controller, NULL, NULL, TRUE); + } + } + =20 NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) { // // remove all pending delay node and DAD entries for the global addres= ses. // @@ -128,11 +163,10 @@ Ip6ConfigOnPolicyChanged ( // // delay 1 second // IpSb->Ticks =3D (UINT32) IP6_GET_TICKS (IP6_ONE_SECO= ND_IN_MS); } - } =20 /** The work function to trigger the DHCPv6 process to perform a stateful au= toconfiguration. =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel