mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 06:43:16 +00:00
zebra: Move the EVPN VRF pointer to zebra_router
It had no logical reason to be in the default VRF. This moves it to the zebra_router, which is better suited to store global references. Signed-off-by: Tuetuopay <tuetuopay@me.com> Sponsored-by: Scaleway
This commit is contained in:
parent
986512a320
commit
0fb2ad05d9
@ -104,6 +104,11 @@ struct zebra_router {
|
||||
|
||||
/* Mlag information for the router */
|
||||
struct zebra_mlag_info mlag_info;
|
||||
|
||||
/*
|
||||
* The EVPN instance, if any
|
||||
*/
|
||||
struct zebra_vrf *evpn_vrf;
|
||||
};
|
||||
|
||||
extern struct zebra_router zrouter;
|
||||
@ -127,4 +132,14 @@ extern void zebra_router_sweep_route(void);
|
||||
extern void zebra_router_show_table_summary(struct vty *vty);
|
||||
|
||||
extern uint32_t zebra_router_get_next_sequence(void);
|
||||
|
||||
static inline vrf_id_t zebra_vrf_get_evpn_id(void)
|
||||
{
|
||||
return zrouter.evpn_vrf ? zvrf_id(zrouter.evpn_vrf) : VRF_DEFAULT;
|
||||
}
|
||||
static inline struct zebra_vrf *zebra_vrf_get_evpn(void)
|
||||
{
|
||||
return zrouter.evpn_vrf ? zrouter.evpn_vrf
|
||||
: zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
||||
}
|
||||
#endif
|
||||
|
@ -124,11 +124,6 @@ struct zebra_vrf {
|
||||
|
||||
int advertise_svi_macip;
|
||||
|
||||
/*
|
||||
* The EVPN instance, if any
|
||||
*/
|
||||
vrf_id_t evpn_vrf_id;
|
||||
|
||||
/* l3-vni info */
|
||||
vni_t l3vni;
|
||||
|
||||
@ -201,15 +196,6 @@ 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)
|
||||
{
|
||||
return zebra_vrf_lookup_by_id(VRF_DEFAULT)->evpn_vrf_id;
|
||||
}
|
||||
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);
|
||||
|
@ -9042,9 +9042,6 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
||||
struct stream *s = NULL;
|
||||
int advertise = 0;
|
||||
enum vxlan_flood_control flood_ctrl;
|
||||
struct zebra_vrf *zvrf_default = NULL;
|
||||
|
||||
zvrf_default = zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
||||
|
||||
/* Mismatch between EVPN VRF and current VRF (should be prevented by
|
||||
* bgpd's cli) */
|
||||
@ -9067,7 +9064,7 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
||||
|
||||
zvrf->advertise_all_vni = advertise;
|
||||
if (EVPN_ENABLED(zvrf)) {
|
||||
zvrf_default->evpn_vrf_id = zvrf_id(zvrf);
|
||||
zrouter.evpn_vrf = zvrf;
|
||||
|
||||
/* Note BUM handling */
|
||||
zvrf->vxlan_flood_ctrl = flood_ctrl;
|
||||
@ -9093,8 +9090,8 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
|
||||
/* cleanup all l3vnis */
|
||||
hash_iterate(zrouter.l3vni_table, zl3vni_cleanup_all, NULL);
|
||||
|
||||
/* Fallback to the default VRF. */
|
||||
zvrf_default->evpn_vrf_id = VRF_DEFAULT;
|
||||
/* Mark as "no EVPN VRF" */
|
||||
zrouter.evpn_vrf = NULL;
|
||||
}
|
||||
|
||||
stream_failure:
|
||||
@ -9135,6 +9132,7 @@ void zebra_vxlan_init(void)
|
||||
{
|
||||
zrouter.l3vni_table = hash_create(l3vni_hash_keymake, l3vni_hash_cmp,
|
||||
"Zebra VRF L3 VNI table");
|
||||
zrouter.evpn_vrf = NULL;
|
||||
}
|
||||
|
||||
/* free l3vni table */
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define _ZEBRA_VXLAN_H
|
||||
|
||||
#include <zebra.h>
|
||||
#include <zebra/zebra_router.h>
|
||||
|
||||
#include "linklist.h"
|
||||
#include "if.h"
|
||||
|
Loading…
Reference in New Issue
Block a user