netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Cc: David Miller <davem@davemloft.net>,
	rick.jones2@hp.com, netdev@vger.kernel.org
Subject: Re: Netperf TCP_RR(loopback) 10% regression in 2.6.24-rc6,	comparing with 2.6.22
Date: Tue, 22 Jan 2008 08:13:12 +0100	[thread overview]
Message-ID: <47959788.3000207@cosmosbay.com> (raw)
In-Reply-To: <1200984664.3151.253.camel@ymzhang>

Zhang, Yanmin a écrit :
> On Mon, 2008-01-21 at 22:22 -0800, David Miller wrote:
>> From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
>> Date: Tue, 22 Jan 2008 14:07:19 +0800
>>
>>> I am wondering if UDP stack in kernel has a bug.
>> If one server binds to INADDR_ANY with port N, then any other socket
>> can be bound to a specific IP address with port N.  When packets
>> come in destined for port N, the delivery will be prioritized
>> to whichever socket has the more specific and matching binding.
> What does 'more specific' mean here? I assume 127.0.0.1 should be
> prioritized before 0.0.0.0 which means packets should be queued to
> 127.0.0.1 firstly.

vi +278 net/ipv4/udp.c

                         int score = (sk->sk_family == PF_INET ? 1 : 0);
                         if (inet->rcv_saddr) {
                                 if (inet->rcv_saddr != daddr)
                                         continue;
                                 score+=2;
                         }
                         if (inet->daddr) {
                                 if (inet->daddr != saddr)
                                         continue;
                                 score+=2;
                         }
                         if (inet->dport) {
                                 if (inet->dport != sport)
                                         continue;
                                 score+=2;
                         }
                         if (sk->sk_bound_dev_if) {
                                 if (sk->sk_bound_dev_if != dif)
                                         continue;
                                 score+=2;
                         }

So in your case, socket bound to 127.0.0.1 should have a better score (+2) 
than other one, unless the other one got an >= score because of another match 
(rcv_saddr set or bounded to an interface)






  reply	other threads:[~2008-01-22  7:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1199871330.3298.132.camel@ymzhang>
2008-01-11  9:30 ` Netperf TCP_RR(loopback) 10% regression in 2.6.24-rc6, comparing with 2.6.22 Zhang, Yanmin
2008-01-11 17:56   ` Rick Jones
2008-01-14  3:11     ` Zhang, Yanmin
2008-01-14 17:46       ` Rick Jones
2008-01-22  5:24         ` Zhang, Yanmin
2008-01-22  6:07           ` Zhang, Yanmin
2008-01-22  6:22             ` David Miller
2008-01-22  6:51               ` Zhang, Yanmin
2008-01-22  7:13                 ` Eric Dumazet [this message]
2008-01-22  6:27             ` Eric Dumazet
2008-01-22  6:52               ` Zhang, Yanmin
2008-01-22  7:32                 ` David Miller
2008-01-22 18:36             ` Rick Jones
2008-01-23  0:42               ` Zhang, Yanmin
2008-01-23  3:25                 ` Zhang, Yanmin
2008-01-14  8:44   ` Ilpo Järvinen
2008-01-14  9:21     ` Ilpo Järvinen
2008-01-14  9:38       ` Zhang, Yanmin
2008-01-14 10:53     ` Herbert Xu
2008-01-16  0:34       ` Zhang, Yanmin
2008-01-16  7:15         ` Zhang, Yanmin

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=47959788.3000207@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=rick.jones2@hp.com \
    --cc=yanmin_zhang@linux.intel.com \
    /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).