@@ -1480,20 +1480,21 @@ int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive,
14801480 return 0 ;
14811481 }
14821482
1483- if (IS_ZEBRA_DEBUG_EVPN_MH_MAC ) {
1484- char mac_buf [MAC_BUF_SIZE ];
1483+ if (!zebra_mac_ext_learn_mode () || CHECK_FLAG (mac -> flags , ZEBRA_MAC_LOCAL_INACTIVE )) {
1484+ /* For Extern Only mode:
1485+ * Update the dataplane only when the MAC is inactive
1486+ */
1487+ if (IS_ZEBRA_DEBUG_EVPN_MH_MAC ) {
1488+ char mac_buf [MAC_BUF_SIZE ];
14851489
1486- zlog_debug ("dp-install sync-mac vni %u mac %pEA es %s %s%s%s" ,
1487- zevpn -> vni , & mac -> macaddr ,
1488- mac -> es ? mac -> es -> esi_str : "-" ,
1489- zebra_evpn_zebra_mac_flag_dump ( mac , mac_buf ,
1490- sizeof ( mac_buf )),
1491- set_static ? "static " : "" ,
1492- set_inactive ? "inactive " : "" );
1490+ zlog_debug ("dp-install sync-mac vni %u mac %pEA es %s %s%s%s" , zevpn -> vni ,
1491+ & mac -> macaddr , mac -> es ? mac -> es -> esi_str : "-" ,
1492+ zebra_evpn_zebra_mac_flag_dump ( mac , mac_buf , sizeof ( mac_buf )) ,
1493+ set_static ? "static " : "" , set_inactive ? "inactive " : "" );
1494+ }
1495+ dplane_local_mac_add ( ifp , br_ifp , vid , & mac -> macaddr , sticky , set_static ,
1496+ set_inactive );
14931497 }
1494-
1495- dplane_local_mac_add (ifp , br_ifp , vid , & mac -> macaddr , sticky ,
1496- set_static , set_inactive );
14971498 return 0 ;
14981499}
14991500
@@ -1545,16 +1546,23 @@ static void zebra_evpn_mac_hold_exp_cb(struct event *t)
15451546 zebra_evpn_zebra_mac_flag_dump (mac , mac_buf , sizeof (mac_buf )));
15461547 }
15471548
1548- /* re-program the local mac in the dataplane if the mac is no
1549- * longer static
1550- */
1551- if (old_static != new_static )
1552- zebra_evpn_sync_mac_dp_install (mac , false, false, __func__ );
1549+ if (zebra_mac_ext_learn_mode ()) {
1550+ vlanid_t vid ;
1551+ struct interface * ifp ;
1552+ /* Upon expiry, MAC is deleted from DP. */
1553+ zebra_evpn_mac_get_access_info (mac , & ifp , & vid );
1554+ zebra_evpn_flush_local_mac (mac , ifp );
1555+ } else {
1556+ /* re-program the local mac in the dataplane if the mac is no
1557+ * longer static
1558+ */
1559+ if (old_static != new_static )
1560+ zebra_evpn_sync_mac_dp_install (mac , false, false, __func__ );
15531561
1554- /* inform bgp if needed */
1555- if (old_bgp_ready != new_bgp_ready )
1556- zebra_evpn_mac_send_add_del_to_client (mac , old_bgp_ready ,
1557- new_bgp_ready );
1562+ /* inform bgp if needed */
1563+ if (old_bgp_ready != new_bgp_ready )
1564+ zebra_evpn_mac_send_add_del_to_client (mac , old_bgp_ready , new_bgp_ready );
1565+ }
15581566}
15591567
15601568static inline void zebra_evpn_mac_start_hold_timer (struct zebra_mac * mac )
@@ -1610,7 +1618,15 @@ void zebra_evpn_sync_mac_del(struct zebra_mac *mac)
16101618 zebra_evpn_mac_start_hold_timer (mac );
16111619 new_static = zebra_evpn_mac_is_static (mac );
16121620
1613- if (old_static != new_static )
1621+ if (zebra_mac_ext_learn_mode () && !new_static &&
1622+ CHECK_FLAG (mac -> flags , ZEBRA_MAC_LOCAL_INACTIVE )) {
1623+ /* Clear the MAC from Peer Proxy, as no age out will happen for extern mode */
1624+ struct interface * ifp ;
1625+ vlanid_t vid ;
1626+
1627+ zebra_evpn_mac_get_access_info (mac , & ifp , & vid );
1628+ zebra_evpn_flush_local_mac (mac , ifp );
1629+ } else if (old_static != new_static )
16141630 /* program the local mac in the kernel */
16151631 zebra_evpn_sync_mac_dp_install (mac , false, false, __func__ );
16161632}
@@ -1823,8 +1839,16 @@ struct zebra_mac *zebra_evpn_proc_sync_mac_update(struct zebra_evpn *zevpn,
18231839 if (old_static != new_static )
18241840 inform_dataplane = true;
18251841
1826- old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp (old_flags );
1827- new_bgp_ready = zebra_evpn_mac_is_ready_for_bgp (mac -> flags );
1842+ /* when going from peer-active to peer-proxy, nothing should be happening
1843+ * Route is maintain in BGP
1844+ */
1845+ if (zebra_mac_ext_learn_mode () && CHECK_FLAG (new_flags , ZEBRA_MAC_ES_PEER_PROXY )) {
1846+ old_bgp_ready = false;
1847+ new_bgp_ready = false;
1848+ } else {
1849+ old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp (old_flags );
1850+ new_bgp_ready = zebra_evpn_mac_is_ready_for_bgp (mac -> flags );
1851+ }
18281852 if (old_bgp_ready != new_bgp_ready )
18291853 inform_bgp = true;
18301854 }
@@ -2411,7 +2435,9 @@ int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac,
24112435 new_bgp_ready );
24122436 }
24132437
2414- /* re-install the inactive entry in the kernel */
2438+ /* In EXT-LEARN mode as well, the MAC will be reprogrammed as static,
2439+ * post age out, until proxy is withdrawn
2440+ */
24152441 zebra_evpn_sync_mac_dp_install (mac , true, false, __func__ );
24162442
24172443 return 0 ;
0 commit comments