On 11/18/13 22:59, Mike Christie wrote:
> On 11/14/2013 05:53 PM, [email protected] wrote:
>> From: Yufei Ren <[email protected]>
>>
>> Got "can not connect to iSCSI daemon (111)!" error during
>> starting iscsi service by:
>> $ iscsiadm -m node --loginall=all
>>
>> Traced down and found that the sun_path was mis-used in both iscsid
>> and iscsiadm.
>> ---
>>  usr/iscsid_req.c |    2 +-
>>  usr/mgmt_ipc.c   |    2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
>> index 715c0aa..0ebde90 100644
>> --- a/usr/iscsid_req.c
>> +++ b/usr/iscsid_req.c
>> @@ -71,7 +71,7 @@ static int ipc_connect(int *fd, char *unix_sock_name, int 
>> start_iscsid)
>>  
>>      memset(&addr, 0, sizeof(addr));
>>      addr.sun_family = AF_LOCAL;
>> -    memcpy((char *) &addr.sun_path + 1, unix_sock_name,
>> +    memcpy((char *) addr.sun_path + 1, unix_sock_name,
>>             strlen(unix_sock_name));
>>  
> 
> Hey, since we have some eyes on this patch, one question I have is why
> is the + 1 in there for? Is should not be there right?

>From the unix(7) man page:

<quote>
abstract: an abstract socket address is distinguished  by  the  fact
that  sun_path[0]  is  a  null byte ('\0').  The socket's address in
this namespace is given by the additional bytes in sun_path that are
covered  by  the  specified  length of the address structure.  (Null
bytes in the name have no special significance.)  The  name  has  no
connection  with  file  system  pathnames.   When  the address of an
abstract socket is returned by getsockname(2),  getpeername(2),  and
accept(2),  the returned addrlen is greater than sizeof(sa_family_t)
(i.e., greater than 2), and the name of the socket is  contained  in
the  first  (addrlen  - sizeof(sa_family_t)) bytes of sun_path.  The
abstract socket namespace is a nonportable Linux extension.</quote>

Hope this helps,

Bart.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to