From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 6416821F3C1B1 for ; Tue, 10 Oct 2017 17:44:07 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2017 17:47:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,359,1503385200"; d="scan'208";a="161219679" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 10 Oct 2017 17:47:35 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Oct 2017 17:47:35 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Oct 2017 17:47:34 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Wed, 11 Oct 2017 08:47:32 +0800 From: "Wu, Jiaxin" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Carsey, Jaben" , "Ni, Ruiyu" Thread-Topic: [edk2] [PATCH v4] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTQdDowDXIvQ1eCEWM2+V6gy3Z1KLd0VXw Date: Wed, 11 Oct 2017 00:47:32 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741633CE8C@SHSMSX103.ccr.corp.intel.com> References: <1507265294-19227-2-git-send-email-meenakshi.aggarwal@nxp.com> <1507644471-7747-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: <1507644471-7747-1-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjA5YzZiNDYtY2M4MS00YzY5LTg4ZTctMGRlYzdmODJjMzQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlVQNm9yYmdlcFdsdEtFQ2pQSHJHZ2VicDNFc2pRMDM2R0VFSFd5YWdOdXc9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v4] 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: Wed, 11 Oct 2017 00:44:07 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Meenakshi Aggarwal > Sent: Tuesday, October 10, 2017 10:08 PM > To: edk2-devel@lists.01.org; Wu, Jiaxin ; Carsey, > Jaben ; Ni, Ruiyu > Subject: [edk2] [PATCH v4] Ifconfig : Fixed False information about Media > State. >=20 > 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. >=20 > Fix : Check return value of NetLibDetectMedia(), if error then > print "Media State Unknown" >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 >=20 > Signed-off-by: Meenakshi Aggarwal > --- > ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 11 +++++++-- > -- > 1 file changed, 7 insertions(+), 4 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > index 4db07b2..082ab72 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 > state unknown"); > } >=20 > // > -- > 2.7.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel