summaryrefslogtreecommitdiff
path: root/nest/route.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-03-09 12:30:05 +0100
committerMaria Matejka <mq@ucw.cz>2022-03-09 12:30:05 +0100
commit1b9189d5fdab672f91600b7e72a1deeab277eafc (patch)
treea6f5c92209a9c290fd0bb7c583fb1d606b133e66 /nest/route.h
parent69d1ffde4c724882398b3b630ea1199f12c0c288 (diff)
Route validity check converted to generic macro dispatch
Diffstat (limited to 'nest/route.h')
-rw-r--r--nest/route.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/nest/route.h b/nest/route.h
index ade14857..4944a854 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -259,7 +259,10 @@ struct rte_storage {
#define REF_MODIFY 16 /* Route is scheduled for modify */
/* Route is valid for propagation (may depend on other flags in the future), accepts NULL */
-static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_FILTERED); }
+static inline int rte_is_valid_rte(rte *r) { return r && !(r->flags & REF_FILTERED); }
+static inline int rte_is_valid_storage(struct rte_storage *r) { return r && rte_is_valid_rte(&r->rte); }
+
+#define rte_is_valid(r) _Generic((*r), rte: rte_is_valid_rte, struct rte_storage: rte_is_valid_storage)(r)
/* Route just has REF_FILTERED flag */
static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED); }