summaryrefslogtreecommitdiff
path: root/nest/route.h
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-12-20 20:44:36 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-06 23:27:13 +0100
commitfde1cff0122ee9d68f141976395e7f89ba28c311 (patch)
treee276b7921c048da689549d6d82d5a2fca754d1d9 /nest/route.h
parent61375bd0b3803fada0d7bb5b81b5824bab16b7c1 (diff)
Nest: Add convenience functions to check rtable net type
Diffstat (limited to 'nest/route.h')
-rw-r--r--nest/route.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/nest/route.h b/nest/route.h
index 5f0c3578..a1732bc7 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -362,6 +362,18 @@ void rt_prune_sync(rtable *t, int all);
int rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, int refeed);
struct rtable_config *rt_new_table(struct symbol *s, uint addr_type);
+static inline int rt_is_ip(rtable *tab)
+{ return (tab->addr_type == NET_IP4) || (tab->addr_type == NET_IP6); }
+
+static inline int rt_is_vpn(rtable *tab)
+{ return (tab->addr_type == NET_VPN4) || (tab->addr_type == NET_VPN6); }
+
+static inline int rt_is_roa(rtable *tab)
+{ return (tab->addr_type == NET_ROA4) || (tab->addr_type == NET_ROA6); }
+
+static inline int rt_is_flow(rtable *tab)
+{ return (tab->addr_type == NET_FLOW4) || (tab->addr_type == NET_FLOW6); }
+
/* Default limit for ECMP next hops, defined in sysdep code */
extern const int rt_default_ecmp;