summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-11-02 11:38:01 +0100
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-12-14 19:57:07 +0100
commit94c2f693a44460f5f741863da5980bd1bb7c01d9 (patch)
treee9d65df7536d0d7e3e9bbffe9dd542c16abbc982 /bgpd
parentbgpd: update type-5 routes when RD changes (diff)
downloadfrr-94c2f693a44460f5f741863da5980bd1bb7c01d9.tar.xz
frr-94c2f693a44460f5f741863da5980bd1bb7c01d9.zip
bgpd: evpn enabled should only be checked for default instance
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_evpn.h9
-rw-r--r--bgpd/bgp_evpn_vty.c5
-rw-r--r--bgpd/bgp_vty.c5
-rw-r--r--bgpd/bgp_zebra.c4
-rw-r--r--bgpd/bgpd.c4
5 files changed, 18 insertions, 9 deletions
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h
index 488ebf686..63985a59a 100644
--- a/bgpd/bgp_evpn.h
+++ b/bgpd/bgp_evpn.h
@@ -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 *);
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index b2f4737b2..849432fca 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -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);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 6c8a4f3d8..102f8df48 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -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");
}
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 3a8631f2f..72c16b101 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -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. */
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index bfca1d729..3a21cfcad 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -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;