#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;
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);
{
struct zebra_vrf *zvrf;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_get_evpn();
if (zvrf && zvrf->advertise_gw_macip)
return 1;
struct stream *s = NULL;
int advertise = 0;
enum vxlan_flood_control flood_ctrl;
+ struct zebra_vrf *zvrf_default = NULL;
- if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_debug("EVPN VNI Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zvrf_default = zebra_vrf_lookup_by_id(VRF_DEFAULT);
+ if (!zvrf_default)
return;
- }
s = msg;
STREAM_GETC(s, advertise);
STREAM_GETC(s, flood_ctrl);
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",
is_evpn_enabled() ? "enabled" : "disabled",
flood_ctrl);
return;
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 */
zvrf->vxlan_flood_ctrl = flood_ctrl;
/* cleanup all l3vnis */
hash_iterate(zrouter.l3vni_table, zl3vni_cleanup_all, NULL);
+
+ /* Fallback to the default VRF. */
+ zvrf_default->evpn_vrf_id = VRF_DEFAULT;
}
stream_failure: