Skip to content

Commit

Permalink
staticd: add a separate function for installing nexthops
Browse files Browse the repository at this point in the history
Will be used in the following commit.

Signed-off-by: Igor Ryzhov <[email protected]>
  • Loading branch information
idryzhov committed Feb 3, 2024
1 parent 71e921a commit 352b2a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
22 changes: 12 additions & 10 deletions staticd/static_routes.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,17 @@ void static_install_nexthop(struct static_nexthop *nh)
}
}

void static_uninstall_nexthop(struct static_nexthop *nh)
{
struct static_path *pn = nh->pn;

if (nh->nh_vrf_id == VRF_UNKNOWN)
return;

static_zebra_nht_register(nh, false);
static_uninstall_path(pn);
}

void static_delete_nexthop(struct static_nexthop *nh)
{
struct static_path *pn = nh->pn;
Expand All @@ -386,17 +397,8 @@ void static_delete_nexthop(struct static_nexthop *nh)
/* Remove BFD session/configuration if any. */
bfd_sess_free(&nh->bsp);

if (nh->nh_vrf_id == VRF_UNKNOWN)
goto EXIT;

static_zebra_nht_register(nh, false);
/*
* If we have other si nodes then route replace
* else delete the route
*/
static_uninstall_path(pn);
static_uninstall_nexthop(nh);

EXIT:
route_unlock_node(rn);
/* Free static route configuration. */
XFREE(MTYPE_STATIC_NEXTHOP, nh);
Expand Down
1 change: 1 addition & 0 deletions staticd/static_routes.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ static_add_nexthop(struct static_path *pn, enum static_nh_type type,
struct ipaddr *ipaddr, const char *ifname,
const char *nh_vrf, uint32_t color);
extern void static_install_nexthop(struct static_nexthop *nh);
extern void static_uninstall_nexthop(struct static_nexthop *nh);

extern void static_delete_nexthop(struct static_nexthop *nh);

Expand Down

0 comments on commit 352b2a6

Please sign in to comment.