[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1283921857.2634.747.camel@edumazet-laptop>
Date: Wed, 08 Sep 2010 06:57:37 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Brian Haley <brian.haley@...com>
Cc: David Miller <davem@...emloft.net>, ole@....pl,
netdev@...r.kernel.org
Subject: Re: [PATCH] inet: dont set inet_rcv_saddr in connect()
Le mardi 07 septembre 2010 à 22:34 -0400, Brian Haley a écrit :
> Is this really the right thing to do? Linux has been doing this forever,
> right? Just like BSD has done it forever. The way I've always "cleared"
> a local address is to set the address family to AF_UNSPEC on the next
> connect() call, as mentioned on the man page. I just want to make sure
> we're not changing something just to work around a broken application,
> sendto()/sendmsg() work perfect in this case by not setting the local address.
>
> BTW, it seems as though the reason this might only happen sometimes is
> that if the first connect() is to 127.0.0.1, you won't be able to then
> try and connect to say, 192.168.1.1. If you first connect() to a remote
> address things will probably just work.
I believe we have the following choice :
1) connect(AF_UNIX) sets the remote address/port
bind() sets the local port (and optionally address)
connect(AF_UNSPEC) clears remote addess/port,
let local address/port unchanged
2) Correct UDP hashing, when local address changes from 0 to x.y.z.t
(cost : two locks taken), and a possible packet drop during the
operation.
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)
--
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