public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
@ 2017-04-28  6:40 Zhang Lubo
  2017-04-28  8:25 ` Wu, Jiaxin
  2017-05-03  2:52 ` Ye, Ting
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Lubo @ 2017-04-28  6:40 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Ye Ting, Fu Siyuan

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>
---
 NetworkPkg/IScsiDxe/IScsiDhcp6.c | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
index d3535d5..06c634c 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
@@ -48,11 +48,11 @@ IScsiDhcp6ExtractRootPath (
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
   EFI_IP_ADDRESS              Ip;
   UINT8                       IpMode;  
 
   ConfigNvData = &ConfigData->SessionConfigData;
-
+  ConfigNvData->DnsMode = FALSE;
   //
   // "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
   //
   IScsiRootPathIdLen = (UINT16) AsciiStrLen (ISCSI_ROOT_PATH_ID);
 
@@ -80,27 +80,40 @@ 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);
 
   //
   // Extract others fields in the Root Path option string.
@@ -151,12 +164,11 @@ 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;
     }
     CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
     ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
  2017-04-28  6:40 [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP Zhang Lubo
@ 2017-04-28  8:25 ` Wu, Jiaxin
  2017-05-03  2:52 ` Ye, Ting
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2017-04-28  8:25 UTC (permalink / raw)
  To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

Thanks,
Jiaxin

> -----Original Message-----
> From: Zhang, Lubo
> Sent: Friday, April 28, 2017 2:40 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan
> <siyuan.fu@intel.com>
> Subject: [patch] 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>
> ---
>  NetworkPkg/IScsiDxe/IScsiDhcp6.c | 38 +++++++++++++++++++++++++-----------
> --
>  1 file changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
> b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
> index d3535d5..06c634c 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
> @@ -48,11 +48,11 @@ IScsiDhcp6ExtractRootPath (
>    ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
>    EFI_IP_ADDRESS              Ip;
>    UINT8                       IpMode;
> 
>    ConfigNvData = &ConfigData->SessionConfigData;
> -
> +  ConfigNvData->DnsMode = FALSE;
>    //
>    // "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
>    //
>    IScsiRootPathIdLen = (UINT16) AsciiStrLen (ISCSI_ROOT_PATH_ID);
> 
> @@ -80,27 +80,40 @@ 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);
> 
>    //
>    // Extract others fields in the Root Path option string.
> @@ -151,12 +164,11 @@ 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;
>      }
>      CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
>      ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
> --
> 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
  2017-04-28  6:40 [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP Zhang Lubo
  2017-04-28  8:25 ` Wu, Jiaxin
@ 2017-05-03  2:52 ` Ye, Ting
  1 sibling, 0 replies; 3+ messages in thread
From: Ye, Ting @ 2017-05-03  2:52 UTC (permalink / raw)
  To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin, Fu, Siyuan

Reviewed-by: Ye Ting <ting.ye@intel.com> 

-----Original Message-----
From: Zhang, Lubo 
Sent: Friday, April 28, 2017 2:40 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>
Subject: [patch] 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>
---
 NetworkPkg/IScsiDxe/IScsiDhcp6.c | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
index d3535d5..06c634c 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c
@@ -48,11 +48,11 @@ IScsiDhcp6ExtractRootPath (
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
   EFI_IP_ADDRESS              Ip;
   UINT8                       IpMode;  
 
   ConfigNvData = &ConfigData->SessionConfigData;
-
+  ConfigNvData->DnsMode = FALSE;
   //
   // "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
   //
   IScsiRootPathIdLen = (UINT16) AsciiStrLen (ISCSI_ROOT_PATH_ID);
 
@@ -80,27 +80,40 @@ 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);
 
   //
   // Extract others fields in the Root Path option string.
@@ -151,12 +164,11 @@ 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;
     }
     CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
     ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
--
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-03  2:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-28  6:40 [patch] NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP Zhang Lubo
2017-04-28  8:25 ` Wu, Jiaxin
2017-05-03  2:52 ` Ye, Ting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox