X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=NetworkPkg%2FIScsiDxe%2FIScsiDhcp6.c;h=2627a59dd6b5b6bc67f3f38163196eaf0dce06d4;hb=216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8;hp=2bf102ba8b88705f5c274976f066b754e788a447;hpb=906e1cb7f7f178f5cb2a3bebbac59f6aa8c273a4;p=mirror_edk2.git diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c index 2bf102ba8b..2627a59dd6 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c @@ -1,7 +1,7 @@ /** @file iSCSI DHCP6 related configuration routines. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -250,6 +250,7 @@ IScsiDhcp6ParseReply ( EFI_DHCP6_PACKET_OPTION *BootFileOpt; EFI_DHCP6_PACKET_OPTION **OptionList; ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData; + UINT16 ParaLen; OptionCount = 0; BootFileOpt = NULL; @@ -282,7 +283,7 @@ IScsiDhcp6ParseReply ( if (OptionList[Index]->OpCode == DHCP6_OPT_DNS_SERVERS) { if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) { - Status = EFI_INVALID_PARAMETER; + Status = EFI_UNSUPPORTED; goto Exit; } // @@ -302,6 +303,24 @@ IScsiDhcp6ParseReply ( // The server sends this option to inform the client about an URL to a boot file. // BootFileOpt = OptionList[Index]; + } else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_PARA) { + // + // The server sends this option to inform the client about DHCP6 server address. + // + if (OptionList[Index]->OpLen < 18) { + Status = EFI_UNSUPPORTED; + goto Exit; + } + // + // Check param-len 1, should be 16 bytes. + // + CopyMem (&ParaLen, &OptionList[Index]->Data[0], sizeof (UINT16)); + if (NTOHS (ParaLen) != 16) { + Status = EFI_UNSUPPORTED; + goto Exit; + } + + CopyMem (&ConfigData->DhcpServer, &OptionList[Index]->Data[2], sizeof (EFI_IPv6_ADDRESS)); } } @@ -405,7 +424,7 @@ IScsiDoDhcp6 ( goto ON_EXIT; } - Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 3); + Oro = AllocateZeroPool (sizeof (EFI_DHCP6_PACKET_OPTION) + 5); if (Oro == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; @@ -416,9 +435,10 @@ IScsiDoDhcp6 ( // All members in EFI_DHCP6_PACKET_OPTION are in network order. // Oro->OpCode = HTONS (DHCP6_OPT_REQUEST_OPTION); - Oro->OpLen = HTONS (2 * 2); + Oro->OpLen = HTONS (2 * 3); Oro->Data[1] = DHCP6_OPT_DNS_SERVERS; Oro->Data[3] = DHCP6_OPT_BOOT_FILE_URL; + Oro->Data[5] = DHCP6_OPT_BOOT_FILE_PARA; InfoReqReXmit.Irt = 4; InfoReqReXmit.Mrc = 1;