aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index cfb249cc0a58..1e589b91605e 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1989,6 +1989,10 @@ static struct node *fib_trie_get_next(struct fib_trie_iter *iter)
1989 unsigned cindex = iter->index; 1989 unsigned cindex = iter->index;
1990 struct tnode *p; 1990 struct tnode *p;
1991 1991
1992 /* A single entry routing table */
1993 if (!tn)
1994 return NULL;
1995
1992 pr_debug("get_next iter={node=%p index=%d depth=%d}\n", 1996 pr_debug("get_next iter={node=%p index=%d depth=%d}\n",
1993 iter->tnode, iter->index, iter->depth); 1997 iter->tnode, iter->index, iter->depth);
1994rescan: 1998rescan:
@@ -2037,11 +2041,18 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter,
2037 if(!iter) 2041 if(!iter)
2038 return NULL; 2042 return NULL;
2039 2043
2040 if (n && IS_TNODE(n)) { 2044 if (n) {
2041 iter->tnode = (struct tnode *) n; 2045 if (IS_TNODE(n)) {
2042 iter->trie = t; 2046 iter->tnode = (struct tnode *) n;
2043 iter->index = 0; 2047 iter->trie = t;
2044 iter->depth = 1; 2048 iter->index = 0;
2049 iter->depth = 1;
2050 } else {
2051 iter->tnode = NULL;
2052 iter->trie = t;
2053 iter->index = 0;
2054 iter->depth = 0;
2055 }
2045 return n; 2056 return n;
2046 } 2057 }
2047 return NULL; 2058 return NULL;
@@ -2279,16 +2290,17 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
2279 if (v == SEQ_START_TOKEN) 2290 if (v == SEQ_START_TOKEN)
2280 return 0; 2291 return 0;
2281 2292
2293 if (!NODE_PARENT(n)) {
2294 if (iter->trie == trie_local)
2295 seq_puts(seq, "<local>:\n");
2296 else
2297 seq_puts(seq, "<main>:\n");
2298 }
2299
2282 if (IS_TNODE(n)) { 2300 if (IS_TNODE(n)) {
2283 struct tnode *tn = (struct tnode *) n; 2301 struct tnode *tn = (struct tnode *) n;
2284 __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); 2302 __be32 prf = htonl(MASK_PFX(tn->key, tn->pos));
2285 2303
2286 if (!NODE_PARENT(n)) {
2287 if (iter->trie == trie_local)
2288 seq_puts(seq, "<local>:\n");
2289 else
2290 seq_puts(seq, "<main>:\n");
2291 }
2292 seq_indent(seq, iter->depth-1); 2304 seq_indent(seq, iter->depth-1);
2293 seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", 2305 seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n",
2294 NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, 2306 NIPQUAD(prf), tn->pos, tn->bits, tn->full_children,