follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 As a follow up to my question from yesterday on the netdev list what I think is a real problem. Either in the kernel or in the POSIX spec. The POSIX spec currently says this about SOCK_DGRAM sockets: If address is a null address for the protocol,

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Andi Kleen
Ulrich Drepper <[EMAIL PROTECTED]> writes: > >fd = socket(AT_INET6, ...) > >connect(fd, ...some IPv6 address...) > >struct sockaddr_in6 sin6 = { .sin6_family = AF_INET6 }; >connect(fd, &sin6, sizeof (sin6)); The standard way to undo connect is to use AF_UNSPEC. Code to handle t

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread David Miller
From: Ulrich Drepper <[EMAIL PROTECTED]> Date: Wed, 19 Sep 2007 08:21:47 -0700 > If you think the POSIX spec is wrong (and can point to other > implementations doing the same as Linux) let me know and I'll work on > getting the spec changed. The whole AF_UNSPEC thing I'm almost certain comes from

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Alan Cox
On Wed, 19 Sep 2007 09:15:10 -0700 (PDT) David Miller <[EMAIL PROTECTED]> wrote: > From: Ulrich Drepper <[EMAIL PROTECTED]> > Date: Wed, 19 Sep 2007 08:21:47 -0700 > > > If you think the POSIX spec is wrong (and can point to other > > implementations doing the same as Linux) let me know and I'll

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andi Kleen wrote: > The standard way to undo connect is to use AF_UNSPEC. Code to handle > that for dgram sockets is there. It's the same code for v4 and v6. I quoted the standard and it does not say anything about AF_UNSPEC. So you cannot simply mak

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread David Miller
From: Ulrich Drepper <[EMAIL PROTECTED]> Date: Wed, 19 Sep 2007 09:49:09 -0700 > But the spec calls for a "null address" to be used and that's in my > understanding something different from using AF_UNSPEC. It just occured to me that AF_UNSPEC might be used simply because "all zeros" might be a v

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Andi Kleen
On Wed, Sep 19, 2007 at 09:49:09AM -0700, Ulrich Drepper wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Andi Kleen wrote: > > The standard way to undo connect is to use AF_UNSPEC. Code to handle > > that for dgram sockets is there. It's the same code for v4 and v6. > > I quoted the

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ulrich Drepper wrote: > Yes, but for IPv4/6 it's not an issue. Some implementations might > handle all-zeros and the spec _currently_ calls for it. In this case an > alignment would be good. Searching the web shows up this: http://developer.apple.c

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Andi Kleen
On Wed, Sep 19, 2007 at 10:46:54AM -0700, Ulrich Drepper wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Andi Kleen wrote: > >> But the spec calls for a "null address" to be used and that's in my > >> understanding something different from using AF_UNSPEC. > > > > memset(&sockaddr, 0

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andi Kleen wrote: >> But the spec calls for a "null address" to be used and that's in my >> understanding something different from using AF_UNSPEC. > > memset(&sockaddr, 0, sizeof(sockaddr)) should give you AF_UNSPEC But the spec calls for null addre

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andi Kleen wrote: > Spec doesn't match traditional behaviour then. Well, determining whether that's the case is part of this exercise. > IPv4 0.0.0.0 is > traditionally an synonym for old style all broadcast (255.255.255.255) > on UDP/RAW and it's

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Alan Cox
On Wed, 19 Sep 2007 10:46:54 -0700 Ulrich Drepper <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Andi Kleen wrote: > >> But the spec calls for a "null address" to be used and that's in my > >> understanding something different from using AF_UNSPEC. > > > > memse

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Andi Kleen
On Wed, Sep 19, 2007 at 11:02:00AM -0700, Ulrich Drepper wrote: > > on UDP/RAW and it's certainly possible to connect() to that. > > Where do you get this from? And where is this implemented? I don't Sorry it's actually loopback, not broadcast as implemented in Linux. In Linux it's implemented

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Rick Jones
Andi Kleen wrote: On Wed, Sep 19, 2007 at 11:02:00AM -0700, Ulrich Drepper wrote: on UDP/RAW and it's certainly possible to connect() to that. Where do you get this from? And where is this implemented? I don't Sorry it's actually loopback, not broadcast as implemented in Linux. In Linux

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Andi Kleen
> It has hung-on in various places (stacks) as an "accepted" broadcast IP > in the receive path, but not the send path for quite possibly decades now. Well it is valid in Linux for sending. And who knows who relies on it. -Andi - To unsubscribe from this list: send the line "unsubscribe netdev

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Ulrich Drepper
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Miller wrote: > It just occured to me that AF_UNSPEC might be used simply > because "all zeros" might be a valid real bindable address > for some address family. And using AF_UNSPEC avoids that > problem entirely. Yes, but for IPv4/6 it's not a

Re: follow-up: discrepancy with POSIX

2007-09-19 Thread Valdis . Kletnieks
On Wed, 19 Sep 2007 11:38:57 PDT, Rick Jones said: > One has to set their way-back machine pretty far back to find the *BSD > bits which used 0.0.0.0 as the "all nets, all subnets" (to mis-use a > term) broadcast IPv4 address when sending. Perhaps as far back as the > time before HP-UX 7 or Su