summaryrefslogtreecommitdiff
path: root/proto/mrt/mrt.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2021-03-30 15:09:53 +0200
committerMaria Matejka <mq@ucw.cz>2021-03-30 21:56:08 +0200
commit4635314cefd55aaa2a0146b6722df55e7efba4b8 (patch)
tree9e9263eff6f5f06e9be58e86f8e41240514a66a9 /proto/mrt/mrt.c
parent7a74ad5a61c82ab0062a62dbc9ea6ab91d480485 (diff)
Routing tables list iteration should use explicit node struct position
Diffstat (limited to 'proto/mrt/mrt.c')
-rw-r--r--proto/mrt/mrt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c
index 838360c2..8d97c860 100644
--- a/proto/mrt/mrt.c
+++ b/proto/mrt/mrt.c
@@ -224,12 +224,15 @@ mrt_next_table_(rtable *tab, rtable *tab_ptr, const char *pattern)
return !tab ? tab_ptr : NULL;
/* Walk routing_tables list, starting after tab (if non-NULL) */
- for (tab = !tab ? HEAD(routing_tables) : NODE_NEXT(tab);
- NODE_VALID(tab);
- tab = NODE_NEXT(tab))
+ for (node *tn = tab ? tab->n.next : HEAD(routing_tables);
+ NODE_VALID(tn);
+ tn = tn->next)
+ {
+ tab = SKIP_BACK(struct rtable, n, tn);
if (patmatch(pattern, tab->name) &&
((tab->addr_type == NET_IP4) || (tab->addr_type == NET_IP6)))
return tab;
+ }
return NULL;
}