zebra: Prevent installation of connected multiple times

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>
This commit is contained in:
Donald Sharp 2020-10-02 14:49:09 -04:00 committed by Chirag Shah
parent d78fa57195
commit 8b48cdb913
4 changed files with 12 additions and 10 deletions

View 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)) { if (if_is_no_ptm_operative(ifp)) {
bool is_up = if_is_operative(ifp);
ifp->flags = ifi->ifi_flags & 0x0000fffff; ifp->flags = ifi->ifi_flags & 0x0000fffff;
if (!if_is_no_ptm_operative(ifp) || if (!if_is_no_ptm_operative(ifp) ||
CHECK_FLAG(zif->flags, CHECK_FLAG(zif->flags,
@ -1939,7 +1940,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
zlog_debug( zlog_debug(
"Intf %s(%u) PTM up, notifying clients", "Intf %s(%u) PTM up, notifying clients",
name, ifp->ifindex); name, ifp->ifindex);
if_up(ifp); if_up(ifp, !is_up);
/* Update EVPN VNI when SVI MAC change /* 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( zlog_debug(
"Intf %s(%u) has come UP", "Intf %s(%u) has come UP",
name, ifp->ifindex); name, ifp->ifindex);
if_up(ifp); if_up(ifp, true);
if (IS_ZEBRA_IF_BRIDGE(ifp)) if (IS_ZEBRA_IF_BRIDGE(ifp))
chgflags = chgflags =
ZEBRA_BRIDGE_MASTER_UP; ZEBRA_BRIDGE_MASTER_UP;

View File

@ -517,7 +517,7 @@ void if_flags_update(struct interface *ifp, uint64_t newflags)
/* inoperative -> operative? */ /* inoperative -> operative? */
ifp->flags = newflags; ifp->flags = newflags;
if (if_is_operative(ifp)) 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. */ /* Interface is up. */
void if_up(struct interface *ifp) void if_up(struct interface *ifp, bool install_connected)
{ {
struct zebra_if *zif; struct zebra_if *zif;
struct interface *link_if; struct interface *link_if;
@ -1077,6 +1077,7 @@ void if_up(struct interface *ifp)
#endif #endif
/* Install connected routes to the kernel. */ /* Install connected routes to the kernel. */
if (install_connected)
if_install_connected(ifp); if_install_connected(ifp);
/* Handle interface up for specific types for EVPN. Non-VxLAN interfaces /* Handle interface up for specific types for EVPN. Non-VxLAN interfaces
@ -2778,7 +2779,7 @@ int if_linkdetect(struct interface *ifp, bool detect)
/* Interface may come up after disabling link detection */ /* Interface may come up after disabling link detection */
if (if_is_operative(ifp) && !if_was_operative) if (if_is_operative(ifp) && !if_was_operative)
if_up(ifp); if_up(ifp, true);
} }
/* FIXME: Will defer status change forwarding if interface /* FIXME: Will defer status change forwarding if interface
does not come down! */ does not come down! */

View 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_nbr_ipv6ll_to_ipv4ll_neigh_del_all(struct interface *ifp);
extern void if_delete_update(struct interface *ifp); extern void if_delete_update(struct interface *ifp);
extern void if_add_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_down(struct interface *);
extern void if_refresh(struct interface *); extern void if_refresh(struct interface *);
extern void if_flags_update(struct interface *, uint64_t); extern void if_flags_update(struct interface *, uint64_t);

View File

@ -350,7 +350,7 @@ DEFUN (no_zebra_ptm_enable_if,
if (IS_ZEBRA_DEBUG_EVENT) if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("%s: Bringing up interface %s", zlog_debug("%s: Bringing up interface %s",
__func__, ifp->name); __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; ifp->ptm_status = ZEBRA_PTM_STATUS_UP;
if (ifp->ptm_enable && if_is_no_ptm_operative(ifp) if (ifp->ptm_enable && if_is_no_ptm_operative(ifp)
&& send_linkup) && send_linkup)
if_up(ifp); if_up(ifp, true);
} else if (!strcmp(cbl_str, ZEBRA_PTM_FAIL_STR) } else if (!strcmp(cbl_str, ZEBRA_PTM_FAIL_STR)
&& (ifp->ptm_status != ZEBRA_PTM_STATUS_DOWN)) { && (ifp->ptm_status != ZEBRA_PTM_STATUS_DOWN)) {
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( zlog_debug(
"%s: Bringing up interface %s", "%s: Bringing up interface %s",
__func__, ifp->name); __func__, ifp->name);
if_up(ifp); if_up(ifp, true);
} }
} }
} }