[BusyBox] tftp: bind with no sin_family

Shaun Jackman sjackman at gmail.com
Thu May 19 18:04:17 UTC 2005


On 5/19/05, Jason Schoon <floydpink at gmail.com> wrote:
> The memset tells you how things are going to behave in the bind.  The
> original code could be expanded as follows:
>  
>  memset(&sa, 0, len);
>  sa.sin_family = AF_UNSPEC;
>  sa.sin_addr.s_addr = INADDR_ANY;   (defined as 0L)
>  
>  For most intents and purposes, AF_UNSPEC behaves very similar to AF_INET. 
> Here is a good page describing the various address families:
>  http://www.opengroup.org/onlinepubs/009619199/getad.htm

Thanks for the pointer. Searching for bind and AF_UNSPEC gave some
interesting results. I see how AF_UNSPEC applies to getaddrinfo, where
you're requesting information from the kernel, but it does seem rather
odd to pass it to bind, where you should be supplying information to
the kernel. In any case, I made a quick patch to my TCP/IP stack so
that a call to bind {AF_UNSPEC} translates to bind {AF_INET,
INADDR_ANY, 0}.

Cheers,
Shaun



More information about the busybox mailing list