diff options
| author | Stephen Worley <sworley@nvidia.com> | 2021-05-26 17:36:16 -0400 |
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2021-06-08 15:05:43 -0400 |
| commit | 7c2ddfb976af93b373bccf080ab228ce4b097244 (patch) | |
| tree | 3819c521aa6d4ba465cc5f560cf52027dc536096 /zebra/rib.h | |
| parent | fdb7f5d54f94225b0f70709ef44b06d10b59f535 (diff) | |
zebra: rework RA handling for vrf-lite
Rework RA handling for vrf-lite scenarios.
Before we were using a single FD descriptor for polling
across multiple zvrf's. This would cause us to hit this
assert() in some bgp unnumbered and vrrp configs:
```
/*
* What happens if we have a thread already
* created for this event?
*/
if (thread_array[fd])
assert(!"Thread already scheduled for file descriptor");
```
We were scheduling a thread_read on the same FD for every zvrf.
With vrf-lite, RAs and ARPs are not vrf-bound, so we can just use one
rtadv instance to manage them for all VRFs. We will choose the default
VRF for this.
This patch removes the rtadv_sock altogether for zrouter and moves the
functionality this represented to the default VRF. All RAs will be
handled in the default VRF under vrf-lite configs with only one poll
thread started for it.
This patch also extends how we track subscribed interfaces (s or msec)
to use an actual sorted list by interface names rather than just a
counter. With multiple daemons turning interfaces/on/off these counters
can get very wrong during ifup/down events. Making them a sorted list
prevents this from happening by preventing duplicates.
With netns-vrf's nothing should change other than the interface list.
Signed-off-by: Stephen Worley <sworley@nvidia.com>
Diffstat (limited to 'zebra/rib.h')
| -rw-r--r-- | zebra/rib.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/zebra/rib.h b/zebra/rib.h index 75d7ae1b67..d72bb672c6 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -288,16 +288,30 @@ DECLARE_LIST(re_list, struct route_entry, next); #define RNODE_NEXT_RE(rn, re) RE_DEST_NEXT_ROUTE(rib_dest_from_rnode(rn), re) #if defined(HAVE_RTADV) +PREDECL_SORTLIST_UNIQ(adv_if_list); /* Structure which hold status of router advertisement. */ struct rtadv { int sock; - int adv_if_count; - int adv_msec_if_count; + struct adv_if_list_head adv_if; + struct adv_if_list_head adv_msec_if; struct thread *ra_read; struct thread *ra_timer; }; + +/* adv list node */ +struct adv_if { + char name[INTERFACE_NAMSIZ]; + struct adv_if_list_item list_item; +}; + +static int adv_if_cmp(const struct adv_if *a, const struct adv_if *b) +{ + return if_cmp_name_func(a->name, b->name); +} + +DECLARE_SORTLIST_UNIQ(adv_if_list, struct adv_if, list_item, adv_if_cmp); #endif /* HAVE_RTADV */ /* |
