mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 18:40:24 +03:00
[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>
This commit is contained in:
committed by
Michael Brown
parent
47849be3a9
commit
c84f9d6727
@@ -1921,6 +1921,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
|
|||||||
char rp_copy[ strlen ( root_path ) + 1 ];
|
char rp_copy[ strlen ( root_path ) + 1 ];
|
||||||
char *rp_comp[NUM_RP_COMPONENTS];
|
char *rp_comp[NUM_RP_COMPONENTS];
|
||||||
char *rp = rp_copy;
|
char *rp = rp_copy;
|
||||||
|
int skip = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -1930,11 +1931,15 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi,
|
|||||||
rp_comp[i++] = rp;
|
rp_comp[i++] = rp;
|
||||||
if ( i == NUM_RP_COMPONENTS )
|
if ( i == NUM_RP_COMPONENTS )
|
||||||
break;
|
break;
|
||||||
for ( ; *rp != ':' ; rp++ ) {
|
for ( ; ( ( *rp != ':' ) || skip ) ; rp++ ) {
|
||||||
if ( ! *rp ) {
|
if ( ! *rp ) {
|
||||||
DBGC ( iscsi, "iSCSI %p root path \"%s\" "
|
DBGC ( iscsi, "iSCSI %p root path \"%s\" "
|
||||||
"too short\n", iscsi, root_path );
|
"too short\n", iscsi, root_path );
|
||||||
return -EINVAL_ROOT_PATH_TOO_SHORT;
|
return -EINVAL_ROOT_PATH_TOO_SHORT;
|
||||||
|
} else if ( *rp == '[' ) {
|
||||||
|
skip = 1;
|
||||||
|
} else if ( *rp == ']' ) {
|
||||||
|
skip = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*(rp++) = '\0';
|
*(rp++) = '\0';
|
||||||
|
|||||||
Reference in New Issue
Block a user