From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.3.51; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30051.outbound.protection.outlook.com [40.107.3.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8C55721EA15B2 for ; Thu, 5 Oct 2017 21:18:24 -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=NwbtAJ70l+q2HQCsj4vpyO+eL7Yzyy46qIMbR9KCC5Q=; b=K4/0ZfDSx2zaT/5HsrLnrYINqdHUrvtiYB1zdHp2Kl0/czQL81fWRLL6NFIeUBCkCgJO8Pi4AhtU9hbNIQmCxONNrPiGZeCg0XBstUCqNqZMEhmdwK1uASs5X+2b1esTC7eC70qDZTj91t++biu2sUhQ3LeT3TF1of71ELPC43E= Received: from DB5PR04MB0998.eurprd04.prod.outlook.com (10.161.199.12) by DB5PR04MB1000.eurprd04.prod.outlook.com (10.161.199.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 6 Oct 2017 04:21:44 +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; Fri, 6 Oct 2017 04:21:44 +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+a7gRlLGVOUOToXEJMSCeSKLVWnYAgAAjDhCAADe0AIAAfyYA Date: Fri, 6 Oct 2017 04:21:44 +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: x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR04MB1000; 6:mnN3yzHTaDSg68R7E4gHsa1ynkSc1nPKtwG19wfjzILRK7N0xUSUyyS3ADjZD2WEg7krrdnGPhSaJXbWvCLwIG9BUp+HdR1AnrJoa15JttggQ4RsjpAnEAcNrPrqFg/q1yu5CKaw+H1h/MRsGCyqISYApO5hVDRF1tLvdBkBgXgIdKCHIhnjxkkPH1evX3FeXvJ9Tk38LAS7mNW7+xIZi5AvVES9cNx8iRpyIdNueDQ6ghoez6w3UuiiGKQRriNWtXcUNUKp5GpBYIYkc4zj8y9tiW1Z5V2hZxdWySVSpx0TzulPgdyXHt/EZvolmiDp/sH3eUnBFWxQAc7J8WN30Q==; 5:0q44TyyjFVbe5yCIXKvrbPG70WZer9ZBPFcrABF6pTm7e87nhQ0IvG/zoneLpUd7W/VPiUxJFi8ucXixuEgrMb2twIyktDPeVYG/NiI+HtDp22hO9PuZrDZewJLVLdd+hKtm65sAfbdt4V23yj9lOw==; 24:TvJDjVvv5VxUL5pXV1vHBkZAujEni+hWbh4wGNG24EfRS4ckn6D2+whCRXHn4rlm4znndZgNyxf/+uKyUFmQY6HVj/l21yFUbi6IlakF7xQ=; 7:AXWNsVS/gRm1jVlIuBtmWzlJHuZHnrdj4i4B3fUd+1vY/1ie8uv0VXUb3ZAqU8CHsFKG9rSDVCm+bRgKzf8AJUVrz2FfUMSEUIXg6TvjqVCmVLHoNSYG3tnX/BjuL+l+xAzZvM96dA/TcQdOxOyeyuHGX8aKdcyWuSIih45lfWEOAxp8uTib67fWjd4zW+KQTYRvAx/x0RA/c7ge3Cp3eLWWksS1uOgQy7LFGRkdg9Y= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 0062e2f6-5196-4284-18b0-08d50c71c0a7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB5PR04MB1000; x-ms-traffictypediagnostic: DB5PR04MB1000: 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)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB5PR04MB1000; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB5PR04MB1000; x-forefront-prvs: 0452022BE1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(377454003)(199003)(189002)(13464003)(229853002)(2906002)(81166006)(3280700002)(81156014)(305945005)(101416001)(8936002)(66066001)(8676002)(6506006)(106356001)(68736007)(50986999)(54356999)(76176999)(7736002)(93886005)(478600001)(105586002)(3660700001)(2950100002)(189998001)(6436002)(5250100002)(33656002)(14454004)(3846002)(6116002)(97736004)(74316002)(99286003)(102836003)(25786009)(110136005)(2501003)(316002)(9686003)(86362001)(2900100001)(55016002)(7696004)(5660300001)(53936002)(53546010)(6246003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1000; 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=meenakshi.aggarwal@nxp.com; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2017 04:21:44.4401 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1000 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: Fri, 06 Oct 2017 04:18:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, we can check return value of NetLibDetectMedia(), then we don't need t= o initialize it with FALSE in loop. NetLibDetectMedia() sets the MediaPresent Flag to TRUE in case of success, = and don't do anything with it in failure cases. I will send the patch, let me know if you agreed with this approach. Thanks, Meenakshi > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Friday, October 06, 2017 1:57 AM > To: Meenakshi Aggarwal ; edk2- > devel@lists.01.org; Wu, Jiaxin ; Ni, Ruiyu > > Subject: RE: [PATCH] Ifconfig : Fixed False information about Media State= . >=20 > What are the conditions that the function does not successfully set the > MediaPresent setting? Should we also be checking the return value of > NetLibDetectMedia? >=20 > > -----Original Message----- > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] > > Sent: Thursday, October 05, 2017 10:10 AM > > To: Carsey, Jaben ; edk2-devel@lists.01.org; > > Wu, Jiaxin ; Ni, Ruiyu > > Subject: RE: [PATCH] Ifconfig : Fixed False information about Media Sta= te. > > Importance: High > > > > Yes, its moved in the function because NetLibDetectMedia() function is > > called in a loop (number of active interfaces). > > So we need to initialize it to FALSE every time before calling > > NetLibDetectMedia() else if it was set TRUE for some interface then it > > will remain so for 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 S= tate. > > > > > > Is there a reason to move the assignment in the function? I think > > > our > > coding > > > guidelines specify initialize variables up top. > > > > > > -Jaben > > > > > > > -----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 Sta= te. > > > > 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