The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 [Cписок руководств | Печать]

rtnetlink (4)
  • rtnetlink (3) ( Русские man: Библиотечные вызовы )
  • rtnetlink (3) ( Linux man: Библиотечные вызовы )
  • >> rtnetlink (4) ( Linux man: Специальные файлы /dev/* )
  • rtnetlink (7) ( Русские man: Макропакеты и соглашения )
  • rtnetlink (7) ( Linux man: Макропакеты и соглашения )


    rtnetlink, NETLINK_ROUTE - Linux IPv4 routing socket.


    #include <asm/types.h>
    #include <linux/netlink.h>
    #include <linux/rtnetlink.h>
    #include <sys/socket.h>

    rtnetlink_socket = socket(PF_NETLINK, socket_type, NETLINK_ROUTE);




    Rtnetlink allows to set up and read network routes, ip addresses, link parameters, neighbour setups, queueing disciplines, traffic classes packet classifiers. It is used to communicate between user level daemons and setup programs and the kernel and to communicate internally between kernel subsystems (not documented). It is based on netlink messages, see netlink(4) for more information.

    Valid family specific netlink message types:

    Create, remove or get information about a specific network interface. Carries a ifinfomsg message as payload.

    Add, remove or receive information about an IP address associated with
    an interface. In Linux 2.1 an interface can carry multiple IP addresses, this replaces the alias device concept in 2.0. These commands handle IP interface address lists. Payload is an ifaddrmsg structure.

    Create, remove or receive information about a network route. Payload is a
    rtmsg structure with an optional sequence of rtattr structures following.
    struct rtmsg
            unsigned char           rtm_family;     /* Address family of route */
            unsigned char           rtm_dst_len;    /* Length of source */
            unsigned char           rtm_src_len;    /* Length of destination */ 
            unsigned char           rtm_tos;        /* TOS filter */
            unsigned char           rtm_table;      /* Routing table id */
            unsigned char           rtm_protocol;   /* Routing protocol; see below  */
            unsigned char           rtm_scope;      /* See below */ 
            unsigned char           rtm_type;       /* See below    */
            unsigned                rtm_flags;      
    struct rtattr
            unsigned short  rta_len;
            unsigned short  rta_type;
        /* Data follows (use RTA_DATA to access) */ 
    Valid rtm_type values are RTN_UNICAST for specifying a gateway or direct route, RTN_LOCAL for a local interface route, RTN_BROADCAST for a local broadcast route (sent as broadcast), RTN_ANYCAST for a local broadcast route that is a sent as unicast, RTN_MULTICAST for a multitasking route, RTN_BLACKHOLE for a packet dropping route, RTN_UNREACHABLE for an unreachable destination, RTN_PROHIBIT for a packet rejection route, RTN_THROW to continue routing lookup in another table, RTN_NAT for a network address translation rule, RTN_XRESOLVE to refer to an external resolver (not implemented). Valid values for rtm_protocol are RTPROT_UNSPEC, RTPROT_REDIRECT for routes installed by ICMP redirects (currently not used), RTPROT_KERNEL for routes installed by the kernel, RTPROT_BOOT for routes installed during boot, RTPROT_STATIC for routes installed by the administrator. Values bigger than RTPROT_STATIC are not interpreted by the kernel, they are just for user information. It can be used to tag the source of a routing information or to distingush between multiple routing daemons. See linux/rtnetlink.h for the already standardized routing daemon identifiers. rtm_scope is the distance to the destination: RT_SCOPE_UNIVERSE for global routes, RT_SCOPE_SITE for intereour routes in the local autonomous system, RT_SCOPE_LINK for on link routes, RT_SCOPE_HOST for routes on the local host and RT_SCOPE_NOWHERE for non existent destinations. The user may use his own values between RT_SCOPE_UNIVERSE and RT_SCOPE_SITE. Valid rtm_flags are RTM_F_NOTIFY to notify the user via rtnetlink of a route change, RTM_F_CLONED for routes cloned from other routes for the destination cache, RTM_F_EQUALIZE for an not yet implemented multicast equalizer. rtm_table may contain: RT_TABLE_UNSPEC for unspecified routing table, RT_TABLE_DEFAULT for the default table, RT_TABLE_MAIN for the main table, RT_TABLE_LOCAL for the local table. The user may assign arbitary values between RT_TABLE_UNSPEC and RT_TABLE_DEFAULT.

    Add, remove or receive information about a neighbour table entry (e.g. an ARP
    entry). Payload is a ndmsg structure.
    struct ndmsg
            unsigned char   ndm_family;
            unsigned char   ndm_pad1;
            unsigned short  ndm_pad2;
            int             ndm_ifindex;    /* Link index                   */
            __u16           ndm_state;  /* State */ 
            __u8            ndm_flags;  /* Flags */
            __u8            ndm_type;   
    struct nda_cacheinfo
            __u32           ndm_confirmed;
            __u32           ndm_used;
            __u32           ndm_updated;
            __u32           ndm_refcnt;
    Valid ndm_type values are: NDA_UNSPEC for unknown type, NDA_DST for a neighbour cache network layer destination address, ND_LLADDR for a neighbour cache link layer address, ND_CACHEINFO for cache statistics (a struct nda_cacheinfo header follows). Valid states are: NUD_INCOMPLETE for a currently resolving cache entry, NUD_REACHABLE for a confirmed working cache entry, NUD_STALE for an expired cache entry, NUD_DELAY for an entry waiting for a timer, NUD_PROBE for a cache entry that is currently reprobed, NUD_FAILED for an invalid cache entry, NUD_NOARP for devices with no destination cache, NUD_PERMANENT for static entries, NUD_NONE for nothing. Valid flags in ndm_flags are NTF_PROXY for a proxy arp entry, NTF_ROUTER for an IPv6 router.

    See <linux/rtnetlink.h> for the declaration of the rtmsg, ifinfomsg, and ifaddrmsg structures.  


    This manual page is lacking and incomplete.  


    rtnetlink is a new feature of Linux 2.2.  


    netlink(4), cmsg(3), ip(4)




    Поиск по тексту MAN-ов: 

    Inferno Solutions
    Hosting by

    Закладки на сайте
    Проследить за страницей
    Created 1996-2023 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру