]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Ifconfig : Fixed False information about Media State.
authorMeenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Thu, 5 Oct 2017 06:24:45 +0000 (11:54 +0530)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 13 Oct 2017 09:14:50 +0000 (17:14 +0800)
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 <meenakshi.aggarwal@nxp.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c

index 4db07b207d58bc2896a6e4d21590608f6660d376..082ab72fed9c4b2797b58983b311a12a01123bae 100644 (file)
@@ -576,11 +576,14 @@ IfConfigShowInterfaceInfo (
     //\r
     // Get Media State.\r
     //\r
-    NetLibDetectMedia (IfCb->NicHandle, &MediaPresent);\r
-    if (!MediaPresent) {\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media disconnected");\r
+    if (EFI_SUCCESS == NetLibDetectMedia (IfCb->NicHandle, &MediaPresent)) {\r
+      if (!MediaPresent) {\r
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media disconnected");\r
+      } else {\r
+        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media present");\r
+      }\r
     } else {\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media present");\r
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media state unknown");\r
     }\r
 \r
     //\r