]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: move tunnel-ip comparison into handler 12700/head
authorTrey Aspelund <taspelund@nvidia.com>
Wed, 25 Jan 2023 18:25:20 +0000 (13:25 -0500)
committerTrey Aspelund <taspelund@nvidia.com>
Fri, 27 Jan 2023 16:12:14 +0000 (11:12 -0500)
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 <taspelund@nvidia.com>
bgpd/bgp_evpn.c

index dbd8bebe5a14c883669f1ef4a93cc5dfe3ebb455..155e33da91984760c8a6322c95e90b1b097fb6dd 100644 (file)
@@ -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