summaryrefslogtreecommitdiffstats
path: root/zebra/rib.h
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2020-03-25 05:41:49 +0100
committerChirag Shah <chirag@cumulusnetworks.com>2020-05-12 23:31:37 +0200
commitdb856683559935952edaf90079fa0e45cb4cefe6 (patch)
tree55eb5d678fd7231a6ee8426938bbbe022ba400f9 /zebra/rib.h
parentzebra: add zebra container to rib model (diff)
downloadfrr-db856683559935952edaf90079fa0e45cb4cefe6.tar.xz
frr-db856683559935952edaf90079fa0e45cb4cefe6.zip
zebra: route node first next node
Add macros for route entry first and next node walk. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'zebra/rib.h')
-rw-r--r--zebra/rib.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/zebra/rib.h b/zebra/rib.h
index 1667f1790..0b4455038 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -251,12 +251,22 @@ DECLARE_LIST(re_list, struct route_entry, next);
(re) && ((next) = re_list_next(&((dest)->routes), (re)), 1); \
(re) = (next))
+#define RE_DEST_FIRST_ROUTE(dest, re) \
+ ((re) = (dest) ? re_list_first(&((dest)->routes)) : NULL)
+
+#define RE_DEST_NEXT_ROUTE(dest, re) \
+ ((re) = (dest) ? re_list_next(&((dest)->routes), (re)) : NULL)
+
#define RNODE_FOREACH_RE(rn, re) \
RE_DEST_FOREACH_ROUTE (rib_dest_from_rnode(rn), re)
#define RNODE_FOREACH_RE_SAFE(rn, re, next) \
RE_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode(rn), re, next)
+#define RNODE_FIRST_RE(rn, re) RE_DEST_FIRST_ROUTE(rib_dest_from_rnode(rn), re)
+
+#define RNODE_NEXT_RE(rn, re) RE_DEST_NEXT_ROUTE(rib_dest_from_rnode(rn), re)
+
#if defined(HAVE_RTADV)
/* Structure which hold status of router advertisement. */
struct rtadv {