summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/IScsiDxe
diff options
context:
space:
mode:
authorZhang, Lubo <lubo.zhang@intel.com>2017-04-28 14:40:22 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2017-05-02 11:11:47 +0800
commit91cdd20f70c5bc739ef45b13e08ae662fbbc55cf (patch)
tree301abe71ecc13e11a8d8916a95301a061d117b65 /NetworkPkg/IScsiDxe
parent597cf8a19ff426bf5f8c03425c00acbc7ac8dd63 (diff)
downloadedk2-91cdd20f70c5bc739ef45b13e08ae662fbbc55cf.tar.gz
edk2-91cdd20f70c5bc739ef45b13e08ae662fbbc55cf.tar.bz2
edk2-91cdd20f70c5bc739ef45b13e08ae662fbbc55cf.zip
NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
if the server name expressed as a site local address begain with FEC0 when retrieving from dhcpv6 option 59 boot file url, it incorrectly process it as a dns name. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg/IScsiDxe')
-rw-r--r--NetworkPkg/IScsiDxe/IScsiDhcp6.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
index d3535d57cb..06c634c3cd 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
@@ -50,7 +50,7 @@ IScsiDhcp6ExtractRootPath (
UINT8 IpMode;
ConfigNvData = &ConfigData->SessionConfigData;
-
+ ConfigNvData->DnsMode = FALSE;
//
// "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
//
@@ -82,23 +82,36 @@ IScsiDhcp6ExtractRootPath (
// Extract SERVERNAME field in the Root Path option.
//
if (TmpStr[Index] != ISCSI_ROOT_PATH_ADDR_START_DELIMITER) {
- Status = EFI_INVALID_PARAMETER;
- goto ON_EXIT;
+ //
+ // The servername is expressed as domain name.
+ //
+ ConfigNvData->DnsMode = TRUE;
} else {
Index++;
}
Fields[RP_FIELD_IDX_SERVERNAME].Str = &TmpStr[Index];
- while ((TmpStr[Index] != ISCSI_ROOT_PATH_ADDR_END_DELIMITER) && (Index < Length)) {
- Index++;
- }
+ if (!ConfigNvData->DnsMode) {
+ while ((TmpStr[Index] != ISCSI_ROOT_PATH_ADDR_END_DELIMITER)&& (Index < Length)) {
+ Index++;
+ }
- //
- // Skip ']' and ':'.
- //
- TmpStr[Index] = '\0';
- Index += 2;
+ //
+ // Skip ']' and ':'.
+ //
+ TmpStr[Index] = '\0';
+ Index += 2;
+ } else {
+ while ((TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) && (Index < Length)) {
+ Index++;
+ }
+ //
+ // Skip ':'.
+ //
+ TmpStr[Index] = '\0';
+ Index += 1;
+ }
Fields[RP_FIELD_IDX_SERVERNAME].Len = (UINT8) AsciiStrLen (Fields[RP_FIELD_IDX_SERVERNAME].Str);
@@ -153,8 +166,7 @@ IScsiDhcp6ExtractRootPath (
//
// Server name is expressed as domain name, just save it.
//
- if ((!NET_IS_DIGIT (*(Field->Str))) && (*(Field->Str) != '[')) {
- ConfigNvData->DnsMode = TRUE;
+ if (ConfigNvData->DnsMode) {
if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {
return EFI_INVALID_PARAMETER;
}