From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.40.80; helo=nam03-co1-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0080.outbound.protection.outlook.com [104.47.40.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 51E0D21CF58A1 for ; Tue, 10 Oct 2017 07:02:09 -0700 (PDT) Received: from BN6PR03CA0002.namprd03.prod.outlook.com (10.168.230.140) by MWHPR03MB2701.namprd03.prod.outlook.com (10.168.207.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 10 Oct 2017 14:05:37 +0000 Received: from BN1AFFO11FD023.protection.gbl (2a01:111:f400:7c10::176) by BN6PR03CA0002.outlook.office365.com (2603:10b6:404:23::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Tue, 10 Oct 2017 14:05:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD023.mail.protection.outlook.com (10.58.52.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Tue, 10 Oct 2017 14:05:36 +0000 Received: from uefi-workstation.ap.freescale.net (uefi-workstation.ap.freescale.net [10.232.14.83]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v9AE5Xj5003435; Tue, 10 Oct 2017 07:05:33 -0700 From: Meenakshi Aggarwal To: , , , Date: Tue, 10 Oct 2017 19:37:51 +0530 Message-ID: <1507644471-7747-1-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507265294-19227-2-git-send-email-meenakshi.aggarwal@nxp.com> References: <1507265294-19227-2-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131521179367469774; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(36756003)(110136005)(8676002)(50986999)(5003940100001)(33646002)(189998001)(53936002)(105606002)(50466002)(85426001)(316002)(8656003)(76176999)(47776003)(4326008)(305945005)(8936002)(6666003)(50226002)(48376002)(97736004)(2950100002)(77096006)(68736007)(106466001)(81166006)(81156014)(86362001)(16586007)(69596002)(104016004)(356003)(498600001)(5660300001)(2906002)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2701; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD023; 1:fmw73331dJzuZLb8ZCpcDjVJMMWmgSp02gnybN3D6JyhR7ZDpJtNZy/JKOSxDL3qmJp1unYmJTLo4wtiiJMV0dedVX/MdhQ6baBJvEVQAFmBCtHKX/JAwFjv1vGYQBso MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea419ec2-b696-4083-116d-08d50fe7fb18 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:MWHPR03MB2701; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 3:RNKu7Ucw6xkSnV8VNIbOMdXxi4TN9m9O2FGJcka+lhtO1xj5rDBM3Vw2sgOwjzuE/iRHEA5UwZMTUBFlc/0r60gS+Zn7ttdKD55s9HQk35pTOaiG/YJQkpF9b9Sb+lOYVNeRQ9QSs1z0WYAidB1BJdgbwIDN7nHuuC6eQZIOu/6GKYu7bRfmHeIFQxy0j5MerZeb0SdFPSRPEnuADRcJj2H6e/+QT56UUTpxUf3ijKaCAHU7gcOronTA9VwzONESUl6T3Xi+5mHjOf7LHbetpp+FHuxKy/IwgNI5YWaqGo/cIYX8i0jeykia9gzZ9E2FRb+d3paSPy//5aUB8KNqoJDBe+V2+HgHgCM0xOB6few=; 25:WmmHsZ28DsJ9a1TAWqsgSWHcczV4Y0VoyadId9hUIW9C8EfjyDSwtKzoWpbBJ6TzHvQjd3Wm6NBZzxgHQdsC3L2qCL6SzRJpVqj0JPHE89pZk1y3MeWoeZbQLoMp8VSNmOekBRyTxNpXVyWY76mkTPYVn0n3yKk/IsCXWtupoJrOjXJcy8sQ8LTRTjKO/uSxjb2JYE4z49u9YJcUQsip4frbo4vpjFccTY9MYEsRSKr/ji4K/dHn3DVYEDhUHwabDFJYlKtgiTLB359BJi0OyQ75Yj0c2tFOntqAWI0Zq9CuTPLk7QDsy+g0w558yidjpmk2DN/ln3hTyABwc3hxgw== X-MS-TrafficTypeDiagnostic: MWHPR03MB2701: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 31:1+l2fp87dlDiUKjE013LK0216B5N3QIIQlZH1K/sOUMgCMm3J+W4tja7i1XKbtJ98rQ4yr4IyjoajmW2ogxdiSl/YG5LFa2UJ5imoVgI9cbQLOxkINMx+4NdL3lWPUc8yH5scmBVuN/4SzVaQ/aGTW36F8au3PD+G0jghSpMjHA/S1GoqMCbT984pKzl+LINbxTCluKCgPXYSC9PoVm2dZmpwtzy00WVSdrPKG378uM=; 4:SiYXh9y/9XI9S2ud2YMaffw8kQsyyh/eXP+X58k9RhCGOPN1v22nr+4HoFZpnQqw6Cj9jYfUKgkyazjVRSzBKJwzBAOmcfuoAraQ8YVxIRy3UwtyKSAyIr6oBkNv0yDnHl3vA+4UW4r/sS6lUOx4C+pvLEJD/l8vvS2/hluzaWEc23ys4gWxUQcmWxWnJ/hMABboRCrNPPKZDCuNs5+4u+qOCBZmea1XbZcvZEafQJvXKkHE7eqzpMi+RCzAjBFPb6F10oEwX1hoFnwqLOQCW0d0FTd5nZYrXAEoDj+P0b4= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6096035)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123561025)(20161123556025)(20161123559100)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2701; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2701; X-Forefront-PRVS: 04569283F9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2701; 23:yEz/Dn0OrhX3ZAv8Bab/ymB+VX6T5Yp3Opq4EUmve?= =?us-ascii?Q?sCUaVgLVh8P+QlSJ7/84guq/o22JWMQQN5dSYPwcOqFBrGMM/Q8bjTrab12v?= =?us-ascii?Q?NlwtuDgZOyPuzWUcrWckukq/XsC9Cwq494HsH1M2NeFe5TVFX1bL2HKAOxIj?= =?us-ascii?Q?O/Zsjj+ccBjJwKzb/oCVPr4VKQgUxIRW5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change-CrossTenant-OriginalArrivalTime: 10 Oct 2017 14:05:36.4973 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2701 Subject: [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: Tue, 10 Oct 2017 14:02:10 -0000 Content-Type: text/plain 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(), if error then print "Media State Unknown" 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..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 == 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"); } // -- 2.7.4