From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.0.48; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00048.outbound.protection.outlook.com [40.107.0.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 767402095B081 for ; Thu, 5 Oct 2017 10:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=AWSrEiQx3ZBYDOty9QMW/29pSqBYbyC/fOvEnirbGBg=; b=XSXui5qnVZeGMBKrws9X6qW6HVbDO3uTusNnMWIR8USVq4eOmH2SRCOhtCb/Wkb1tTOnaezf9gP5Ya/QeL2s5rfNXbUVLMypa19tZkcN6SXnRr1PF4qbw0050IrEMdaDKCSs/MTg2wkM+t/RpbOOZvqm3nsdiiUj9M/AFCXUiGI= Received: from DB5PR04MB0998.eurprd04.prod.outlook.com (10.161.199.12) by DB5PR04MB0999.eurprd04.prod.outlook.com (10.161.199.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 5 Oct 2017 17:10:05 +0000 Received: from DB5PR04MB0998.eurprd04.prod.outlook.com ([fe80::411c:6de2:e600:73c0]) by DB5PR04MB0998.eurprd04.prod.outlook.com ([fe80::411c:6de2:e600:73c0%14]) with mapi id 15.20.0077.018; Thu, 5 Oct 2017 17:10:05 +0000 From: Meenakshi Aggarwal To: "Carsey, Jaben" , "edk2-devel@lists.01.org" , "Wu, Jiaxin" , "Ni, Ruiyu" Thread-Topic: [PATCH] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPaP+a7gRlLGVOUOToXEJMSCeSKLVWnYAgAAjDhA= Date: Thu, 5 Oct 2017 17:10:05 +0000 Message-ID: References: <1507185391-6076-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=meenakshi.aggarwal@nxp.com; x-originating-ip: [180.188.246.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR04MB0999; 6:VFSTmvoeINPmxPHBVUJJ2O/f7V/Q1hv6Ol4OHcWelwnQaPpKqiUziVFyct9v6C5fxuvzFl3FHBSw6qCMf2+OIqqcI2XHxkY/+Df3CAlR1daPlbT4Qs+79XXMyUYkhPCdOlj66rNaTe/OkCqhK7doE4OPTxvz0UXhxuRHn36WA+E7LLIw38o7xE2L0A4ngIkmYdgnYpJ+RJ2yaPHA7Zv2tSZxdLYLxJeTA3n46CqNbrOsOjEcEiv64IeVi+V6EgCbxQHgGGzAXBZ039L0kJseC5NwNQWicApORKiysOzQE3u/scxPmTHEK30hNLoMtSthBFBh3ZZyGHSz6qy4Iz2hDA==; 5:6pOEKUk60wbjmIQxnKP/vghsS1dnD9YT9r3EbxDe6AFQGqUXw4WpViUTbR9NC7Y0WRcz2NrxQlJa+jAK2mo3DlAkbTvXdiisss8Cp/sK884zrKz5sKavO9E23ghaG5+r8ZK2A3JUn54S+9wSTBS+NA==; 24:rFLqybks56bsD78KohTANzMoti0QkaWQ4opwoDNo9gBw6c/SbNGHD3OLTbxT8b1KS6qjw8CbLjZ7fTSg33iWKwkbYTCGDv/PocMCdAw0rWg=; 7:cQ9G751ocFHpS+FIzNuJbc7iNZ0bn8hZDeEo2PYZ7peJCFNg0beytcp2At3KK7xId1eGRv+e111AAPeksCmfq6RMJfQdfM349stRpf+qr7ml4CE8dk+HFITohmqEUTysjG4o4Z2ilqtLzATRjx+9qwP9mJKsGv+ODgNNOFzekhZwhU7eXFxGnw+PpQ+4Gu1Aca7CRBy3D8vEkO70dsApmGeOdyueb7V0YOpgOm0Ndr8= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 7501f8a0-e724-4fb7-2bd1-08d50c13eca6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB5PR04MB0999; x-ms-traffictypediagnostic: DB5PR04MB0999: x-exchange-antispam-report-test: UriScan:(185117386973197)(162533806227266)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123562025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB5PR04MB0999; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB5PR04MB0999; x-forefront-prvs: 04519BA941 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(199003)(377454003)(189002)(13464003)(2950100002)(25786009)(50986999)(53546010)(86362001)(68736007)(14454004)(5250100002)(6116002)(110136005)(316002)(2906002)(229853002)(3280700002)(102836003)(33656002)(3846002)(3660700001)(2501003)(106356001)(66066001)(6436002)(105586002)(189998001)(8676002)(6506006)(76176999)(97736004)(7736002)(2900100001)(7696004)(81156014)(53936002)(8936002)(81166006)(305945005)(478600001)(5660300001)(99286003)(6246003)(101416001)(74316002)(54356999)(55016002)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB0999; H:DB5PR04MB0998.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2017 17:10:05.5768 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB0999 Subject: Re: [PATCH] Ifconfig : Fixed False information about Media State. 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: Thu, 05 Oct 2017 17:06:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, its moved in the function because NetLibDetectMedia() function is call= ed in a loop (number of active interfaces). So we need to initialize it to FALSE every time before calling NetLibDetect= Media() else if it was set TRUE for some interface then it will remain so f= or remaining. Thanks, Meenakshi > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Thursday, October 05, 2017 8:32 PM > To: Meenakshi Aggarwal ; edk2- > devel@lists.01.org; Wu, Jiaxin ; Ni, Ruiyu > > Subject: RE: [PATCH] Ifconfig : Fixed False information about Media State= . >=20 > Is there a reason to move the assignment in the function? I think our co= ding > guidelines specify initialize variables up top. >=20 > -Jaben >=20 > > -----Original Message----- > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] > > Sent: Wednesday, October 04, 2017 11:37 PM > > To: edk2-devel@lists.01.org; Wu, Jiaxin ; Carsey, > > Jaben ; Ni, Ruiyu > > Cc: Meenakshi Aggarwal > > Subject: [PATCH] Ifconfig : Fixed False information about Media State. > > Importance: High > > > > Issue : We were setting MediaPresent as TRUE (default), so even if > > NetLibDetectMedia() did not set MediaPresent Flag as TRUE, ifconfig > > always display Media State as 'Media Present' > > > > Fix : Set MediaPresent as FALSE before calling NetLibDetectMedia() > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Meenakshi Aggarwal > > --- > > ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > index 4db07b2..7c05b68 100644 > > --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > @@ -554,8 +554,6 @@ IfConfigShowInterfaceInfo ( > > EFI_IPv4_ADDRESS Gateway; > > UINT32 Index; > > > > - MediaPresent =3D TRUE; > > - > > if (IsListEmpty (IfList)) { > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); > > } > > @@ -576,6 +574,8 @@ IfConfigShowInterfaceInfo ( > > // > > // Get Media State. > > // > > + MediaPresent =3D FALSE; > > + > > NetLibDetectMedia (IfCb->NicHandle, &MediaPresent); > > if (!MediaPresent) { > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > disconnected"); > > -- > > 2.7.4