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.24; helo=mga09.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 2EF9721CF58DD for ; Sun, 8 Oct 2017 18:27:55 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2017 18:31:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,497,1500966000"; d="scan'208";a="1179984965" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 08 Oct 2017 18:31:19 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 8 Oct 2017 18:29:54 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Mon, 9 Oct 2017 09:29:27 +0800 From: "Wu, Jiaxin" To: Meenakshi Aggarwal , "Carsey, Jaben" , "edk2-devel@lists.01.org" , "Ni, Ruiyu" Thread-Topic: [PATCH v3] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPl4Q73ohqnwSHUSAH1KNgfdaM6LWVHkAgALNTgCAAZxkYA== Date: Mon, 9 Oct 2017 01:29:27 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741633C189@SHSMSX103.ccr.corp.intel.com> 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-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjY1N2NkMGUtNWNmYi00MDA0LTg3MzAtOGNkZDk4YTU5NzRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkFzUGQ5S3k4VEZNWEpaWFFuMXY5QTRjQllzaHdCOXlpU2gzbW1QZnVHUGs9In0= 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 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: Mon, 09 Oct 2017 01:27:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I agree with Jaben. If NetLibDetectMedia return error status, we can output= as below: ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_= STATE), gShellNetwork1HiiHandle, L"Media state unknown"); Thanks, Jiaxin > -----Original Message----- > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] > Sent: Sunday, October 8, 2017 4:49 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org; Wu, > Jiaxin ; Ni, Ruiyu > Subject: RE: [PATCH v3] Ifconfig : Fixed False information about Media St= ate. >=20 > It is hard to say when can an API fail because its dependent on > implementation. >=20 >=20 > > -----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 > State. > > > > Reviewed-by: Jaben Carsey Do you know under > > what conditions the API will fail? Is it worth saying something like me= dia > 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 St= ate. > > > 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 an= d > > > 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