diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-03 21:38:12 +0200 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-04 22:28:10 +0200 | 
| commit | 6090b2b939cd01f1c9d44c14ebfa257795f06a1b (patch) | |
| tree | b9499f9e1b4a81b53756c1648451db4cedf873a7 /staticd | |
| parent | 0d9127bca1fa4aa3613f9bc48f732ec1100f865b (diff) | |
staticd: add a separate function for uninstalling nexthops
Will be used in the following commit.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'staticd')
| -rw-r--r-- | staticd/static_routes.c | 22 | ||||
| -rw-r--r-- | staticd/static_routes.h | 1 | 
2 files changed, 13 insertions, 10 deletions
diff --git a/staticd/static_routes.c b/staticd/static_routes.c index db3fc32fd8..6c83c82c06 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -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; @@ -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); diff --git a/staticd/static_routes.h b/staticd/static_routes.h index d88ed29364..2e2e4986c3 100644 --- a/staticd/static_routes.h +++ b/staticd/static_routes.h @@ -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);  | 
