From 97c4e1d0e47ade1da3c00c6cda93744444a23ae1 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 13 Feb 2019 18:22:14 -0800 Subject: [PATCH] zebra: advertise evpn route upon l3vni svi mac chg L3VNI keeps reference to svi interface (ifp). When a netlink change received there is no flag that mac has changed. Currently simply overwrite interface's (ifp) hw_addr (MAC) field. For originating EVPN type-2 and type-5 routes due to VNI MAC change, comparison is required to check existing MAC vs. netlink change MAC field. Ticket:CM-23850 Reviewed By:CCR-8283 Testing Done: Validate EVPN type-5 routes originated upon changing MAC address of L3VNI's SVI inteface via ip link set cmd. checked show bgp l2vpn evpn route and Rmac field contains new MAC address. Signed-off-by: Chirag Shah --- zebra/if_netlink.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index faca52fe41..3583d63d31 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -68,6 +68,7 @@ #include "zebra/kernel_netlink.h" #include "zebra/if_netlink.h" #include "zebra/zebra_errors.h" +#include "zebra/zebra_vxlan.h" extern struct zebra_privs_t zserv_privs; @@ -1111,6 +1112,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) ifindex_t bridge_ifindex = IFINDEX_INTERNAL; ifindex_t bond_ifindex = IFINDEX_INTERNAL; ifindex_t link_ifindex = IFINDEX_INTERNAL; + uint8_t old_hw_addr[INTERFACE_HWADDR_MAX]; zns = zebra_ns_lookup(ns_id); @@ -1312,6 +1314,8 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) was_bond_slave = IS_ZEBRA_IF_BOND_SLAVE(ifp); zebra_if_set_ziftype(ifp, zif_type, zif_slave_type); + memcpy(old_hw_addr, ifp->hw_addr, INTERFACE_HWADDR_MAX); + netlink_interface_update_hw_addr(tb, ifp); if (if_is_no_ptm_operative(ifp)) { @@ -1330,6 +1334,22 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) "Intf %s(%u) PTM up, notifying clients", name, ifp->ifindex); zebra_interface_up_update(ifp); + + /* Update EVPN VNI when SVI MAC change + */ + if (IS_ZEBRA_IF_VLAN(ifp) && + memcmp(old_hw_addr, ifp->hw_addr, + INTERFACE_HWADDR_MAX)) { + struct interface *link_if; + + link_if = + if_lookup_by_index_per_ns( + zebra_ns_lookup(NS_DEFAULT), + link_ifindex); + if (link_if) + zebra_vxlan_svi_up(ifp, + link_if); + } } } else { ifp->flags = ifi->ifi_flags & 0x0000fffff; -- 2.39.5