Lines Matching defs:nh

101 static int nhop_get_prio(const struct nhop_object *nh);
190 nhop_can_multipath(const struct nhop_object *nh)
193 if ((nh->nh_flags & NHF_MULTIPATH) != 0)
195 if ((nh->nh_flags & NHF_GATEWAY) == 0)
197 if ((nh->nh_flags & NHF_REDIRECT) != 0)
237 nhop_get_prio(const struct nhop_object *nh)
239 if (NH_IS_PINNED(nh))
245 * Check if specified @gw matches gw data in the nexthop @nh.
250 match_nhop_gw(const struct nhop_object *nh, const struct sockaddr *gw)
253 if (nh->gw_sa.sa_family != gw->sa_family)
258 return (nh->gw4_sa.sin_addr.s_addr ==
270 if (IN6_ARE_ADDR_EQUAL(&nh->gw6_sa.sin6_addr,
279 return (nh->gwl_sa.sdl_index == sdl->sdl_index);
282 return (memcmp(&nh->gw_sa, gw, nh->gw_sa.sa_len) == 0);
294 rib_match_gw(const struct rtentry *rt, const struct nhop_object *nh, void *gw_sa)
298 return (match_nhop_gw(nh, gw));
310 match_gw_one(const struct rtentry *rt, const struct nhop_object *nh, void *_data)
315 if (match_nhop_gw(nh, gwd->gw) && gwd->count++ == 0)
321 * Checks if data in @info matches nexhop @nh.
329 const struct nhop_object *nh)
334 if (info->rti_filter(rt, nh, info->rti_filterdata) == 0)
339 if ((gw != NULL) && !match_nhop_gw(nh, gw))
643 struct nhop_object *nh = nhop_alloc(rh_dst->rib_fibnum, rh_dst->rib_family);
644 if (nh == NULL) {
648 nhop_copy(nh, rnd_src->rnd_nhop);
649 nhop_set_origin(nh, nhop_get_origin(rnd_src->rnd_nhop));
650 nhop_set_fibnum(nh, rh_dst->rib_fibnum);
651 nh = nhop_get_nhop_internal(rh_dst, nh, &error);
661 nhop_free(nh);
666 .rnd_nhop = nh,
669 int op_flags = RTM_F_CREATE | (NH_IS_PINNED(nh) ? RTM_F_FORCE : 0);
679 nhop_free(nh);
730 struct nhop_object *nh;
765 error = nhop_create_from_info(rnh, info, &nh);
771 rnd_add.rnd_nhop = nh;
791 struct nhop_object *nh;
797 nh = rnd_add->rnd_nhop;
831 nh = rc->rc_nh_old;
866 nhop_free_any(nh);
1009 struct nhop_object *nh = rt->rt_nhop;
1012 if (NH_IS_NHGRP(nh)) {
1013 struct nhgrp_object *nhg = (struct nhgrp_object *)nh;
1031 if (cb != NULL && !cb(rt, nh, cbdata))
1034 if (prio < nhop_get_prio(nh))
1147 if (check_info_match_nhop(info, NULL, wn[i].nh) == 0) {
1148 nh_orig = wn[i].nh;
1169 wn_new[found_idx].nh = nh_new;
1479 struct nhop_object *nh;
1506 nh = rt->rt_nhop;
1509 di.rc.rc_nh_old = nh;
1517 if (NH_IS_NHGRP(nh)) {
1518 nhg = (struct nhgrp_object *)nh;
1521 rt_routemsg(RTM_DELETE, rt, wn[i].nh, fibnum);
1524 rt_routemsg(RTM_DELETE, rt, nh, fibnum);