[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1283925171.2634.838.camel@edumazet-laptop>
Date: Wed, 08 Sep 2010 07:52:51 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: brian.haley@...com, ole@....pl, netdev@...r.kernel.org
Subject: Re: [PATCH] inet: dont set inet_rcv_saddr in connect()
Le mardi 07 septembre 2010 à 22:36 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@...il.com>
> Date: Wed, 08 Sep 2010 06:57:37 +0200
>
> > Document that connect() also sets local address, and that before
> > doing a second connect() to change remote address, its mandatory to
> > first issue a connect(AF_UNSPEC) to clear local address (if not locked
> > by a prior bind() call)
>
> For connectionless sockets, the application may connect() as many
> times as it wishes to change the remote address. The local address
> remains set if it were set before such a re-associating connect().
>
> It need only issue a connect(AF_UNSPEC) to make the socket have no
> remote association, and as you state this operation will also wipe out
> any local address settings not created by a bind() call.
>
> And nicely our man pages are very clear about this :-) as is BSD and
> Steven's volume 2.
>
> This has been legal for decades, so we have to keep working this way.
Yes, its also buggy, if 2nd remote address is not reachable on same interface.
Even if we try a connect(AF_UNSPEC), the local address stay as is :
after bind(port 5555) local addr=0x0:5555
after connect(123) local addr=0x7f000001:5555 remote addr=0x7f000001:123
Could not connect, errno=22
after connect(AF_UNSPEC) local addr=0x7f000001:5555
connect: Invalid argument
I'll work on UDP fix anyway.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists