]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, zebra: Redo checks to advertise_all_vni
authorTuetuopay <tuetuopay@me.com>
Fri, 22 Mar 2019 12:37:06 +0000 (13:37 +0100)
committerTuetuopay <tuetuopay@me.com>
Fri, 22 Mar 2019 12:37:06 +0000 (13:37 +0100)
This replaces manual checks of the flag with a wrapper macro to convey
the meaning "is evpn enabled on this vrf?"

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
bgpd/bgp_evpn.h
bgpd/bgp_evpn_vty.c
bgpd/bgp_zebra.c
zebra/zebra_vxlan.c
zebra/zebra_vxlan.h

index bcc524d5aa48f692af66dc9b173c740ead39bbd4..7f88c1ebf0950267a9cf4ae913d1ed70877c57ea 100644 (file)
 #define EVPN_ROUTE_STRLEN 200 /* Must be >> MAC + IPv6 strings. */
 #define EVPN_AUTORT_VXLAN 0x10000000
 
+#define EVPN_ENABLED(bgp)  (bgp)->advertise_all_vni
 static inline int is_evpn_enabled(void)
 {
        struct bgp *bgp = NULL;
 
        bgp = bgp_get_evpn();
-       return bgp ? bgp->advertise_all_vni : 0;
+       return bgp ? EVPN_ENABLED(bgp) : 0;
 }
 
 static inline void vni2label(vni_t vni, mpls_label_t *label)
index 08f487e497e4389a2a836681ed649f733e2ed06f..f020483ebbcf052d74c073bae3c916ffdc815492 100644 (file)
@@ -2917,7 +2917,7 @@ DEFUN (bgp_evpn_advertise_default_gw,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under the EVPN VRF\n");
                return CMD_WARNING;
@@ -2939,7 +2939,7 @@ DEFUN (no_bgp_evpn_advertise_default_gw,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under the EVPN VRF\n");
                return CMD_WARNING;
@@ -3066,7 +3066,7 @@ DEFPY (dup_addr_detection,
        if (!bgp_vrf)
                return CMD_WARNING;
 
-       if (!bgp_vrf->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp_vrf)) {
                vty_out(vty,
                        "This command is only supported under the EVPN VRF\n");
                return CMD_WARNING;
@@ -3098,7 +3098,7 @@ DEFPY (dup_addr_detection_auto_recovery,
        if (!bgp_vrf)
                return CMD_WARNING;
 
-       if (!bgp_vrf->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp_vrf)) {
                vty_out(vty,
                        "This command is only supported under the EVPN VRF\n");
                return CMD_WARNING;
@@ -3133,7 +3133,7 @@ DEFPY (no_dup_addr_detection,
        if (!bgp_vrf)
                return CMD_WARNING;
 
-       if (!bgp_vrf->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp_vrf)) {
                vty_out(vty,
                        "This command is only supported under the EVPN VRF\n");
                return CMD_WARNING;
@@ -3205,7 +3205,7 @@ DEFPY(bgp_evpn_advertise_svi_ip,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -4522,7 +4522,7 @@ DEFUN (bgp_evpn_vni_rd,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -4558,7 +4558,7 @@ DEFUN (no_bgp_evpn_vni_rd,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -4598,7 +4598,7 @@ DEFUN (no_bgp_evpn_vni_rd_without_val,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -4927,7 +4927,7 @@ DEFUN (bgp_evpn_vni_rt,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -4995,7 +4995,7 @@ DEFUN (no_bgp_evpn_vni_rt,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
@@ -5094,7 +5094,7 @@ DEFUN (no_bgp_evpn_vni_rt_without_val,
        if (!bgp)
                return CMD_WARNING;
 
-       if (!bgp->advertise_all_vni) {
+       if (!EVPN_ENABLED(bgp)) {
                vty_out(vty,
                        "This command is only supported under EVPN VRF\n");
                return CMD_WARNING;
index 398735d7a4260d7204893b61e096e5e2390f8031..0c77f63335026ea45ca56edb723962cdb20cd4fa 100644 (file)
@@ -1632,8 +1632,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
                        return CMD_WARNING;
 
 #if ENABLE_BGP_VNC
-               if (bgp->advertise_all_vni
-                   && type == ZEBRA_ROUTE_VNC_DIRECT) {
+               if (EVPN_ENABLED(bgp) && type == ZEBRA_ROUTE_VNC_DIRECT) {
                        vnc_export_bgp_enable(
                                bgp, afi); /* only enables if mode bits cfg'd */
                }
@@ -1794,7 +1793,7 @@ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type,
  * status. red lookup fails if there is no zebra connection.
  */
 #if ENABLE_BGP_VNC
-       if (bgp->advertise_all_vni && type == ZEBRA_ROUTE_VNC_DIRECT) {
+       if (EVPN_ENABLED(bgp) && type == ZEBRA_ROUTE_VNC_DIRECT) {
                vnc_export_bgp_disable(bgp, afi);
        }
 #endif
index 0ceaed8d24ddef03f9b651f819437d7ea44796b5..2934a2ecd5553a1fa5538f3615166b477c7bcfcf 100644 (file)
@@ -9048,7 +9048,7 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
 
        /* Mismatch between EVPN VRF and current VRF (should be prevented by
         * bgpd's cli) */
-       if (is_evpn_enabled() && !zvrf->advertise_all_vni)
+       if (is_evpn_enabled() && !EVPN_ENABLED(zvrf))
                return;
 
        s = msg;
@@ -9066,7 +9066,7 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
                return;
 
        zvrf->advertise_all_vni = advertise;
-       if (zvrf->advertise_all_vni) {
+       if (EVPN_ENABLED(zvrf)) {
                zvrf_default->evpn_vrf_id = zvrf_id(zvrf);
 
                /* Note BUM handling */
index 6ca33ae15943d49ff2babf543004b93f62cc6a8d..46165cf4daff23175bea4115df9e77f2fa074361 100644 (file)
@@ -41,7 +41,7 @@ static inline int is_evpn_enabled(void)
 {
        struct zebra_vrf *zvrf = NULL;
        zvrf = zebra_vrf_get_evpn();
-       return zvrf ? zvrf->advertise_all_vni : 0;
+       return zvrf ? EVPN_ENABLED(zvrf) : 0;
 }
 
 static inline int