From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g9t5008.houston.hpe.com (g9t5008.houston.hpe.com [15.241.48.72]) (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 92D88209589ED for ; Mon, 31 Jul 2017 21:29:21 -0700 (PDT) Received: from G4W9119.americas.hpqcorp.net (g4w9119.houston.hp.com [16.210.20.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5008.houston.hpe.com (Postfix) with ESMTPS id 8EFDD79 for ; Tue, 1 Aug 2017 04:31:28 +0000 (UTC) Received: from G4W9120.americas.hpqcorp.net (2002:10d2:150f::10d2:150f) by G4W9119.americas.hpqcorp.net (2002:10d2:14d6::10d2:14d6) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 1 Aug 2017 04:31:28 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.241.52.10) by G4W9120.americas.hpqcorp.net (16.210.21.15) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Tue, 1 Aug 2017 04:31:28 +0000 Received: from CS1PR84MB0247.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.157) by CS1PR84MB0198.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1304.22; Tue, 1 Aug 2017 04:31:25 +0000 Received: from CS1PR84MB0247.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.157]) by CS1PR84MB0247.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.157]) with mapi id 15.01.1304.023; Tue, 1 Aug 2017 04:31:25 +0000 From: "Hegde, Nagaraj P" To: Jiaxin Wu , "edk2-devel@lists.01.org" CC: "Subramanian, Sriram" , Ni Ruiyu , Ye Ting , Fu Siyuan Thread-Topic: [Patch] NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue Thread-Index: AQHTCT0dahR0P/ErskmMgz9agSykDaJu63DA Date: Tue, 1 Aug 2017 04:31:25 +0000 Message-ID: References: <1501423607-28280-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1501423607-28280-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nagaraj-p.hegde@hpe.com; x-originating-ip: [16.242.235.134] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR84MB0198; 7:7Wk4UPlOveFTLGqeN+WcRrBYUcIbD5EOPLXhNdSJX+E7WCEd52ZR+dfrhWUbe4aMTfgzMJNa772f+LbRNMRyG1x3GzuV5X1NbdqxpAYoShJtT4tgltBdyssemiCG1axFIJ+UKYVI4uhpxVJCILl7EltB3e6GHoFR4HDHSO8Px/KwrskS522rR2egziacr0wvmDwZFmmMCDuc08/Tsw1w9/k0arbrZYNPhuAYeofyEDJe9A01PRALeyxcl3GZV8u79qG/bJlEcC6apRwVAhnpKYYC/FeiPP/lE67L7Dgu+xQW6qCYKVGiiJ1OyGDlHSgqKmZz+69kUhRHYB6FONeY4gjHC06Og9+S7DEhWkMc2KUhe61yI1ftP0bOn94GUud+bFTRZPru12uYiU/iB7KZf2mnrPpHiEY+u0ZzmpKNuBMzpt/hCsc2zqV6PUzKmpouUV09pD3mTwDC5wNqNXKWrrp0ZLzmmmm44D8F/TI51QQbSFBEjxVifyEgqe1lGrwg6sU2Ry/XHFGsH79t0+s19VKjO6Iu/8y8iq0IG8jUKIan0Tj7CKnr2GRBQmg7iQbJndYnGi3p9UrL22Sqj/nT0YvfEmDnRgETtPcKnVD3ub/RfkLbxVMoEhl5kHbqW7RCm4/0CfQmCM92Ghme0FuSEQjzD2s0hw6sxUGsRETnWyyhaGbsfCF4OmyCpTYvj1IlXqzDCzpjI0xqd5ab/HS661QdZ67xZPdg/utUOZ63S3hyic5ijnJpG/H08rf6TNvrbs8PlhEDm24W0+pP7cmJPnnbmecOxYRwDvVplVMIy/w= x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39410400002)(39860400002)(39450400003)(39840400002)(39400400002)(377454003)(189002)(199003)(13464003)(50986999)(54356999)(478600001)(14454004)(6436002)(8936002)(6246003)(2906002)(55016002)(9686003)(6306002)(966005)(229853002)(53546010)(3660700001)(3280700002)(54906002)(86362001)(2950100002)(4326008)(7696004)(3846002)(102836003)(6116002)(66066001)(8676002)(68736007)(189998001)(53936002)(81156014)(25786009)(76176999)(77096006)(2501003)(2900100001)(305945005)(6506006)(7736002)(81166006)(38730400002)(33656002)(101416001)(106356001)(74316002)(105586002)(5660300001)(97736004)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0198; H:CS1PR84MB0247.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 416d767a-92ba-42b7-55cb-08d4d8962baa x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CS1PR84MB0198; x-ms-traffictypediagnostic: CS1PR84MB0198: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CS1PR84MB0198; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CS1PR84MB0198; x-forefront-prvs: 0386B406AA received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Aug 2017 04:31:25.4578 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0198 X-OriginatorOrg: hpe.com Subject: Re: [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: , X-List-Received-Date: Tue, 01 Aug 2017 04:29:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hegde, Nagaraj P Tested-by: Hegde, Nagaraj P -----Original Message----- From: Jiaxin Wu [mailto:jiaxin.wu@intel.com]=20 Sent: Sunday, July 30, 2017 7:37 PM To: edk2-devel@lists.01.org Cc: Hegde, Nagaraj P ; Subramanian, Sriram ; Ni Ruiyu ; Ye Ting ; Fu= Siyuan ; Wu Jiaxin Subject: [Patch] NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missi= ng issue 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, w= hich leads to the IPv6 PXE boot option goes missing. Through the above analysis, the IP driver should take the responsibility fo= r 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 --- 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 -- 1.9.5.msysgit.1