---
name: "nhop"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/nhop"
---

# nhop(9)

structure of a nexthop entry in the kernel routing table

## NAME

**nhop**, **nhop\_object** – structure of a nexthop entry in the kernel routing table

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<sys/socket.h\>**

**#include \<net/route.h\>**

**#include \<net/route/nhop.h\>**

## DESCRIPTION

The kernel provides a common mechanism by which all routes can store and retrieve nexthop entries from a central table of routes. The ⟨net/route/nhop.h⟩ header file defines the structures and manifest constants used in this facility.

The data plane structure of a nexthop is defined by *struct nhop\_object*, which includes the following fields:

- *uint16\_t flags*;

  See below.

- *uint16\_t nh\_mtu*;

  MTU for this nexthop.

- *char gw\_buf\[28\]*;

  The gateway of the nexthop. An storage suitable to hold AF\_INET, AF\_INET6, or AF\_NET gateway.

- *struct ifnet \*nh\_ifp*;

  - *struct ifaddr \*nh\_ifa*;

  These two fields represent the “answer”, as it were, to the question posed by a route lookup; that is, they name the interface and interface address to be used in sending a packet to the destination or set of destinations which nexthop represents.

- *struct ifnet \*nh\_aifp*;

  Interface of the source address. It is same as *nh\_ifp* except for IPv6 loopback routes, or when the NHF\_PREFSRC is set, which means the source address is borrowed from another interface.

- *counter\_u64\_t nh\_pksent*;

  A count of packets successfully sent via this nexthop.

- *uint8\_t nh\_prepend\_len*;

  link-level prepend length which is currently unused.

- *uint8\_t spare\[3\]*;

  - *uint32\_t spare1*;

  These two fields are unused.

- *char nh\_prepend\[48\]*;

  link-level prepend data which is currently unused.

- *struct nhop\_priv \*nh\_priv*;

  Pointer to control plane data of nexthop.

The following flag bits are defined:

- NHF\_MULTIPATH

  The nexthop is a nexthop group.

- NHF\_REJECT

  Same as RTF\_REJECT. The destination is presently unreachable.

- NHF\_BLACKHOLE

  Same as RTF\_BLACKHOLE Requests that output sent via this nexthop be discarded.

- NHF\_REDIRECT

  Same as RTF\_DYNAMIC and RTF\_MODIFIED flags together.

- NHF\_DEFAULT

  The nexthop is used for default route.

- NHF\_BROADCAST

  Same as RTF\_BROADCAST Indicates that the destination is a broadcast address.

- NHF\_GATEWAY

  Same as RTF\_GATEWAY The route points to an intermediate destination and not the ultimate recipient; the *gw4\_sa* and *gw6\_sa* fields name that destination.

- NHF\_HOST

  Same as RTF\_HOST This is a nexthop to a host route. This should result in an EHOSTUNREACH error from output routines.

- NHF\_INVALID

  This nexthop is currently down.

- NHF\_PREFSRC

  Used only in the [rtnetlink(4)](/rtnetlink/4.md) indicating that the source address is manually overwritten.

## SEE ALSO

[route(4)](/route/4.md), [route(8)](/route/8.md), [rtentry(9)](/rtentry/9.md)

## HISTORY

The **nhop** stack is a rework of routing subsystem by Alexander V. Chernikov ⟨*melifaro@FreeBSD.org*⟩

## AUTHORS

This manual page was written by Seyed Pouria Mousavizadeh Tehrani ⟨*pouria@FreeBSD.org*⟩
