Index: head/sys/net/route/nhgrp_ctl.c =================================================================== --- head/sys/net/route/nhgrp_ctl.c +++ head/sys/net/route/nhgrp_ctl.c @@ -294,6 +294,17 @@ } void +nhgrp_ref_object(struct nhgrp_object *nhg) +{ + struct nhgrp_priv *nhg_priv; + u_int old; + + nhg_priv = NHGRP_PRIV(nhg); + old = refcount_acquire(&nhg_priv->nhg_refcount); + KASSERT(old > 0, ("%s: nhgrp object %p has 0 refs", __func__, nhg)); +} + +void nhgrp_free(struct nhgrp_object *nhg) { struct nhgrp_priv *nhg_priv; Index: head/sys/net/route/nhop_ctl.c =================================================================== --- head/sys/net/route/nhop_ctl.c +++ head/sys/net/route/nhop_ctl.c @@ -691,6 +691,19 @@ } void +nhop_ref_any(struct nhop_object *nh) +{ +#ifdef ROUTE_MPATH + if (!NH_IS_NHGRP(nh)) + nhop_ref_object(nh); + else + nhgrp_ref_object((struct nhgrp_object *)nh); +#else + nhop_ref_object(nh); +#endif +} + +void nhop_free_any(struct nhop_object *nh) { Index: head/sys/net/route/route_var.h =================================================================== --- head/sys/net/route/route_var.h +++ head/sys/net/route/route_var.h @@ -242,6 +242,7 @@ void nhops_destroy_rib(struct rib_head *rh); void nhop_ref_object(struct nhop_object *nh); int nhop_try_ref_object(struct nhop_object *nh); +void nhop_ref_any(struct nhop_object *nh); void nhop_free_any(struct nhop_object *nh); void nhop_set_type(struct nhop_object *nh, enum nhop_type nh_type); @@ -306,6 +307,7 @@ struct route_nhop_data *rnd_orig, struct route_nhop_data *rnd_add, struct route_nhop_data *rnd_new); +void nhgrp_ref_object(struct nhgrp_object *nhg); uint32_t nhgrp_get_idx(const struct nhgrp_object *nhg); void nhgrp_free(struct nhgrp_object *nhg);