From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 0D70F21EA15D6 for ; Fri, 6 Oct 2017 06:58:30 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 06 Oct 2017 07:01:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,483,1500966000"; d="scan'208";a="320344435" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 06 Oct 2017 07:01:53 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Oct 2017 07:01:53 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.182]) by fmsmsx111.amr.corp.intel.com ([169.254.12.234]) with mapi id 14.03.0319.002; Fri, 6 Oct 2017 07:01:53 -0700 From: "Carsey, Jaben" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Wu, Jiaxin" , "Ni, Ruiyu" Thread-Topic: [PATCH v3] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPl4PSOUmECgcbEakFQgFdd2Ps6LW2nKg Date: Fri, 6 Oct 2017 14:01:52 +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: <1507265294-19227-2-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDgwMmNmYTQtZDlmYi00YTUwLTg1ZWQtYmI1ZTQ1M2Q0YWFjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlYwYzdlUDY4amRoQ2NlN0paR0JHMHVSU3loWlFDZkZXd2hWS0xRNTRaTnc9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 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: Fri, 06 Oct 2017 13:58:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey Do you know under what conditions the API will fail? Is it worth saying som= ething like media stats unknown when the function fails? Ray, What do you think? > -----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 State. > Importance: High >=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() >=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..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"); > } >=20 > // > -- > 2.7.4