diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/iface.c | 4 | ||||
-rw-r--r-- | nest/iface.h | 4 | ||||
-rw-r--r-- | nest/neighbor.c | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/nest/iface.c b/nest/iface.c index 682340c5..6c84cbcf 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -147,7 +147,7 @@ ifa_send_notify(struct proto *p, unsigned c, struct ifa *a) { if (p->ifa_notify && (p->proto_state != PS_DOWN) && - (!p->vrf_set || p->vrf == a->iface->master)) + (!p->vrf_set || if_in_vrf(a->iface, p->vrf))) { if (p->debug & D_IFACES) log(L_TRACE "%s < address %N on interface %s %s", @@ -185,7 +185,7 @@ if_send_notify(struct proto *p, unsigned c, struct iface *i) { if (p->if_notify && (p->proto_state != PS_DOWN) && - (!p->vrf_set || p->vrf == i->master)) + (!p->vrf_set || if_in_vrf(i, p->vrf))) { if (p->debug & D_IFACES) log(L_TRACE "%s < interface %s %s", p->name, i->name, 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 */ diff --git a/nest/neighbor.c b/nest/neighbor.c index 7cf9c85d..2c2d3adf 100644 --- a/nest/neighbor.c +++ b/nest/neighbor.c @@ -153,7 +153,7 @@ if_connected_any(ip_addr a, struct iface *vrf, uint vrf_set, struct iface **ifac /* Prefer SCOPE_HOST or longer prefix */ WALK_LIST(i, iface_list) - if ((!vrf_set || vrf == i->master) && ((s = if_connected(a, i, &b, flags)) >= 0)) + if ((!vrf_set || if_in_vrf(i, vrf)) && ((s = if_connected(a, i, &b, flags)) >= 0)) if (scope_better(s, scope) || (scope_remote(s, scope) && ifa_better(b, *addr))) { *iface = i; @@ -369,7 +369,7 @@ neigh_update(neighbor *n, struct iface *iface) return; /* VRF-bound neighbors ignore changes in other VRFs */ - if (p->vrf_set && (p->vrf != iface->master)) + if (p->vrf_set && !if_in_vrf(iface, p->vrf)) return; scope = if_connected(n->addr, iface, &ifa, n->flags); |