Update for NetworkPkg.
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6ConfigNv.c
index b383488..db2155e 100644 (file)
@@ -1651,7 +1651,7 @@ Ip6FormCallback (
     return EFI_SUCCESS;\r
   }\r
 \r
-  if (Action != EFI_BROWSER_ACTION_CHANGING) {\r
+  if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -1677,224 +1677,230 @@ Ip6FormCallback (
 \r
   CopyMem (&OldIfrNvData, IfrNvData, BufferSize);\r
 \r
-  switch (QuestionId) {\r
-  case KEY_INTERFACE_ID:\r
-    Status = Ip6ParseInterfaceIdFromString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId);\r
-    if (EFI_ERROR (Status)) {\r
-      CreatePopUp (\r
-        EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
-        &Key,\r
-        L"Invalid Interface ID!",\r
-        NULL\r
-        );\r
-    }\r
-\r
-    break;\r
-\r
-  case KEY_MANUAL_ADDRESS:\r
-    Status = Ip6ParseAddressListFromString (\r
-               IfrNvData->ManualAddress,\r
-               &Ip6NvData->ManualAddress,\r
-               &Ip6NvData->ManualAddressCount\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      CreatePopUp (\r
-        EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
-        &Key,\r
-        L"Invalid Host Addresses!",\r
-        NULL\r
-        );\r
-    }\r
-\r
-    break;\r
-\r
-  case KEY_GATEWAY_ADDRESS:\r
-    Status = Ip6ParseAddressListFromString (\r
-               IfrNvData->GatewayAddress,\r
-               &Ip6NvData->GatewayAddress,\r
-               &Ip6NvData->GatewayAddressCount\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      CreatePopUp (\r
-        EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
-        &Key,\r
-        L"Invalid Gateway Addresses!",\r
-        NULL\r
-        );\r
-    }\r
-\r
-    break;\r
-\r
-  case KEY_DNS_ADDRESS:\r
-    Status = Ip6ParseAddressListFromString (\r
-               IfrNvData->DnsAddress,\r
-               &Ip6NvData->DnsAddress,\r
-               &Ip6NvData->DnsAddressCount\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      CreatePopUp (\r
-        EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
-        &Key,\r
-        L"Invalid DNS Addresses!",\r
-        NULL\r
-        );\r
-    }\r
-\r
-    break;\r
-\r
-  case KEY_SAVE_CONFIG_CHANGES:\r
-    CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
-    break;\r
-\r
-  case KEY_IGNORE_CONFIG_CHANGES:\r
-    CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;\r
-    break;\r
-\r
-  case KEY_SAVE_CHANGES:\r
-    Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);\r
-    if (EFI_ERROR (Status)) {\r
-      break;\r
-    }\r
-\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-    break;\r
-\r
-  case KEY_GET_CURRENT_SETTING:\r
-    Ip6Config = &Instance->Ip6Config;\r
-    HiiHandle = Instance->CallbackInfo.RegisteredHandle;\r
-    Data      = NULL;\r
-\r
-    //\r
-    // Get current interface info.\r
-    //\r
-    Status = Ip6ConfigNvGetData (\r
-               Ip6Config,\r
-               Ip6ConfigDataTypeInterfaceInfo,\r
-               &DataSize,\r
-               (VOID **) &Data\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-    //\r
-    // Generate dynamic text opcode for host address and draw it.\r
-    //\r
-    IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;\r
-    Status = Ip6ConvertAddressListToString (\r
-               PortString,\r
-               HiiHandle,\r
-               Ip6ConfigNvHostAddress,\r
-               IfInfo->AddressInfo,\r
-               IfInfo->AddressInfoCount\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      FreePool (Data);\r
-      return Status;\r
-    }\r
-\r
-    //\r
-    // Generate the dynamic text opcode for route table and draw it.\r
-    //\r
-    Status = Ip6ConvertAddressListToString (\r
-               PortString,\r
-               HiiHandle,\r
-               Ip6ConfigNvRouteTable,\r
-               IfInfo->RouteTable,\r
-               IfInfo->RouteCount\r
-               );\r
-    if (EFI_ERROR (Status)) {\r
-      FreePool (Data);\r
-      return Status;\r
-    }\r
+  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
+    switch (QuestionId) {\r
+    case KEY_GET_CURRENT_SETTING:\r
+      Ip6Config = &Instance->Ip6Config;\r
+      HiiHandle = Instance->CallbackInfo.RegisteredHandle;\r
+      Data      = NULL;\r
 \r
-    //\r
-    // Get DNS server list.\r
-    //\r
-    FreePool (Data);\r
-    DataSize = 0;\r
-    Data = NULL;\r
-    Status = Ip6ConfigNvGetData (\r
-               Ip6Config,\r
-               Ip6ConfigDataTypeDnsServer,\r
-               &DataSize,\r
-               (VOID **) &Data\r
-               );\r
-    if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
-      if (Data != NULL) {\r
-        FreePool (Data);\r
+      //\r
+      // Get current interface info.\r
+      //\r
+      Status = Ip6ConfigNvGetData (\r
+                 Ip6Config,\r
+                 Ip6ConfigDataTypeInterfaceInfo,\r
+                 &DataSize,\r
+                 (VOID **) &Data\r
+                 );\r
+      if (EFI_ERROR (Status)) {\r
+        return Status;\r
       }\r
-      return Status;\r
-    }\r
 \r
-    if (DataSize > 0) {\r
       //\r
-      // Generate the dynamic text opcode for DNS server and draw it.\r
+      // Generate dynamic text opcode for host address and draw it.\r
       //\r
+      IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;\r
       Status = Ip6ConvertAddressListToString (\r
                  PortString,\r
                  HiiHandle,\r
-                 Ip6ConfigNvDnsAddress,\r
-                 Data,\r
-                 DataSize / sizeof (EFI_IPv6_ADDRESS)\r
+                 Ip6ConfigNvHostAddress,\r
+                 IfInfo->AddressInfo,\r
+                 IfInfo->AddressInfoCount\r
                  );\r
       if (EFI_ERROR (Status)) {\r
         FreePool (Data);\r
         return Status;\r
       }\r
-    }\r
-\r
-    //\r
-    // Get gateway adderss list.\r
-    //\r
-    if (Data != NULL) {\r
-      FreePool (Data);\r
-    }\r
-\r
-    DataSize = 0;\r
-    Data = NULL;\r
-    Status = Ip6ConfigNvGetData (\r
-               Ip6Config,\r
-               Ip6ConfigDataTypeGateway,\r
-               &DataSize,\r
-               (VOID **) &Data\r
-               );\r
-    if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
-      if (Data != NULL) {\r
-        FreePool (Data);\r
-      }\r
-      return Status;\r
-    }\r
 \r
-    if (DataSize > 0) {\r
       //\r
-      // Generate the dynamic text opcode for gateway and draw it.\r
+      // Generate the dynamic text opcode for route table and draw it.\r
       //\r
       Status = Ip6ConvertAddressListToString (\r
                  PortString,\r
                  HiiHandle,\r
-                 Ip6ConfigNvGatewayAddress,\r
-                 Data,\r
-                 DataSize / sizeof (EFI_IPv6_ADDRESS)\r
+                 Ip6ConfigNvRouteTable,\r
+                 IfInfo->RouteTable,\r
+                 IfInfo->RouteCount\r
                  );\r
       if (EFI_ERROR (Status)) {\r
         FreePool (Data);\r
         return Status;\r
       }\r
-    }\r
 \r
-    if (Data != NULL) {\r
+      //\r
+      // Get DNS server list.\r
+      //\r
       FreePool (Data);\r
+      DataSize = 0;\r
+      Data = NULL;\r
+      Status = Ip6ConfigNvGetData (\r
+                 Ip6Config,\r
+                 Ip6ConfigDataTypeDnsServer,\r
+                 &DataSize,\r
+                 (VOID **) &Data\r
+                 );\r
+      if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
+        if (Data != NULL) {\r
+          FreePool (Data);\r
+        }\r
+        return Status;\r
+      }\r
+\r
+      if (DataSize > 0) {\r
+        //\r
+        // Generate the dynamic text opcode for DNS server and draw it.\r
+        //\r
+        Status = Ip6ConvertAddressListToString (\r
+                   PortString,\r
+                   HiiHandle,\r
+                   Ip6ConfigNvDnsAddress,\r
+                   Data,\r
+                   DataSize / sizeof (EFI_IPv6_ADDRESS)\r
+                   );\r
+        if (EFI_ERROR (Status)) {\r
+          FreePool (Data);\r
+          return Status;\r
+        }\r
+      }\r
+\r
+      //\r
+      // Get gateway adderss list.\r
+      //\r
+      if (Data != NULL) {\r
+        FreePool (Data);\r
+      }\r
+\r
+      DataSize = 0;\r
+      Data = NULL;\r
+      Status = Ip6ConfigNvGetData (\r
+                 Ip6Config,\r
+                 Ip6ConfigDataTypeGateway,\r
+                 &DataSize,\r
+                 (VOID **) &Data\r
+                 );\r
+      if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {\r
+        if (Data != NULL) {\r
+          FreePool (Data);\r
+        }\r
+        return Status;\r
+      }\r
+\r
+      if (DataSize > 0) {\r
+        //\r
+        // Generate the dynamic text opcode for gateway and draw it.\r
+        //\r
+        Status = Ip6ConvertAddressListToString (\r
+                   PortString,\r
+                   HiiHandle,\r
+                   Ip6ConfigNvGatewayAddress,\r
+                   Data,\r
+                   DataSize / sizeof (EFI_IPv6_ADDRESS)\r
+                   );\r
+        if (EFI_ERROR (Status)) {\r
+          FreePool (Data);\r
+          return Status;\r
+        }\r
+      }\r
+\r
+      if (Data != NULL) {\r
+        FreePool (Data);\r
+      }\r
+\r
+      Status = EFI_SUCCESS;\r
+\r
+      break;\r
+\r
+    default:\r
+      break;\r
     }\r
+  } else if (Action == EFI_BROWSER_ACTION_CHANGED) {\r
+    switch (QuestionId) {\r
+    case KEY_SAVE_CONFIG_CHANGES:\r
+      CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;\r
+      break;\r
 \r
-    Status = EFI_SUCCESS;\r
+    case KEY_IGNORE_CONFIG_CHANGES:\r
+      CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;\r
+      break;\r
 \r
-    break;\r
+    case KEY_SAVE_CHANGES:\r
+      Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);\r
+      if (EFI_ERROR (Status)) {\r
+        break;\r
+      }\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
+      break;\r
+    \r
+    case KEY_INTERFACE_ID:\r
+      Status = Ip6ParseInterfaceIdFromString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId);\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Invalid Interface ID!",\r
+          NULL\r
+          );\r
+      }\r
+    \r
+      break;\r
+    \r
+    case KEY_MANUAL_ADDRESS:\r
+      Status = Ip6ParseAddressListFromString (\r
+                 IfrNvData->ManualAddress,\r
+                 &Ip6NvData->ManualAddress,\r
+                 &Ip6NvData->ManualAddressCount\r
+                 );\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Invalid Host Addresses!",\r
+          NULL\r
+          );\r
+      }\r
+    \r
+      break;\r
+    \r
+    case KEY_GATEWAY_ADDRESS:\r
+      Status = Ip6ParseAddressListFromString (\r
+                 IfrNvData->GatewayAddress,\r
+                 &Ip6NvData->GatewayAddress,\r
+                 &Ip6NvData->GatewayAddressCount\r
+                 );\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Invalid Gateway Addresses!",\r
+          NULL\r
+          );\r
+      }\r
+    \r
+      break;\r
+    \r
+    case KEY_DNS_ADDRESS:\r
+      Status = Ip6ParseAddressListFromString (\r
+                 IfrNvData->DnsAddress,\r
+                 &Ip6NvData->DnsAddress,\r
+                 &Ip6NvData->DnsAddressCount\r
+                 );\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Invalid DNS Addresses!",\r
+          NULL\r
+          );\r
+      }\r
+    \r
+      break;\r
 \r
-  default:\r
-    break;\r
+    default:\r
+      break;\r
+    }\r
   }\r
 \r
   if (!EFI_ERROR (Status)) {\r