1.\" 2.\" Copyright (c) 2026 Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> 3.\" 4.\" SPDX-License-Identifier: BSD-2-Clause 5.\" 6.Dd July 30, 2026 7.Dt NHOP 9 8.Os 9.Sh NAME 10.Nm nhop , 11.Nm nhop_object 12.Nd structure of a nexthop entry in the kernel routing table 13.Sh SYNOPSIS 14.In sys/types.h 15.In sys/socket.h 16.In net/route.h 17.In net/route/nhop.h 18.Sh DESCRIPTION 19The kernel provides a common mechanism by which all routes can store 20and retrieve nexthop entries from a central table of routes. 21The 22.In net/route/nhop.h 23header file defines the structures and manifest constants used in this 24facility. 25.Pp 26The data plane structure of a nexthop is defined by 27.Vt "struct nhop_object" , 28which includes the following fields: 29.Bl -tag -offset indent -width 6n 30.It Vt "uint16_t flags" ; 31See below. 32.It Vt "uint16_t nh_mtu" ; 33MTU for this nexthop. 34.It Vt "char gw_buf[28]"; 35The gateway of the nexthop. 36An storage suitable to hold AF_INET, AF_INET6, or AF_NET gateway. 37.It Vt "struct ifnet *nh_ifp" ; 38.It Vt "struct ifaddr *nh_ifa" ; 39These two fields represent the 40.Dq answer , 41as it were, to the question posed by a route lookup; that is, they 42name the interface and interface address to be used in sending a 43packet to the destination or set of destinations which nexthop represents. 44.It Vt "struct ifnet *nh_aifp" ; 45Interface of the source address. 46It is same as 47.Va nh_ifp 48except for IPv6 loopback routes, or when the 49.Dv NHF_PREFSRC 50is set, which means the source address is borrowed from another interface. 51.It Vt "counter_u64_t nh_pksent"; 52A count of packets successfully sent via this nexthop. 53.It Vt "uint8_t nh_prepend_len"; 54link-level prepend length which is currently unused. 55.It Vt "uint8_t spare[3]"; 56.It Vt "uint32_t spare1"; 57These two fields are unused. 58.It Vt "char nh_prepend[48]"; 59link-level prepend data which is currently unused. 60.It Vt "struct nhop_priv *nh_priv"; 61Pointer to control plane data of nexthop. 62.El 63.Pp 64The following flag bits are defined: 65.Bl -tag -offset indent -width "NHF_BLACKHOLE" -compact 66.It Dv NHF_MULTIPATH 67The nexthop is a nexthop group. 68.It Dv NHF_REJECT 69Same as 70.Dv RTF_REJECT . 71The destination is presently unreachable. 72.It Dv NHF_BLACKHOLE 73Same as 74.Dv RTF_BLACKHOLE 75Requests that output sent via this nexthop be discarded. 76.It Dv NHF_REDIRECT 77Same as 78.Dv RTF_DYNAMIC 79and 80.Dv RTF_MODIFIED 81flags together. 82.It Dv NHF_DEFAULT 83The nexthop is used for default route. 84.It Dv NHF_BROADCAST 85Same as 86.Dv RTF_BROADCAST 87Indicates that the destination is a broadcast address. 88.It Dv NHF_GATEWAY 89Same as 90.Dv RTF_GATEWAY 91The route points to an intermediate destination and not the ultimate 92recipient; the 93.Va gw4_sa 94and 95.Va gw6_sa 96fields name that destination. 97.It Dv NHF_HOST 98Same as 99.Dv RTF_HOST 100This is a nexthop to a host route. 101This should result in an 102.Er EHOSTUNREACH 103error from output routines. 104.It Dv NHF_INVALID 105This nexthop is currently down. 106.It Dv NHF_PREFSRC 107Used only in the 108.Xr rtnetlink 4 109indicating that the source address is manually overwritten. 110.El 111.Sh SEE ALSO 112.Xr route 4 , 113.Xr route 8 , 114.Xr rtentry 9 115.Sh HISTORY 116The 117.Nm 118stack is a rework of routing subsystem by 119.An Alexander V. Chernikov Aq Mt melifaro@FreeBSD.org 120.Sh AUTHORS 121.An -nosplit 122This manual page was written by 123.An Seyed Pouria Mousavizadeh Tehrani Aq Mt pouria@FreeBSD.org 124