fixing socket name

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

willem itsme at xs4all.nl
Mon Mar 29 14:39:31 UTC 2010


On 2010-03-29 12:52:11, Holger Freyther wrote:
> On Monday 29 March 2010 12:39:48 willem wrote:
>   
>> the /tmp/osmoncon*  sockets created by osmocon are created one character
>> too short.
>>     
> Can you explain?
>   

the sockaddr struct for named sockets is defined like this ( on my mac )


struct    sockaddr_un {
    unsigned char    sun_len;    /* sockaddr len including null */
    sa_family_t    sun_family;    /* [XSI] AF_UNIX */
    char        sun_path[104];    /* [XSI] path name (gag) */
};

the sun_len value is ignored.
but the total length of the struct passed to bind / connect
should include it.

without this fix, the second time i run './osmocon'  it will complain:
Failed to bind the unix domain socket
since it tried to unlink the correct name, but called bind with a one
char too short name.

willem





More information about the baseband-devel mailing list