netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ja@ssi.bg
Cc: shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: [BUG] VPN broken in net-next
Date: Thu, 03 Mar 2011 11:23:28 -0800 (PST)	[thread overview]
Message-ID: <20110303.112328.59677094.davem@davemloft.net> (raw)
In-Reply-To: <alpine.LFD.2.00.1103031454060.2113@ja.ssi.bg>

From: Julian Anastasov <ja@ssi.bg>
Date: Thu, 3 Mar 2011 15:09:22 +0200 (EET)

> On Thu, 3 Mar 2011, Julian Anastasov wrote:
> 
>> 	May be the problem is in inet_hash_insert(), it should
>> hash ifa_local, not ifa_address. May be they are equal for
> 
> 	... and of course the new __ip_dev_find should use
> ifa_local too.

Thanks for looking into this Julian.  I will look at the other
cases you found later.

Stephen, is this sufficient to fix your problem?  I suspect it is
not because fib_add_addr() adds prefixes with RTN_LOCAL to the
local routing table too :-/

I suspect that even if we need to handle prefixes, we can still use
the hash for optimistic lookup, and fallback to a local table FIB
inspection if that fails.

--------------------
ipv4: Fix __ip_dev_find() to use ifa_local instead of ifa_address.

Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 9038928..ff53860 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -111,7 +111,7 @@ static inline unsigned int inet_addr_hash(struct net *net, __be32 addr)
 
 static void inet_hash_insert(struct net *net, struct in_ifaddr *ifa)
 {
-	unsigned int hash = inet_addr_hash(net, ifa->ifa_address);
+	unsigned int hash = inet_addr_hash(net, ifa->ifa_local);
 
 	spin_lock(&inet_addr_hash_lock);
 	hlist_add_head_rcu(&ifa->hash, &inet_addr_lst[hash]);
@@ -146,7 +146,7 @@ struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref)
 
 		if (!net_eq(dev_net(dev), net))
 			continue;
-		if (ifa->ifa_address == addr) {
+		if (ifa->ifa_local == addr) {
 			result = dev;
 			break;
 		}

  parent reply	other threads:[~2011-03-03 19:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  0:28 [BUG] VPN broken in net-next Stephen Hemminger
2011-03-03  0:41 ` Stephen Hemminger
2011-03-03  0:43   ` David Miller
2011-03-03  0:46     ` Stephen Hemminger
2011-03-03  0:50       ` David Miller
2011-03-03  0:54         ` David Miller
2011-03-03 12:41           ` Julian Anastasov
2011-03-03 13:09             ` Julian Anastasov
2011-03-03 17:32               ` Stephen Hemminger
2011-03-03 19:23               ` David Miller [this message]
2011-03-03 21:54                 ` Stephen Hemminger
2011-03-04  8:39                 ` Julian Anastasov
2011-03-23  4:56                   ` David Miller
2011-03-23  9:05                     ` Julian Anastasov
2011-03-23 15:24                     ` Stephen Hemminger
2011-03-09 21:28               ` David Miller
2011-03-03  0:56         ` Stephen Hemminger
2011-03-03  1:03           ` David Miller
2011-03-03  1:16             ` Stephen Hemminger

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=20110303.112328.59677094.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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).