diff options
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index cfb249cc0a58..13307c04d5a1 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); |
1994 | rescan: | 1998 | rescan: |
@@ -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; |