Skip to content

Commit

Permalink
zebra: extern setting protodown reason directly
Browse files Browse the repository at this point in the history
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 <sworley@nvidia.com>
  • Loading branch information
sworleys committed Mar 9, 2022
1 parent ab465d2 commit 321c80d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 6 additions & 8 deletions zebra/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

/*
Expand Down
8 changes: 8 additions & 0 deletions zebra/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 321c80d

Please sign in to comment.