Skip to content

Commit

Permalink
Add nhgrp_get_idx() as a counterpart for nhop_get_idx().
Browse files Browse the repository at this point in the history
It allows the routing-related code to reference nexthop groups by index
 instead of storing a pointer.
  • Loading branch information
AlexanderChernikov committed Nov 28, 2020
1 parent 7a6dc73 commit ef6ef7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sys/net/route/nhgrp_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,15 @@ dump_nhgrp_entry(struct rib_head *rh, const struct nhgrp_priv *nhg_priv,
return (error);
}

uint32_t
nhgrp_get_idx(const struct nhgrp_object *nhg)
{
const struct nhgrp_priv *nhg_priv;

nhg_priv = NHGRP_PRIV_CONST(nhg);
return (nhg_priv->nhg_idx);
}

int
nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w)
{
Expand Down
1 change: 1 addition & 0 deletions sys/net/route/route_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ int nhgrp_get_addition_group(struct rib_head *rnh,
struct route_nhop_data *rnd_orig, struct route_nhop_data *rnd_add,
struct route_nhop_data *rnd_new);

uint32_t nhgrp_get_idx(const struct nhgrp_object *nhg);
void nhgrp_free(struct nhgrp_object *nhg);

/* Entropy data used for outbound hashing */
Expand Down

0 comments on commit ef6ef7e

Please sign in to comment.