aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-02-09 19:22:57 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:20:40 -0500
commit7cc482634f1f1e1db5401007658c8e8d6cf1617d (patch)
treec79f22adc08cd76c2c211a0120fe19d726b8c225 /net
parent093c2ca4167cf66f69020329d14138da0da8599b (diff)
[IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer
This patch removes the next pointer from 'struct rt6_info.u' union, and renames u.next to u.dst.rt6_next. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ip6_fib.c20
-rw-r--r--net/ipv6/route.c20
2 files changed, 20 insertions, 20 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index f90ab5233326..8c9024890bbe 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -298,7 +298,7 @@ static int fib6_dump_node(struct fib6_walker_t *w)
298 int res; 298 int res;
299 struct rt6_info *rt; 299 struct rt6_info *rt;
300 300
301 for (rt = w->leaf; rt; rt = rt->u.next) { 301 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
302 res = rt6_dump_route(rt, w->args); 302 res = rt6_dump_route(rt, w->args);
303 if (res < 0) { 303 if (res < 0) {
304 /* Frame is full, suspend walking */ 304 /* Frame is full, suspend walking */
@@ -624,11 +624,11 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
624 fn->leaf == &ip6_null_entry && 624 fn->leaf == &ip6_null_entry &&
625 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){ 625 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){
626 fn->leaf = rt; 626 fn->leaf = rt;
627 rt->u.next = NULL; 627 rt->u.dst.rt6_next = NULL;
628 goto out; 628 goto out;
629 } 629 }
630 630
631 for (iter = fn->leaf; iter; iter=iter->u.next) { 631 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {
632 /* 632 /*
633 * Search for duplicates 633 * Search for duplicates
634 */ 634 */
@@ -656,7 +656,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
656 if (iter->rt6i_metric > rt->rt6i_metric) 656 if (iter->rt6i_metric > rt->rt6i_metric)
657 break; 657 break;
658 658
659 ins = &iter->u.next; 659 ins = &iter->u.dst.rt6_next;
660 } 660 }
661 661
662 /* 662 /*
@@ -664,7 +664,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
664 */ 664 */
665 665
666out: 666out:
667 rt->u.next = iter; 667 rt->u.dst.rt6_next = iter;
668 *ins = rt; 668 *ins = rt;
669 rt->rt6i_node = fn; 669 rt->rt6i_node = fn;
670 atomic_inc(&rt->rt6i_ref); 670 atomic_inc(&rt->rt6i_ref);
@@ -1105,7 +1105,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1105 RT6_TRACE("fib6_del_route\n"); 1105 RT6_TRACE("fib6_del_route\n");
1106 1106
1107 /* Unlink it */ 1107 /* Unlink it */
1108 *rtp = rt->u.next; 1108 *rtp = rt->u.dst.rt6_next;
1109 rt->rt6i_node = NULL; 1109 rt->rt6i_node = NULL;
1110 rt6_stats.fib_rt_entries--; 1110 rt6_stats.fib_rt_entries--;
1111 rt6_stats.fib_discarded_routes++; 1111 rt6_stats.fib_discarded_routes++;
@@ -1115,14 +1115,14 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1115 FOR_WALKERS(w) { 1115 FOR_WALKERS(w) {
1116 if (w->state == FWS_C && w->leaf == rt) { 1116 if (w->state == FWS_C && w->leaf == rt) {
1117 RT6_TRACE("walker %p adjusted by delroute\n", w); 1117 RT6_TRACE("walker %p adjusted by delroute\n", w);
1118 w->leaf = rt->u.next; 1118 w->leaf = rt->u.dst.rt6_next;
1119 if (w->leaf == NULL) 1119 if (w->leaf == NULL)
1120 w->state = FWS_U; 1120 w->state = FWS_U;
1121 } 1121 }
1122 } 1122 }
1123 read_unlock(&fib6_walker_lock); 1123 read_unlock(&fib6_walker_lock);
1124 1124
1125 rt->u.next = NULL; 1125 rt->u.dst.rt6_next = NULL;
1126 1126
1127 if (fn->leaf == NULL && fn->fn_flags&RTN_TL_ROOT) 1127 if (fn->leaf == NULL && fn->fn_flags&RTN_TL_ROOT)
1128 fn->leaf = &ip6_null_entry; 1128 fn->leaf = &ip6_null_entry;
@@ -1190,7 +1190,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
1190 * Walk the leaf entries looking for ourself 1190 * Walk the leaf entries looking for ourself
1191 */ 1191 */
1192 1192
1193 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { 1193 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.dst.rt6_next) {
1194 if (*rtp == rt) { 1194 if (*rtp == rt) {
1195 fib6_del_route(fn, rtp, info); 1195 fib6_del_route(fn, rtp, info);
1196 return 0; 1196 return 0;
@@ -1317,7 +1317,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1317 struct rt6_info *rt; 1317 struct rt6_info *rt;
1318 struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w; 1318 struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w;
1319 1319
1320 for (rt = w->leaf; rt; rt = rt->u.next) { 1320 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
1321 res = c->func(rt, c->arg); 1321 res = c->func(rt, c->arg);
1322 if (res < 0) { 1322 if (res < 0) {
1323 w->leaf = rt; 1323 w->leaf = rt;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fc8448cc5d21..a415ac610e2d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -243,7 +243,7 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt,
243 struct rt6_info *sprt; 243 struct rt6_info *sprt;
244 244
245 if (oif) { 245 if (oif) {
246 for (sprt = rt; sprt; sprt = sprt->u.next) { 246 for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) {
247 struct net_device *dev = sprt->rt6i_dev; 247 struct net_device *dev = sprt->rt6i_dev;
248 if (dev->ifindex == oif) 248 if (dev->ifindex == oif)
249 return sprt; 249 return sprt;
@@ -376,7 +376,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
376 376
377 for (rt = rt0, metric = rt0->rt6i_metric; 377 for (rt = rt0, metric = rt0->rt6i_metric;
378 rt && rt->rt6i_metric == metric && (!last || rt != rt0); 378 rt && rt->rt6i_metric == metric && (!last || rt != rt0);
379 rt = rt->u.next) { 379 rt = rt->u.dst.rt6_next) {
380 int m; 380 int m;
381 381
382 if (rt6_check_expired(rt)) 382 if (rt6_check_expired(rt))
@@ -404,9 +404,9 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
404 /* no entries matched; do round-robin */ 404 /* no entries matched; do round-robin */
405 static DEFINE_SPINLOCK(lock); 405 static DEFINE_SPINLOCK(lock);
406 spin_lock(&lock); 406 spin_lock(&lock);
407 *head = rt0->u.next; 407 *head = rt0->u.dst.rt6_next;
408 rt0->u.next = last->u.next; 408 rt0->u.dst.rt6_next = last->u.dst.rt6_next;
409 last->u.next = rt0; 409 last->u.dst.rt6_next = rt0;
410 spin_unlock(&lock); 410 spin_unlock(&lock);
411 } 411 }
412 412
@@ -1278,7 +1278,7 @@ static int ip6_route_del(struct fib6_config *cfg)
1278 &cfg->fc_src, cfg->fc_src_len); 1278 &cfg->fc_src, cfg->fc_src_len);
1279 1279
1280 if (fn) { 1280 if (fn) {
1281 for (rt = fn->leaf; rt; rt = rt->u.next) { 1281 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1282 if (cfg->fc_ifindex && 1282 if (cfg->fc_ifindex &&
1283 (rt->rt6i_dev == NULL || 1283 (rt->rt6i_dev == NULL ||
1284 rt->rt6i_dev->ifindex != cfg->fc_ifindex)) 1284 rt->rt6i_dev->ifindex != cfg->fc_ifindex))
@@ -1329,7 +1329,7 @@ static struct rt6_info *__ip6_route_redirect(struct fib6_table *table,
1329 read_lock_bh(&table->tb6_lock); 1329 read_lock_bh(&table->tb6_lock);
1330 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 1330 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
1331restart: 1331restart:
1332 for (rt = fn->leaf; rt; rt = rt->u.next) { 1332 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1333 /* 1333 /*
1334 * Current route is on-link; redirect is always invalid. 1334 * Current route is on-link; redirect is always invalid.
1335 * 1335 *
@@ -1590,7 +1590,7 @@ static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixle
1590 if (!fn) 1590 if (!fn)
1591 goto out; 1591 goto out;
1592 1592
1593 for (rt = fn->leaf; rt; rt = rt->u.next) { 1593 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1594 if (rt->rt6i_dev->ifindex != ifindex) 1594 if (rt->rt6i_dev->ifindex != ifindex)
1595 continue; 1595 continue;
1596 if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY)) 1596 if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY))
@@ -1641,7 +1641,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d
1641 return NULL; 1641 return NULL;
1642 1642
1643 write_lock_bh(&table->tb6_lock); 1643 write_lock_bh(&table->tb6_lock);
1644 for (rt = table->tb6_root.leaf; rt; rt=rt->u.next) { 1644 for (rt = table->tb6_root.leaf; rt; rt=rt->u.dst.rt6_next) {
1645 if (dev == rt->rt6i_dev && 1645 if (dev == rt->rt6i_dev &&
1646 ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && 1646 ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
1647 ipv6_addr_equal(&rt->rt6i_gateway, addr)) 1647 ipv6_addr_equal(&rt->rt6i_gateway, addr))
@@ -1684,7 +1684,7 @@ void rt6_purge_dflt_routers(void)
1684 1684
1685restart: 1685restart:
1686 read_lock_bh(&table->tb6_lock); 1686 read_lock_bh(&table->tb6_lock);
1687 for (rt = table->tb6_root.leaf; rt; rt = rt->u.next) { 1687 for (rt = table->tb6_root.leaf; rt; rt = rt->u.dst.rt6_next) {
1688 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) { 1688 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) {
1689 dst_hold(&rt->u.dst); 1689 dst_hold(&rt->u.dst);
1690 read_unlock_bh(&table->tb6_lock); 1690 read_unlock_bh(&table->tb6_lock);