diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2016-10-12 16:20:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-13 12:05:26 -0400 |
commit | 6104e112f4a613506ba1ea9d4b974279f888006b (patch) | |
tree | a8b14bd20547bbcf015e0fccff23f17dbf02d7ec | |
parent | 3c293f4e08b58ad5b78f78d89ca1fd41f87f8729 (diff) |
net: ipv4: Do not drop to make_route if oif is l3mdev
Commit e0d56fdd7342 was a bit aggressive removing l3mdev calls in
the IPv4 stack. If the fib_lookup fails we do not want to drop to
make_route if the oif is an l3mdev device.
Also reverts 19664c6a0009 ("net: l3mdev: Remove netif_index_is_l3_master")
which removed netif_index_is_l3_master.
Fixes: e0d56fdd7342 ("net: l3mdev: remove redundant calls")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/l3mdev.h | 24 | ||||
-rw-r--r-- | net/ipv4/route.c | 3 |
2 files changed, 26 insertions, 1 deletions
diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h index b220dabeab45..3832099289c5 100644 --- a/include/net/l3mdev.h +++ b/include/net/l3mdev.h | |||
@@ -114,6 +114,25 @@ static inline u32 l3mdev_fib_table(const struct net_device *dev) | |||
114 | return tb_id; | 114 | return tb_id; |
115 | } | 115 | } |
116 | 116 | ||
117 | static inline bool netif_index_is_l3_master(struct net *net, int ifindex) | ||
118 | { | ||
119 | struct net_device *dev; | ||
120 | bool rc = false; | ||
121 | |||
122 | if (ifindex == 0) | ||
123 | return false; | ||
124 | |||
125 | rcu_read_lock(); | ||
126 | |||
127 | dev = dev_get_by_index_rcu(net, ifindex); | ||
128 | if (dev) | ||
129 | rc = netif_is_l3_master(dev); | ||
130 | |||
131 | rcu_read_unlock(); | ||
132 | |||
133 | return rc; | ||
134 | } | ||
135 | |||
117 | struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6); | 136 | struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6); |
118 | 137 | ||
119 | static inline | 138 | static inline |
@@ -207,6 +226,11 @@ static inline u32 l3mdev_fib_table_by_index(struct net *net, int ifindex) | |||
207 | return 0; | 226 | return 0; |
208 | } | 227 | } |
209 | 228 | ||
229 | static inline bool netif_index_is_l3_master(struct net *net, int ifindex) | ||
230 | { | ||
231 | return false; | ||
232 | } | ||
233 | |||
210 | static inline | 234 | static inline |
211 | struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6) | 235 | struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6) |
212 | { | 236 | { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f2be689a6c85..62d4d90c1389 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2265,7 +2265,8 @@ struct rtable *__ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, | |||
2265 | if (err) { | 2265 | if (err) { |
2266 | res.fi = NULL; | 2266 | res.fi = NULL; |
2267 | res.table = NULL; | 2267 | res.table = NULL; |
2268 | if (fl4->flowi4_oif) { | 2268 | if (fl4->flowi4_oif && |
2269 | !netif_index_is_l3_master(net, fl4->flowi4_oif)) { | ||
2269 | /* Apparently, routing tables are wrong. Assume, | 2270 | /* Apparently, routing tables are wrong. Assume, |
2270 | that the destination is on link. | 2271 | that the destination is on link. |
2271 | 2272 | ||