Lines Matching refs:nh

86 static int dump_nhop_entry(struct rib_head *rh, struct nhop_object *nh, struct sysctl_req *w);
88 static int finalize_nhop(struct nh_control *ctl, struct nhop_object *nh, bool link);
89 static struct ifnet *get_aifp(const struct nhop_object *nh);
93 static void destroy_nhop(struct nhop_object *nh);
126 get_aifp(const struct nhop_object *nh) in get_aifp() argument
137 if ((nh->nh_ifp->if_flags & IFF_LOOPBACK) && in get_aifp()
138 nh->gw_sa.sa_family == AF_LINK) { in get_aifp()
139 aifp = ifnet_byindex(nh->gwl_sa.sdl_index); in get_aifp()
141 FIB_NH_LOG(LOG_WARNING, nh, "unable to get aifp for %s index %d", in get_aifp()
142 if_name(nh->nh_ifp), nh->gwl_sa.sdl_index); in get_aifp()
147 aifp = nh->nh_ifp; in get_aifp()
156 if (memcmp(_one->nh, _two->nh, NHOP_END_CMP) != 0) in cmp_priv()
169 set_nhop_mtu_from_info(struct nhop_object *nh, const struct rt_addrinfo *info) in set_nhop_mtu_from_info() argument
172 nhop_set_mtu(nh, info->rti_rmx->rmx_mtu, true); in set_nhop_mtu_from_info()
191 set_nhop_gw_from_info(struct nhop_object *nh, struct rt_addrinfo *info) in set_nhop_gw_from_info() argument
213 FIB_NH_LOG(LOG_DEBUG, nh, "error: invalid ifindex %d", in set_nhop_gw_from_info()
217 nhop_set_direct_gw(nh, ifp); in set_nhop_gw_from_info()
231 if (!nhop_set_gw(nh, gw, is_gw)) in set_nhop_gw_from_info()
238 set_nhop_expire_from_info(struct nhop_object *nh, const struct rt_addrinfo *info) in set_nhop_expire_from_info() argument
245 nhop_set_expire(nh, nh_expire); in set_nhop_expire_from_info()
271 struct nhop_object *nh = nhop_alloc(rnh->rib_fibnum, rnh->rib_family); in nhop_create_from_info() local
272 if (nh == NULL) in nhop_create_from_info()
275 if ((error = set_nhop_gw_from_info(nh, info)) != 0) { in nhop_create_from_info()
276 nhop_free(nh); in nhop_create_from_info()
279 nhop_set_transmit_ifp(nh, info->rti_ifp); in nhop_create_from_info()
281 nhop_set_blackhole(nh, info->rti_flags & (RTF_BLACKHOLE | RTF_REJECT)); in nhop_create_from_info()
284 info->rti_info[RTAX_NETMASK], nh); in nhop_create_from_info()
286 nhop_set_redirect(nh, info->rti_flags & RTF_DYNAMIC); in nhop_create_from_info()
287 nhop_set_pinned(nh, info->rti_flags & RTF_PINNED); in nhop_create_from_info()
288 set_nhop_expire_from_info(nh, info); in nhop_create_from_info()
289 nhop_set_rtflags(nh, info->rti_flags); in nhop_create_from_info()
291 set_nhop_mtu_from_info(nh, info); in nhop_create_from_info()
292 nhop_set_src(nh, info->rti_ifa); in nhop_create_from_info()
298 *nh_ret = nhop_get_nhop(nh, &error); in nhop_create_from_info()
313 nhop_get_nhop(struct nhop_object *nh, int *perror) in nhop_get_nhop() argument
315 struct rib_head *rnh = nhop_get_rh(nh); in nhop_get_nhop()
319 nhop_free(nh); in nhop_get_nhop()
323 return (nhop_get_nhop_internal(rnh, nh, perror)); in nhop_get_nhop()
327 nhop_get_nhop_internal(struct rib_head *rnh, struct nhop_object *nh, int *perror) in nhop_get_nhop_internal() argument
332 nh->nh_aifp = get_aifp(nh); in nhop_get_nhop_internal()
335 error = rnh->rnh_augment_nh(rnh->rib_fibnum, nh); in nhop_get_nhop_internal()
337 nhop_free(nh); in nhop_get_nhop_internal()
342 tmp_priv = find_nhop(rnh->nh_control, nh->nh_priv); in nhop_get_nhop_internal()
344 nhop_free(nh); in nhop_get_nhop_internal()
346 return (tmp_priv->nh); in nhop_get_nhop_internal()
357 *perror = finalize_nhop(rnh->nh_control, nh, true); in nhop_get_nhop_internal()
358 return (*perror == 0 ? nh : NULL); in nhop_get_nhop_internal()
369 nhop_get_unlinked(struct nhop_object *nh) in nhop_get_unlinked() argument
371 struct rib_head *rnh = nhop_get_rh(nh); in nhop_get_unlinked()
374 nhop_free(nh); in nhop_get_unlinked()
378 nh->nh_aifp = get_aifp(nh); in nhop_get_unlinked()
380 return (finalize_nhop(rnh->nh_control, nh, false)); in nhop_get_unlinked()
397 alter_nhop_from_info(struct nhop_object *nh, struct rt_addrinfo *info) in alter_nhop_from_info() argument
403 set_nhop_mtu_from_info(nh, info); in alter_nhop_from_info()
406 uint32_t rt_flags = nhop_get_rtflags(nh) & ~RT_CHANGE_RTFLAGS_MASK; in alter_nhop_from_info()
408 nhop_set_rtflags(nh, rt_flags); in alter_nhop_from_info()
413 error = set_nhop_gw_from_info(nh, info); in alter_nhop_from_info()
419 nhop_set_src(nh, info->rti_ifa); in alter_nhop_from_info()
421 nhop_set_transmit_ifp(nh, info->rti_ifp); in alter_nhop_from_info()
439 struct nhop_object *nh; in nhop_create_from_nhop() local
444 nh = nhop_alloc(rnh->rib_fibnum, rnh->rib_family); in nhop_create_from_nhop()
445 if (nh == NULL) in nhop_create_from_nhop()
448 nhop_copy(nh, nh_orig); in nhop_create_from_nhop()
450 error = alter_nhop_from_info(nh, info); in nhop_create_from_nhop()
452 nhop_free(nh); in nhop_create_from_nhop()
456 *pnh = nhop_get_nhop(nh, &error); in nhop_create_from_nhop()
462 reference_nhop_deps(struct nhop_object *nh) in reference_nhop_deps() argument
464 if (!ifa_try_ref(nh->nh_ifa)) in reference_nhop_deps()
466 nh->nh_aifp = get_aifp(nh); in reference_nhop_deps()
467 if (!if_try_ref(nh->nh_aifp)) { in reference_nhop_deps()
468 ifa_free(nh->nh_ifa); in reference_nhop_deps()
471 FIB_NH_LOG(LOG_DEBUG2, nh, "nh_aifp: %s nh_ifp %s", in reference_nhop_deps()
472 if_name(nh->nh_aifp), if_name(nh->nh_ifp)); in reference_nhop_deps()
473 if (!if_try_ref(nh->nh_ifp)) { in reference_nhop_deps()
474 ifa_free(nh->nh_ifa); in reference_nhop_deps()
475 if_rele(nh->nh_aifp); in reference_nhop_deps()
489 finalize_nhop(struct nh_control *ctl, struct nhop_object *nh, bool link) in finalize_nhop() argument
493 nh->nh_pksent = counter_u64_alloc(M_NOWAIT); in finalize_nhop()
494 if (nh->nh_pksent == NULL) { in finalize_nhop()
495 nhop_free(nh); in finalize_nhop()
497 FIB_NH_LOG(LOG_WARNING, nh, "counter_u64_alloc() failed"); in finalize_nhop()
501 if (!reference_nhop_deps(nh)) { in finalize_nhop()
502 counter_u64_free(nh->nh_pksent); in finalize_nhop()
503 nhop_free(nh); in finalize_nhop()
505 FIB_NH_LOG(LOG_WARNING, nh, "interface reference failed"); in finalize_nhop()
510 nh->nh_priv->nh_vnet = curvnet; in finalize_nhop()
513 refcount_init(&nh->nh_priv->nh_linked, 2); in finalize_nhop()
515 MPASS(nh->nh_priv->nh_fibnum == ctl->ctl_rh->rib_fibnum); in finalize_nhop()
518 refcount_release(&nh->nh_priv->nh_linked); in finalize_nhop()
520 nh->nh_priv->nh_finalized = 1; in finalize_nhop()
522 } else if (link_nhop(ctl, nh->nh_priv) == 0) { in finalize_nhop()
530 FIB_NH_LOG(LOG_WARNING, nh, "failed to link %s", in finalize_nhop()
531 nhop_print_buf(nh, nhbuf, sizeof(nhbuf))); in finalize_nhop()
532 destroy_nhop(nh); in finalize_nhop()
539 FIB_NH_LOG(LOG_DEBUG, nh, "finalized: %s", in finalize_nhop()
540 nhop_print_buf(nh, nhbuf, sizeof(nhbuf))); in finalize_nhop()
547 destroy_nhop(struct nhop_object *nh) in destroy_nhop() argument
549 if_rele(nh->nh_ifp); in destroy_nhop()
550 if_rele(nh->nh_aifp); in destroy_nhop()
551 ifa_free(nh->nh_ifa); in destroy_nhop()
552 counter_u64_free(nh->nh_pksent); in destroy_nhop()
554 uma_zfree(nhops_zone, nh); in destroy_nhop()
567 destroy_nhop(nh_priv->nh); in destroy_nhop_epoch()
571 nhop_ref_object(struct nhop_object *nh) in nhop_ref_object() argument
575 old = refcount_acquire(&nh->nh_priv->nh_refcnt); in nhop_ref_object()
576 KASSERT(old > 0, ("%s: nhop object %p has 0 refs", __func__, nh)); in nhop_ref_object()
580 nhop_try_ref_object(struct nhop_object *nh) in nhop_try_ref_object() argument
583 return (refcount_acquire_if_not_zero(&nh->nh_priv->nh_refcnt)); in nhop_try_ref_object()
587 nhop_free(struct nhop_object *nh) in nhop_free() argument
590 struct nhop_priv *nh_priv = nh->nh_priv; in nhop_free()
598 uma_zfree(nhops_zone, nh); in nhop_free()
604 FIB_NH_LOG(LOG_DEBUG, nh, "deleting %s", in nhop_free()
605 nhop_print_buf(nh, nhbuf, sizeof(nhbuf))); in nhop_free()
633 FIB_NH_LOG(LOG_WARNING, nh, "failed to unlink %s", in nhop_free()
634 nhop_print_buf(nh, nhbuf, sizeof(nhbuf))); in nhop_free()
645 nhop_ref_any(struct nhop_object *nh) in nhop_ref_any() argument
648 if (!NH_IS_NHGRP(nh)) in nhop_ref_any()
649 nhop_ref_object(nh); in nhop_ref_any()
651 nhgrp_ref_object((struct nhgrp_object *)nh); in nhop_ref_any()
653 nhop_ref_object(nh); in nhop_ref_any()
658 nhop_free_any(struct nhop_object *nh) in nhop_free_any() argument
662 if (!NH_IS_NHGRP(nh)) in nhop_free_any()
663 nhop_free(nh); in nhop_free_any()
665 nhgrp_free((struct nhgrp_object *)nh); in nhop_free_any()
667 nhop_free(nh); in nhop_free_any()
680 struct nhop_object *nh; in nhop_alloc() local
683 nh = (struct nhop_object *)uma_zalloc(nhops_zone, M_NOWAIT | M_ZERO); in nhop_alloc()
684 if (__predict_false(nh == NULL)) in nhop_alloc()
687 nh_priv = (struct nhop_priv *)((char *)nh + NHOP_OBJECT_ALIGNED_SIZE); in nhop_alloc()
688 nh->nh_priv = nh_priv; in nhop_alloc()
689 nh_priv->nh = nh; in nhop_alloc()
697 return (nh); in nhop_alloc()
701 nhop_copy(struct nhop_object *nh, const struct nhop_object *nh_orig) in nhop_copy() argument
703 struct nhop_priv *nh_priv = nh->nh_priv; in nhop_copy()
705 nh->nh_flags = nh_orig->nh_flags; in nhop_copy()
706 nh->nh_mtu = nh_orig->nh_mtu; in nhop_copy()
707 memcpy(&nh->gw_sa, &nh_orig->gw_sa, nh_orig->gw_sa.sa_len); in nhop_copy()
708 nh->nh_ifp = nh_orig->nh_ifp; in nhop_copy()
709 nh->nh_ifa = nh_orig->nh_ifa; in nhop_copy()
710 nh->nh_aifp = nh_orig->nh_aifp; in nhop_copy()
721 nhop_set_direct_gw(struct nhop_object *nh, struct ifnet *ifp) in nhop_set_direct_gw() argument
723 nh->nh_flags &= ~NHF_GATEWAY; in nhop_set_direct_gw()
724 nh->nh_priv->rt_flags &= ~RTF_GATEWAY; in nhop_set_direct_gw()
725 nh->nh_priv->nh_neigh_family = nh->nh_priv->nh_upper_family; in nhop_set_direct_gw()
727 fill_sdl_from_ifp(&nh->gwl_sa, ifp); in nhop_set_direct_gw()
728 memset(&nh->gw_buf[nh->gw_sa.sa_len], 0, sizeof(nh->gw_buf) - nh->gw_sa.sa_len); in nhop_set_direct_gw()
754 nhop_set_gw(struct nhop_object *nh, const struct sockaddr *gw, bool is_gw) in nhop_set_gw() argument
756 if (gw->sa_len > sizeof(nh->gw_buf)) { in nhop_set_gw()
757 FIB_NH_LOG(LOG_DEBUG, nh, "nhop SA size too big: AF %d len %u", in nhop_set_gw()
762 if (!nhop_check_gateway(nh->nh_priv->nh_upper_family, gw->sa_family)) { in nhop_set_gw()
763 FIB_NH_LOG(LOG_DEBUG, nh, in nhop_set_gw()
765 nh->nh_priv->nh_upper_family, gw->sa_family); in nhop_set_gw()
769 memcpy(&nh->gw_sa, gw, gw->sa_len); in nhop_set_gw()
770 memset(&nh->gw_buf[gw->sa_len], 0, sizeof(nh->gw_buf) - gw->sa_len); in nhop_set_gw()
773 nh->nh_flags |= NHF_GATEWAY; in nhop_set_gw()
774 nh->nh_priv->rt_flags |= RTF_GATEWAY; in nhop_set_gw()
775 nh->nh_priv->nh_neigh_family = gw->sa_family; in nhop_set_gw()
777 nh->nh_flags &= ~NHF_GATEWAY; in nhop_set_gw()
778 nh->nh_priv->rt_flags &= ~RTF_GATEWAY; in nhop_set_gw()
779 nh->nh_priv->nh_neigh_family = nh->nh_priv->nh_upper_family; in nhop_set_gw()
786 nhop_set_upper_family(struct nhop_object *nh, int family) in nhop_set_upper_family() argument
788 if (!nhop_check_gateway(nh->nh_priv->nh_upper_family, family)) { in nhop_set_upper_family()
789 FIB_NH_LOG(LOG_DEBUG, nh, in nhop_set_upper_family()
791 nh->nh_priv->nh_upper_family, family); in nhop_set_upper_family()
795 nh->nh_priv->nh_upper_family = family; in nhop_set_upper_family()
800 nhop_set_broadcast(struct nhop_object *nh, bool is_broadcast) in nhop_set_broadcast() argument
803 nh->nh_flags |= NHF_BROADCAST; in nhop_set_broadcast()
804 nh->nh_priv->rt_flags |= RTF_BROADCAST; in nhop_set_broadcast()
806 nh->nh_flags &= ~NHF_BROADCAST; in nhop_set_broadcast()
807 nh->nh_priv->rt_flags &= ~RTF_BROADCAST; in nhop_set_broadcast()
812 nhop_set_blackhole(struct nhop_object *nh, int blackhole_rt_flag) in nhop_set_blackhole() argument
814 nh->nh_flags &= ~(NHF_BLACKHOLE | NHF_REJECT); in nhop_set_blackhole()
815 nh->nh_priv->rt_flags &= ~(RTF_BLACKHOLE | RTF_REJECT); in nhop_set_blackhole()
818 nh->nh_flags |= NHF_BLACKHOLE; in nhop_set_blackhole()
819 nh->nh_priv->rt_flags |= RTF_BLACKHOLE; in nhop_set_blackhole()
822 nh->nh_flags |= NHF_REJECT; in nhop_set_blackhole()
823 nh->nh_priv->rt_flags |= RTF_REJECT; in nhop_set_blackhole()
830 nh->nh_ifp = V_loif; in nhop_set_blackhole()
831 nh->nh_flags &= ~NHF_GATEWAY; in nhop_set_blackhole()
832 nh->nh_priv->rt_flags &= ~RTF_GATEWAY; in nhop_set_blackhole()
833 nh->nh_priv->nh_neigh_family = nh->nh_priv->nh_upper_family; in nhop_set_blackhole()
835 bzero(&nh->gw_sa, sizeof(nh->gw_sa)); in nhop_set_blackhole()
837 switch (nh->nh_priv->nh_upper_family) { in nhop_set_blackhole()
840 nh->gw4_sa.sin_family = AF_INET; in nhop_set_blackhole()
841 nh->gw4_sa.sin_len = sizeof(struct sockaddr_in); in nhop_set_blackhole()
842 nh->gw4_sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); in nhop_set_blackhole()
847 nh->gw6_sa.sin6_family = AF_INET6; in nhop_set_blackhole()
848 nh->gw6_sa.sin6_len = sizeof(struct sockaddr_in6); in nhop_set_blackhole()
849 nh->gw6_sa.sin6_addr = in6addr_loopback; in nhop_set_blackhole()
856 nhop_set_redirect(struct nhop_object *nh, bool is_redirect) in nhop_set_redirect() argument
859 nh->nh_priv->rt_flags |= RTF_DYNAMIC; in nhop_set_redirect()
860 nh->nh_flags |= NHF_REDIRECT; in nhop_set_redirect()
862 nh->nh_priv->rt_flags &= ~RTF_DYNAMIC; in nhop_set_redirect()
863 nh->nh_flags &= ~NHF_REDIRECT; in nhop_set_redirect()
868 nhop_set_pinned(struct nhop_object *nh, bool is_pinned) in nhop_set_pinned() argument
871 nh->nh_priv->rt_flags |= RTF_PINNED; in nhop_set_pinned()
873 nh->nh_priv->rt_flags &= ~RTF_PINNED; in nhop_set_pinned()
877 nhop_get_idx(const struct nhop_object *nh) in nhop_get_idx() argument
880 return (nh->nh_priv->nh_idx); in nhop_get_idx()
884 nhop_get_uidx(const struct nhop_object *nh) in nhop_get_uidx() argument
886 return (nh->nh_priv->nh_uidx); in nhop_get_uidx()
890 nhop_set_uidx(struct nhop_object *nh, uint32_t uidx) in nhop_set_uidx() argument
892 nh->nh_priv->nh_uidx = uidx; in nhop_set_uidx()
896 nhop_get_type(const struct nhop_object *nh) in nhop_get_type() argument
899 return (nh->nh_priv->nh_type); in nhop_get_type()
903 nhop_set_type(struct nhop_object *nh, enum nhop_type nh_type) in nhop_set_type() argument
906 nh->nh_priv->nh_type = nh_type; in nhop_set_type()
910 nhop_get_rtflags(const struct nhop_object *nh) in nhop_get_rtflags() argument
913 return (nh->nh_priv->rt_flags); in nhop_get_rtflags()
920 nhop_set_rtflags(struct nhop_object *nh, int rt_flags) in nhop_set_rtflags() argument
922 nh->nh_priv->rt_flags &= ~RT_SET_RTFLAGS_MASK; in nhop_set_rtflags()
923 nh->nh_priv->rt_flags |= (rt_flags & RT_SET_RTFLAGS_MASK); in nhop_set_rtflags()
930 nhop_set_pxtype_flag(struct nhop_object *nh, int nh_flag) in nhop_set_pxtype_flag() argument
933 nh->nh_flags |= NHF_HOST; in nhop_set_pxtype_flag()
934 nh->nh_flags &= ~NHF_DEFAULT; in nhop_set_pxtype_flag()
935 nh->nh_priv->rt_flags |= RTF_HOST; in nhop_set_pxtype_flag()
937 nh->nh_flags |= NHF_DEFAULT; in nhop_set_pxtype_flag()
938 nh->nh_flags &= ~NHF_HOST; in nhop_set_pxtype_flag()
939 nh->nh_priv->rt_flags &= ~RTF_HOST; in nhop_set_pxtype_flag()
941 nh->nh_flags &= ~(NHF_HOST | NHF_DEFAULT); in nhop_set_pxtype_flag()
942 nh->nh_priv->rt_flags &= ~RTF_HOST; in nhop_set_pxtype_flag()
951 nhop_set_mtu(struct nhop_object *nh, uint32_t mtu, bool from_user) in nhop_set_mtu() argument
955 nh->nh_priv->rt_flags |= RTF_FIXEDMTU; in nhop_set_mtu()
957 nh->nh_priv->rt_flags &= ~RTF_FIXEDMTU; in nhop_set_mtu()
959 nh->nh_mtu = mtu; in nhop_set_mtu()
963 nhop_set_src(struct nhop_object *nh, struct ifaddr *ifa) in nhop_set_src() argument
965 nh->nh_ifa = ifa; in nhop_set_src()
969 nhop_set_transmit_ifp(struct nhop_object *nh, struct ifnet *ifp) in nhop_set_transmit_ifp() argument
971 nh->nh_ifp = ifp; in nhop_set_transmit_ifp()
976 nhop_get_vnet(const struct nhop_object *nh) in nhop_get_vnet() argument
979 return (nh->nh_priv->nh_vnet); in nhop_get_vnet()
983 nhop_select_func(struct nhop_object *nh, uint32_t flowid) in nhop_select_func() argument
986 return (nhop_select(nh, flowid)); in nhop_select_func()
993 nhop_get_upper_family(const struct nhop_object *nh) in nhop_get_upper_family() argument
995 return (nh->nh_priv->nh_upper_family); in nhop_get_upper_family()
1003 nhop_get_neigh_family(const struct nhop_object *nh) in nhop_get_neigh_family() argument
1005 return (nh->nh_priv->nh_neigh_family); in nhop_get_neigh_family()
1009 nhop_get_fibnum(const struct nhop_object *nh) in nhop_get_fibnum() argument
1011 return (nh->nh_priv->nh_fibnum); in nhop_get_fibnum()
1015 nhop_set_fibnum(struct nhop_object *nh, uint32_t fibnum) in nhop_set_fibnum() argument
1017 nh->nh_priv->nh_fibnum = fibnum; in nhop_set_fibnum()
1021 nhop_get_expire(const struct nhop_object *nh) in nhop_get_expire() argument
1023 return (nh->nh_priv->nh_expire); in nhop_get_expire()
1027 nhop_set_expire(struct nhop_object *nh, uint32_t expire) in nhop_set_expire() argument
1029 MPASS(!NH_IS_LINKED(nh)); in nhop_set_expire()
1030 nh->nh_priv->nh_expire = expire; in nhop_set_expire()
1034 nhop_get_rh(const struct nhop_object *nh) in nhop_get_rh() argument
1036 uint32_t fibnum = nhop_get_fibnum(nh); in nhop_get_rh()
1037 int family = nhop_get_neigh_family(nh); in nhop_get_rh()
1043 nhop_get_origin(const struct nhop_object *nh) in nhop_get_origin() argument
1045 return (nh->nh_priv->nh_origin); in nhop_get_origin()
1049 nhop_set_origin(struct nhop_object *nh, uint8_t origin) in nhop_set_origin() argument
1051 nh->nh_priv->nh_origin = origin; in nhop_set_origin()
1059 struct nhop_object *nh; in nhops_update_ifmtu() local
1065 nh = nh_priv->nh; in nhops_update_ifmtu()
1066 if (nh->nh_ifp == ifp) { in nhops_update_ifmtu()
1068 nh->nh_mtu > mtu) { in nhops_update_ifmtu()
1070 nh->nh_mtu = mtu; in nhops_update_ifmtu()
1103 return (nh_priv->nh); in nhops_iter_next()
1111 return (nh_priv->nh); in nhops_iter_next()
1133 nhop_print_buf(const struct nhop_object *nh, char *buf, size_t bufsize) in nhop_print_buf() argument
1138 struct nhop_priv *nh_priv = nh->nh_priv; in nhop_print_buf()
1139 const char *upper_str = rib_print_family(nh->nh_priv->nh_upper_family); in nhop_print_buf()
1141 switch (nh->gw_sa.sa_family) { in nhop_print_buf()
1144 inet_ntop(AF_INET, &nh->gw4_sa.sin_addr, abuf, sizeof(abuf)); in nhop_print_buf()
1146 if_name(nh->nh_ifp), abuf); in nhop_print_buf()
1151 inet_ntop(AF_INET6, &nh->gw6_sa.sin6_addr, abuf, sizeof(abuf)); in nhop_print_buf()
1153 if_name(nh->nh_ifp), abuf); in nhop_print_buf()
1158 if_name(nh->nh_ifp)); in nhop_print_buf()
1162 if_name(nh->nh_ifp)); in nhop_print_buf()
1170 nhop_print_buf_any(const struct nhop_object *nh, char *buf, size_t bufsize) in nhop_print_buf_any() argument
1173 if (NH_IS_NHGRP(nh)) in nhop_print_buf_any()
1174 return (nhgrp_print_buf((const struct nhgrp_object *)nh, buf, bufsize)); in nhop_print_buf_any()
1177 return (nhop_print_buf(nh, buf, bufsize)); in nhop_print_buf_any()
1189 dump_nhop_entry(struct rib_head *rh, struct nhop_object *nh, struct sysctl_req *w) in dump_nhop_entry() argument
1208 arpc.rtm.rtm_flags = nh->nh_priv->rt_flags; in dump_nhop_entry()
1213 pnhe->nh_idx = nh->nh_priv->nh_idx; in dump_nhop_entry()
1215 pnhe->ifindex = nh->nh_ifp->if_index; in dump_nhop_entry()
1216 pnhe->aifindex = nh->nh_aifp->if_index; in dump_nhop_entry()
1217 pnhe->nh_family = nh->nh_priv->nh_upper_family; in dump_nhop_entry()
1218 pnhe->nh_type = nh->nh_priv->nh_type; in dump_nhop_entry()
1219 pnhe->nh_mtu = nh->nh_mtu; in dump_nhop_entry()
1220 pnhe->nh_flags = nh->nh_flags; in dump_nhop_entry()
1222 memcpy(pnhe->nh_prepend, nh->nh_prepend, sizeof(nh->nh_prepend)); in dump_nhop_entry()
1223 pnhe->prepend_len = nh->nh_prepend_len; in dump_nhop_entry()
1224 pnhe->nh_refcount = nh->nh_priv->nh_refcnt; in dump_nhop_entry()
1225 pnhe->nh_pksent = counter_u64_fetch(nh->nh_pksent); in dump_nhop_entry()
1230 gw_sa = (struct sockaddr *)&nh->gw4_sa; in dump_nhop_entry()
1233 src_sa = nh->nh_ifa->ifa_addr; in dump_nhop_entry()
1238 nh->nh_ifa->ifa_ifp); in dump_nhop_entry()
1285 error = dump_nhop_entry(rh, nh_priv->nh, w); in nhops_dump_sysctl()