aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index eb6f69a8f27a..1d2cdd43a878 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -158,18 +158,20 @@ static void fib_flush(struct net *net)
158struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) 158struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref)
159{ 159{
160 struct flowi fl = { 160 struct flowi fl = {
161 .nl_u = { 161 .fl4_dst = addr,
162 .ip4_u = {
163 .daddr = addr
164 }
165 },
166 .flags = FLOWI_FLAG_MATCH_ANY_IIF
167 }; 162 };
168 struct fib_result res = { 0 }; 163 struct fib_result res = { 0 };
169 struct net_device *dev = NULL; 164 struct net_device *dev = NULL;
165 struct fib_table *local_table;
166
167#ifdef CONFIG_IP_MULTIPLE_TABLES
168 res.r = NULL;
169#endif
170 170
171 rcu_read_lock(); 171 rcu_read_lock();
172 if (fib_lookup(net, &fl, &res)) { 172 local_table = fib_get_table(net, RT_TABLE_LOCAL);
173 if (!local_table ||
174 fib_table_lookup(local_table, &fl, &res, FIB_LOOKUP_NOREF)) {
173 rcu_read_unlock(); 175 rcu_read_unlock();
174 return NULL; 176 return NULL;
175 } 177 }
@@ -193,7 +195,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net,
193 const struct net_device *dev, 195 const struct net_device *dev,
194 __be32 addr) 196 __be32 addr)
195{ 197{
196 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 198 struct flowi fl = { .fl4_dst = addr };
197 struct fib_result res; 199 struct fib_result res;
198 unsigned ret = RTN_BROADCAST; 200 unsigned ret = RTN_BROADCAST;
199 struct fib_table *local_table; 201 struct fib_table *local_table;
@@ -247,13 +249,9 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
247{ 249{
248 struct in_device *in_dev; 250 struct in_device *in_dev;
249 struct flowi fl = { 251 struct flowi fl = {
250 .nl_u = { 252 .fl4_dst = src,
251 .ip4_u = { 253 .fl4_src = dst,
252 .daddr = src, 254 .fl4_tos = tos,
253 .saddr = dst,
254 .tos = tos
255 }
256 },
257 .mark = mark, 255 .mark = mark,
258 .iif = oif 256 .iif = oif
259 }; 257 };
@@ -853,13 +851,9 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb)
853 struct fib_result res; 851 struct fib_result res;
854 struct flowi fl = { 852 struct flowi fl = {
855 .mark = frn->fl_mark, 853 .mark = frn->fl_mark,
856 .nl_u = { 854 .fl4_dst = frn->fl_addr,
857 .ip4_u = { 855 .fl4_tos = frn->fl_tos,
858 .daddr = frn->fl_addr, 856 .fl4_scope = frn->fl_scope,
859 .tos = frn->fl_tos,
860 .scope = frn->fl_scope
861 }
862 }
863 }; 857 };
864 858
865#ifdef CONFIG_IP_MULTIPLE_TABLES 859#ifdef CONFIG_IP_MULTIPLE_TABLES
@@ -999,7 +993,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
999 rt_cache_flush(dev_net(dev), 0); 993 rt_cache_flush(dev_net(dev), 0);
1000 break; 994 break;
1001 case NETDEV_UNREGISTER_BATCH: 995 case NETDEV_UNREGISTER_BATCH:
1002 rt_cache_flush_batch(); 996 /* The batch unregister is only called on the first
997 * device in the list of devices being unregistered.
998 * Therefore we should not pass dev_net(dev) in here.
999 */
1000 rt_cache_flush_batch(NULL);
1003 break; 1001 break;
1004 } 1002 }
1005 return NOTIFY_DONE; 1003 return NOTIFY_DONE;