]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_vxlan.c
zebra: install EVPN gateway MAC as static/sticky
[mirror_frr.git] / zebra / zebra_vxlan.c
index 59f0cf52f0a1b46664f472442b23090663d568c3..a3b1c7d62e79db11103efad2b859e827edfacfc9 100644 (file)
@@ -581,6 +581,9 @@ static void zvni_print_mac(zebra_mac_t *mac, void *ctxt)
        if (CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW))
                vty_out(vty, " Default-gateway Mac ");
 
+       if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW))
+               vty_out(vty, " Remote-gateway Mac ");
+
        vty_out(vty, "\n");
        /* print all the associated neigh */
        vty_out(vty, " Neighbors:\n");
@@ -2534,7 +2537,8 @@ static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac)
                return -1;
        vxl = &zif->l2info.vxl;
 
-       sticky = CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY) ? 1 : 0;
+       sticky = CHECK_FLAG(mac->flags,
+                        (ZEBRA_MAC_STICKY | ZEBRA_MAC_REMOTE_DEF_GW)) ? 1 : 0;
 
        return kernel_add_mac(zvni->vxlan_if, vxl->access_vlan, &mac->macaddr,
                              mac->fwd_info.r_vtep_ip, sticky);
@@ -5152,6 +5156,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
        char buf[ETHER_ADDR_STRLEN];
        char buf1[INET6_ADDRSTRLEN];
        uint8_t sticky = 0;
+       u_char remote_gw = 0;
        uint8_t flags = 0;
        struct interface *ifp = NULL;
        struct zebra_if *zif = NULL;
@@ -5193,6 +5198,7 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
                /* Get flags - sticky mac and/or gateway mac */
                STREAM_GETC(s, flags);
                sticky = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
+               remote_gw = CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
                l++;
 
                if (IS_ZEBRA_DEBUG_VXLAN)
@@ -5266,6 +5272,8 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
                if (!mac || !CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)
                    || (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY) ? 1 : 0)
                               != sticky
+                   || (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW) ? 1 : 0)
+                              != remote_gw
                    || !IPV4_ADDR_SAME(&mac->fwd_info.r_vtep_ip, &vtep_ip))
                        update_mac = 1;
 
@@ -5297,6 +5305,11 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
                        else
                                UNSET_FLAG(mac->flags, ZEBRA_MAC_STICKY);
 
+                       if (remote_gw)
+                               SET_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW);
+                       else
+                               UNSET_FLAG(mac->flags, ZEBRA_MAC_REMOTE_DEF_GW);
+
                        zvni_process_neigh_on_remote_mac_add(zvni, mac);
 
                        /* Install the entry. */