From d63c1b18b426fbb2685208dac16ca20767c3219d Mon Sep 17 00:00:00 2001 From: vivek Date: Tue, 28 Aug 2018 17:02:40 -0700 Subject: [PATCH] zebra: Remove unused parameter in MAC delete When a MAC moves from local to remote, a replace is allowed, EVPN no longer has to delete the local MAC before installing the remote MAC. Signed-off-by: Vivek Venkatraman Reviewed-by: Anuradha Karuppiah Reviewed-by: Chirag Shah --- zebra/rt.h | 3 +-- zebra/rt_netlink.c | 19 ++++++++----------- zebra/rt_socket.c | 2 +- zebra/zebra_vxlan.c | 33 +++++++++++---------------------- 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/zebra/rt.h b/zebra/rt.h index e40bae3a3e..244b377f86 100644 --- a/zebra/rt.h +++ b/zebra/rt.h @@ -118,8 +118,7 @@ extern int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, uint8_t sticky); extern int kernel_del_mac(struct interface *ifp, vlanid_t vid, - struct ethaddr *mac, struct in_addr vtep_ip, - int local); + struct ethaddr *mac, struct in_addr vtep_ip); extern int kernel_add_neigh(struct interface *ifp, struct ipaddr *ip, struct ethaddr *mac, uint8_t flags); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b600a7db50..2709dc824e 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -2178,7 +2178,7 @@ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, - int local, int cmd, uint8_t sticky) + int cmd, uint8_t sticky) { struct zebra_ns *zns; struct { @@ -2223,12 +2223,10 @@ static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid, addattr_l(&req.n, sizeof(req), NDA_LLADDR, mac, 6); req.ndm.ndm_ifindex = ifp->ifindex; - if (!local) { - dst_alen = 4; // TODO: hardcoded - addattr_l(&req.n, sizeof(req), NDA_DST, &vtep_ip, dst_alen); - dst_present = 1; - sprintf(dst_buf, " dst %s", inet_ntoa(vtep_ip)); - } + dst_alen = 4; // TODO: hardcoded + addattr_l(&req.n, sizeof(req), NDA_DST, &vtep_ip, dst_alen); + dst_present = 1; + sprintf(dst_buf, " dst %s", inet_ntoa(vtep_ip)); br_zif = (struct zebra_if *)br_if->info; if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif) && vid > 0) { addattr16(&req.n, sizeof(req), NDA_VLAN, vid); @@ -2565,15 +2563,14 @@ static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip, int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, struct in_addr vtep_ip, uint8_t sticky) { - return netlink_macfdb_update(ifp, vid, mac, vtep_ip, 0, RTM_NEWNEIGH, + return netlink_macfdb_update(ifp, vid, mac, vtep_ip, RTM_NEWNEIGH, sticky); } int kernel_del_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, - struct in_addr vtep_ip, int local) + struct in_addr vtep_ip) { - return netlink_macfdb_update(ifp, vid, mac, vtep_ip, local, - RTM_DELNEIGH, 0); + return netlink_macfdb_update(ifp, vid, mac, vtep_ip, RTM_DELNEIGH, 0); } int kernel_add_neigh(struct interface *ifp, struct ipaddr *ip, diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index a6de84d56f..2a93992ebb 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -459,7 +459,7 @@ int kernel_add_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, } int kernel_del_mac(struct interface *ifp, vlanid_t vid, struct ethaddr *mac, - struct in_addr vtep_ip, int local) + struct in_addr vtep_ip) { return 0; } diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 469aceafb9..7fe2b904a9 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -153,7 +153,7 @@ static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr, static zebra_vni_t *zvni_map_vlan(struct interface *ifp, struct interface *br_if, vlanid_t vid); static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac); -static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac, int local); +static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac); static void zvni_install_mac_hash(struct hash_backet *backet, void *ctxt); static unsigned int vni_hash_keymake(void *p); @@ -2309,7 +2309,7 @@ static void zvni_mac_del_hash_entry(struct hash_backet *backet, void *arg) } if (wctx->uninstall) - zvni_mac_uninstall(wctx->zvni, mac, 0); + zvni_mac_uninstall(wctx->zvni, mac); zvni_mac_del(wctx->zvni, mac); } @@ -2611,18 +2611,16 @@ static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac) } /* - * Uninstall remote MAC from the kernel. In the scenario where the MAC - * moves to remote, we have to uninstall any existing local entry first. + * Uninstall remote MAC from the kernel. */ -static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac, int local) +static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac) { struct zebra_if *zif; struct zebra_l2info_vxlan *vxl; struct in_addr vtep_ip = {.s_addr = 0}; - struct zebra_ns *zns; struct interface *ifp; - if (!local && !(mac->flags & ZEBRA_MAC_REMOTE)) + if (!(mac->flags & ZEBRA_MAC_REMOTE)) return 0; if (!zvni->vxlan_if) { @@ -2636,19 +2634,10 @@ static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac, int local) return -1; vxl = &zif->l2info.vxl; - if (local) { - zns = zebra_ns_lookup(NS_DEFAULT); - ifp = if_lookup_by_index_per_ns(zns, - mac->fwd_info.local.ifindex); - if (!ifp) // unexpected - return -1; - } else { - ifp = zvni->vxlan_if; - vtep_ip = mac->fwd_info.r_vtep_ip; - } + ifp = zvni->vxlan_if; + vtep_ip = mac->fwd_info.r_vtep_ip; - return kernel_del_mac(ifp, vxl->access_vlan, &mac->macaddr, vtep_ip, - local); + return kernel_del_mac(ifp, vxl->access_vlan, &mac->macaddr, vtep_ip); } /* @@ -2677,7 +2666,7 @@ static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac, return; if (uninstall) - zvni_mac_uninstall(zvni, mac, 0); + zvni_mac_uninstall(zvni, mac); zvni_mac_del(zvni, mac); } @@ -3290,7 +3279,7 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) vxl = &zif->l2info.vxl; return kernel_del_mac(zl3vni->vxlan_if, vxl->access_vlan, - &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0); + &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip); } /* handle rmac add */ @@ -4391,7 +4380,7 @@ static void process_remote_macip_del(vni_t vni, zvni_process_neigh_on_remote_mac_del(zvni, mac); if (list_isempty(mac->neigh_list)) { - zvni_mac_uninstall(zvni, mac, 0); + zvni_mac_uninstall(zvni, mac); zvni_mac_del(zvni, mac); } else SET_FLAG(mac->flags, ZEBRA_MAC_AUTO); -- 2.39.5