aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/route.h2
-rw-r--r--net/ipv4/arp.c2
-rw-r--r--net/ipv4/devinet.c8
-rw-r--r--net/ipv4/fib_frontend.c17
-rw-r--r--net/ipv4/fib_hash.c6
-rw-r--r--net/ipv4/fib_rules.c2
-rw-r--r--net/ipv4/fib_trie.c6
-rw-r--r--net/ipv4/route.c8
8 files changed, 27 insertions, 24 deletions
diff --git a/include/net/route.h b/include/net/route.h
index fc836ff824cc..3140cc500854 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -111,7 +111,7 @@ struct in_device;
111extern int ip_rt_init(void); 111extern int ip_rt_init(void);
112extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, 112extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
113 __be32 src, struct net_device *dev); 113 __be32 src, struct net_device *dev);
114extern void rt_cache_flush(int how); 114extern void rt_cache_flush(struct net *net, int how);
115extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 115extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
116extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 116extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
117extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 117extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 20c515a1be28..29df75a6bcc7 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1197,7 +1197,7 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event, vo
1197 switch (event) { 1197 switch (event) {
1198 case NETDEV_CHANGEADDR: 1198 case NETDEV_CHANGEADDR:
1199 neigh_changeaddr(&arp_tbl, dev); 1199 neigh_changeaddr(&arp_tbl, dev);
1200 rt_cache_flush(0); 1200 rt_cache_flush(dev_net(dev), 0);
1201 break; 1201 break;
1202 default: 1202 default:
1203 break; 1203 break;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 9de2514946ca..2e667e2f90df 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1348,7 +1348,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
1348 dev_disable_lro(idev->dev); 1348 dev_disable_lro(idev->dev);
1349 } 1349 }
1350 rtnl_unlock(); 1350 rtnl_unlock();
1351 rt_cache_flush(0); 1351 rt_cache_flush(net, 0);
1352 } 1352 }
1353 } 1353 }
1354 1354
@@ -1362,9 +1362,10 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1362 int *valp = ctl->data; 1362 int *valp = ctl->data;
1363 int val = *valp; 1363 int val = *valp;
1364 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 1364 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
1365 struct net *net = ctl->extra2;
1365 1366
1366 if (write && *valp != val) 1367 if (write && *valp != val)
1367 rt_cache_flush(0); 1368 rt_cache_flush(net, 0);
1368 1369
1369 return ret; 1370 return ret;
1370} 1371}
@@ -1375,9 +1376,10 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
1375{ 1376{
1376 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, 1377 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp,
1377 newval, newlen); 1378 newval, newlen);
1379 struct net *net = table->extra2;
1378 1380
1379 if (ret == 1) 1381 if (ret == 1)
1380 rt_cache_flush(0); 1382 rt_cache_flush(net, 0);
1381 1383
1382 return ret; 1384 return ret;
1383} 1385}
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 5ad01d63f83b..65c1503f8cc8 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -144,7 +144,7 @@ static void fib_flush(struct net *net)
144 } 144 }
145 145
146 if (flushed) 146 if (flushed)
147 rt_cache_flush(-1); 147 rt_cache_flush(net, -1);
148} 148}
149 149
150/* 150/*
@@ -897,21 +897,22 @@ static void fib_disable_ip(struct net_device *dev, int force)
897{ 897{
898 if (fib_sync_down_dev(dev, force)) 898 if (fib_sync_down_dev(dev, force))
899 fib_flush(dev_net(dev)); 899 fib_flush(dev_net(dev));
900 rt_cache_flush(0); 900 rt_cache_flush(dev_net(dev), 0);
901 arp_ifdown(dev); 901 arp_ifdown(dev);
902} 902}
903 903
904static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr) 904static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
905{ 905{
906 struct in_ifaddr *ifa = (struct in_ifaddr*)ptr; 906 struct in_ifaddr *ifa = (struct in_ifaddr*)ptr;
907 struct net_device *dev = ifa->ifa_dev->dev;
907 908
908 switch (event) { 909 switch (event) {
909 case NETDEV_UP: 910 case NETDEV_UP:
910 fib_add_ifaddr(ifa); 911 fib_add_ifaddr(ifa);
911#ifdef CONFIG_IP_ROUTE_MULTIPATH 912#ifdef CONFIG_IP_ROUTE_MULTIPATH
912 fib_sync_up(ifa->ifa_dev->dev); 913 fib_sync_up(dev);
913#endif 914#endif
914 rt_cache_flush(-1); 915 rt_cache_flush(dev_net(dev), -1);
915 break; 916 break;
916 case NETDEV_DOWN: 917 case NETDEV_DOWN:
917 fib_del_ifaddr(ifa); 918 fib_del_ifaddr(ifa);
@@ -919,9 +920,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
919 /* Last address was deleted from this interface. 920 /* Last address was deleted from this interface.
920 Disable IP. 921 Disable IP.
921 */ 922 */
922 fib_disable_ip(ifa->ifa_dev->dev, 1); 923 fib_disable_ip(dev, 1);
923 } else { 924 } else {
924 rt_cache_flush(-1); 925 rt_cache_flush(dev_net(dev), -1);
925 } 926 }
926 break; 927 break;
927 } 928 }
@@ -949,14 +950,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
949#ifdef CONFIG_IP_ROUTE_MULTIPATH 950#ifdef CONFIG_IP_ROUTE_MULTIPATH
950 fib_sync_up(dev); 951 fib_sync_up(dev);
951#endif 952#endif
952 rt_cache_flush(-1); 953 rt_cache_flush(dev_net(dev), -1);
953 break; 954 break;
954 case NETDEV_DOWN: 955 case NETDEV_DOWN:
955 fib_disable_ip(dev, 0); 956 fib_disable_ip(dev, 0);
956 break; 957 break;
957 case NETDEV_CHANGEMTU: 958 case NETDEV_CHANGEMTU:
958 case NETDEV_CHANGE: 959 case NETDEV_CHANGE:
959 rt_cache_flush(0); 960 rt_cache_flush(dev_net(dev), 0);
960 break; 961 break;
961 } 962 }
962 return NOTIFY_DONE; 963 return NOTIFY_DONE;
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index eeec4bf982b8..c8cac6c7f881 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -472,7 +472,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
472 472
473 fib_release_info(fi_drop); 473 fib_release_info(fi_drop);
474 if (state & FA_S_ACCESSED) 474 if (state & FA_S_ACCESSED)
475 rt_cache_flush(-1); 475 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
476 rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id, 476 rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id,
477 &cfg->fc_nlinfo, NLM_F_REPLACE); 477 &cfg->fc_nlinfo, NLM_F_REPLACE);
478 return 0; 478 return 0;
@@ -532,7 +532,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
532 532
533 if (new_f) 533 if (new_f)
534 fz->fz_nent++; 534 fz->fz_nent++;
535 rt_cache_flush(-1); 535 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
536 536
537 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id, 537 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id,
538 &cfg->fc_nlinfo, 0); 538 &cfg->fc_nlinfo, 0);
@@ -614,7 +614,7 @@ static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg)
614 write_unlock_bh(&fib_hash_lock); 614 write_unlock_bh(&fib_hash_lock);
615 615
616 if (fa->fa_state & FA_S_ACCESSED) 616 if (fa->fa_state & FA_S_ACCESSED)
617 rt_cache_flush(-1); 617 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
618 fn_free_alias(fa, f); 618 fn_free_alias(fa, f);
619 if (kill_fn) { 619 if (kill_fn) {
620 fn_free_node(f); 620 fn_free_node(f);
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 1fb56876be54..bc05de413087 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -260,7 +260,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
260 260
261static void fib4_rule_flush_cache(void) 261static void fib4_rule_flush_cache(void)
262{ 262{
263 rt_cache_flush(-1); 263 rt_cache_flush(&init_net, -1);
264} 264}
265 265
266static struct fib_rules_ops fib4_rules_ops_template = { 266static struct fib_rules_ops fib4_rules_ops_template = {
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 394db9c941a1..d16ae4623be6 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1271,7 +1271,7 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1271 1271
1272 fib_release_info(fi_drop); 1272 fib_release_info(fi_drop);
1273 if (state & FA_S_ACCESSED) 1273 if (state & FA_S_ACCESSED)
1274 rt_cache_flush(-1); 1274 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
1275 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, 1275 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen,
1276 tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE); 1276 tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE);
1277 1277
@@ -1316,7 +1316,7 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1316 list_add_tail_rcu(&new_fa->fa_list, 1316 list_add_tail_rcu(&new_fa->fa_list,
1317 (fa ? &fa->fa_list : fa_head)); 1317 (fa ? &fa->fa_list : fa_head));
1318 1318
1319 rt_cache_flush(-1); 1319 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
1320 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, 1320 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
1321 &cfg->fc_nlinfo, 0); 1321 &cfg->fc_nlinfo, 0);
1322succeeded: 1322succeeded:
@@ -1664,7 +1664,7 @@ static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
1664 trie_leaf_remove(t, l); 1664 trie_leaf_remove(t, l);
1665 1665
1666 if (fa->fa_state & FA_S_ACCESSED) 1666 if (fa->fa_state & FA_S_ACCESSED)
1667 rt_cache_flush(-1); 1667 rt_cache_flush(cfg->fc_nlinfo.nl_net, -1);
1668 1668
1669 fib_release_info(fa->fa_info); 1669 fib_release_info(fa->fa_info);
1670 alias_free_mem_rcu(fa); 1670 alias_free_mem_rcu(fa);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fe3a02237286..cedc366505bd 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -791,7 +791,7 @@ static void rt_cache_invalidate(void)
791 * delay < 0 : invalidate cache (fast : entries will be deleted later) 791 * delay < 0 : invalidate cache (fast : entries will be deleted later)
792 * delay >= 0 : invalidate & flush cache (can be long) 792 * delay >= 0 : invalidate & flush cache (can be long)
793 */ 793 */
794void rt_cache_flush(int delay) 794void rt_cache_flush(struct net *net, int delay)
795{ 795{
796 rt_cache_invalidate(); 796 rt_cache_invalidate();
797 if (delay >= 0) 797 if (delay >= 0)
@@ -2825,7 +2825,7 @@ done:
2825 2825
2826void ip_rt_multicast_event(struct in_device *in_dev) 2826void ip_rt_multicast_event(struct in_device *in_dev)
2827{ 2827{
2828 rt_cache_flush(0); 2828 rt_cache_flush(dev_net(in_dev->dev), 0);
2829} 2829}
2830 2830
2831#ifdef CONFIG_SYSCTL 2831#ifdef CONFIG_SYSCTL
@@ -2837,7 +2837,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
2837{ 2837{
2838 if (write) { 2838 if (write) {
2839 proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 2839 proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
2840 rt_cache_flush(flush_delay); 2840 rt_cache_flush(&init_net, flush_delay);
2841 return 0; 2841 return 0;
2842 } 2842 }
2843 2843
@@ -2857,7 +2857,7 @@ static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
2857 return -EINVAL; 2857 return -EINVAL;
2858 if (get_user(delay, (int __user *)newval)) 2858 if (get_user(delay, (int __user *)newval))
2859 return -EFAULT; 2859 return -EFAULT;
2860 rt_cache_flush(delay); 2860 rt_cache_flush(&init_net, delay);
2861 return 0; 2861 return 0;
2862} 2862}
2863 2863