[stgt] [PATCH] Fix IPv6 discovery by stripping Zone ID

Lee Duncan lduncan at suse.com
Tue Mar 5 03:34:21 CET 2013



On 03/04/2013 06:04 PM, FUJITA Tomonori wrote:
> On Mon,  4 Mar 2013 15:15:57 -0800
> Lee Duncan <lduncan at suse.com> wrote:
> 
>> This strips off the "%ZONEID" that can be at the end of IPv6
> 
> 'Can' means that possibly the string doesn't exist, right? The
> following code works in such case?

Yes, correct. The strsep() only puts a NULL in the string if it finds
any tokens from the supplied list, "%" in this case. Otherwise, the
string is untouched.

> 
>> addresses returned by getnameinfo(). Without this, IPv6 discovery
>> fails because the address has something like "%eth0" appended to it.
>>
>> Signed of by: Lee Duncan <lduncan at suse.com>
>> ---
>>  usr/iscsi/iscsid.c |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
>> index 9614001..b10be1d 100644
>> --- a/usr/iscsi/iscsid.c
>> +++ b/usr/iscsi/iscsid.c
>> @@ -871,6 +871,10 @@ static void text_scan_text(struct iscsi_connection *conn)
>>  				continue;
>>  			}
>>  
>> +			/* strip zone id */
>> +			if (ss.ss_family == AF_INET6)
>> +				(void) strsep(&p, "%");
>> +
>>  			p = buf + strlen(buf);
>>  
>>  			if (ss.ss_family == AF_INET6)
>> -- 
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe stgt" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Lee Duncan
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list