diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-18 12:43:09 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-18 12:43:09 -0800 |
commit | 9435eb1cf0b76b323019cebf8d16762a50a12a19 (patch) | |
tree | b8396802efe005380366a59c58ce85267a460af1 /net/ipv4/fib_frontend.c | |
parent | fd23c3b31107e2fc483301ee923d8a1db14e53f4 (diff) | |
download | linux-9435eb1cf0b76b323019cebf8d16762a50a12a19.tar.gz linux-9435eb1cf0b76b323019cebf8d16762a50a12a19.tar.bz2 linux-9435eb1cf0b76b323019cebf8d16762a50a12a19.zip |
ipv4: Implement __ip_dev_find using new interface address hash.
Much quicker than going through the FIB tables.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 2a49c061b34c..ad0778a3fa53 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -132,46 +132,6 @@ static void fib_flush(struct net *net) rt_cache_flush(net, -1); } -/** - * __ip_dev_find - find the first device with a given source address. - * @net: the net namespace - * @addr: the source address - * @devref: if true, take a reference on the found device - * - * If a caller uses devref=false, it should be protected by RCU, or RTNL - */ -struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) -{ - struct flowi fl = { - .fl4_dst = addr, - }; - struct fib_result res = { 0 }; - struct net_device *dev = NULL; - struct fib_table *local_table; - -#ifdef CONFIG_IP_MULTIPLE_TABLES - res.r = NULL; -#endif - - rcu_read_lock(); - local_table = fib_get_table(net, RT_TABLE_LOCAL); - if (!local_table || - fib_table_lookup(local_table, &fl, &res, FIB_LOOKUP_NOREF)) { - rcu_read_unlock(); - return NULL; - } - if (res.type != RTN_LOCAL) - goto out; - dev = FIB_RES_DEV(res); - - if (dev && devref) - dev_hold(dev); -out: - rcu_read_unlock(); - return dev; -} -EXPORT_SYMBOL(__ip_dev_find); - /* * Find address type as if only "dev" was present in the system. If * on_dev is NULL then all interfaces are taken into consideration. |