- Describe all available message headers.

- Sync structures/constants with sources.
- Fix multiple typos.

Reviewed by:	wollman
This commit is contained in:
Ruslan Ermilov 1999-09-14 00:26:11 +00:00
parent 3a6a5ebeb6
commit 646bae6082
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51251

View file

@ -47,7 +47,7 @@
.Ft int
.Fn socket PF_ROUTE SOCK_RAW "int family"
.Sh DESCRIPTION
.Tn UNIX
.Fx
provides some packet routing facilities.
The kernel maintains a routing information database, which
is used in selecting the appropriate network interface when
@ -117,7 +117,7 @@ to a specific address family by specifying which one is desired.
There can be more than one routing socket open per system.
.Pp
Messages are formed by a header followed by a small
number of sockadders (now variable length particularly
number of sockaddrs (now variable length particularly
in the
.Tn ISO
case), interpreted by position, and delimited
@ -132,7 +132,7 @@ to most significant bit within the vector.
.Pp
Any messages sent to the kernel are returned, and copies are sent
to all interested listeners. The kernel will provide the process
id. for the sender, and the sender may use an additional sequence
ID for the sender, and the sender may use an additional sequence
field to distinguish between outstanding messages. However,
message replies may be lost when kernel buffers are exhausted.
.Pp
@ -151,7 +151,7 @@ or
.Dv ENOBUFS
if insufficient resources were available
to install a new route.
In the current implementation, all routing process run locally,
In the current implementation, all routing processes run locally,
and the values for
.Ar rtm_errno
are available through the normal
@ -179,7 +179,8 @@ be reclaimed until all references to it are released.
User processes can obtain information about the routing
entry to a specific destination by using a
.Dv RTM_GET
message.
message, or by calling
.Xr sysctl 3 .
.Pp
Messages include:
.Bd -literal
@ -187,44 +188,100 @@ Messages include:
#define RTM_DELETE 0x2 /* Delete Route */
#define RTM_CHANGE 0x3 /* Change Metrics, Flags, or Gateway */
#define RTM_GET 0x4 /* Report Information */
#define RTM_LOOSING 0x5 /* Kernel Suspects Partitioning */
#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
#define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_RESOLVE 0xb /* request to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
.Ed
.Pp
A message header consists of:
A message header consists of one of the following:
.Bd -literal
struct rt_msghdr {
u_short rmt_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rmt_index; /* index for associated ifp */
int rtm_flags; /* flags, incl kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
pid_t rmt_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_use; /* from rtentry */
u_long rtm_inits; /* which values we are initializing */
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
pid_t rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_use; /* from rtentry */
u_long rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
struct if_msghdr {
u_short ifm_msglen; /* to skip over non-understood messages */
u_char ifm_version; /* future binary compatability */
u_char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
u_short ifm_index; /* index for associated ifp */
struct if_data ifm_data; /* statistics and other data about if */
};
struct ifa_msghdr {
u_short ifam_msglen; /* to skip over non-understood messages */
u_char ifam_version; /* future binary compatability */
u_char ifam_type; /* message type */
int ifam_addrs; /* like rtm_addrs */
int ifam_flags; /* value of ifa_flags */
u_short ifam_index; /* index for associated ifp */
int ifam_metric; /* value of ifa_metric */
};
struct ifma_msghdr {
u_short ifmam_msglen; /* to skip over non-understood messages */
u_char ifmam_version; /* future binary compatability */
u_char ifmam_type; /* message type */
int ifmam_addrs; /* like rtm_addrs */
int ifmam_flags; /* value of ifa_flags */
u_short ifmam_index; /* index for associated ifp */
};
.Ed
.Pp
where
The
.Dv RTM_IFINFO
message uses a
.Ar if_msghdr
header, the
.Dv RTM_NEWADDR
and
.Dv RTM_DELADDR
messages use a
.Ar ifa_msghdr
header, the
.Dv RTM_NEWMADDR
and
.Dv RTM_DELMADDR
messages use a
.Ar ifma_msghdr ,
and all other messages use the
.Ar rt_msghdr
header.
.Pp
The
.Dq Li "struct rt_metrics"
and the flag bits are as defined in
.Xr rtentry 9 .
.Pp
Specifiers for metric values in rmx_locks and rtm_inits are:
.Bd -literal
#define RTV_SSTHRESH 0x1 /* init or lock _ssthresh */
#define RTV_RPIPE 0x2 /* init or lock _recvpipe */
#define RTV_SPIPE 0x4 /* init or lock _sendpipe */
#define RTV_HOPCOUNT 0x8 /* init or lock _hopcount */
#define RTV_RTT 0x10 /* init or lock _rtt */
#define RTV_RTTVAR 0x20 /* init or lock _rttvar */
#define RTV_MTU 0x40 /* init or lock _mtu */
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
#define RTV_EXPIRE 0x4 /* init or lock _expire */
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
.Ed
.Pp
Specifiers for which addresses are present in the messages are:
@ -236,8 +293,10 @@ Specifiers for which addresses are present in the messages are:
#define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
.Ed
.Sh SEE ALSO
.Xr sysctl 3 ,
.Xr route 8 ,
.Xr rtentry 9
.Sh HISTORY