diff options
author | Hannes Reinecke <hare@suse.de> | 2018-03-01 13:30:41 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2018-03-01 13:30:41 +0000 |
commit | c84f9d67272beaed98f98bf308471df16340a3be (patch) | |
tree | 09a3c6a798c6bd0f149f62b25b43237e66de1677 /src/net/tcp | |
parent | 47849be3a900c546cf92066849be0806f4e611d9 (diff) | |
download | ipxe-c84f9d67272beaed98f98bf308471df16340a3be.tar.gz |
[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>
Diffstat (limited to 'src/net/tcp')
-rw-r--r-- | src/net/tcp/iscsi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 789ac86e6..f8379b285 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -1921,6 +1921,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi, char rp_copy[ strlen ( root_path ) + 1 ]; char *rp_comp[NUM_RP_COMPONENTS]; char *rp = rp_copy; + int skip = 0; int i = 0; int rc; @@ -1930,11 +1931,15 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi, rp_comp[i++] = rp; if ( i == NUM_RP_COMPONENTS ) break; - for ( ; *rp != ':' ; rp++ ) { + for ( ; ( ( *rp != ':' ) || skip ) ; rp++ ) { if ( ! *rp ) { DBGC ( iscsi, "iSCSI %p root path \"%s\" " "too short\n", iscsi, root_path ); return -EINVAL_ROOT_PATH_TOO_SHORT; + } else if ( *rp == '[' ) { + skip = 1; + } else if ( *rp == ']' ) { + skip = 0; } } *(rp++) = '\0'; |