man-pages/man7/rtnetlink.7.html
2021-03-31 01:06:50 +01:00

581 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of RTNETLINK</TITLE>
</HEAD><BODY>
<H1>RTNETLINK</H1>
Section: Linux Programmer's Manual (7)<BR>Updated: 2020-02-09<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
rtnetlink - Linux IPv4 routing socket
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/asm/types.h">asm/types.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/linux/if_link.h">linux/if_link.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/linux/netlink.h">linux/netlink.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/linux/rtnetlink.h">linux/rtnetlink.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/sys/socket.h">sys/socket.h</A>&gt;</B>
<P>
<B>rtnetlink_socket = socket(AF_NETLINK, int </B><I>socket_type</I><B>, NETLINK_ROUTE);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Rtnetlink allows the kernel's routing tables to be read and altered.
It is used within the kernel to communicate between
various subsystems, though this usage is not documented here, and for
communication with user-space programs.
Network routes, IP addresses, link parameters, neighbor setups, queueing
disciplines, traffic classes and packet classifiers may all be controlled
through
<B>NETLINK_ROUTE</B>
sockets.
It is based on netlink messages; see
<B><A HREF="/cgi-bin/man/man2html?7+netlink">netlink</A></B>(7)
for more information.
<A NAME="lbAE">&nbsp;</A>
<H3>Routing attributes</H3>
Some rtnetlink messages have optional attributes after the initial header:
<P>
struct rtattr {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;short&nbsp;rta_len;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Length&nbsp;of&nbsp;option&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;short&nbsp;rta_type;&nbsp;&nbsp;&nbsp;/*&nbsp;Type&nbsp;of&nbsp;option&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Data&nbsp;follows&nbsp;*/
};
<P>
These attributes should be manipulated using only the RTA_* macros
or libnetlink, see
<B><A HREF="/cgi-bin/man/man2html?3+rtnetlink">rtnetlink</A></B>(3).
<A NAME="lbAF">&nbsp;</A>
<H3>Messages</H3>
Rtnetlink consists of these message types
(in addition to standard netlink messages):
<DL COMPACT>
<DT id="1"><B>RTM_NEWLINK</B>, <B>RTM_DELLINK</B>, <B>RTM_GETLINK</B>
<DD>
Create, remove or get information about a specific network interface.
These messages contain an
<I>ifinfomsg</I>
structure followed by a series of
<I>rtattr</I>
structures.
<DT id="2"><DD>
struct ifinfomsg {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;ifi_family;&nbsp;/*&nbsp;AF_UNSPEC&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;short&nbsp;ifi_type;&nbsp;&nbsp;&nbsp;/*&nbsp;Device&nbsp;type&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ifi_index;&nbsp;&nbsp;/*&nbsp;Interface&nbsp;index&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;int&nbsp;&nbsp;&nbsp;ifi_flags;&nbsp;&nbsp;/*&nbsp;Device&nbsp;flags&nbsp;&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;int&nbsp;&nbsp;&nbsp;ifi_change;&nbsp;/*&nbsp;change&nbsp;mask&nbsp;*/
};
<DT id="3"><DD>
<I>ifi_flags</I>
contains the device flags, see
<B><A HREF="/cgi-bin/man/man2html?7+netdevice">netdevice</A></B>(7);
<I>ifi_index</I>
is the unique interface index
(since Linux 3.7, it is possible to feed a nonzero value with the
<B>RTM_NEWLINK</B>
message, thus creating a link with the given
<I>ifindex</I>);
<I>ifi_change</I>
is reserved for future use and should be always set to 0xFFFFFFFF.
<TABLE>
<TR VALIGN=top><TD ALIGN=center COLSPAN=3>Routing attributes<BR></TD></TR>
<TR VALIGN=top><TD>rta_type</TD><TD>value type</TD><TD>description<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=3><HR></TD></TR>
<TR VALIGN=top><TD>IFLA_UNSPEC</TD><TD>-</TD><TD>unspecified.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_ADDRESS</TD><TD>hardware address</TD><TD>interface L2 address<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_BROADCAST</TD><TD>hardware address</TD><TD>L2 broadcast address.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_IFNAME</TD><TD>asciiz string</TD><TD>Device name.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_MTU</TD><TD>unsigned int</TD><TD>MTU of the device.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_LINK</TD><TD>int</TD><TD>Link type.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_QDISC</TD><TD>asciiz string</TD><TD>Queueing discipline.<BR></TD></TR>
<TR VALIGN=top><TD>IFLA_STATS</TD><TD>
see below
</TD><TD>Interface Statistics.<BR></TD></TR>
</TABLE>
</DL>
<P>
The value type for
<B>IFLA_STATS</B>
is
<I>struct rtnl_link_stats</I>
(<I>struct net_device_stats</I>
in Linux 2.4 and earlier).
<DL COMPACT>
<DT id="4"><B>RTM_NEWADDR</B>, <B>RTM_DELADDR</B>, <B>RTM_GETADDR</B>
<DD>
Add, remove or receive information about an IP address associated with
an interface.
In Linux 2.2, an interface can carry multiple IP addresses,
this replaces the alias device concept in 2.0.
In Linux 2.2, these messages
support IPv4 and IPv6 addresses.
They contain an
<I>ifaddrmsg</I>
structure, optionally followed by
<I>rtattr</I>
routing attributes.
<DT id="5"><DD>
struct ifaddrmsg {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;ifa_family;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Address&nbsp;type&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;ifa_prefixlen;&nbsp;/*&nbsp;Prefixlength&nbsp;of&nbsp;address&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;ifa_flags;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Address&nbsp;flags&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;ifa_scope;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Address&nbsp;scope&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;int&nbsp;&nbsp;ifa_index;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Interface&nbsp;index&nbsp;*/
};
<DT id="6"><DD>
<I>ifa_family</I>
is the address family type (currently
<B>AF_INET</B>
or
<B>AF_INET6</B>),
<I>ifa_prefixlen</I>
is the length of the address mask of the address if defined for the
family (like for IPv4),
<I>ifa_scope</I>
is the address scope,
<I>ifa_index</I>
is the interface index of the interface the address is associated with.
<I>ifa_flags</I>
is a flag word of
<B>IFA_F_SECONDARY</B>
for secondary address (old alias interface),
<B>IFA_F_PERMANENT</B>
for a permanent address set by the user and other undocumented flags.
<TABLE>
<TR VALIGN=top><TD ALIGN=center COLSPAN=3>Attributes<BR></TD></TR>
<TR VALIGN=top><TD>rta_type</TD><TD>value type</TD><TD>description<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=3><HR></TD></TR>
<TR VALIGN=top><TD>IFA_UNSPEC</TD><TD>-</TD><TD>unspecified.<BR></TD></TR>
<TR VALIGN=top><TD>IFA_ADDRESS</TD><TD>raw protocol address</TD><TD>interface address<BR></TD></TR>
<TR VALIGN=top><TD>IFA_LOCAL</TD><TD>raw protocol address</TD><TD>local address<BR></TD></TR>
<TR VALIGN=top><TD>IFA_LABEL</TD><TD>asciiz string</TD><TD>name of the interface<BR></TD></TR>
<TR VALIGN=top><TD>IFA_BROADCAST</TD><TD>raw protocol address</TD><TD>broadcast address.<BR></TD></TR>
<TR VALIGN=top><TD>IFA_ANYCAST</TD><TD>raw protocol address</TD><TD>anycast address<BR></TD></TR>
<TR VALIGN=top><TD>IFA_CACHEINFO</TD><TD>struct ifa_cacheinfo</TD><TD>Address information.<BR></TD></TR>
</TABLE>
<DT id="7"><B>RTM_NEWROUTE</B>, <B>RTM_DELROUTE</B>, <B>RTM_GETROUTE</B>
<DD>
Create, remove or receive information about a network route.
These messages contain an
<I>rtmsg</I>
structure with an optional sequence of
<I>rtattr</I>
structures following.
For
<B>RTM_GETROUTE</B>,
setting
<I>rtm_dst_len</I>
and
<I>rtm_src_len</I>
to 0 means you get all entries for the specified routing table.
For the other fields, except
<I>rtm_table</I>
and
<I>rtm_protocol</I>,
0 is the wildcard.
<DT id="8"><DD>
struct rtmsg {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_family;&nbsp;&nbsp;&nbsp;/*&nbsp;Address&nbsp;family&nbsp;of&nbsp;route&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_dst_len;&nbsp;&nbsp;/*&nbsp;Length&nbsp;of&nbsp;destination&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_src_len;&nbsp;&nbsp;/*&nbsp;Length&nbsp;of&nbsp;source&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_tos;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;TOS&nbsp;filter&nbsp;*/
<P>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_table;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Routing&nbsp;table&nbsp;ID&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_protocol;&nbsp;/*&nbsp;Routing&nbsp;protocol;&nbsp;see&nbsp;below&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_scope;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;See&nbsp;below&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;rtm_type;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;See&nbsp;below&nbsp;*/
<P>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;int&nbsp;&nbsp;rtm_flags;
};
<TABLE>
<TR VALIGN=top><TD>rtm_type</TD><TD>Route type<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=2><HR></TD></TR>
<TR VALIGN=top><TD>RTN_UNSPEC</TD><TD>unknown route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_UNICAST</TD><TD>a gateway or direct route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_LOCAL</TD><TD>a local interface route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_BROADCAST</TD><TD>
a local broadcast route (sent as a broadcast)
<BR></TD></TR>
<TR VALIGN=top><TD>RTN_ANYCAST</TD><TD>
a local broadcast route (sent as a unicast)
<BR></TD></TR>
<TR VALIGN=top><TD>RTN_MULTICAST</TD><TD>a multicast route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_BLACKHOLE</TD><TD>a packet dropping route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_UNREACHABLE</TD><TD>an unreachable destination<BR></TD></TR>
<TR VALIGN=top><TD>RTN_PROHIBIT</TD><TD>a packet rejection route<BR></TD></TR>
<TR VALIGN=top><TD>RTN_THROW</TD><TD>continue routing lookup in another table<BR></TD></TR>
<TR VALIGN=top><TD>RTN_NAT</TD><TD>a network address translation rule<BR></TD></TR>
<TR VALIGN=top><TD>RTN_XRESOLVE</TD><TD>
refer to an external resolver (not implemented)
<BR></TD></TR>
</TABLE>
<TABLE>
<TR VALIGN=top><TD>rtm_protocol</TD><TD>Route origin.<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=2><HR></TD></TR>
<TR VALIGN=top><TD>RTPROT_UNSPEC</TD><TD>unknown<BR></TD></TR>
<TR VALIGN=top><TD>RTPROT_REDIRECT</TD><TD>
by an ICMP redirect (currently unused)
<BR></TD></TR>
<TR VALIGN=top><TD>RTPROT_KERNEL</TD><TD>by the kernel<BR></TD></TR>
<TR VALIGN=top><TD>RTPROT_BOOT</TD><TD>during boot<BR></TD></TR>
<TR VALIGN=top><TD>RTPROT_STATIC</TD><TD>by the administrator<BR></TD></TR>
</TABLE>
<P>
Values larger than
<B>RTPROT_STATIC</B>
are not interpreted by the kernel, they are just for user information.
They may be used to tag the source of a routing information or to
distinguish between multiple routing daemons.
See
<I>&lt;<A HREF="file:///usr/include/linux/rtnetlink.h">linux/rtnetlink.h</A>&gt;</I>
for the routing daemon identifiers which are already assigned.
<DT id="9"><DD>
<I>rtm_scope</I>
is the distance to the destination:
<TABLE>
<TR VALIGN=top><TD>RT_SCOPE_UNIVERSE</TD><TD>global route<BR></TD></TR>
<TR VALIGN=top><TD>RT_SCOPE_SITE</TD><TD>
interior route in the local autonomous system
<BR></TD></TR>
<TR VALIGN=top><TD>RT_SCOPE_LINK</TD><TD>route on this link<BR></TD></TR>
<TR VALIGN=top><TD>RT_SCOPE_HOST</TD><TD>route on the local host<BR></TD></TR>
<TR VALIGN=top><TD>RT_SCOPE_NOWHERE</TD><TD>destination doesn't exist<BR></TD></TR>
</TABLE>
<P>
The values between
<B>RT_SCOPE_UNIVERSE</B>
and
<B>RT_SCOPE_SITE</B>
are available to the user.
<DT id="10"><DD>
The
<I>rtm_flags</I>
have the following meanings:
<TABLE>
<TR VALIGN=top><TD>RTM_F_NOTIFY</TD><TD>
if the route changes, notify the user via rtnetlink
<BR></TD></TR>
<TR VALIGN=top><TD>RTM_F_CLONED</TD><TD>route is cloned from another route<BR></TD></TR>
<TR VALIGN=top><TD>RTM_F_EQUALIZE</TD><TD>a multipath equalizer (not yet implemented)<BR></TD></TR>
</TABLE>
<P>
<I>rtm_table</I>
specifies the routing table
<TABLE>
<TR VALIGN=top><TD>RT_TABLE_UNSPEC</TD><TD>an unspecified routing table<BR></TD></TR>
<TR VALIGN=top><TD>RT_TABLE_DEFAULT</TD><TD>the default table<BR></TD></TR>
<TR VALIGN=top><TD>RT_TABLE_MAIN</TD><TD>the main table<BR></TD></TR>
<TR VALIGN=top><TD>RT_TABLE_LOCAL</TD><TD>the local table<BR></TD></TR>
</TABLE>
<P>
The user may assign arbitrary values between
<B>RT_TABLE_UNSPEC</B>
and
<B>RT_TABLE_DEFAULT</B>.
<TABLE>
<TR VALIGN=top><TD ALIGN=center COLSPAN=3>Attributes<BR></TD></TR>
<TR VALIGN=top><TD>rta_type</TD><TD>value type</TD><TD>description<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=3><HR></TD></TR>
<TR VALIGN=top><TD>RTA_UNSPEC</TD><TD>-</TD><TD>ignored.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_DST</TD><TD>protocol address</TD><TD>Route destination address.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_SRC</TD><TD>protocol address</TD><TD>Route source address.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_IIF</TD><TD>int</TD><TD>Input interface index.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_OIF</TD><TD>int</TD><TD>Output interface index.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_GATEWAY</TD><TD>protocol address</TD><TD>The gateway of the route<BR></TD></TR>
<TR VALIGN=top><TD>RTA_PRIORITY</TD><TD>int</TD><TD>Priority of route.<BR></TD></TR>
<TR VALIGN=top><TD>RTA_PREFSRC</TD><TD></TD><TD><BR></TD></TR>
<TR VALIGN=top><TD>RTA_METRICS</TD><TD>int</TD><TD>Route metric<BR></TD></TR>
<TR VALIGN=top><TD>RTA_MULTIPATH</TD><TD></TD><TD><BR></TD></TR>
<TR VALIGN=top><TD>RTA_PROTOINFO</TD><TD></TD><TD><BR></TD></TR>
<TR VALIGN=top><TD>RTA_FLOW</TD><TD></TD><TD><BR></TD></TR>
<TR VALIGN=top><TD>RTA_CACHEINFO</TD><TD></TD><TD><BR></TD></TR>
</TABLE>
<P>
<B>Fill these values in!</B>
<DT id="11"><B>RTM_NEWNEIGH</B>, <B>RTM_DELNEIGH</B>, <B>RTM_GETNEIGH</B>
<DD>
Add, remove or receive information about a neighbor table
entry (e.g., an ARP entry).
The message contains an
<I>ndmsg</I>
structure.
<DT id="12"><DD>
struct ndmsg {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;ndm_family;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_ifindex;&nbsp;&nbsp;/*&nbsp;Interface&nbsp;index&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_state;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;State&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_flags;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Flags&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_type;
};
<P>
struct nda_cacheinfo {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_confirmed;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_used;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_updated;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ndm_refcnt;
};
<DT id="13"><DD>
<I>ndm_state</I>
is a bit mask of the following states:
<TABLE>
<TR VALIGN=top><TD>NUD_INCOMPLETE</TD><TD>a currently resolving cache entry<BR></TD></TR>
<TR VALIGN=top><TD>NUD_REACHABLE</TD><TD>a confirmed working cache entry<BR></TD></TR>
<TR VALIGN=top><TD>NUD_STALE</TD><TD>an expired cache entry<BR></TD></TR>
<TR VALIGN=top><TD>NUD_DELAY</TD><TD>an entry waiting for a timer<BR></TD></TR>
<TR VALIGN=top><TD>NUD_PROBE</TD><TD>a cache entry that is currently reprobed<BR></TD></TR>
<TR VALIGN=top><TD>NUD_FAILED</TD><TD>an invalid cache entry<BR></TD></TR>
<TR VALIGN=top><TD>NUD_NOARP</TD><TD>a device with no destination cache<BR></TD></TR>
<TR VALIGN=top><TD>NUD_PERMANENT</TD><TD>a static entry<BR></TD></TR>
</TABLE>
<P>
Valid
<I>ndm_flags</I>
are:
<TABLE>
<TR VALIGN=top><TD>NTF_PROXY</TD><TD>a proxy arp entry<BR></TD></TR>
<TR VALIGN=top><TD>NTF_ROUTER</TD><TD>an IPv6 router<BR></TD></TR>
</TABLE>
<P>
The
<I>rtattr</I>
struct has the following meanings for the
<I>rta_type</I>
field:
<TABLE>
<TR VALIGN=top><TD>NDA_UNSPEC</TD><TD>unknown type<BR></TD></TR>
<TR VALIGN=top><TD>NDA_DST</TD><TD>a neighbor cache n/w layer destination address<BR></TD></TR>
<TR VALIGN=top><TD>NDA_LLADDR</TD><TD>a neighbor cache link layer address<BR></TD></TR>
<TR VALIGN=top><TD>NDA_CACHEINFO</TD><TD>cache statistics.<BR></TD></TR>
</TABLE>
<P>
If the
<I>rta_type</I>
field is
<B>NDA_CACHEINFO</B>,
then a
<I>struct nda_cacheinfo</I>
header follows
<DT id="14"><B>RTM_NEWRULE</B>, <B>RTM_DELRULE</B>, <B>RTM_GETRULE</B>
<DD>
Add, delete or retrieve a routing rule.
Carries a
<I>struct rtmsg</I>
<DT id="15"><B>RTM_NEWQDISC</B>, <B>RTM_DELQDISC</B>, <B>RTM_GETQDISC</B>
<DD>
Add, remove or get a queueing discipline.
The message contains a
<I>struct tcmsg</I>
and may be followed by a series of
attributes.
<DT id="16"><DD>
struct tcmsg {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;&nbsp;&nbsp;tcm_family;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcm_ifindex;&nbsp;&nbsp;&nbsp;/*&nbsp;interface&nbsp;index&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcm_handle;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Qdisc&nbsp;handle&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcm_parent;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Parent&nbsp;qdisc&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;__u32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcm_info;
};
<TABLE>
<TR VALIGN=top><TD ALIGN=center COLSPAN=3>Attributes<BR></TD></TR>
<TR VALIGN=top><TD>rta_type&nbsp;&nbsp;</TD><TD>value type&nbsp;&nbsp;</TD><TD>Description<BR></TD></TR>
<TR VALIGN=top><TD COLSPAN=3><HR></TD></TR>
<TR VALIGN=top><TD>TCA_UNSPEC&nbsp;&nbsp;</TD><TD>-&nbsp;&nbsp;</TD><TD>unspecified<BR></TD></TR>
<TR VALIGN=top><TD>TCA_KIND&nbsp;&nbsp;</TD><TD>asciiz string&nbsp;&nbsp;</TD><TD>Name of queueing discipline<BR></TD></TR>
<TR VALIGN=top><TD>TCA_OPTIONS&nbsp;&nbsp;</TD><TD>byte sequence&nbsp;&nbsp;</TD><TD>Qdisc-specific options follow<BR></TD></TR>
<TR VALIGN=top><TD>TCA_STATS&nbsp;&nbsp;</TD><TD>struct tc_stats&nbsp;&nbsp;</TD><TD>Qdisc statistics.<BR></TD></TR>
<TR VALIGN=top><TD>TCA_XSTATS&nbsp;&nbsp;</TD><TD>qdisc-specific&nbsp;&nbsp;</TD><TD>Module-specific statistics.<BR></TD></TR>
<TR VALIGN=top><TD>TCA_RATE&nbsp;&nbsp;</TD><TD>struct tc_estimator&nbsp;&nbsp;</TD><TD>Rate limit.<BR></TD></TR>
</TABLE>
<P>
In addition, various other qdisc-module-specific attributes are allowed.
For more information see the appropriate include files.
<DT id="17"><B>RTM_NEWTCLASS</B>, <B>RTM_DELTCLASS</B>, <B>RTM_GETTCLASS</B>
<DD>
Add, remove or get a traffic class.
These messages contain a
<I>struct tcmsg</I>
as described above.
<DT id="18"><B>RTM_NEWTFILTER</B>, <B>RTM_DELTFILTER</B>, <B>RTM_GETTFILTER</B>
<DD>
Add, remove or receive information about a traffic filter.
These messages contain a
<I>struct tcmsg</I>
as described above.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>VERSIONS</H2>
<B>rtnetlink</B>
is a new feature of Linux 2.2.
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>
This manual page is incomplete.
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+cmsg">cmsg</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+rtnetlink">rtnetlink</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?7+ip">ip</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+netlink">netlink</A></B>(7)
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="19"><A HREF="#lbAB">NAME</A><DD>
<DT id="20"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="21"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="22"><A HREF="#lbAE">Routing attributes</A><DD>
<DT id="23"><A HREF="#lbAF">Messages</A><DD>
</DL>
<DT id="24"><A HREF="#lbAG">VERSIONS</A><DD>
<DT id="25"><A HREF="#lbAH">BUGS</A><DD>
<DT id="26"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="27"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:09 GMT, March 31, 2021
</BODY>
</HTML>