]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Prevent installation of connected multiple times 10662/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 2 Oct 2020 18:49:09 +0000 (14:49 -0400)
committerChirag Shah <chirag@nvidia.com>
Thu, 3 Mar 2022 02:34:32 +0000 (18:34 -0800)
With recent changes to interface up mechanics in if_netlink.c
FRR was receiving as many as 4 up events for an interface
on ifdown/ifup events.  This was causing timing issues
in FRR based upon some fun timings.  Remove this from
happening.

Ticket: CM-31623
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/if_netlink.c
zebra/interface.c
zebra/interface.h
zebra/zebra_ptm.c

index 42e55acb5176ad5f7f00324f0a908afd240a1a70..a75b165270c861c9cb4213ff1b94e0b6854c7ce3 100644 (file)
@@ -1920,6 +1920,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                        }
 
                        if (if_is_no_ptm_operative(ifp)) {
+                               bool is_up = if_is_operative(ifp);
                                ifp->flags = ifi->ifi_flags & 0x0000fffff;
                                if (!if_is_no_ptm_operative(ifp) ||
                                    CHECK_FLAG(zif->flags,
@@ -1939,7 +1940,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                                                zlog_debug(
                                                        "Intf %s(%u) PTM up, notifying clients",
                                                        name, ifp->ifindex);
-                                       if_up(ifp);
+                                       if_up(ifp, !is_up);
 
                                        /* Update EVPN VNI when SVI MAC change
                                         */
@@ -1975,7 +1976,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                                                zlog_debug(
                                                        "Intf %s(%u) has come UP",
                                                        name, ifp->ifindex);
-                                       if_up(ifp);
+                                       if_up(ifp, true);
                                        if (IS_ZEBRA_IF_BRIDGE(ifp))
                                                chgflags =
                                                        ZEBRA_BRIDGE_MASTER_UP;
index fbd2aac005843207267306171b45f85f6f15f120..12c073144c2b0eb6a2e5ac1dca0c1da96e4b6f18 100644 (file)
@@ -517,7 +517,7 @@ void if_flags_update(struct interface *ifp, uint64_t newflags)
                /* inoperative -> operative? */
                ifp->flags = newflags;
                if (if_is_operative(ifp))
-                       if_up(ifp);
+                       if_up(ifp, true);
        }
 }
 
@@ -1045,7 +1045,7 @@ bool if_nhg_dependents_is_empty(const struct interface *ifp)
 }
 
 /* Interface is up. */
-void if_up(struct interface *ifp)
+void if_up(struct interface *ifp, bool install_connected)
 {
        struct zebra_if *zif;
        struct interface *link_if;
@@ -1077,7 +1077,8 @@ void if_up(struct interface *ifp)
 #endif
 
        /* Install connected routes to the kernel. */
-       if_install_connected(ifp);
+       if (install_connected)
+               if_install_connected(ifp);
 
        /* Handle interface up for specific types for EVPN. Non-VxLAN interfaces
         * are checked to see if (remote) neighbor entries need to be installed
@@ -2778,7 +2779,7 @@ int if_linkdetect(struct interface *ifp, bool detect)
 
                /* Interface may come up after disabling link detection */
                if (if_is_operative(ifp) && !if_was_operative)
-                       if_up(ifp);
+                       if_up(ifp, true);
        }
        /* FIXME: Will defer status change forwarding if interface
           does not come down! */
index c19e494860cb2eefca90703e577bdb913dac9ea0..315a3170d8e7e693442c921ba38ea44c1f791c73 100644 (file)
@@ -486,7 +486,7 @@ extern void if_nbr_ipv6ll_to_ipv4ll_neigh_update(struct interface *ifp,
 extern void if_nbr_ipv6ll_to_ipv4ll_neigh_del_all(struct interface *ifp);
 extern void if_delete_update(struct interface *ifp);
 extern void if_add_update(struct interface *ifp);
-extern void if_up(struct interface *);
+extern void if_up(struct interface *ifp, bool install_connected);
 extern void if_down(struct interface *);
 extern void if_refresh(struct interface *);
 extern void if_flags_update(struct interface *, uint64_t);
index 68e5c391cf861a1b706c187d630f3218bf609538..c28e251e3a52d05a4c23b6986286847dfdb9eb38 100644 (file)
@@ -350,7 +350,7 @@ DEFUN (no_zebra_ptm_enable_if,
                        if (IS_ZEBRA_DEBUG_EVENT)
                                zlog_debug("%s: Bringing up interface %s",
                                           __func__, ifp->name);
-                       if_up(ifp);
+                       if_up(ifp, true);
                }
        }
 
@@ -553,7 +553,7 @@ static int zebra_ptm_handle_cbl_msg(void *arg, void *in_ctxt,
                ifp->ptm_status = ZEBRA_PTM_STATUS_UP;
                if (ifp->ptm_enable && if_is_no_ptm_operative(ifp)
                    && send_linkup)
-                       if_up(ifp);
+                       if_up(ifp, true);
        } else if (!strcmp(cbl_str, ZEBRA_PTM_FAIL_STR)
                   && (ifp->ptm_status != ZEBRA_PTM_STATUS_DOWN)) {
                ifp->ptm_status = ZEBRA_PTM_STATUS_DOWN;
@@ -1163,7 +1163,7 @@ void zebra_ptm_reset_status(int ptm_disable)
                                                zlog_debug(
                                                        "%s: Bringing up interface %s",
                                                        __func__, ifp->name);
-                                       if_up(ifp);
+                                       if_up(ifp, true);
                                }
                        }
                }