Nest: VRF support for neighbor cache and olock code
Actually much simpler than expected.
This commit is contained in:
parent
943478b00f
commit
9f4908fe78
5 changed files with 8 additions and 4 deletions
|
@ -45,6 +45,7 @@ olock_same(struct object_lock *x, struct object_lock *y)
|
||||||
return
|
return
|
||||||
x->type == y->type &&
|
x->type == y->type &&
|
||||||
x->iface == y->iface &&
|
x->iface == y->iface &&
|
||||||
|
x->vrf == y->vrf &&
|
||||||
x->port == y->port &&
|
x->port == y->port &&
|
||||||
x->inst == y->inst &&
|
x->inst == y->inst &&
|
||||||
ipa_equal(x->addr, y->addr);
|
ipa_equal(x->addr, y->addr);
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct object_lock {
|
||||||
uint port; /* ... port number */
|
uint port; /* ... port number */
|
||||||
uint inst; /* ... instance ID */
|
uint inst; /* ... instance ID */
|
||||||
struct iface *iface; /* ... interface */
|
struct iface *iface; /* ... interface */
|
||||||
|
struct iface *vrf; /* ... or VRF (if iface is unknown) */
|
||||||
void (*hook)(struct object_lock *); /* Called when the lock succeeds */
|
void (*hook)(struct object_lock *); /* Called when the lock succeeds */
|
||||||
void *data; /* User data */
|
void *data; /* User data */
|
||||||
/* ... internal to lock manager, don't touch ... */
|
/* ... internal to lock manager, don't touch ... */
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
* when the protocol has explicitly requested it via the %NEF_STICKY
|
* when the protocol has explicitly requested it via the %NEF_STICKY
|
||||||
* flag because it wishes to be notified when the node will again become
|
* flag because it wishes to be notified when the node will again become
|
||||||
* a neighbor. Such entries are enqueued in a special list which is walked
|
* a neighbor. Such entries are enqueued in a special list which is walked
|
||||||
* whenever an interface changes its state to up.
|
* whenever an interface changes its state to up. Neighbor entry VRF
|
||||||
|
* association is implied by respective protocol.
|
||||||
*
|
*
|
||||||
* When a neighbor event occurs (a neighbor gets disconnected or a sticky
|
* When a neighbor event occurs (a neighbor gets disconnected or a sticky
|
||||||
* inactive neighbor becomes connected), the protocol hook neigh_notify()
|
* inactive neighbor becomes connected), the protocol hook neigh_notify()
|
||||||
|
@ -152,8 +153,9 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WALK_LIST(i, iface_list)
|
WALK_LIST(i, iface_list)
|
||||||
if ((scope = if_connected(a, i, &addr)) >= 0)
|
if ((!p->vrf || p->vrf == i->master) &&
|
||||||
{
|
((scope = if_connected(a, i, &addr)) >= 0))
|
||||||
|
{
|
||||||
ifa = i;
|
ifa = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1181,6 +1181,7 @@ bgp_start(struct proto *P)
|
||||||
lock->addr = p->cf->remote_ip;
|
lock->addr = p->cf->remote_ip;
|
||||||
lock->port = p->cf->remote_port;
|
lock->port = p->cf->remote_port;
|
||||||
lock->iface = p->cf->iface;
|
lock->iface = p->cf->iface;
|
||||||
|
lock->vrf = p->cf->iface ? NULL : p->p.vrf;
|
||||||
lock->type = OBJLOCK_TCP;
|
lock->type = OBJLOCK_TCP;
|
||||||
lock->hook = bgp_start_locked;
|
lock->hook = bgp_start_locked;
|
||||||
lock->data = p;
|
lock->data = p;
|
||||||
|
|
|
@ -321,7 +321,6 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf
|
||||||
ifa->timer = tm;
|
ifa->timer = tm;
|
||||||
|
|
||||||
struct object_lock *lock = olock_new(pool);
|
struct object_lock *lock = olock_new(pool);
|
||||||
lock->addr = IPA_NONE;
|
|
||||||
lock->type = OBJLOCK_IP;
|
lock->type = OBJLOCK_IP;
|
||||||
lock->port = ICMPV6_PROTO;
|
lock->port = ICMPV6_PROTO;
|
||||||
lock->iface = iface;
|
lock->iface = iface;
|
||||||
|
|
Loading…
Reference in a new issue