diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-10-15 18:16:07 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-15 18:16:07 -0400 |
commit | 2502991560dc8244dbe10e48473d85722c1e2ec1 (patch) | |
tree | 63b1f3be2ed56ff06f1e8db709e4ce85d69c3add /net/ipv6/route.c | |
parent | 7e69a8c4d06b7ecb874f571e82b715a9f79bc3c4 (diff) | |
parent | a9ff8f6462635c8d9f8d64b7b10ddcea8404d77b (diff) |
Merge branch 'fixes' into for-linus
Conflicts:
arch/arm/mach-versatile/core.c
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 63442a1e741c..89dc69924340 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1003,6 +1003,25 @@ int icmp6_dst_gc(void) | |||
1003 | return more; | 1003 | return more; |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), | ||
1007 | void *arg) | ||
1008 | { | ||
1009 | struct dst_entry *dst, **pprev; | ||
1010 | |||
1011 | spin_lock_bh(&icmp6_dst_lock); | ||
1012 | pprev = &icmp6_dst_gc_list; | ||
1013 | while ((dst = *pprev) != NULL) { | ||
1014 | struct rt6_info *rt = (struct rt6_info *) dst; | ||
1015 | if (func(rt, arg)) { | ||
1016 | *pprev = dst->next; | ||
1017 | dst_free(dst); | ||
1018 | } else { | ||
1019 | pprev = &dst->next; | ||
1020 | } | ||
1021 | } | ||
1022 | spin_unlock_bh(&icmp6_dst_lock); | ||
1023 | } | ||
1024 | |||
1006 | static int ip6_dst_gc(struct dst_ops *ops) | 1025 | static int ip6_dst_gc(struct dst_ops *ops) |
1007 | { | 1026 | { |
1008 | unsigned long now = jiffies; | 1027 | unsigned long now = jiffies; |
@@ -1814,16 +1833,19 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
1814 | static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) | 1833 | static int ip6_pkt_drop(struct sk_buff *skb, int code, int ipstats_mib_noroutes) |
1815 | { | 1834 | { |
1816 | int type; | 1835 | int type; |
1836 | struct dst_entry *dst = skb->dst; | ||
1817 | switch (ipstats_mib_noroutes) { | 1837 | switch (ipstats_mib_noroutes) { |
1818 | case IPSTATS_MIB_INNOROUTES: | 1838 | case IPSTATS_MIB_INNOROUTES: |
1819 | type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); | 1839 | type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); |
1820 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { | 1840 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { |
1821 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | 1841 | IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst), |
1842 | IPSTATS_MIB_INADDRERRORS); | ||
1822 | break; | 1843 | break; |
1823 | } | 1844 | } |
1824 | /* FALLTHROUGH */ | 1845 | /* FALLTHROUGH */ |
1825 | case IPSTATS_MIB_OUTNOROUTES: | 1846 | case IPSTATS_MIB_OUTNOROUTES: |
1826 | IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes); | 1847 | IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst), |
1848 | ipstats_mib_noroutes); | ||
1827 | break; | 1849 | break; |
1828 | } | 1850 | } |
1829 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); | 1851 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); |
@@ -1930,6 +1952,7 @@ void rt6_ifdown(struct net *net, struct net_device *dev) | |||
1930 | }; | 1952 | }; |
1931 | 1953 | ||
1932 | fib6_clean_all(net, fib6_ifdown, 0, &adn); | 1954 | fib6_clean_all(net, fib6_ifdown, 0, &adn); |
1955 | icmp6_clean_all(fib6_ifdown, &adn); | ||
1933 | } | 1956 | } |
1934 | 1957 | ||
1935 | struct rt6_mtu_change_arg | 1958 | struct rt6_mtu_change_arg |
@@ -2611,10 +2634,8 @@ static int ip6_route_net_init(struct net *net) | |||
2611 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, | 2634 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, |
2612 | sizeof(*net->ipv6.ip6_prohibit_entry), | 2635 | sizeof(*net->ipv6.ip6_prohibit_entry), |
2613 | GFP_KERNEL); | 2636 | GFP_KERNEL); |
2614 | if (!net->ipv6.ip6_prohibit_entry) { | 2637 | if (!net->ipv6.ip6_prohibit_entry) |
2615 | kfree(net->ipv6.ip6_null_entry); | 2638 | goto out_ip6_null_entry; |
2616 | goto out; | ||
2617 | } | ||
2618 | net->ipv6.ip6_prohibit_entry->u.dst.path = | 2639 | net->ipv6.ip6_prohibit_entry->u.dst.path = |
2619 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; | 2640 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; |
2620 | net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2641 | net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; |
@@ -2622,16 +2643,22 @@ static int ip6_route_net_init(struct net *net) | |||
2622 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, | 2643 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, |
2623 | sizeof(*net->ipv6.ip6_blk_hole_entry), | 2644 | sizeof(*net->ipv6.ip6_blk_hole_entry), |
2624 | GFP_KERNEL); | 2645 | GFP_KERNEL); |
2625 | if (!net->ipv6.ip6_blk_hole_entry) { | 2646 | if (!net->ipv6.ip6_blk_hole_entry) |
2626 | kfree(net->ipv6.ip6_null_entry); | 2647 | goto out_ip6_prohibit_entry; |
2627 | kfree(net->ipv6.ip6_prohibit_entry); | ||
2628 | goto out; | ||
2629 | } | ||
2630 | net->ipv6.ip6_blk_hole_entry->u.dst.path = | 2648 | net->ipv6.ip6_blk_hole_entry->u.dst.path = |
2631 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; | 2649 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; |
2632 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2650 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; |
2633 | #endif | 2651 | #endif |
2634 | 2652 | ||
2653 | net->ipv6.sysctl.flush_delay = 0; | ||
2654 | net->ipv6.sysctl.ip6_rt_max_size = 4096; | ||
2655 | net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; | ||
2656 | net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; | ||
2657 | net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; | ||
2658 | net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; | ||
2659 | net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; | ||
2660 | net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; | ||
2661 | |||
2635 | #ifdef CONFIG_PROC_FS | 2662 | #ifdef CONFIG_PROC_FS |
2636 | proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); | 2663 | proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); |
2637 | proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); | 2664 | proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); |
@@ -2642,6 +2669,12 @@ static int ip6_route_net_init(struct net *net) | |||
2642 | out: | 2669 | out: |
2643 | return ret; | 2670 | return ret; |
2644 | 2671 | ||
2672 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
2673 | out_ip6_prohibit_entry: | ||
2674 | kfree(net->ipv6.ip6_prohibit_entry); | ||
2675 | out_ip6_null_entry: | ||
2676 | kfree(net->ipv6.ip6_null_entry); | ||
2677 | #endif | ||
2645 | out_ip6_dst_ops: | 2678 | out_ip6_dst_ops: |
2646 | release_net(net->ipv6.ip6_dst_ops->dst_net); | 2679 | release_net(net->ipv6.ip6_dst_ops->dst_net); |
2647 | kfree(net->ipv6.ip6_dst_ops); | 2680 | kfree(net->ipv6.ip6_dst_ops); |