ShellPkg: Update ping/ifconfig library source code to consume Ip4Config2 protocol.
[mirror_edk2.git] / ShellPkg / Library / UefiShellNetwork1CommandsLib / Ping.c
index e23588afdb76ec73eb3bd20a13dcc9db26cde45f..fda062de1d73c7d11019a239b563349881a442a8 100644 (file)
@@ -955,7 +955,7 @@ PingCreateIpInstance (
       //\r
       Status = gBS->HandleProtocol (\r
                       HandleBuffer[HandleIndex],\r
-                      Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4ConfigProtocolGuid,\r
+                      Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4Config2ProtocolGuid,\r
                       (VOID **) &IpXCfg\r
                       );\r
 \r
@@ -973,8 +973,9 @@ PingCreateIpInstance (
                            NULL\r
                            );\r
       } else {\r
-        Status = ((EFI_IP4_CONFIG_PROTOCOL*)IpXCfg)->GetData (\r
+        Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (\r
                            IpXCfg,\r
+                           Ip4Config2DataTypeInterfaceInfo,\r
                            &IfInfoSize,\r
                            NULL\r
                            );\r
@@ -1009,8 +1010,9 @@ PingCreateIpInstance (
                            IpXInterfaceInfo\r
                            );\r
       } else {\r
-        Status = ((EFI_IP4_CONFIG_PROTOCOL*)IpXCfg)->GetData (\r
+        Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (\r
                            IpXCfg,\r
+                           Ip4Config2DataTypeInterfaceInfo,\r
                            &IfInfoSize,\r
                            IpXInterfaceInfo\r
                            );\r
@@ -1045,7 +1047,7 @@ PingCreateIpInstance (
         //\r
         // IP4 address check\r
         //\r
-        if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_IPCONFIG_DATA*)IpXInterfaceInfo)->StationAddress)) {\r
+        if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) {\r
           //\r
           // Match a certain interface address.\r
           //\r
@@ -1137,11 +1139,6 @@ PingCreateIpInstance (
     //\r
     // Configure the ip4 instance for icmp4 packet exchange.\r
     //\r
-//    PING_IP4_COPY_ADDRESS (&Ip4Config.StationAddress,     &Private->SrcAddress);\r
-//    Ip4Config.SubnetMask.Addr[0] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[1] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[2] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[3] = 0x00;\r
     Ip4Config.DefaultProtocol   = 1;\r
     Ip4Config.AcceptAnyProtocol = FALSE;\r
     Ip4Config.AcceptBroadcast   = FALSE;\r
@@ -1429,6 +1426,10 @@ ON_EXIT:
 \r
   @param[in] ImageHandle  Handle to the Image (NULL if Internal).\r
   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).\r
+\r
+  @retval SHELL_SUCCESS  The ping processed successfullly.\r
+  @retval others         The ping processed unsuccessfully.\r
+  \r
 **/\r
 SHELL_STATUS\r
 EFIAPI\r