]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiDhcp6.c
1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDhcp6.c
index 2bf102ba8b88705f5c274976f066b754e788a447..2627a59dd6b5b6bc67f3f38163196eaf0dce06d4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   iSCSI DHCP6 related configuration routines.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2012, 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
@@ -250,6 +250,7 @@ IScsiDhcp6ParseReply (
   EFI_DHCP6_PACKET_OPTION     *BootFileOpt;\r
   EFI_DHCP6_PACKET_OPTION     **OptionList;\r
   ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;\r
+  UINT16                      ParaLen;\r
  \r
   OptionCount = 0;\r
   BootFileOpt = NULL;\r
@@ -282,7 +283,7 @@ IScsiDhcp6ParseReply (
     if (OptionList[Index]->OpCode == DHCP6_OPT_DNS_SERVERS) {\r
 \r
       if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {\r
-        Status = EFI_INVALID_PARAMETER;\r
+        Status = EFI_UNSUPPORTED;\r
         goto Exit;\r
       }\r
       //\r
@@ -302,6 +303,24 @@ 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
+      //\r
+      // The server sends this option to inform the client about DHCP6 server address.\r
+      //\r
+      if (OptionList[Index]->OpLen < 18) {\r
+        Status = EFI_UNSUPPORTED;\r
+        goto Exit;\r
+      }\r
+      //\r
+      // Check param-len 1, should be 16 bytes.\r
+      //\r
+      CopyMem (&ParaLen, &OptionList[Index]->Data[0], sizeof (UINT16));\r
+      if (NTOHS (ParaLen) != 16) {\r
+        Status = EFI_UNSUPPORTED;\r
+        goto Exit;\r
+      }\r
+\r
+      CopyMem (&ConfigData->DhcpServer, &OptionList[Index]->Data[2], sizeof (EFI_IPv6_ADDRESS));\r
     }\r
   }\r
 \r
@@ -405,7 +424,7 @@ IScsiDoDhcp6 (
     goto ON_EXIT;\r
   }\r
 \r
-  Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 3);\r
+  Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 5);\r
   if (Oro == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ON_EXIT;\r
@@ -416,9 +435,10 @@ IScsiDoDhcp6 (
   // All members in EFI_DHCP6_PACKET_OPTION are in network order.\r
   //\r
   Oro->OpCode  = HTONS (DHCP6_OPT_REQUEST_OPTION);\r
-  Oro->OpLen   = HTONS (2 * 2);\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
 \r
   InfoReqReXmit.Irt = 4;\r
   InfoReqReXmit.Mrc = 1;\r