Thread (9 messages) 9 messages, 3 authors, 2011-08-30

Re: [Bug 42012] New: regression on 2.6.39.3 with socket/bind; still there in 3.0.4

From: Eric Dumazet <hidden>
Date: 2011-08-30 19:44:23

Le mardi 30 août 2011 à 21:16 +0200, Eric Dumazet a écrit :
Le mardi 30 août 2011 à 14:07 -0400, David Miller a écrit :
quoted
From: Eric Dumazet <redacted>
Date: Tue, 30 Aug 2011 18:11:48 +0200
quoted
Yep, we should relax the check and accept AF_UNSPEC.
I guess we'll have to do this, but I just can't bring myself to accept
that we can just do zero validation of what the user is passing us,
see an AF_UNSPEC, and say "yeah it's fine to assume there's an ipv4
address in there."
I couldnt accept it either ;)

By the way, if we accept it, strace() will probably still print binary
blob instead of the IP address (not necessarily ANY address ?)

connect ( AF_UNSPEC ) has special semantic, but AFAIK, bind (AF_UNSPEC)
only brings some mixed results : FreeBSD was accepting it in old
versions it seems. I guess I should try current FreeBSD versions.
Status on FreeBSD 8.1-RELEASE

bind(AF_UNSPEC) is accepted (converted to AF_INET), only with a 0.0.0.0
address.

Following code works :

struct sockaddr_in addr;
fd = socket(PF_INET, SOCK_STREAM, 0);
memset(&addr, 0, sizeof(addr))
bind(fd, (struct sockaddr *)&addr, sizeof(addr)); -> 0

If tried on ipv6 sockets, it doesnt work : bind() returns -1, errno=47

struct sockaddr_in6 addr;
fd = socket(PF_INET6, SOCK_STREAM, 0);
memset(&addr, 0, sizeof(addr))
bind(fd, (struct sockaddr *)&addr, sizeof(addr)); -> -1 errno=47
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help