bgpd: evpn enabled should only be checked for default instance

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
This commit is contained in:
Mitesh Kanjariya 2017-11-02 03:38:01 -07:00
parent 80b140af22
commit 94c2f693a4
5 changed files with 18 additions and 9 deletions

View File

@ -22,9 +22,18 @@
#define _QUAGGA_BGP_EVPN_H
#include "vxlan.h"
#include "bgpd.h"
#define EVPN_ROUTE_STRLEN 200 /* Must be >> MAC + IPv6 strings. */
static inline int is_evpn_enabled(void)
{
struct bgp *bgp = NULL;
bgp = bgp_get_default();
return bgp ? bgp->advertise_all_vni : 0;
}
extern void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi);
extern void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi);
extern void bgp_evpn_vrf_delete(struct bgp *);

View File

@ -2578,7 +2578,7 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
? "Enabled"
: "Disabled");
json_object_string_add(json, "advertiseAllVnis",
bgp->advertise_all_vni
is_evpn_enabled()
? "Enabled"
: "Disabled");
} else {
@ -2588,8 +2588,7 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
/* Display all VNIs */
vty_out(vty, "Advertise All VNI flag: %s\n",
bgp->advertise_all_vni ? "Enabled"
: "Disabled");
is_evpn_enabled() ? "Enabled" : "Disabled");
}
evpn_show_all_vnis(vty, bgp, json);

View File

@ -58,6 +58,7 @@
#include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_bfd.h"
#include "bgpd/bgp_io.h"
#include "bgpd/bgp_evpn.h"
static struct peer_group *listen_range_exists(struct bgp *bgp,
struct prefix *range, int exact);
@ -7743,7 +7744,7 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
}
if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
if (p->bgp->advertise_all_vni)
if (is_evpn_enabled())
json_object_boolean_true_add(
json_addr, "advertiseAllVnis");
}
@ -8015,7 +8016,7 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
/* advertise-vni-all */
if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
if (p->bgp->advertise_all_vni)
if (is_evpn_enabled())
vty_out(vty, " advertise-all-vni\n");
}

View File

@ -1573,7 +1573,7 @@ void bgp_zebra_instance_register(struct bgp *bgp)
/* For default instance, register to learn about VNIs, if appropriate.
*/
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT
&& bgp->advertise_all_vni)
&& is_evpn_enabled())
bgp_zebra_advertise_all_vni(bgp, 1);
}
@ -1592,7 +1592,7 @@ void bgp_zebra_instance_deregister(struct bgp *bgp)
/* For default instance, unregister learning about VNIs, if appropriate.
*/
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT
&& bgp->advertise_all_vni)
&& is_evpn_enabled())
bgp_zebra_advertise_all_vni(bgp, 0);
/* Deregister for router-id, interfaces, redistributed routes. */

View File

@ -217,7 +217,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id)
return 0;
/* EVPN uses router id in RD, withdraw them */
if (bgp->advertise_all_vni)
if (is_evpn_enabled())
bgp_evpn_handle_router_id_update(bgp, TRUE);
IPV4_ADDR_COPY(&bgp->router_id, id);
@ -234,7 +234,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id)
}
/* EVPN uses router id in RD, update them */
if (bgp->advertise_all_vni)
if (is_evpn_enabled())
bgp_evpn_handle_router_id_update(bgp, FALSE);
return 0;