From 321c80d6b2142a769059df5b9fed0f251409ed92 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 15 Feb 2022 12:33:06 -0500 Subject: [PATCH] zebra: extern setting protodown reason directly Extern the api for setting the protodown reason code bitfield directly. Some places may want to completely update the bitfield with more than one reason at a time. Signed-off-by: Stephen Worley --- zebra/interface.c | 14 ++++++-------- zebra/interface.h | 8 ++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index 167f1b4587..a547230d37 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -63,8 +63,6 @@ DEFINE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp), static void if_down_del_nbr_connected(struct interface *ifp); -static int zebra_if_update_protodown(struct interface *ifp, bool new_down, - uint32_t new_protodown_rc); static void if_zebra_speed_update(struct thread *thread) { @@ -266,9 +264,9 @@ static int if_zebra_delete_hook(struct interface *ifp) /* If we set protodown, clear our reason now from the kernel */ if (ZEBRA_IF_IS_PROTODOWN(zebra_if) && zebra_if->protodown_rc && !ZEBRA_IF_IS_PROTODOWN_ONLY_EXTERNAL(zebra_if)) - zebra_if_update_protodown(ifp, true, - (zebra_if->protodown_rc & - ~ZEBRA_PROTODOWN_ALL)); + zebra_if_update_protodown_rc(ifp, true, + (zebra_if->protodown_rc & + ~ZEBRA_PROTODOWN_ALL)); /* Free installed address chains tree. */ if (zebra_if->ipv4_subnets) @@ -1294,8 +1292,8 @@ static bool if_ignore_set_protodown(const struct interface *ifp, bool new_down, return false; } -static int zebra_if_update_protodown(struct interface *ifp, bool new_down, - uint32_t new_protodown_rc) +int zebra_if_update_protodown_rc(struct interface *ifp, bool new_down, + uint32_t new_protodown_rc) { struct zebra_if *zif; @@ -1338,7 +1336,7 @@ int zebra_if_set_protodown(struct interface *ifp, bool new_down, else new_protodown_rc = zif->protodown_rc & ~new_reason; - return zebra_if_update_protodown(ifp, new_down, new_protodown_rc); + return zebra_if_update_protodown_rc(ifp, new_down, new_protodown_rc); } /* diff --git a/zebra/interface.h b/zebra/interface.h index 7429f5eade..d4eaf389f7 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -505,6 +505,14 @@ extern void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id); extern void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex, ns_id_t ns_id); extern void zebra_if_update_all_links(struct zebra_ns *zns); +/** + * Directly update entire protodown & reason code bitfield. + */ +extern int zebra_if_update_protodown_rc(struct interface *ifp, bool new_down, + uint32_t new_protodown_rc); +/** + * Set protodown with single reason. + */ extern int zebra_if_set_protodown(struct interface *ifp, bool down, enum protodown_reasons new_reason); extern int if_ip_address_install(struct interface *ifp, struct prefix *prefix, -- 2.39.5