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.88; helo=mga01.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 D03672095B07C for ; Thu, 5 Oct 2017 13:23:18 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2017 13:26:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,482,1500966000"; d="scan'208";a="1202723533" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 05 Oct 2017 13:26:40 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.182]) by FMSMSX108.amr.corp.intel.com ([169.254.9.100]) with mapi id 14.03.0319.002; Thu, 5 Oct 2017 13:26:40 -0700 From: "Carsey, Jaben" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Wu, Jiaxin" , "Ni, Ruiyu" Thread-Topic: [PATCH] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPaQIZRmk8nmGw0q9wR7D6IDn/aLVWkXQgACZX4D//8FUQA== Date: Thu, 5 Oct 2017 20:26:40 +0000 Message-ID: References: <1507185391-6076-1-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTU5YWFjNzgtZGMxMS00YTY1LThhNzYtZWE5MmRhMmNiYzJiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlVWa0R3b1NCd1pTZFZiOCsxN3RUUXl0dnp0N1ZcL0NQNHVvdFNPQkd2OFNFPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 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: Thu, 05 Oct 2017 20:23:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable What are the conditions that the function does not successfully set the Med= iaPresent setting? Should we also be checking the return value of NetLibDe= tectMedia? > -----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 State= . > Importance: High >=20 > 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 wi= ll > remain so for remaining. >=20 >=20 > Thanks, > Meenakshi >=20 > > -----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 Sta= te. > > > > 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 State= . > > > 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