}
/*
- * There is a tunnel endpoint IP address change for this VNI,
- * need to re-advertise routes with the new nexthop.
+ * There is a tunnel endpoint IP address change for this VNI, delete
+ * prior type-3 route (if needed) and update.
+ * Note: Route re-advertisement happens elsewhere after other processing
+ * other changes.
*/
static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
struct in_addr originator_ip)
/* Update the tunnel IP and re-advertise all routes for this VNI. */
vpn->originator_ip = originator_ip;
- return update_routes_for_vni(bgp, vpn);
+ return 0;
}
/*
}
/*
- * Handle add (or update) of a local VNI. The only VNI change we care
- * about is change to local-tunnel-ip.
+ * Handle add (or update) of a local VNI. The VNI changes we care
+ * about are for the local-tunnel-ip and the (tenant) VRF.
*/
int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
struct in_addr originator_ip,
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (vpn) {
- /* update tenant_vrf_id if required */
+ if (is_vni_live(vpn)
+ && IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip)
+ && vpn->tenant_vrf_id == tenant_vrf_id)
+ /* Probably some other param has changed that we don't
+ * care about. */
+ return 0;
+
+ /* Update tenant_vrf_id if it has changed. */
if (vpn->tenant_vrf_id != tenant_vrf_id) {
bgpevpn_unlink_from_l3vni(vpn);
vpn->tenant_vrf_id = tenant_vrf_id;
bgpevpn_link_to_l3vni(vpn);
-
- /* update all routes with new export RT for VRFs */
- update_routes_for_vni(bgp, vpn);
}
- if (is_vni_live(vpn)
- && IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
- /* Probably some other param has changed that we don't
- * care about. */
- return 0;
+ /* If tunnel endpoint IP has changed, update (and delete prior
+ * type-3 route, if needed.)
+ */
+ if (!IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
+ handle_tunnel_ip_change(bgp, vpn, originator_ip);
- /* Local tunnel endpoint IP address has changed */
- handle_tunnel_ip_change(bgp, vpn, originator_ip);
+ /* Update all routes with new endpoint IP and/or export RT
+ * for VRFs
+ */
+ if (is_vni_live(vpn))
+ update_routes_for_vni(bgp, vpn);
}
/* Create or update as appropriate. */