Reference

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) indicating that the source address is manually overwritten.

SEE ALSO

route(4), route(8), rtentry(9)

HISTORY

The nhop stack is a rework of routing subsystem by Alexander V. Chernikov ⟨[email protected]⟩

AUTHORS

This manual page was written by Seyed Pouria Mousavizadeh Tehrani ⟨[email protected]⟩