summaryrefslogtreecommitdiff
path: root/nest/iface.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-08-23 15:55:31 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-08-23 16:08:40 +0200
commite3c0eca95642a846ab65261424a51dd99d954017 (patch)
treee108f29222cd8b62a40f7b05360c05b9f34d3b9a /nest/iface.h
parent5121101136cb80151a9361c63dc4822afeb44eef (diff)
Nest: Treat VRF interfaces as inside respective VRFs
Despite not having defined 'master interface', VRF interfaces should be treated as being inside respective VRFs. They behave as a loopback for respective VRFs. Treating the VRF interface as inside the VRF allows e.g. OSPF to pick up IP addresses defined on the VRF interface. For this, we also need to tell apart VRF interfaces and regular interfaces. Extend Netlink code to parse interface type and mark VRF interfaces with IF_VRF flag. Based on the patch from Erin Shepherd, thanks!
Diffstat (limited to 'nest/iface.h')
-rw-r--r--nest/iface.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/nest/iface.h b/nest/iface.h
index 1189cdd4..f8e92850 100644
--- a/nest/iface.h
+++ b/nest/iface.h
@@ -53,6 +53,7 @@ struct iface {
#define IF_IGNORE 0x40 /* Not to be used by routing protocols (loopbacks etc.) */
#define IF_ADMIN_UP 0x80 /* Administrative up (e.g. IFF_UP in Linux) */
#define IF_LINK_UP 0x100 /* Link available (e.g. IFF_LOWER_UP in Linux) */
+#define IF_VRF 0x200 /* Iface is VRF master */
#define IA_PRIMARY 0x10000 /* This address is primary */
#define IA_SECONDARY 0x20000 /* This address has been reported as secondary by the kernel */
@@ -119,6 +120,9 @@ struct iface *if_find_by_name(const char *);
struct iface *if_get_by_name(const char *);
void if_recalc_all_preferred_addresses(void);
+static inline int if_in_vrf(struct iface *i, struct iface *vrf)
+{ return (i->flags & IF_VRF) ? (i == vrf) : (i->master == vrf); }
+
/* The Neighbor Cache */