Module route

Source
Expand description

Structures and functions for interacting with routing configuration and state.

This file contains machinery for interacting with the illumos router socket. This socket has the address family AF_ROUTE. Packets exchanged over an AF_ROUTE socket have a special header described by [sys::rt_msghdr].

The structure of an AF_ROUTE message is the following.

rt_msghdr: 74 bytes
route_addr_element_1: N bytes
route_addr_element_2: N bytes
...
route_addr_element_N: N bytes

In the rt_msghdr there is a field addrs which is a bitmask that identifies what address elements are present in the message. Members of this bitfield are constants with the name format RTA_<address name>. These include

RTA_DST =       1
RTA_GATEWAY =   (1<<1)
RTA_NETMASK =   (1<<2)
RTA_GENMASK =   (1<<3)
RTA_IFP =       (1<<4)
RTA_IFA =       (1<<5)
RTA_AUTHOR =    (1<<6)
RTA_BRD =       (1<<7)
RTA_SRC =       (1<<8)
RTA_DELAY =     (1<<9)

Address elements always appear in the order they are defined in the bitmask. For example, a message containing RTA_DST RTA_GENMASK and RTA_AUTHOR will always be structured as

t_msghdr
TA_DST
TA_GENMASK
TA_AUTHOR

Structs§

Route
RtMsg
SocketDlAddr

Enums§

Error

Functions§

add_route
delete_route
ensure_route_present
get_route
get_routes