From: Trey Aspelund Date: Wed, 25 Jan 2023 18:25:20 +0000 (-0500) Subject: bgpd: move tunnel-ip comparison into handler X-Git-Tag: base_8.5~23^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F12700%2Fhead;p=mirror%2Ffrr.git bgpd: move tunnel-ip comparison into handler Moves the old/new IP comparison into handle_tunnel_ip_change instead of expecting the caller to do the check on their own. Also changes handle_tunnel_ip_change to return void since it only ever returned 0 in all cases. Signed-off-by: Trey Aspelund --- diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index dbd8bebe5a..155e33da91 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2736,15 +2736,18 @@ static int bgp_evpn_mcast_grp_change(struct bgp *bgp, struct bgpevpn *vpn, * 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) +static void handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn, + struct in_addr originator_ip) { struct prefix_evpn p; + if (IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip)) + return; + /* 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; + return; } /* Update the tunnel-ip hash */ @@ -2765,7 +2768,7 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn, /* Update the tunnel IP and re-advertise all routes for this VNI. */ vpn->originator_ip = originator_ip; - return 0; + return; } static struct bgp_path_info * @@ -6548,8 +6551,7 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, /* 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); + handle_tunnel_ip_change(bgp, vpn, originator_ip); /* Update all routes with new endpoint IP and/or export RT * for VRFs