From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.2.69; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0069.outbound.protection.outlook.com [104.47.2.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DA5521FC7475 for ; Sun, 8 Oct 2017 01:45:51 -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=B8qnKgm44P2ii488L8lqIxPklCiiyBXn9S7u4yDapug=; b=ClZqVmGnCywdaFYn+D6IV6o5uSrFuH90aJ8BU2QZEqOmVzyMZ1AAFpgQazYP3pkGjAs+G2RTHJWqY3RFBZiF1DeyTcznA+mHAnA1u13dAIIuH3L1WJBP6KY5XUs5HjOS+x2ieEZZarGqfjyTqKDozIegQlo2RN5Bm2uGEgYsXmg= 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; Sun, 8 Oct 2017 08:49:12 +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.019; Sun, 8 Oct 2017 08:49:12 +0000 From: Meenakshi Aggarwal To: "Carsey, Jaben" , "edk2-devel@lists.01.org" , "Wu, Jiaxin" , "Ni, Ruiyu" Thread-Topic: [PATCH v3] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPl4TPsmH79gxEkGQuMS8QVQr+aLW2pUAgALMjUA= Date: Sun, 8 Oct 2017 08:49:12 +0000 Message-ID: References: <1507264809-19123-1-git-send-email-meenakshi.aggarwal@nxp.com> <1507265294-19227-1-git-send-email-meenakshi.aggarwal@nxp.com> <1507265294-19227-2-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:r9u5ut1A1ntpDsynViwe2W2cu8cIeVhTMpBQ5Huyx1HRv3KgImDSMpIwdrQyKSGvrb88+mar6dfsxCN5lzkCfgmGRH+vFheRdfoC8cfiRLGwN/P6UFJTI6H8mHqVGr56ayurIUCC3LqfhzaV0RXHOYSMfh1N7RtVfQ1XHMBdiJ5DcU+hlNybc6L9N4CB3WM7H7pNZ2waVnGK7nutLep2e1SAohEHD89dl+Hp9izwWUXapY/tDOzLuIyZi9rkPoZLNbdbqRa93/UV8SLCaP0MBdQ3pY4XvMJ7tj979LHx7dXKKHjqJnLayEG7VQ6HT43U0Xp5MKizM+GP0gmjLAa5Sw==; 5:2f7PklREQrhD27YUKXNCZ71JrgvlRYPjqzJQ6mxssLjmFkJPnJ3P3w+oNoFp+y8SKwC6iLoVXCFoei2YhYa5RVTdcQho5pkmW9JCDRq005KNnGQ3JKxXkF5CfKFztZkfxkVDKTVFJaXEDRklGjz3GQ==; 24:giYRZJJCN67IxiVz04eJe7BfO7oBYECh4rLDcnFoJ8ub9Ts/ayYtSHe1vVV7116Ck4r/PLkjYIaqL5enan8bN5HS/g0Zoeu2y1XyA4OsISo=; 7:oqS5IgwcYgmEmOh6w+HEVvTz7Y1RAR1m+nE37HnuZCaC+18pbGFDgzVKB04nyqee1eVXysnTac6XBBRWtO4N+LZyV7Wwb83obb1NNaRKVRFceAigv1jFOcUXu9KndapbCdSryMNxIrkRyjHL4yAgnfFS7QfR9Mb7Oljtjm2CVc/5U2Xx0jk/i018uY2v9wDfF35YPzPqnG9svrZwMmWfm6z2qm86yjuXiZtd6MWUGmo= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 2a470de4-7f2f-479d-d846-08d50e2972b1 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)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(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: 0454444834 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(377454003)(189002)(199003)(13464003)(76104003)(5250100002)(54356999)(2501003)(86362001)(189998001)(6506006)(305945005)(7736002)(5660300001)(6436002)(6246003)(74316002)(76176999)(316002)(110136005)(50986999)(106356001)(105586002)(7696004)(97736004)(2900100001)(66066001)(93886005)(3846002)(9686003)(102836003)(6116002)(53936002)(2906002)(101416001)(53546010)(14454004)(229853002)(3660700001)(3280700002)(25786009)(33656002)(55016002)(68736007)(99286003)(81156014)(8936002)(2950100002)(478600001)(8676002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB0999; H:DB5PR04MB0998.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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: 08 Oct 2017 08:49:12.2405 (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 v3] 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: Sun, 08 Oct 2017 08:45:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It is hard to say when can an API fail because its dependent on implementat= ion. > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Friday, October 06, 2017 7:32 PM > To: Meenakshi Aggarwal ; edk2- > devel@lists.01.org; Wu, Jiaxin ; Ni, Ruiyu > > Subject: RE: [PATCH v3] Ifconfig : Fixed False information about Media St= ate. >=20 > Reviewed-by: Jaben Carsey Do you know under > what conditions the API will fail? Is it worth saying something like medi= a stats > unknown when the function fails? >=20 > Ray, >=20 > What do you think? >=20 >=20 > > -----Original Message----- > > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] > > Sent: Thursday, October 05, 2017 9:48 PM > > To: edk2-devel@lists.01.org; Wu, Jiaxin ; Carsey, > > Jaben ; Ni, Ruiyu > > Cc: Meenakshi Aggarwal > > Subject: [PATCH v3] Ifconfig : Fixed False information about Media Stat= e. > > Importance: High > > > > Issue : We were setting MediaPresent as TRUE (default) and not > > checking return status of NetLibDetectMedia(). > > NetLibDetectMedia() sets MediaPresent FLAG in case of success only and > > dont change flag on error. > > So, Media State will display as 'Media Present', in case of error > > also. > > > > Fix : Check return value of NetLibDetectMedia() > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Meenakshi Aggarwal > > --- > > ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 11 > > +++++++-- > > -- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > index 4db07b2..90ca724 100644 > > --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > > @@ -576,11 +576,14 @@ IfConfigShowInterfaceInfo ( > > // > > // Get Media State. > > // > > - NetLibDetectMedia (IfCb->NicHandle, &MediaPresent); > > - if (!MediaPresent) { > > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > disconnected"); > > + if (EFI_SUCCESS =3D=3D NetLibDetectMedia (IfCb->NicHandle, > > &MediaPresent)) { > > + if (!MediaPresent) { > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > disconnected"); > > + } else { > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > present"); > > + } > > } else { > > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > present"); > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > > disconnected"); > > } > > > > // > > -- > > 2.7.4