From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) (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 5858421D091B9 for ; Tue, 1 Aug 2017 01:10:14 -0700 (PDT) Received: from G9W8454.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id B14404F for ; Tue, 1 Aug 2017 08:12:22 +0000 (UTC) Received: from G4W9122.americas.hpqcorp.net (2002:10d2:1511::10d2:1511) by G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 1 Aug 2017 08:12:22 +0000 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (15.241.52.10) by G4W9122.americas.hpqcorp.net (16.210.21.17) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Tue, 1 Aug 2017 08:12:22 +0000 Received: from TU4PR84MB0207.NAMPRD84.PROD.OUTLOOK.COM (10.162.187.21) by TU4PR84MB0256.NAMPRD84.PROD.OUTLOOK.COM (10.162.186.14) 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 08:12:20 +0000 Received: from TU4PR84MB0207.NAMPRD84.PROD.OUTLOOK.COM ([10.162.187.21]) by TU4PR84MB0207.NAMPRD84.PROD.OUTLOOK.COM ([10.162.187.21]) with mapi id 15.01.1304.023; Tue, 1 Aug 2017 08:12:19 +0000 From: "Subramanian, Sriram" To: Jiaxin Wu , "edk2-devel@lists.01.org" CC: "Hegde, Nagaraj P" , Ni Ruiyu , Ye Ting , Fu Siyuan Thread-Topic: [Patch] NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue Thread-Index: AQHTCT0dqr8DqIQqG0Wg/qsMGYANgaJu7DZg Date: Tue, 1 Aug 2017 08:12:19 +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=sriram-s@hpe.com; x-originating-ip: [16.242.235.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TU4PR84MB0256; 7:8RmPdktOLdUEinZz21Qa0pPwW8avDwUZQdwFQenBHqHVNZHyMywG8ajdTc2UnzWCewhiJXK/vJU/kWhSOjNFe4OKFxI4yaOJ217+szImrMb8FKbPeGNUkvtVUdN9RF2+Ne7zlImI6oMsK2NDUwHATRGt1G6ehrwpELbOrQNNoiKRUsq+30uz0FkqNYKaAEDhkjUPu4LTkOxzXQMJg0us8d3Eu1kiVTl1Yaah/GZug/NLk3h/PDTawbDS2pnBwFHxtB4YNHkQrKm2apMfHh0e6PPgP69TCiaT6P68C9Od3joRiau0DAglR1STEArUrtdJofO2Oiuzwghvxx2hYJZR7RsYRupXBUZO3s6aRyNi4onPwPG/K/029lxR0cw/WBROI52B9M3YNbo/bi4EmQG8Mj5uqERUGN49Ila+Zg3cl0NbWVuPLLqrFryLb51az+vyYyxnqq8LVm/msSTOIXif0pXdEucRNlhLRndwLSNN+AwB7Fu3SwvHzlXCSQ+X9C/HgQvOUiLUs35qAD2H0Cbaj0+qLSfDgl8e7B1xIAA9FsgnQu+ZYhrKLrHXOaDgVmFjzmVr4tPuDr/tYf2s3G96/YTB9pHfMFNU0lcDnV7PjHj7Bsaw6I9oiBvqVURD/lJl4qWcgLcExExlQoVmZS79hSnVb/OeSabQn309lRzgHpm7CVcHPySS0V3/ZdezNyL9RtxVebP4xZP4Edh8XGj6ykKWyGN54udHjmYtEYK57bOLohHbdWFIqTUh/EtW6WC2SlA4IN3/9PrHhzDsQXn3r9LkjEsM4tMaihig3c75Y9E= x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39400400002)(39840400002)(39850400002)(39410400002)(39860400002)(39450400003)(199003)(377454003)(189002)(13464003)(189998001)(8936002)(9686003)(3660700001)(2906002)(54906002)(55016002)(6436002)(6306002)(478600001)(2900100001)(25786009)(7696004)(3280700002)(33656002)(5660300001)(53936002)(6246003)(38730400002)(97736004)(8676002)(68736007)(81166006)(81156014)(106356001)(53546010)(6506006)(50986999)(76176999)(54356999)(2501003)(229853002)(14454004)(74316002)(105586002)(66066001)(6116002)(2950100002)(86362001)(101416001)(102836003)(7736002)(3846002)(966005)(305945005)(77096006)(4326008)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:TU4PR84MB0256; H:TU4PR84MB0207.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 0876d118-c57a-4a57-8fa2-08d4d8b507b9 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:TU4PR84MB0256; x-ms-traffictypediagnostic: TU4PR84MB0256: 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)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:TU4PR84MB0256; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:TU4PR84MB0256; 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 08:12:19.4957 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR84MB0256 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 08:10:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sriram Subramanian -----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, which 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 --=20 1.9.5.msysgit.1