Subject: Re: Use of sun_len in AF_UNIX socket addresses
To: Martin Husemann <martin@duskware.de>
From: SODA Noriyuki <soda@sra.co.jp>
List: tech-net
Date: 10/11/2006 18:56:12
>>>>> On Wed, 11 Oct 2006 11:38:11 +0200,
      Martin Husemann <martin@duskware.de> said:

>> Currently we are not using the value of sa_len provided by the
>> userland,

> This should go into unix(4) then, in addition to the example recently
> added (and maybe an explicit hint how to use it with longer path names).

Perhaps the author of the manual thought using memset(addr, 0, sizeof(addr)))
was a good idea for portability, so he made the sun_len initialization
ambiguous.  Although I'm not really sure.
At least the Stevens' UNIX Network Programming is using such style.
Although RFC2553 (IPv6 API) doesn't use such style.

>> but using the 3rd argument (namelen) of bind(2) and
>> connect(2), aren't we (as you see in "sa->sa_len = buflen" in
>> sockargs(9)))?

> That is great! It means we should remove all uses of SUN_LEN() from
> the kernel, doesn't it?

Well, I cannot find any use of SUN_LEN() in the kernel... :)
-- 
soda