]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiDhcp6.c
MdeModulePkg RegularExpressionDxe: Remove GCC -fno-builtin option
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDhcp6.c
index 331b0f161b25bdac6a395190717a0078881eb257..d3535d57cb5a2eb646118f7c447400a75b2cfa20 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   iSCSI DHCP6 related configuration routines.\r
 \r
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -150,13 +150,26 @@ IScsiDhcp6ExtractRootPath (
     IpMode = ConfigData->AutoConfigureMode;\r
   }\r
 \r
-  Status = IScsiAsciiStrToIp (Field->Str, IpMode, &Ip);\r
-  CopyMem (&ConfigNvData->TargetIp, &Ip, sizeof (EFI_IP_ADDRESS));\r
-\r
+  //\r
+  // Server name is expressed as domain name, just save it.\r
+  //\r
+  if ((!NET_IS_DIGIT (*(Field->Str))) && (*(Field->Str) != '[')) {\r
+    ConfigNvData->DnsMode = TRUE;\r
+    if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+    CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);\r
+    ConfigNvData->TargetUrl[Field->Len + 1] = '\0';\r
+  } else {\r
+    ZeroMem(&ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));\r
+    Status = IScsiAsciiStrToIp (Field->Str, IpMode, &Ip);\r
+    CopyMem (&ConfigNvData->TargetIp, &Ip, sizeof (EFI_IP_ADDRESS));\r
 \r
-  if (EFI_ERROR (Status)) {\r
-    goto ON_EXIT;\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_EXIT;\r
+    }\r
   }\r
+\r
   //\r
   // Check the protocol type.\r
   //\r
@@ -303,7 +316,7 @@ IScsiDhcp6ParseReply (
       // The server sends this option to inform the client about an URL to a boot file.\r
       //\r
       BootFileOpt = OptionList[Index];\r
-    } else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_PARA) {\r
+    } else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_PARAM) {\r
       //\r
       // The server sends this option to inform the client about DHCP6 server address.\r
       //\r
@@ -434,11 +447,11 @@ IScsiDoDhcp6 (
   // Ask the server to reply with DNS and Boot File URL options by info request.\r
   // All members in EFI_DHCP6_PACKET_OPTION are in network order.\r
   //\r
-  Oro->OpCode  = HTONS (DHCP6_OPT_REQUEST_OPTION);\r
+  Oro->OpCode  = HTONS (DHCP6_OPT_ORO);\r
   Oro->OpLen   = HTONS (2 * 3);\r
   Oro->Data[1] = DHCP6_OPT_DNS_SERVERS;\r
   Oro->Data[3] = DHCP6_OPT_BOOT_FILE_URL;\r
-  Oro->Data[5] = DHCP6_OPT_BOOT_FILE_PARA;\r
+  Oro->Data[5] = DHCP6_OPT_BOOT_FILE_PARAM;\r
 \r
   InfoReqReXmit.Irt = 4;\r
   InfoReqReXmit.Mrc = 1;\r