diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 60 | ||||
-rw-r--r-- | net/ipv6/route.c | 10 |
3 files changed, 27 insertions, 45 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 9f4fcce6379b..74d543d504a1 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -153,7 +153,7 @@ static int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, | |||
153 | 153 | ||
154 | static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); | 154 | static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); |
155 | 155 | ||
156 | struct ipv6_devconf ipv6_devconf __read_mostly = { | 156 | static struct ipv6_devconf ipv6_devconf __read_mostly = { |
157 | .forwarding = 0, | 157 | .forwarding = 0, |
158 | .hop_limit = IPV6_DEFAULT_HOPLIMIT, | 158 | .hop_limit = IPV6_DEFAULT_HOPLIMIT, |
159 | .mtu6 = IPV6_MIN_MTU, | 159 | .mtu6 = IPV6_MIN_MTU, |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 4de2b9efcacb..08ea2de28d63 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -661,17 +661,17 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
661 | 661 | ||
662 | static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) | 662 | static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) |
663 | { | 663 | { |
664 | if (net->ipv6.ip6_fib_timer->expires == 0 && | 664 | if (!timer_pending(&net->ipv6.ip6_fib_timer) && |
665 | (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) | 665 | (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) |
666 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + | 666 | mod_timer(&net->ipv6.ip6_fib_timer, |
667 | net->ipv6.sysctl.ip6_rt_gc_interval); | 667 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); |
668 | } | 668 | } |
669 | 669 | ||
670 | void fib6_force_start_gc(struct net *net) | 670 | void fib6_force_start_gc(struct net *net) |
671 | { | 671 | { |
672 | if (net->ipv6.ip6_fib_timer->expires == 0) | 672 | if (!timer_pending(&net->ipv6.ip6_fib_timer)) |
673 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + | 673 | mod_timer(&net->ipv6.ip6_fib_timer, |
674 | net->ipv6.sysctl.ip6_rt_gc_interval); | 674 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); |
675 | } | 675 | } |
676 | 676 | ||
677 | /* | 677 | /* |
@@ -1447,27 +1447,23 @@ void fib6_run_gc(unsigned long expires, struct net *net) | |||
1447 | gc_args.timeout = expires ? (int)expires : | 1447 | gc_args.timeout = expires ? (int)expires : |
1448 | net->ipv6.sysctl.ip6_rt_gc_interval; | 1448 | net->ipv6.sysctl.ip6_rt_gc_interval; |
1449 | } else { | 1449 | } else { |
1450 | local_bh_disable(); | 1450 | if (!spin_trylock_bh(&fib6_gc_lock)) { |
1451 | if (!spin_trylock(&fib6_gc_lock)) { | 1451 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1452 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + HZ); | ||
1453 | local_bh_enable(); | ||
1454 | return; | 1452 | return; |
1455 | } | 1453 | } |
1456 | gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; | 1454 | gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; |
1457 | } | 1455 | } |
1458 | gc_args.more = 0; | ||
1459 | 1456 | ||
1460 | icmp6_dst_gc(&gc_args.more); | 1457 | gc_args.more = icmp6_dst_gc(); |
1461 | 1458 | ||
1462 | fib6_clean_all(net, fib6_age, 0, NULL); | 1459 | fib6_clean_all(net, fib6_age, 0, NULL); |
1463 | 1460 | ||
1464 | if (gc_args.more) | 1461 | if (gc_args.more) |
1465 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + | 1462 | mod_timer(&net->ipv6.ip6_fib_timer, |
1466 | net->ipv6.sysctl.ip6_rt_gc_interval); | 1463 | round_jiffies(jiffies |
1467 | else { | 1464 | + net->ipv6.sysctl.ip6_rt_gc_interval)); |
1468 | del_timer(net->ipv6.ip6_fib_timer); | 1465 | else |
1469 | net->ipv6.ip6_fib_timer->expires = 0; | 1466 | del_timer(&net->ipv6.ip6_fib_timer); |
1470 | } | ||
1471 | spin_unlock_bh(&fib6_gc_lock); | 1467 | spin_unlock_bh(&fib6_gc_lock); |
1472 | } | 1468 | } |
1473 | 1469 | ||
@@ -1478,24 +1474,15 @@ static void fib6_gc_timer_cb(unsigned long arg) | |||
1478 | 1474 | ||
1479 | static int fib6_net_init(struct net *net) | 1475 | static int fib6_net_init(struct net *net) |
1480 | { | 1476 | { |
1481 | int ret; | 1477 | setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); |
1482 | struct timer_list *timer; | ||
1483 | |||
1484 | ret = -ENOMEM; | ||
1485 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); | ||
1486 | if (!timer) | ||
1487 | goto out; | ||
1488 | |||
1489 | setup_timer(timer, fib6_gc_timer_cb, (unsigned long)net); | ||
1490 | net->ipv6.ip6_fib_timer = timer; | ||
1491 | 1478 | ||
1492 | net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); | 1479 | net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); |
1493 | if (!net->ipv6.rt6_stats) | 1480 | if (!net->ipv6.rt6_stats) |
1494 | goto out_timer; | 1481 | goto out_timer; |
1495 | 1482 | ||
1496 | net->ipv6.fib_table_hash = | 1483 | net->ipv6.fib_table_hash = kcalloc(FIB_TABLE_HASHSZ, |
1497 | kzalloc(sizeof(*net->ipv6.fib_table_hash)*FIB_TABLE_HASHSZ, | 1484 | sizeof(*net->ipv6.fib_table_hash), |
1498 | GFP_KERNEL); | 1485 | GFP_KERNEL); |
1499 | if (!net->ipv6.fib_table_hash) | 1486 | if (!net->ipv6.fib_table_hash) |
1500 | goto out_rt6_stats; | 1487 | goto out_rt6_stats; |
1501 | 1488 | ||
@@ -1521,9 +1508,7 @@ static int fib6_net_init(struct net *net) | |||
1521 | #endif | 1508 | #endif |
1522 | fib6_tables_init(net); | 1509 | fib6_tables_init(net); |
1523 | 1510 | ||
1524 | ret = 0; | 1511 | return 0; |
1525 | out: | ||
1526 | return ret; | ||
1527 | 1512 | ||
1528 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 1513 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1529 | out_fib6_main_tbl: | 1514 | out_fib6_main_tbl: |
@@ -1534,15 +1519,14 @@ out_fib_table_hash: | |||
1534 | out_rt6_stats: | 1519 | out_rt6_stats: |
1535 | kfree(net->ipv6.rt6_stats); | 1520 | kfree(net->ipv6.rt6_stats); |
1536 | out_timer: | 1521 | out_timer: |
1537 | kfree(timer); | 1522 | return -ENOMEM; |
1538 | goto out; | ||
1539 | } | 1523 | } |
1540 | 1524 | ||
1541 | static void fib6_net_exit(struct net *net) | 1525 | static void fib6_net_exit(struct net *net) |
1542 | { | 1526 | { |
1543 | rt6_ifdown(net, NULL); | 1527 | rt6_ifdown(net, NULL); |
1544 | del_timer_sync(net->ipv6.ip6_fib_timer); | 1528 | del_timer_sync(&net->ipv6.ip6_fib_timer); |
1545 | kfree(net->ipv6.ip6_fib_timer); | 1529 | |
1546 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 1530 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1547 | kfree(net->ipv6.fib6_local_tbl); | 1531 | kfree(net->ipv6.fib6_local_tbl); |
1548 | #endif | 1532 | #endif |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 615b328de251..86540b24b27c 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -978,13 +978,12 @@ out: | |||
978 | return &rt->u.dst; | 978 | return &rt->u.dst; |
979 | } | 979 | } |
980 | 980 | ||
981 | int icmp6_dst_gc(int *more) | 981 | int icmp6_dst_gc(void) |
982 | { | 982 | { |
983 | struct dst_entry *dst, *next, **pprev; | 983 | struct dst_entry *dst, *next, **pprev; |
984 | int freed; | 984 | int more = 0; |
985 | 985 | ||
986 | next = NULL; | 986 | next = NULL; |
987 | freed = 0; | ||
988 | 987 | ||
989 | spin_lock_bh(&icmp6_dst_lock); | 988 | spin_lock_bh(&icmp6_dst_lock); |
990 | pprev = &icmp6_dst_gc_list; | 989 | pprev = &icmp6_dst_gc_list; |
@@ -993,16 +992,15 @@ int icmp6_dst_gc(int *more) | |||
993 | if (!atomic_read(&dst->__refcnt)) { | 992 | if (!atomic_read(&dst->__refcnt)) { |
994 | *pprev = dst->next; | 993 | *pprev = dst->next; |
995 | dst_free(dst); | 994 | dst_free(dst); |
996 | freed++; | ||
997 | } else { | 995 | } else { |
998 | pprev = &dst->next; | 996 | pprev = &dst->next; |
999 | (*more)++; | 997 | ++more; |
1000 | } | 998 | } |
1001 | } | 999 | } |
1002 | 1000 | ||
1003 | spin_unlock_bh(&icmp6_dst_lock); | 1001 | spin_unlock_bh(&icmp6_dst_lock); |
1004 | 1002 | ||
1005 | return freed; | 1003 | return more; |
1006 | } | 1004 | } |
1007 | 1005 | ||
1008 | static int ip6_dst_gc(struct dst_ops *ops) | 1006 | static int ip6_dst_gc(struct dst_ops *ops) |