Skip to content

Commit c84f9d6

Browse files
hreineckemcb30
authored andcommittedMar 1, 2018
[iscsi] Parse IPv6 address in root path
The iSCSI root path may contain a literal IPv6 address. Update the parser to handle this address format correctly. Signed-off-by: Hannes Reinecke <hare@suse.de> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
1 parent 47849be commit c84f9d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/net/tcp/iscsi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
19211921
char rp_copy[ strlen ( root_path ) + 1 ];
19221922
char *rp_comp[NUM_RP_COMPONENTS];
19231923
char *rp = rp_copy;
1924+
int skip = 0;
19241925
int i = 0;
19251926
int rc;
19261927

@@ -1930,11 +1931,15 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
19301931
rp_comp[i++] = rp;
19311932
if ( i == NUM_RP_COMPONENTS )
19321933
break;
1933-
for ( ; *rp != ':' ; rp++ ) {
1934+
for ( ; ( ( *rp != ':' ) || skip ) ; rp++ ) {
19341935
if ( ! *rp ) {
19351936
DBGC ( iscsi, "iSCSI %p root path \"%s\" "
19361937
"too short\n", iscsi, root_path );
19371938
return -EINVAL_ROOT_PATH_TOO_SHORT;
1939+
} else if ( *rp == '[' ) {
1940+
skip = 1;
1941+
} else if ( *rp == ']' ) {
1942+
skip = 0;
19381943
}
19391944
}
19401945
*(rp++) = '\0';

0 commit comments

Comments
 (0)