mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 01:40:16 +00:00
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
This commit is contained in:
parent
e2f3a930c5
commit
150971b5ec
@ -107,23 +107,28 @@ struct zebra_vrf {
|
|||||||
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
|
#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;
|
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;
|
int advertise_all_vni;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Whether we are advertising g/w macip in EVPN or not.
|
* 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_gw_macip;
|
||||||
|
|
||||||
int advertise_svi_macip;
|
int advertise_svi_macip;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The EVPN instance, if any
|
||||||
|
*/
|
||||||
|
vrf_id_t evpn_vrf_id;
|
||||||
|
|
||||||
/* l3-vni info */
|
/* l3-vni info */
|
||||||
vni_t l3vni;
|
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 zebra_vrf *zebra_vrf_alloc(void);
|
||||||
extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
|
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 *
|
extern struct route_table *
|
||||||
zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, vrf_id_t vrf_id);
|
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);
|
extern int zebra_vrf_has_config(struct zebra_vrf *zvrf);
|
||||||
|
@ -324,7 +324,7 @@ static int advertise_gw_macip_enabled(zebra_vni_t *zvni)
|
|||||||
{
|
{
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
|
|
||||||
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
zvrf = zebra_vrf_get_evpn();
|
||||||
if (zvrf && zvrf->advertise_gw_macip)
|
if (zvrf && zvrf->advertise_gw_macip)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -9041,19 +9041,19 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
|||||||
struct stream *s = NULL;
|
struct stream *s = NULL;
|
||||||
int advertise = 0;
|
int advertise = 0;
|
||||||
enum vxlan_flood_control flood_ctrl;
|
enum vxlan_flood_control flood_ctrl;
|
||||||
|
struct zebra_vrf *zvrf_default = NULL;
|
||||||
|
|
||||||
if (zvrf_id(zvrf) != VRF_DEFAULT) {
|
zvrf_default = zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
||||||
zlog_debug("EVPN VNI Adv for non-default VRF %u",
|
if (!zvrf_default)
|
||||||
zvrf_id(zvrf));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
s = msg;
|
s = msg;
|
||||||
STREAM_GETC(s, advertise);
|
STREAM_GETC(s, advertise);
|
||||||
STREAM_GETC(s, flood_ctrl);
|
STREAM_GETC(s, flood_ctrl);
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_VXLAN)
|
if (IS_ZEBRA_DEBUG_VXLAN)
|
||||||
zlog_debug("EVPN VNI Adv %s, currently %s, flood control %u",
|
zlog_debug("EVPN VRF %s(%u) VNI Adv %s, currently %s, flood control %u",
|
||||||
|
zvrf_name(zvrf), zvrf_id(zvrf),
|
||||||
advertise ? "enabled" : "disabled",
|
advertise ? "enabled" : "disabled",
|
||||||
is_evpn_enabled() ? "enabled" : "disabled",
|
is_evpn_enabled() ? "enabled" : "disabled",
|
||||||
flood_ctrl);
|
flood_ctrl);
|
||||||
@ -9062,7 +9062,9 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
zvrf->advertise_all_vni = advertise;
|
zvrf->advertise_all_vni = advertise;
|
||||||
if (is_evpn_enabled()) {
|
if (zvrf->advertise_all_vni) {
|
||||||
|
zvrf_default->evpn_vrf_id = zvrf_id(zvrf);
|
||||||
|
|
||||||
/* Note BUM handling */
|
/* Note BUM handling */
|
||||||
zvrf->vxlan_flood_ctrl = flood_ctrl;
|
zvrf->vxlan_flood_ctrl = flood_ctrl;
|
||||||
|
|
||||||
@ -9086,6 +9088,9 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
|||||||
|
|
||||||
/* cleanup all l3vnis */
|
/* cleanup all l3vnis */
|
||||||
hash_iterate(zrouter.l3vni_table, zl3vni_cleanup_all, NULL);
|
hash_iterate(zrouter.l3vni_table, zl3vni_cleanup_all, NULL);
|
||||||
|
|
||||||
|
/* Fallback to the default VRF. */
|
||||||
|
zvrf_default->evpn_vrf_id = VRF_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_failure:
|
stream_failure:
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
static inline int is_evpn_enabled(void)
|
static inline int is_evpn_enabled(void)
|
||||||
{
|
{
|
||||||
struct zebra_vrf *zvrf = NULL;
|
struct zebra_vrf *zvrf = NULL;
|
||||||
zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
zvrf = zebra_vrf_get_evpn();
|
||||||
return zvrf ? zvrf->advertise_all_vni : 0;
|
return zvrf ? zvrf->advertise_all_vni : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user