diff mbox

[RFC,3/6] ipv6: if no function for cleaner is specified only visit nodes

Message ID ee139a874fbb76f5116e9a66e764382d5cfaf6d2.1410477596.git.hannes@stressinduktion.org
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Hannes Frederic Sowa Sept. 11, 2014, 11:21 p.m. UTC
We now allow NULL rt6_info walker functions to we only visit nodes.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
 net/ipv6/ip6_fib.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 101efab..590c5d2 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1529,6 +1529,13 @@  static int fib6_clean_node(struct fib6_walker_t *w)
 	if (c->sernum)
 		c->w.node->fn_sernum = c->sernum;
 
+	/* if func is NULL only visit node to update sernum */
+	if (!c->func) {
+		WARN_ON_ONCE(!c->sernum);
+		w->leaf = NULL;
+		return 0;
+	}
+
 	for (rt = w->leaf; rt; rt = rt->dst.rt6_next) {
 		res = c->func(rt, c->arg);
 		if (res < 0) {