zebra: use a macro for check protodown

Add a helper macro for checking if interface is protodown,
typing this out is annoying.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
Stephen Worley 2022-01-25 14:44:25 -05:00
parent 0dcd8506f2
commit d89b300829
3 changed files with 6 additions and 7 deletions

View File

@ -857,7 +857,7 @@ static void netlink_proc_dplane_if_protodown(struct zebra_if *zif,
else
zif->protodown_rc &= ~ZEBRA_PROTODOWN_EXTERNAL;
old_protodown = !!(zif->flags & ZIF_FLAG_PROTODOWN);
old_protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
if (protodown == old_protodown)
return;
@ -906,7 +906,7 @@ static void if_sweep_protodown(struct zebra_if *zif)
{
bool protodown;
protodown = !!(zif->flags & ZIF_FLAG_PROTODOWN);
protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
if (!protodown)
return;

View File

@ -1244,7 +1244,7 @@ static bool if_ignore_set_protodown(const struct interface *ifp, bool new_down,
zif = ifp->info;
/* Current state as we know it */
old_down = !!(zif->flags & ZIF_FLAG_PROTODOWN);
old_down = !!(ZEBRA_IF_IS_PROTODOWN(zif));
old_set_down = !!(zif->flags & ZIF_FLAG_SET_PROTODOWN);
old_unset_down = !!(zif->flags & ZIF_FLAG_UNSET_PROTODOWN);
@ -2091,7 +2091,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
zebra_evpn_if_es_print(vty, NULL, zebra_if);
vty_out(vty, " protodown: %s %s\n",
(zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off",
(ZEBRA_IF_IS_PROTODOWN(zebra_if)) ? "on" : "off",
if_is_protodown_applicable(ifp) ? "" : "(n/a)");
if (zebra_if->protodown_rc)
vty_out(vty, " protodown reasons: %s\n",
@ -2442,7 +2442,7 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
if (if_is_protodown_applicable(ifp)) {
json_object_string_add(
json_if, "protodown",
(zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off");
(ZEBRA_IF_IS_PROTODOWN(zebra_if)) ? "on" : "off");
if (zebra_if->protodown_rc)
json_object_string_add(
json_if, "protodownReason",

View File

@ -2732,8 +2732,7 @@ int dplane_ctx_intf_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
else if (unset_pdown)
ctx->u.intf.protodown = false;
else
ctx->u.intf.protodown =
!!(zif->flags & ZIF_FLAG_PROTODOWN);
ctx->u.intf.protodown = !!ZEBRA_IF_IS_PROTODOWN(zif);
}
dplane_ctx_ns_init(ctx, zns, (op == DPLANE_OP_INTF_UPDATE));