ip6_fib.c (f3db48517f59133610f558f29de8834d7b007691) ip6_fib.c (5b7c931dff03621ae7ac524c4fa280d4e5f187a4)
1/*
2 * Linux INET6 implementation
3 * Forwarding Information Database
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * $Id: ip6_fib.c,v 1.25 2001/10/31 21:55:55 davem Exp $

--- 79 unchanged lines hidden (view full) ---

88 * A routing update causes an increase of the serial number on the
89 * affected subtree. This allows for cached routes to be asynchronously
90 * tested when modifications are made to the destination cache as a
91 * result of redirects, path MTU changes, etc.
92 */
93
94static __u32 rt_sernum;
95
1/*
2 * Linux INET6 implementation
3 * Forwarding Information Database
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * $Id: ip6_fib.c,v 1.25 2001/10/31 21:55:55 davem Exp $

--- 79 unchanged lines hidden (view full) ---

88 * A routing update causes an increase of the serial number on the
89 * affected subtree. This allows for cached routes to be asynchronously
90 * tested when modifications are made to the destination cache as a
91 * result of redirects, path MTU changes, etc.
92 */
93
94static __u32 rt_sernum;
95
96static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0);
96static void fib6_gc_timer_cb(unsigned long arg);
97
97
98static DEFINE_TIMER(ip6_fib_timer, fib6_gc_timer_cb, 0,
99 (unsigned long)&init_net);
100
98static struct fib6_walker_t fib6_walker_list = {
99 .prev = &fib6_walker_list,
100 .next = &fib6_walker_list,
101};
102
103#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next)
104
105static inline void fib6_walker_link(struct fib6_walker_t *w)

--- 1321 unchanged lines hidden (view full) ---

1427 gc_args.more++;
1428 }
1429
1430 return 0;
1431}
1432
1433static DEFINE_SPINLOCK(fib6_gc_lock);
1434
101static struct fib6_walker_t fib6_walker_list = {
102 .prev = &fib6_walker_list,
103 .next = &fib6_walker_list,
104};
105
106#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next)
107
108static inline void fib6_walker_link(struct fib6_walker_t *w)

--- 1321 unchanged lines hidden (view full) ---

1430 gc_args.more++;
1431 }
1432
1433 return 0;
1434}
1435
1436static DEFINE_SPINLOCK(fib6_gc_lock);
1437
1435void fib6_run_gc(unsigned long dummy)
1438void fib6_run_gc(unsigned long expires, struct net *net)
1436{
1439{
1437 if (dummy != ~0UL) {
1440 if (expires != ~0UL) {
1438 spin_lock_bh(&fib6_gc_lock);
1441 spin_lock_bh(&fib6_gc_lock);
1439 gc_args.timeout = dummy ? (int)dummy :
1440 init_net.ipv6.sysctl.ip6_rt_gc_interval;
1442 gc_args.timeout = expires ? (int)expires :
1443 net->ipv6.sysctl.ip6_rt_gc_interval;
1441 } else {
1442 local_bh_disable();
1443 if (!spin_trylock(&fib6_gc_lock)) {
1444 mod_timer(&ip6_fib_timer, jiffies + HZ);
1445 local_bh_enable();
1446 return;
1447 }
1444 } else {
1445 local_bh_disable();
1446 if (!spin_trylock(&fib6_gc_lock)) {
1447 mod_timer(&ip6_fib_timer, jiffies + HZ);
1448 local_bh_enable();
1449 return;
1450 }
1448 gc_args.timeout = init_net.ipv6.sysctl.ip6_rt_gc_interval;
1451 gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
1449 }
1450 gc_args.more = 0;
1451
1452 icmp6_dst_gc(&gc_args.more);
1453
1452 }
1453 gc_args.more = 0;
1454
1455 icmp6_dst_gc(&gc_args.more);
1456
1454 fib6_clean_all(&init_net, fib6_age, 0, NULL);
1457 fib6_clean_all(net, fib6_age, 0, NULL);
1455
1456 if (gc_args.more)
1457 mod_timer(&ip6_fib_timer, jiffies +
1458
1459 if (gc_args.more)
1460 mod_timer(&ip6_fib_timer, jiffies +
1458 init_net.ipv6.sysctl.ip6_rt_gc_interval);
1461 net->ipv6.sysctl.ip6_rt_gc_interval);
1459 else {
1460 del_timer(&ip6_fib_timer);
1461 ip6_fib_timer.expires = 0;
1462 }
1463 spin_unlock_bh(&fib6_gc_lock);
1464}
1465
1462 else {
1463 del_timer(&ip6_fib_timer);
1464 ip6_fib_timer.expires = 0;
1465 }
1466 spin_unlock_bh(&fib6_gc_lock);
1467}
1468
1469static void fib6_gc_timer_cb(unsigned long arg)
1470{
1471 fib6_run_gc(0, (struct net *)arg);
1472}
1473
1466static int fib6_net_init(struct net *net)
1467{
1468 int ret;
1469
1470 ret = -ENOMEM;
1471 net->ipv6.fib_table_hash =
1472 kzalloc(sizeof(*net->ipv6.fib_table_hash)*FIB_TABLE_HASHSZ,
1473 GFP_KERNEL);

--- 85 unchanged lines hidden ---
1474static int fib6_net_init(struct net *net)
1475{
1476 int ret;
1477
1478 ret = -ENOMEM;
1479 net->ipv6.fib_table_hash =
1480 kzalloc(sizeof(*net->ipv6.fib_table_hash)*FIB_TABLE_HASHSZ,
1481 GFP_KERNEL);

--- 85 unchanged lines hidden ---