From: David Miller <davem@davemloft.net>
To: brian.haley@hp.com
Cc: eric.dumazet@gmail.com, ole@ans.pl, netdev@vger.kernel.org
Subject: Re: [PATCH] inet: dont set inet_rcv_saddr in connect()
Date: Tue, 07 Sep 2010 20:34:10 -0700 (PDT) [thread overview]
Message-ID: <20100907.203410.245386536.davem@davemloft.net> (raw)
In-Reply-To: <4C86F653.6070707@hp.com>
From: Brian Haley <brian.haley@hp.com>
Date: Tue, 07 Sep 2010 22:34:59 -0400
> Is this really the right thing to do? Linux has been doing this forever,
> right? Just like BSD has done it forever.
Indeed, I checked for this in Stevens volume 2 when I reviewed
Eric's patch, the logic is identical.
> 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.
Actually I have enough doubts about this too. So I'm going to hold
off on the patch until we sort this out.
As Eric stated, sendmsg() on raw and UDP sockets pick the source
address based upon the bound or looked up route anyways. But still
I think something still might end up being not-kosher with Eric's
change.
More so, I suspect, the issue is simply that the ordering of events
is simply inconvenient for the secondary hash implementation :-)
The port bind happens before the source address is bound, and that
is what screws everything up.
In this sense leaving the source addresses at INADDR_ANY is just a
workaround for the secondary hash table :-)
next prev parent reply other threads:[~2010-09-08 3:33 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-06 17:11 2.6.34: Problem with UDP traffic on lo + poll(?) Krzysztof Oledzki
2010-09-06 19:42 ` Eric Dumazet
2010-09-06 19:55 ` Krzysztof Olędzki
2010-09-06 20:29 ` Eric Dumazet
2010-09-06 20:44 ` Krzysztof Olędzki
2010-09-06 20:48 ` Krzysztof Olędzki
2010-09-07 15:37 ` Krzysztof Olędzki
2010-09-07 16:36 ` Eric Dumazet
2010-09-07 19:20 ` Krzysztof Olędzki
2010-09-07 19:26 ` Eric Dumazet
2010-09-07 19:59 ` David Miller
2010-09-07 21:35 ` [PATCH] inet: dont set inet_rcv_saddr in connect() Eric Dumazet
2010-09-07 21:52 ` Krzysztof Olędzki
2010-09-08 2:16 ` David Miller
2010-09-08 4:13 ` Eric Dumazet
2010-09-08 2:34 ` Brian Haley
2010-09-08 3:34 ` David Miller [this message]
2010-09-08 4:42 ` Eric Dumazet
2010-09-08 5:51 ` David Miller
2010-09-08 4:57 ` Eric Dumazet
2010-09-08 5:36 ` David Miller
2010-09-08 5:52 ` Eric Dumazet
2010-09-08 10:10 ` [PATCH] udp: add rehash on connect() Eric Dumazet
2010-09-08 15:06 ` Krzysztof Olędzki
2010-09-08 15:17 ` Eric Dumazet
2010-09-08 15:29 ` Krzysztof Olędzki
2010-09-08 15:08 ` [PATCH v2] " Eric Dumazet
2010-09-08 16:52 ` Krzysztof Olędzki
2010-09-09 4:39 ` David Miller
2010-09-08 14:27 ` [PATCH] inet: dont set inet_rcv_saddr in connect() Eric Dumazet
2010-09-07 21:28 ` 2.6.34: Problem with UDP traffic on lo + poll(?) Krzysztof Olędzki
2010-09-07 21:39 ` Eric Dumazet
2010-09-07 21:51 ` Krzysztof Olędzki
2010-09-08 4:12 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100907.203410.245386536.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=brian.haley@hp.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ole@ans.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).