diff options
author | Tuetuopay <tuetuopay@me.com> | 2019-02-19 21:37:59 +0100 |
---|---|---|
committer | Tuetuopay <tuetuopay@me.com> | 2019-03-19 11:56:25 +0100 |
commit | 150971b5ecc3416496a2ffaf2a35c108c970553c (patch) | |
tree | c5b87c9137ee51e6fc39525ae0fcfd004d13e243 /zebra/zebra_vrf.h | |
parent | bgpd: Allow non-default instance to be EVPN one (diff) | |
download | frr-150971b5ecc3416496a2ffaf2a35c108c970553c.tar.xz frr-150971b5ecc3416496a2ffaf2a35c108c970553c.zip |
zebra: Store the EVPN VRF in the default VRF
The EVPN VRF is defined by bgpd, and is the one vrf where
`advertise-all-vni` is present.
Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
Diffstat (limited to 'zebra/zebra_vrf.h')
-rw-r--r-- | zebra/zebra_vrf.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index e35101d83..3574f4b67 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -107,23 +107,28 @@ struct zebra_vrf { #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0) /* - * VNI hash table (for EVPN). Only in default instance. + * VNI hash table (for EVPN). Only in the EVPN instance. */ struct hash *vni_table; /* - * Whether EVPN is enabled or not. Only in default instance. + * Whether EVPN is enabled or not. Only in the EVPN instance. */ int advertise_all_vni; /* * Whether we are advertising g/w macip in EVPN or not. - * Only in default instance. + * Only in the EVPN instance. */ int advertise_gw_macip; int advertise_svi_macip; + /* + * The EVPN instance, if any + */ + vrf_id_t evpn_vrf_id; + /* l3-vni info */ vni_t l3vni; @@ -196,6 +201,17 @@ extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *); extern struct zebra_vrf *zebra_vrf_alloc(void); extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t); +static inline vrf_id_t zebra_vrf_get_evpn_id(void) +{ + struct zebra_vrf *zvrf = NULL; + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); + return zvrf ? zvrf->evpn_vrf_id : VRF_DEFAULT; +} +static inline struct zebra_vrf *zebra_vrf_get_evpn(void) +{ + return zebra_vrf_lookup_by_id(zebra_vrf_get_evpn_id()); +} + extern struct route_table * zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, vrf_id_t vrf_id); extern int zebra_vrf_has_config(struct zebra_vrf *zvrf); |