Lines Matching refs:nh
204 static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh,
209 const struct nhop_object *nh, struct rt_metrics *out);
216 struct rib_cmd_info *rc, struct nhop_object *nh);
281 struct nhop_object *nh; in report_route_event() local
283 nh = rc->rc_cmd == RTM_DELETE ? rc->rc_nh_old : rc->rc_nh_new; in report_route_event()
284 rt_routemsg(rc->rc_cmd, rc->rc_rt, nh, fibnum); in report_route_event()
512 struct nhop_object *nh, union sockaddr_union *saun, struct ucred *cred) in rtm_get_jailed() argument
519 if (prison_if(cred, nh->nh_ifa->ifa_addr) == 0) { in rtm_get_jailed()
520 info->rti_info[RTAX_IFA] = nh->nh_ifa->ifa_addr; in rtm_get_jailed()
554 ia = ((struct sockaddr_in *)nh->nh_ifa->ifa_addr)-> in rtm_get_jailed()
597 ia6 = ((struct sockaddr_in6 *)nh->nh_ifa->ifa_addr)-> in rtm_get_jailed()
718 struct nhop_object *nh; in fill_addrinfo() local
730 nh = rib_lookup(fibnum, info->rti_info[RTAX_GATEWAY], NHR_NONE, 0); in fill_addrinfo()
731 if (nh != NULL && nh->gw_sa.sa_family == AF_LINK && in fill_addrinfo()
732 nh->nh_ifp->if_flags & IFF_LOOPBACK) { in fill_addrinfo()
742 select_nhop(struct nhop_object *nh, const struct sockaddr *gw) in select_nhop() argument
744 if (!NH_IS_NHGRP(nh)) in select_nhop()
745 return (nh); in select_nhop()
749 wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); in select_nhop()
751 return (wn[0].nh); in select_nhop()
753 if (match_nhop_gw(wn[i].nh, gw)) in select_nhop()
754 return (wn[i].nh); in select_nhop()
773 struct nhop_object *nh; in handle_rtm_get() local
809 nh = select_nhop(rt_get_raw_nhop(rc->rc_rt), info->rti_info[RTAX_GATEWAY]); in handle_rtm_get()
810 if (nh == NULL) { in handle_rtm_get()
824 if (nh->nh_ifp != NULL && in handle_rtm_get()
825 nh->nh_ifp->if_type == IFT_PROPVIRTUAL) { in handle_rtm_get()
835 rt_maskedcopy(nh->nh_ifa->ifa_addr, in handle_rtm_get()
837 nh->nh_ifa->ifa_netmask); in handle_rtm_get()
847 nh = select_nhop(rt_get_raw_nhop(rc->rc_rt), info->rti_info[RTAX_GATEWAY]); in handle_rtm_get()
848 if (nh == NULL) { in handle_rtm_get()
853 rc->rc_nh_new = nh; in handle_rtm_get()
972 int alloc_len, struct rib_cmd_info *rc, struct nhop_object *nh) in update_rtm_from_rc() argument
987 info->rti_info[RTAX_GATEWAY] = &nh->gw_sa; in update_rtm_from_rc()
989 ifp = nh->nh_ifp; in update_rtm_from_rc()
994 error = rtm_get_jailed(info, ifp, nh, in update_rtm_from_rc()
1000 nh->nh_ifa->ifa_dstaddr; in update_rtm_from_rc()
1013 rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh); in update_rtm_from_rc()
1017 rt_getmetrics(rc->rc_rt, nh, &rtm->rtm_rmx); in update_rtm_from_rc()
1071 struct nhop_object *nh; in rts_send() local
1105 nh = NULL; in rts_send()
1175 nh = rc.rc_nh_new; in rts_send()
1176 if (nh != NULL) { in rts_send()
1177 rtm->rtm_index = nh->nh_ifp->if_index; in rts_send()
1178 rtm->rtm_flags = rc.rc_rt->rte_flags | nhop_get_rtflags(nh); in rts_send()
1196 nh = rc.rc_nh_old; in rts_send()
1204 nh = rc.rc_nh_new; in rts_send()
1214 if (error == 0 && nh != NULL) { in rts_send()
1215 error = update_rtm_from_rc(&info, &rtm, alloc_len, &rc, nh); in rts_send()
1321 rt_getmetrics(const struct rtentry *rt, const struct nhop_object *nh, in rt_getmetrics() argument
1326 out->rmx_mtu = nh->nh_mtu; in rt_getmetrics()
1328 out->rmx_nhidx = nhop_get_idx(nh); in rt_getmetrics()
1330 out->rmx_expire = nhop_get_expire(nh) ? in rt_getmetrics()
1331 nhop_get_expire(nh) - time_uptime + time_second : 0; in rt_getmetrics()
2042 rtsock_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh, in rtsock_routemsg() argument
2058 info.rti_info[RTAX_GATEWAY] = &nh->gw_sa; in rtsock_routemsg()
2059 info.rti_flags = rt->rte_flags | nhop_get_rtflags(nh); in rtsock_routemsg()
2060 info.rti_ifp = nh->nh_ifp; in rtsock_routemsg()
2243 struct nhop_object *nh; in sysctl_dumpentry() local
2251 nh = rt_get_raw_nhop(rt); in sysctl_dumpentry()
2253 if (NH_IS_NHGRP(nh)) { in sysctl_dumpentry()
2257 wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); in sysctl_dumpentry()
2259 error = sysctl_dumpnhop(rt, wn[i].nh, wn[i].weight, w); in sysctl_dumpentry()
2265 sysctl_dumpnhop(rt, nh, rt->rt_weight, w); in sysctl_dumpentry()
2272 sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight, in sysctl_dumpnhop() argument
2279 rtflags = nhop_get_rtflags(nh); in sysctl_dumpnhop()
2286 info.rti_info[RTAX_GATEWAY] = &nh->gw_sa; in sysctl_dumpnhop()
2289 if (nh->nh_ifp && !(nh->nh_ifp->if_flags & IFF_DYING)) { in sysctl_dumpnhop()
2290 info.rti_info[RTAX_IFP] = nh->nh_ifp->if_addr->ifa_addr; in sysctl_dumpnhop()
2291 info.rti_info[RTAX_IFA] = nh->nh_ifa->ifa_addr; in sysctl_dumpnhop()
2292 if (nh->nh_ifp->if_flags & IFF_POINTOPOINT) in sysctl_dumpnhop()
2293 info.rti_info[RTAX_BRD] = nh->nh_ifa->ifa_dstaddr; in sysctl_dumpnhop()
2312 rt_getmetrics(rt, nh, &rtm->rtm_rmx); in sysctl_dumpnhop()
2314 rtm->rtm_index = nh->nh_ifp->if_index; in sysctl_dumpnhop()