diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2021-08-05 09:38:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-05 09:38:00 -0400 |
| commit | 5dbd69cc9fbfe3c3215fafe5c89815e5ca9dac4a (patch) | |
| tree | 1c33c1de1692b073720876d835646c8c767dfdb7 /staticd/static_zebra.c | |
| parent | 5f10f7804f0dc07d58173afda47b3067472e1b6f (diff) | |
| parent | 4067e951407bbbdcdb8f4edb9c64763cd777476d (diff) | |
Merge pull request #9023 from idryzhov/static-nb
staticd: simplify the northbound code
Diffstat (limited to 'staticd/static_zebra.c')
| -rw-r--r-- | staticd/static_zebra.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index 40275908f7..452b5c42a4 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -261,9 +261,10 @@ static void static_nht_hash_free(void *data) XFREE(MTYPE_TMP, nhtd); } -void static_zebra_nht_register(struct route_node *rn, struct static_nexthop *nh, - bool reg) +void static_zebra_nht_register(struct static_nexthop *nh, bool reg) { + struct static_path *pn = nh->pn; + struct route_node *rn = pn->rn; struct static_nht_data *nhtd, lookup; uint32_t cmd; struct prefix p; @@ -339,8 +340,10 @@ void static_zebra_nht_register(struct route_node *rn, struct static_nexthop *nh, * When nexthop gets updated via configuration then use the * already registered NH and resend the route to zebra */ -int static_zebra_nh_update(struct route_node *rn, struct static_nexthop *nh) +int static_zebra_nh_update(struct static_nexthop *nh) { + struct static_path *pn = nh->pn; + struct route_node *rn = pn->rn; struct static_nht_data *nhtd, lookup = {}; struct prefix p = {}; afi_t afi = AFI_IP; @@ -381,25 +384,23 @@ int static_zebra_nh_update(struct route_node *rn, struct static_nexthop *nh) return 0; } -extern void static_zebra_route_add(struct route_node *rn, - struct static_path *pn, safi_t safi, - bool install) +extern void static_zebra_route_add(struct static_path *pn, bool install) { + struct route_node *rn = pn->rn; + struct static_route_info *si = rn->info; struct static_nexthop *nh; const struct prefix *p, *src_pp; struct zapi_nexthop *api_nh; struct zapi_route api; uint32_t nh_num = 0; - struct stable_info *info; p = src_pp = NULL; srcdest_rnode_prefixes(rn, &p, &src_pp); memset(&api, 0, sizeof(api)); - info = static_get_stable_info(rn); - api.vrf_id = GET_STABLE_VRF_ID(info); + api.vrf_id = si->svrf->vrf->vrf_id; api.type = ZEBRA_ROUTE_STATIC; - api.safi = safi; + api.safi = si->safi; memcpy(&api.prefix, p, sizeof(api.prefix)); if (src_pp) { |
