[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100907.225146.232739797.davem@davemloft.net>
Date: Tue, 07 Sep 2010 22:51:46 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: brian.haley@...com, ole@....pl, netdev@...r.kernel.org
Subject: Re: [PATCH] inet: dont set inet_rcv_saddr in connect()
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Wed, 08 Sep 2010 06:42:45 +0200
> Problem is AF_UNSPEC always clears the remote address (as stated in
> manual), and sometimes local one (as not stated)
>
> if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
> inet_reset_saddr(sk);
>
> This is the workaround that was coded years ago in Linux to undo the
> local addr setting ;)
Ok, I mis-remembered about AF_UNSPEC, I thought BSD did it too, it
does not.
But we really offer the most flexibility here because we offer this.
In BSD case, connect() on an already connect()'d UDP socket
unconditionally zaps the local address setting (because, as Stevens
states, that local address "might" have been created by a previous
connect()).
This forces the application to re-bind() the local address if it wants
to use something other than what connect() is going to choose.
We leave the local settings alone for normal connect() on already
connect()'d sockets, and provide connect(AF_UNSPEC) to explicitly kill
connect() created local and remote associations.
This allows bind() settings to survive through multiple connect()
calls if the user wants, a facility BSD does not provide.
--
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