]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: fix wrong conversion for evpn advertising
authoranlan_cs <vic.lan@pica8.com>
Thu, 19 Jan 2023 06:19:51 +0000 (14:19 +0800)
committeranlan_cs <vic.lan@pica8.com>
Fri, 20 Jan 2023 01:47:46 +0000 (09:47 +0800)
The two commands ( `advertise-svi-ip` and `advertise-default-gw` ) can
be set in both `BGP_EVPN_NODE` and `BGP_EVPN_VNI_NODE`. So, when
configuring one of them, need to consider the configuration of the
other.  Configuring it under `BGP_EVPN_NODE`, it does check the other.
However, the conversion is wrong when configured under `BGP_EVPN_VNI_NODE`.

One example:
With the following steps, the evpn routes with `SVI` will be mistakenly
withdrawn.

```
anlan(config-router-af)# advertise-svi-ip
anlan(config-router-af)# vni 100
anlan(config-router-af-vni)# advertise-svi-ip
anlan(config-router-af-vni)# no advertise-svi-ip
```

This commit fixed the conversion under `BGP_EVPN_VNI_NODE` for the
two commands.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
zebra/zebra_vxlan.c

index 568ebf2961074d681ea9b766ac607781130ad61e..c6ff5089ca9e50dabdf34187b32665d056e0b858 100644 (file)
@@ -5554,6 +5554,7 @@ void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS)
                struct zebra_if *zif = NULL;
                struct zebra_l2info_vxlan zl2_info;
                struct interface *vlan_if = NULL;
+               int old_advertise;
 
                zevpn = zebra_evpn_lookup(vni);
                if (!zevpn)
@@ -5567,13 +5568,14 @@ void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS)
                                        ? "enabled"
                                        : "disabled");
 
-               if (zevpn->advertise_svi_macip == advertise)
-                       return;
+               old_advertise = advertise_svi_macip_enabled(zevpn);
 
                /* Store flag even though SVI is not present.
                 * Once SVI comes up triggers self MAC-IP route add.
                 */
                zevpn->advertise_svi_macip = advertise;
+               if (advertise_svi_macip_enabled(zevpn) == old_advertise)
+                       return;
 
                ifp = zevpn->vxlan_if;
                if (!ifp)
@@ -5719,6 +5721,7 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)
                struct zebra_l2info_vxlan zl2_info;
                struct interface *vlan_if = NULL;
                struct interface *vrr_if = NULL;
+               int old_advertise;
 
                zevpn = zebra_evpn_lookup(vni);
                if (!zevpn)
@@ -5731,10 +5734,11 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)
                                advertise_gw_macip_enabled(zevpn) ? "enabled"
                                                                  : "disabled");
 
-               if (zevpn->advertise_gw_macip == advertise)
-                       return;
+               old_advertise = advertise_gw_macip_enabled(zevpn);
 
                zevpn->advertise_gw_macip = advertise;
+               if (advertise_gw_macip_enabled(zevpn) == old_advertise)
+                       return;
 
                ifp = zevpn->vxlan_if;
                if (!ifp)