Lines Matching refs:nh
176 struct nhop_object *nh = unhop->un_nhop; in nl_find_nhop() local
179 nhop_ref_any(nh); in nl_find_nhop()
180 return (nh); in nl_find_nhop()
229 struct nhop_object *nh; in nl_find_nhop() local
232 nh = un_tmp->un_nhop; in nl_find_nhop()
235 nh = un_new->un_nhop; in nl_find_nhop()
240 NL_LOG(LOG_DEBUG2, "linked cloned nexthop %p", nh); in nl_find_nhop()
249 nhop_ref_any(nh); in nl_find_nhop()
250 return (nh); in nl_find_nhop()
276 struct nhop_object *nh = NULL; in clone_unhop() local
287 struct nhop_object *nh; in clone_unhop() local
288 nh = nhop_alloc(fibnum, AF_UNSPEC); in clone_unhop()
289 if (nh == NULL) in clone_unhop()
291 nhop_copy(nh, unhop->un_nhop_src); in clone_unhop()
293 if (!nhop_set_upper_family(nh, family)) { in clone_unhop()
294 nhop_free(nh); in clone_unhop()
297 nhop_set_uidx(nh, unhop->un_idx); in clone_unhop()
298 nhop_set_pxtype_flag(nh, nh_flags); in clone_unhop()
299 return (nhop_get_nhop(nh, &error)); in clone_unhop()
313 uint32_t uidx = nhop_get_uidx(wn[i].nh); in clone_unhop()
315 wn_new[i].nh = nl_find_nhop(fibnum, family, uidx, nh_flags, &error); in clone_unhop()
322 struct rib_head *rh = nhop_get_rh(wn_new[0].nh); in clone_unhop()
326 nh = (struct nhop_object *)nhg; in clone_unhop()
332 return (nh); in clone_unhop()
421 grp->id = nhop_get_uidx(wn[i].nh); in dump_nhgrp()
436 dump_nhop(const struct nhop_object *nh, uint32_t uidx, struct nlmsghdr *hdr, in dump_nhop() argument
444 nhm->nh_family = nhop_get_neigh_family(nh); in dump_nhop()
446 nhm->nh_protocol = nhop_get_origin(nh); in dump_nhop()
451 if (nh->nh_flags & NHF_BLACKHOLE) { in dump_nhop()
455 nlattr_add_u32(nw, NHA_OIF, if_getindex(nh->nh_ifp)); in dump_nhop()
457 switch (nh->gw_sa.sa_family) { in dump_nhop()
460 nlattr_add(nw, NHA_GATEWAY, 4, &nh->gw4_sa.sin_addr); in dump_nhop()
466 struct in6_addr addr = nh->gw6_sa.sin6_addr; in dump_nhop()
476 nlattr_add_u32(nw, NHAF_AIF, if_getindex(nh->nh_aifp)); in dump_nhop()
479 nlattr_add_u32(nw, NHAF_KID, nhop_get_idx(nh)); in dump_nhop()
480 nlattr_add_u32(nw, NHAF_FAMILY, nhop_get_upper_family(nh)); in dump_nhop()
481 nlattr_add_u32(nw, NHAF_TABLE, nhop_get_fibnum(nh)); in dump_nhop()
746 eligible_nhg(const struct nhop_object *nh) in eligible_nhg() argument
748 return (nh->nh_flags & NHF_GATEWAY); in eligible_nhg()
784 wn[i].nh = unhop->un_nhop_src; in newnhg()
799 nl_set_nexthop_gw(struct nhop_object *nh, struct sockaddr *gw, if_t ifp, in nl_set_nexthop_gw() argument
814 nhop_set_gw(nh, gw, true); in nl_set_nexthop_gw()
822 struct nhop_object *nh; in newnhop() local
844 nh = nhop_alloc(RT_DEFAULT_FIB, family); in newnhop()
845 if (nh == NULL) { in newnhop()
849 nhop_set_uidx(nh, attrs->nha_id); in newnhop()
850 nhop_set_origin(nh, attrs->nh_protocol); in newnhop()
853 nhop_set_blackhole(nh, NHF_BLACKHOLE); in newnhop()
855 error = nl_set_nexthop_gw(nh, attrs->nha_gw, attrs->nha_oif, npt); in newnhop()
857 nhop_free(nh); in newnhop()
860 nhop_set_transmit_ifp(nh, attrs->nha_oif); in newnhop()
861 nhop_set_src(nh, ifa); in newnhop()
864 error = nhop_get_unlinked(nh); in newnhop()
872 nhop_print_buf(nh, nhbuf, sizeof(nhbuf)); in newnhop()
876 unhop->un_nhop_src = nh; in newnhop()
1049 for (struct nhop_object *nh = nhops_iter_start(&iter); nh; in rtnl_handle_getnhop() local
1050 nh = nhops_iter_next(&iter)) { in rtnl_handle_getnhop()
1051 NL_LOG(LOG_DEBUG3, "get %u", nhop_get_idx(nh)); in rtnl_handle_getnhop()
1052 if (nhop_get_idx(nh) == attrs.nhaf_kid) { in rtnl_handle_getnhop()
1053 dump_nhop(nh, 0, &wa.hdr, wa.nw); in rtnl_handle_getnhop()
1068 for (struct nhop_object *nh = nhops_iter_start(&iter); nh; in rtnl_handle_getnhop() local
1069 nh = nhops_iter_next(&iter)) { in rtnl_handle_getnhop()
1070 dump_nhop(nh, 0, &wa.hdr, wa.nw); in rtnl_handle_getnhop()