.\" $NetBSD: srt.4,v 1.3 2019/03/26 22:03:34 pgoyette Exp $
.\"
.\" This file is in the public domain.
.\"
.Dd March 27, 2019
.Dt SRT 4
.Os
.Sh NAME
.Nm srt
.Nd source-routing network interface
.Sh SYNOPSIS
.Cd pseudo-device srt
.Sh DESCRIPTION
The
.Nm srt
interface is a software interface that implements source-address-based
routing.
Packets are directed to the
.Nm
interface using normal routing decision process.
Packets queued for delivery are then processed according to the rules
established for the interface using the
.Xr srtconfig 1
utility.
.Pp
To use an
.Nm
device, the administrator must first create the interface.
This can be done by using the
.Xr ifconfig 8
.Cm create
command.
An
.Xr open 2
call on
.Pa /dev/srt Ns Sy N
will also create a network interface with a unit number the same as the
minor device number of that device if the interface doesn't exist yet.
.Pp
To be useful, the
.Nm
interface needs to be configured using
.Xr srtconfig 1
which uses the associated
.Nm
character device
.Pa /dev/srt Ns Sy # .
.Pp
The network interfaces should be named
.Sy srt Ns Ar 0 ,
.Sy srt Ns Ar 1 ,
etc.
The
.Nm
interface supports only the
.Xr open 2 ,
.Xr close 2 ,
and
.Xr ioctl 2
operations; other operations such as
.Xr read 2
and
.Xr write 2
are not supported.
.Pp
All standard network interface
.Xr ioctl 2
calls are supported by the
.Nm
interface.
In addition, the following
.Xr ioctl 2
calls
.Pq defined in Aq Pa net/if_srt.h
are supported on the
.Nm
character device:
.Bl -tag -width SRT_SGFLAGS -offset 4n
.It Dv SRT_GETNRT
The argument is a pointer to an integer, in which the number of
entries in the device's routing table is returned.
.It Dv SRT_GETRT
The argument is the address of a
.Fa struct srt_rt .
The routing table entry specified by the
.Dq inx
member is returned.
.It Dv SRT_SETRT
The argument is the address of a
.Fa struct srt_rt .
The routing entry is placed into the device's routing table at the
index specified by the
.Dq inx
member.
.It Dv SRT_DELRT
The argument is the address of a
.Fa struct srt_rt .
The routing entry specified by the
.Dq inx
member is deleted from the device's routing table.
(Any entries in the device's routing table with higher index values are
renumbered.)
.It Dv SRT_SFLAGS
The argument is a pointer to an integer containing any of the following
flags to be set:
.Bl -tag -width SSF_MTULOCK
.It Dv SSF_MTULOCK
If set, do not automatically update the interface's MTU.
.El
.It Dv SRT_GFLAGS
The argument is a pointer to an integer in which the current flags
are returned.
.It Dv SRT_SGFLAGS
This call updates the flags in the same manner as
.Dv SRT_SFLAGS .
The original flags are returned in the integer pointed to by the argument.
.It Dv SRT_DEBUG
Currently this is a no-op.
.El
.Sh SEE ALSO
.Xr srtconfig 1 ,
.Xr inet 4 ,
.Xr intro 4
.Sh HISTORY
.An -nosplit
The
.Nm
device was added in
.Nx 5.0
by
.An der Mouse Aq Mt mouse@NetBSD.org .
This manual page was prepared by
.An Paul Goyette Aq Mt pgoyette@NetBSD.org .