]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: handle local-es bridge port association
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Tue, 14 Apr 2020 15:30:09 +0000 (08:30 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Mon, 26 Oct 2020 17:33:21 +0000 (10:33 -0700)
A local ES can be added or removed to a bridge after it is created.
When it becomes a bridge port member the dataplane attributes need
to be programmed.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
zebra/zebra_evpn_mh.c
zebra/zebra_evpn_mh.h
zebra/zebra_l2.c

index 3c457bdfa5d88aea920dc8c726af7b4b0f995ec9..02c0736767496167dd4e0941b24e2b8c316b9c85 100644 (file)
@@ -1505,6 +1505,30 @@ static void zebra_evpn_es_local_mac_update(struct zebra_evpn_es *es,
        }
 }
 
+void zebra_evpn_es_local_br_port_update(struct zebra_if *zif)
+{
+       struct zebra_evpn_es *es = zif->es_info.es;
+       bool old_br_port = !!(es->flags & ZEBRA_EVPNES_BR_PORT);
+       bool new_br_port;
+
+       if (zif->brslave_info.bridge_ifindex != IFINDEX_INTERNAL)
+               es->flags |= ZEBRA_EVPNES_BR_PORT;
+       else
+               es->flags &= ~ZEBRA_EVPNES_BR_PORT;
+
+       new_br_port = !!(es->flags & ZEBRA_EVPNES_BR_PORT);
+       if (old_br_port == new_br_port)
+               return;
+
+       if (IS_ZEBRA_DEBUG_EVPN_MH_ES)
+               zlog_debug("es %s br_port change old %u new %u", es->esi_str,
+                          old_br_port, new_br_port);
+
+       /* update the dataplane br_port attrs */
+       if (new_br_port && zebra_evpn_es_br_port_dplane_update_needed(es))
+               zebra_evpn_es_br_port_dplane_update(es, __func__);
+}
+
 static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es,
                struct zebra_if *zif)
 {
@@ -1529,6 +1553,9 @@ static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es,
        if (if_is_operative(zif->ifp))
                es->flags |= ZEBRA_EVPNES_OPER_UP;
 
+       if (zif->brslave_info.bridge_ifindex != IFINDEX_INTERNAL)
+               es->flags |= ZEBRA_EVPNES_BR_PORT;
+
        /* setup base-vni if one doesn't already exist; the ES will get sent
         * to BGP as a part of that process
         */
@@ -1590,6 +1617,9 @@ static void zebra_evpn_es_local_info_clear(struct zebra_evpn_es **esp)
        zif->es_info.es = NULL;
        es->zif = NULL;
 
+       /* clear all local flags associated with the ES */
+       es->flags &= ~(ZEBRA_EVPNES_OPER_UP | ZEBRA_EVPNES_BR_PORT);
+
        /* remove from the ES list */
        list_delete_node(zmh_info->local_es_list, &es->local_es_listnode);
 
@@ -2094,9 +2124,14 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty,
                vty_out(vty, " Interface: %s\n",
                                (es->zif) ?
                                es->zif->ifp->name : "-");
-               vty_out(vty, " State: %s\n",
-                               (es->flags & ZEBRA_EVPNES_OPER_UP) ?
-                               "up" : "down");
+               if (es->flags & ZEBRA_EVPNES_LOCAL) {
+                       vty_out(vty, " State: %s\n",
+                               (es->flags & ZEBRA_EVPNES_OPER_UP) ? "up"
+                                                                  : "down");
+                       vty_out(vty, " Bridge port: %s\n",
+                               (es->flags & ZEBRA_EVPNES_BR_PORT) ? "yes"
+                                                                  : "no");
+               }
                vty_out(vty, " Ready for BGP: %s\n",
                                (es->flags & ZEBRA_EVPNES_READY_FOR_BGP) ?
                                "yes" : "no");
index da3c31df950aad5e93a42541025107d786c15f73..ee162ad4869feda5ef9bf60170a5ec508da54c38 100644 (file)
@@ -257,5 +257,6 @@ extern int zebra_evpn_mh_mac_holdtime_update(struct vty *vty,
 void zebra_evpn_mh_config_write(struct vty *vty);
 int zebra_evpn_mh_neigh_holdtime_update(struct vty *vty,
                uint32_t duration, bool set_default);
+void zebra_evpn_es_local_br_port_update(struct zebra_if *zif);
 
 #endif /* _ZEBRA_EVPN_MH_H */
index 417056ecb0ee7e3e6237ff914b8dd43057ecf6f3..19d8bfd733d17d70813ca4bcff48db4694f83210 100644 (file)
@@ -286,6 +286,8 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
                /* In the case of VxLAN, invoke the handler for EVPN. */
                if (zif->zif_type == ZEBRA_IF_VXLAN)
                        zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
+               if (zif->es_info.es)
+                       zebra_evpn_es_local_br_port_update(zif);
        } else if (old_bridge_ifindex != IFINDEX_INTERNAL) {
                /*
                 * In the case of VxLAN, invoke the handler for EVPN.
@@ -294,6 +296,8 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
                 */
                if (zif->zif_type == ZEBRA_IF_VXLAN)
                        zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
+               if (zif->es_info.es)
+                       zebra_evpn_es_local_br_port_update(zif);
                zebra_l2_unmap_slave_from_bridge(&zif->brslave_info);
        }
 }