From ddd16ed5f274863ca23401f1f7bf628feb610b11 Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Thu, 6 Jul 2017 16:33:50 -0700 Subject: [PATCH] bgpd/zebra: honor tunnel ip change in bgp regardless of vni readiness Ticket: CM-17014 Review: CCR-6432 Unit-test: Manual Signed-off-by: Mitesh Kanjariya --- bgpd/bgp_evpn.c | 14 ++++++++++++-- bgpd/bgp_evpn_vty.c | 2 ++ zebra/zebra_vxlan.c | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index ab3307a6a7..110ff3a17b 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1193,6 +1193,12 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn, { struct prefix_evpn p; + /* If VNI is not live, we only need to update the originator ip */ + if (!is_vni_live(vpn)) { + vpn->originator_ip = originator_ip; + return 0; + } + /* Need to withdraw type-3 route as the originator IP is part * of the key. */ @@ -2678,14 +2684,14 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, /* Lookup VNI. If present and no change, exit. */ vpn = bgp_evpn_lookup_vni(bgp, vni); - if (vpn && is_vni_live(vpn)) { + if (vpn) { if (IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip)) /* Probably some other param has changed that we don't * care about. */ return 0; /* Local tunnel endpoint IP address has changed */ - return handle_tunnel_ip_change(bgp, vpn, originator_ip); + handle_tunnel_ip_change(bgp, vpn, originator_ip); } /* Create or update as appropriate. */ @@ -2699,6 +2705,10 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, } } + /* if the VNI is live already, there is nothibng more to do */ + if (is_vni_live(vpn)) + return 0; + /* Mark as "live" */ SET_FLAG(vpn->flags, VNI_FLAG_LIVE); diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index a6f5e168c9..8a583a74d8 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -195,6 +195,8 @@ static void display_vni(struct vty *vty, struct bgpevpn *vpn) vty_out(vty, " RD: %s\n", prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN)); vty_out(vty, " Originator IP: %s\n", inet_ntoa(vpn->originator_ip)); + vty_out(vty, " Advertise-gw-macip : %s\n", + vpn->advertise_gw_macip ? "Yes" : "No"); vty_out(vty, " Import Route Target:\n"); for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode, ecom)) { diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 393ac997b3..52886bd7f0 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -607,6 +607,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt) json_object_int_add(json, "ifindex", zvni->vxlan_if->ifindex); json_object_string_add(json, "vtepIp", inet_ntoa(zvni->local_vtep_ip)); + json_object_string_add(json, "advertiseGatewayMacip", + zvni->advertise_gw_macip ? "Yes" : "No"); json_object_int_add(json, "numMacs", num_macs); json_object_int_add(json, "numArpNd", num_neigh); } @@ -641,6 +643,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt) " Number of ARPs (IPv4 and IPv6, local and remote) " "known for this VNI: %u\n", num_neigh); + vty_out(vty, " Advertise-gw-macip: %s\n", + zvni->advertise_gw_macip ? "Yes" : "No"); } } @@ -2751,8 +2755,12 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf, } if (use_json) { json = json_object_new_object(); + json_object_string_add(json, "advertiseGatewayMacip", + zvrf->advertise_gw_macip ? "Yes" : "No"); json_object_int_add(json, "numVnis", num_vnis); } else { + vty_out(vty, "Advertise gateway mac-ip: %s\n", + zvrf->advertise_gw_macip ? "Yes" : "No"); vty_out(vty, "Number of VNIs: %u\n", num_vnis); vty_out(vty, "%-10s %-21s %-15s %-8s %-8s %-15s\n", "VNI", "VxLAN IF", "VTEP IP", "# MACs", "# ARPs", -- 2.39.5