Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netns: add namespace parameter to rt_cache_flush

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Denis V. Lunev and committed by
David S. Miller
76e6ebfb f43798c2

+27 -24
+1 -1
include/net/route.h
··· 111 111 extern int ip_rt_init(void); 112 112 extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, 113 113 __be32 src, struct net_device *dev); 114 - extern void rt_cache_flush(int how); 114 + extern void rt_cache_flush(struct net *net, int how); 115 115 extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 116 116 extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 117 117 extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
+1 -1
net/ipv4/arp.c
··· 1197 1197 switch (event) { 1198 1198 case NETDEV_CHANGEADDR: 1199 1199 neigh_changeaddr(&arp_tbl, dev); 1200 - rt_cache_flush(0); 1200 + rt_cache_flush(dev_net(dev), 0); 1201 1201 break; 1202 1202 default: 1203 1203 break;
+5 -3
net/ipv4/devinet.c
··· 1348 1348 dev_disable_lro(idev->dev); 1349 1349 } 1350 1350 rtnl_unlock(); 1351 - rt_cache_flush(0); 1351 + rt_cache_flush(net, 0); 1352 1352 } 1353 1353 } 1354 1354 ··· 1362 1362 int *valp = ctl->data; 1363 1363 int val = *valp; 1364 1364 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 1365 + struct net *net = ctl->extra2; 1365 1366 1366 1367 if (write && *valp != val) 1367 - rt_cache_flush(0); 1368 + rt_cache_flush(net, 0); 1368 1369 1369 1370 return ret; 1370 1371 } ··· 1376 1375 { 1377 1376 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, 1378 1377 newval, newlen); 1378 + struct net *net = table->extra2; 1379 1379 1380 1380 if (ret == 1) 1381 - rt_cache_flush(0); 1381 + rt_cache_flush(net, 0); 1382 1382 1383 1383 return ret; 1384 1384 }
+9 -8
net/ipv4/fib_frontend.c
··· 144 144 } 145 145 146 146 if (flushed) 147 - rt_cache_flush(-1); 147 + rt_cache_flush(net, -1); 148 148 } 149 149 150 150 /* ··· 897 897 { 898 898 if (fib_sync_down_dev(dev, force)) 899 899 fib_flush(dev_net(dev)); 900 - rt_cache_flush(0); 900 + rt_cache_flush(dev_net(dev), 0); 901 901 arp_ifdown(dev); 902 902 } 903 903 904 904 static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr) 905 905 { 906 906 struct in_ifaddr *ifa = (struct in_ifaddr*)ptr; 907 + struct net_device *dev = ifa->ifa_dev->dev; 907 908 908 909 switch (event) { 909 910 case NETDEV_UP: 910 911 fib_add_ifaddr(ifa); 911 912 #ifdef CONFIG_IP_ROUTE_MULTIPATH 912 - fib_sync_up(ifa->ifa_dev->dev); 913 + fib_sync_up(dev); 913 914 #endif 914 - rt_cache_flush(-1); 915 + rt_cache_flush(dev_net(dev), -1); 915 916 break; 916 917 case NETDEV_DOWN: 917 918 fib_del_ifaddr(ifa); ··· 920 919 /* Last address was deleted from this interface. 921 920 Disable IP. 922 921 */ 923 - fib_disable_ip(ifa->ifa_dev->dev, 1); 922 + fib_disable_ip(dev, 1); 924 923 } else { 925 - rt_cache_flush(-1); 924 + rt_cache_flush(dev_net(dev), -1); 926 925 } 927 926 break; 928 927 } ··· 950 949 #ifdef CONFIG_IP_ROUTE_MULTIPATH 951 950 fib_sync_up(dev); 952 951 #endif 953 - rt_cache_flush(-1); 952 + rt_cache_flush(dev_net(dev), -1); 954 953 break; 955 954 case NETDEV_DOWN: 956 955 fib_disable_ip(dev, 0); 957 956 break; 958 957 case NETDEV_CHANGEMTU: 959 958 case NETDEV_CHANGE: 960 - rt_cache_flush(0); 959 + rt_cache_flush(dev_net(dev), 0); 961 960 break; 962 961 } 963 962 return NOTIFY_DONE;
+3 -3
net/ipv4/fib_hash.c
··· 472 472 473 473 fib_release_info(fi_drop); 474 474 if (state & FA_S_ACCESSED) 475 - rt_cache_flush(-1); 475 + rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); 476 476 rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id, 477 477 &cfg->fc_nlinfo, NLM_F_REPLACE); 478 478 return 0; ··· 532 532 533 533 if (new_f) 534 534 fz->fz_nent++; 535 - rt_cache_flush(-1); 535 + rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); 536 536 537 537 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id, 538 538 &cfg->fc_nlinfo, 0); ··· 614 614 write_unlock_bh(&fib_hash_lock); 615 615 616 616 if (fa->fa_state & FA_S_ACCESSED) 617 - rt_cache_flush(-1); 617 + rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); 618 618 fn_free_alias(fa, f); 619 619 if (kill_fn) { 620 620 fn_free_node(f);
+1 -1
net/ipv4/fib_rules.c
··· 260 260 261 261 static void fib4_rule_flush_cache(void) 262 262 { 263 - rt_cache_flush(-1); 263 + rt_cache_flush(&init_net, -1); 264 264 } 265 265 266 266 static struct fib_rules_ops fib4_rules_ops_template = {
+3 -3
net/ipv4/fib_trie.c
··· 1271 1271 1272 1272 fib_release_info(fi_drop); 1273 1273 if (state & FA_S_ACCESSED) 1274 - rt_cache_flush(-1); 1274 + rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); 1275 1275 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, 1276 1276 tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE); 1277 1277 ··· 1316 1316 list_add_tail_rcu(&new_fa->fa_list, 1317 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 1320 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, 1321 1321 &cfg->fc_nlinfo, 0); 1322 1322 succeeded: ··· 1664 1664 trie_leaf_remove(t, l); 1665 1665 1666 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 1669 fib_release_info(fa->fa_info); 1670 1670 alias_free_mem_rcu(fa);
+4 -4
net/ipv4/route.c
··· 791 791 * delay < 0 : invalidate cache (fast : entries will be deleted later) 792 792 * delay >= 0 : invalidate & flush cache (can be long) 793 793 */ 794 - void rt_cache_flush(int delay) 794 + void rt_cache_flush(struct net *net, int delay) 795 795 { 796 796 rt_cache_invalidate(); 797 797 if (delay >= 0) ··· 2825 2825 2826 2826 void 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 2831 #ifdef CONFIG_SYSCTL ··· 2837 2837 { 2838 2838 if (write) { 2839 2839 proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 2840 - rt_cache_flush(flush_delay); 2840 + rt_cache_flush(&init_net, flush_delay); 2841 2841 return 0; 2842 2842 } 2843 2843 ··· 2857 2857 return -EINVAL; 2858 2858 if (get_user(delay, (int __user *)newval)) 2859 2859 return -EFAULT; 2860 - rt_cache_flush(delay); 2860 + rt_cache_flush(&init_net, delay); 2861 2861 return 0; 2862 2862 } 2863 2863