[PATCH 7/7] ipv4: Perform multihop and default route resolution in check_leaf().
DORMANTno replies
From: David Miller <davem@davemloft.net>
Date: 2012-07-28 04:18:44
Subsystem:
networking [general], networking [ipv4/ipv6], the rest · Maintainers:
"David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds
And thus eliminate two more members of fib_result. Signed-off-by: David S. Miller <davem@davemloft.net> --- include/net/ip_fib.h | 2 -- net/ipv4/fib_trie.c | 11 +++++++++-- net/ipv4/route.c | 17 ----------------- 3 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 66f5365..400c1a7 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h@@ -128,8 +128,6 @@ struct fib_table; struct fib_result { u32 tclassid; struct fib_nh *nh; - struct fib_table *table; - struct list_head *fa_head; }; struct fib_result_nl {
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 3d1d450..afd5048 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c@@ -1391,9 +1391,16 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, #ifdef CONFIG_IP_FIB_TRIE_STATS t->stats.semantic_match_passed++; #endif +#ifdef CONFIG_IP_ROUTE_MULTIPATH + if (fi->fib_nhs > 1 && !flp->flowi4_oif) + nh = fib_select_multipath(nh); + else +#endif + if (!li->plen && tb->tb_num_default > 1 && + fi->fib_type == RTN_UNICAST && + !flp->flowi4_oif) + nh = fib_select_default(nh, &li->falh, tb); res->nh = nh; - res->table = tb; - res->fa_head = &li->falh; if (!(fib_flags & FIB_LOOKUP_NOREF)) atomic_inc(&fi->fib_clntref); return 0;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6b54323..2d1ede9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c@@ -1459,11 +1459,6 @@ static int ip_mkroute_input(struct sk_buff *skb, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) { -#ifdef CONFIG_IP_ROUTE_MULTIPATH - if (res->nh->nh_parent->fib_nhs > 1) - res->nh = fib_select_multipath(res->nh); -#endif - /* create a routing cache entry */ return __mkroute_input(skb, res, in_dev, daddr, saddr, tos); }
@@ -1814,7 +1809,6 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) res.tclassid = 0; res.nh = NULL; - res.table = NULL; orig_oif = fl4->flowi4_oif;
@@ -1916,7 +1910,6 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) if (fib_lookup(net, fl4, &res)) { res.nh = NULL; - res.table = NULL; if (fl4->flowi4_oif) { /* Apparently, routing tables are wrong. Assume, that the destination is on link.
@@ -1962,16 +1955,6 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) goto make_route; } -#ifdef CONFIG_IP_ROUTE_MULTIPATH - if (res.nh->nh_parent->fib_nhs > 1 && fl4->flowi4_oif == 0) - res.nh = fib_select_multipath(res.nh); - else -#endif - if (!res.nh->nh_parent->fib_prefixlen && - res.table->tb_num_default > 1 && - type == RTN_UNICAST && !fl4->flowi4_oif) - res.nh = fib_select_default(res.nh, res.fa_head, res.table); - if (!fl4->saddr) fl4->saddr = fib_res_prefsrc(net, &res);
--
1.7.10.4