From a2e22bfdcb5162c1299f38767601db0730549eea Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 22 Mar 2011 21:56:23 -0700 Subject: [PATCH] --- yaml --- r: 242628 b: refs/heads/master c: 406b6f974dae76a5b795d5c251d11c979a4e509b h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/ipv4/devinet.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 6733ee5e8c94..fb40a11362a7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f6152737a95bd6c22f0c664b20831aefd48085a8 +refs/heads/master: 406b6f974dae76a5b795d5c251d11c979a4e509b diff --git a/trunk/net/ipv4/devinet.c b/trunk/net/ipv4/devinet.c index d5a4553bebc3..5345b0bee6df 100644 --- a/trunk/net/ipv4/devinet.c +++ b/trunk/net/ipv4/devinet.c @@ -64,6 +64,8 @@ #include #include +#include "fib_lookup.h" + static struct ipv4_devconf ipv4_devconf = { .data = { [IPV4_DEVCONF_ACCEPT_REDIRECTS - 1] = 1, @@ -151,6 +153,20 @@ struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) break; } } + if (!result) { + struct flowi4 fl4 = { .daddr = addr }; + struct fib_result res = { 0 }; + struct fib_table *local; + + /* Fallback to FIB local table so that communication + * over loopback subnets work. + */ + local = fib_get_table(net, RT_TABLE_LOCAL); + if (local && + !fib_table_lookup(local, &fl4, &res, FIB_LOOKUP_NOREF) && + res.type == RTN_LOCAL) + result = FIB_RES_DEV(res); + } if (result && devref) dev_hold(result); rcu_read_unlock();