summaryrefslogtreecommitdiff
path: root/zebra/if_netlink.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@nvidia.com>2022-01-31 16:12:01 -0500
committerStephen Worley <sworley@nvidia.com>2022-03-09 18:02:44 -0500
commitab465d24bd864c7ab9f5841af89c108e03e768ac (patch)
tree922a88a2a82111b869059347bbe121ec6e169654 /zebra/if_netlink.c
parent97c726337389b7084ad970cf631a1126e5d5329c (diff)
zebra: only clear pd_reason on shutdown/sweep
Only clear protodown reason on shutdown/sweep, retain protodown state. This is to retain traditional and expected behavior with daemons like vrrpd setting protodown. They expet it to be set on shutdown and retained on bring up to prevent traffic from being dropped. We must cleanup our reason code though to prevent us from blocking others. Signed-off-by: Stephen Worley <sworley@nvidia.com>
Diffstat (limited to 'zebra/if_netlink.c')
-rw-r--r--zebra/if_netlink.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 2467e837b8..3591106fed 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -852,7 +852,8 @@ static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
* If the reason we got from the kernel is ONLY frr though, don't
* set it.
*/
- if (protodown && is_if_protodown_r_only_frr(rc_bitfield) == false)
+ if (protodown && rc_bitfield &&
+ is_if_protodown_r_only_frr(rc_bitfield) == false)
zif->protodown_rc |= ZEBRA_PROTODOWN_EXTERNAL;
else
zif->protodown_rc &= ~ZEBRA_PROTODOWN_EXTERNAL;
@@ -900,7 +901,8 @@ static uint8_t netlink_parse_lacp_bypass(struct rtattr **linkinfo)
}
/*
- * Only called at startup to cleanup leftover protodown we may have not cleanup
+ * Only called at startup to cleanup leftover protodown reasons we may
+ * have not cleaned up. We leave protodown set though.
*/
static void if_sweep_protodown(struct zebra_if *zif)
{
@@ -912,12 +914,12 @@ static void if_sweep_protodown(struct zebra_if *zif)
return;
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("interface %s sweeping protdown %s", zif->ifp->name,
- protodown ? "on" : "off");
+ zlog_debug("interface %s sweeping protodown %s reason 0x%x",
+ zif->ifp->name, protodown ? "on" : "off",
+ zif->protodown_rc);
/* Only clear our reason codes, leave external if it was set */
- zif->protodown_rc |= ~ZEBRA_PROTODOWN_ALL;
- zif->flags |= ZIF_FLAG_UNSET_PROTODOWN;
+ zif->protodown_rc &= ~ZEBRA_PROTODOWN_ALL;
dplane_intf_update(zif->ifp);
}
@@ -2158,6 +2160,7 @@ ssize_t netlink_intf_msg_encode(uint16_t cmd,
struct rtattr *nest_protodown_reason;
ifindex_t ifindex = dplane_ctx_get_ifindex(ctx);
bool down = dplane_ctx_intf_is_protodown(ctx);
+ bool pd_reason_val = dplane_ctx_get_intf_pd_reason_val(ctx);
struct nlsock *nl =
kernel_netlink_nlsock_lookup(dplane_ctx_get_ns_sock(ctx));
@@ -2191,13 +2194,14 @@ ssize_t netlink_intf_msg_encode(uint16_t cmd,
nl_attr_put32(&req->n, buflen, IFLA_PROTO_DOWN_REASON_MASK,
(1 << frr_protodown_r_bit));
nl_attr_put32(&req->n, buflen, IFLA_PROTO_DOWN_REASON_VALUE,
- ((int)down) << frr_protodown_r_bit);
+ ((int)pd_reason_val) << frr_protodown_r_bit);
nl_attr_nest_end(&req->n, nest_protodown_reason);
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("%s: %s, protodown=%d ifindex=%u", __func__,
- nl_msg_type_to_str(cmd), down, ifindex);
+ zlog_debug("%s: %s, protodown=%d reason_val=%d ifindex=%u",
+ __func__, nl_msg_type_to_str(cmd), down,
+ pd_reason_val, ifindex);
return NLMSG_ALIGN(req->n.nlmsg_len);
}