.\" -*- coding: UTF-8 -*- '\" t .\" This man page is Copyright (C) 1999 Andi Kleen . .\" .\" %%%LICENSE_START(VERBATIM_ONE_PARA) .\" Permission is granted to distribute possibly modified copies .\" of this page provided the header is included verbatim, .\" and in case of nontrivial modification author and date .\" of the modification is added to the header. .\" %%%LICENSE_END .\" .\" Based on the original comments from Alexey Kuznetsov, written with .\" help from Matthew Wilcox. .\" $Id: rtnetlink.7,v 1.8 2000/01/22 01:55:04 freitag Exp $ .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH RTNETLINK 7 "15 setembro 2017" Linux "Manual do Programador do Linux" .SH NOME rtnetlink \- 'socket' Linux de roteamento IPv4 .SH SINOPSE \fB#include \fP .br \fB#include \fP .br \fB#include \fP .br \fB#include \fP .br \fB#include \fP .PP \fBrtnetlink_socket = socket(AF_NETLINK, int \fP\fIsocket_type\fP\fB, NETLINK_ROUTE);\fP .SH DESCRIÇÃO .\" FIXME . ? all these macros could be moved to rtnetlink(3) Rtnetlink permite que as tabelas de roteamento do kernel sejam lidas e alteradas. É usado dentro do kernel para a comunicação entre vários subsistemas, apesar de que seu uso não é documentado aqui, e para comunicação com programas do espaço do usuário. Rotas de rede, endereços IP, parâmetros de ligação, configurações de vizinhança, disciplinas de filas, classes de tráfego e classificadores de pacotes podem todos ser controlados através de 'sockets' \fBNETLINK_ROUTE\fP. Ele é baseado em mensagens de "netlink"; veja \fBnetlink\fP(7) para maiores informações. .SS "Atributos de roteamento" Algumas mensagens do rnetlink têm atributos opcionais depois do cabeçalho inicial: .PP .in +4n .EX struct rtattr { unsigned short rta_len; /* Length of option */ unsigned short rta_type; /* Type of option */ /* Data follows */ }; .EE .in .PP Estes atributos seriam manipulados somente pelo uso de macros RTA_* ou do libnetlink, veja \fBrtnetlink\fP(3). .SS Messages Rtnetlink consiste nos seguintes tipos de mensagens (além das mensagens padrão do netlink): .TP \fBRTM_NEWLINK\fP, \fBRTM_DELLINK\fP, \fBRTM_GETLINK\fP Cria, remove ou obtém informações sobre uma interface de rede específica. Essas mensagens contêm uma estrutura \fIifinfomsg\fP seguida por uma série de estruturas \fIrtattr\fP. .IP .EX struct ifinfomsg { unsigned char ifi_family; /* AF_UNSPEC */ unsigned short ifi_type; /* Device type */ int ifi_index; /* Interface index */ unsigned int ifi_flags; /* Device flags */ unsigned int ifi_change; /* change mask */ }; .EE .IP .\" FIXME Document ifinfomsg.ifi_type \fIifi_flags\fP contains the device flags, see \fBnetdevice\fP(7); \fIifi_index\fP is the unique interface index (since Linux 3.7, it is possible to feed a nonzero value with the \fBRTM_NEWLINK\fP message, thus creating a link with the given \fIifindex\fP); \fIifi_change\fP is reserved for future use and should be always set to 0xFFFFFFFF. .TS tab(:); c s s l l l. Atributos de roteamento rta_type:tipo de valor:descrição _ IFLA_UNSPEC:\-:não\-especificado IFLA_ADDRESS:ender. de hardware:interface L2 address IFLA_BROADCAST:ender. de hardware:broadcast L2. IFLA_IFNAME:cadeia asciiz:Nome do dispos. IFLA_MTU:int. sem sinal:MTU do dispos. IFLA_LINK:int:Tipo de ligação. IFLA_QDISC:cadeia asciiz:Disciplina de fila IFLA_STATS:T{ see below T}:estatísticas .TE .PP The value type for \fBIFLA_STATS\fP is \fIstruct rtnl_link_stats\fP (\fIstruct net_device_stats\fP in Linux 2.4 and earlier). .TP \fBRTM_NEWADDR\fP, \fBRTM_DELADDR\fP, \fBRTM_GETADDR\fP 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 \fIifaddrmsg\fP structure, optionally followed by \fIrtattr\fP routing attributes. .IP .EX struct ifaddrmsg { unsigned char ifa_family; /* Address type */ unsigned char ifa_prefixlen; /* Prefixlength of address */ unsigned char ifa_flags; /* Address flags */ unsigned char ifa_scope; /* Address scope */ int ifa_index; /* Interface index */ }; .EE .IP \fIifa_family\fP is the address family type (currently \fBAF_INET\fP or \fBAF_INET6\fP), \fIifa_prefixlen\fP is the length of the address mask of the address if defined for the family (like for IPv4), \fIifa_scope\fP is the address scope, \fIifa_index\fP is the interface index of the interface the address is associated with. \fIifa_flags\fP is a flag word of \fBIFA_F_SECONDARY\fP for secondary address (old alias interface), \fBIFA_F_PERMANENT\fP for a permanent address set by the user and other undocumented flags. .TS tab(:); c s s l l l. Atributos rta_type:tipo de valor:descrição _ IFA_UNSPEC:\-:não\-especificado IFA_ADDRESS:ender. de protocolo direto:ender. da interface IFA_LOCAL:ender. de protocolo direto:ender. local IFA_LABEL:cadeia asciiz:nome da interface IFA_BROADCAST:ender. de protocolo direto:ender. de broadcast IFA_ANYCAST:ender. de protocolo direto:ender. de anycast IFA_CACHEINFO:struct ifa_cacheinfo:Address information. .TE .\" FIXME Document struct ifa_cacheinfo .TP \fBRTM_NEWROUTE\fP, \fBRTM_DELROUTE\fP, \fBRTM_GETROUTE\fP Create, remove or receive information about a network route. These messages contain an \fIrtmsg\fP structure with an optional sequence of \fIrtattr\fP structures following. For \fBRTM_GETROUTE\fP, setting \fIrtm_dst_len\fP and \fIrtm_src_len\fP to 0 means you get all entries for the specified routing table. For the other fields, except \fIrtm_table\fP and \fIrtm_protocol\fP, 0 is the wildcard. .IP .EX struct rtmsg { unsigned char rtm_family; /* Address family of route */ unsigned char rtm_dst_len; /* Length of destination */ unsigned char rtm_src_len; /* Length of source */ 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 int rtm_flags; }; .EE .TS tab(:); l l. rtm_type:Tipo de rota _ RTN_UNSPEC:rota desconhecida RTN_UNICAST:um gateway ou rota direta RTN_LOCAL:uma rota de interface local RTN_BROADCAST:T{ uma rota de broadcast local (enviado como um broadcast) T} RTN_ANYCAST:T{ uma rota de broadcast local (enviado como um unicast) T} RTN_MULTICAST:uma rota de multicast RTN_BLACKHOLE:uma rota de perda de pacotes RTN_UNREACHABLE:um destino não alcançável RTN_PROHIBIT:uma rota de rejeição de pacotes RTN_THROW:continua a busca de roteamento em outra tabela RTN_NAT:uma regra de tradução de endereço de rede RTN_XRESOLVE:T{ refere\-se a um resolvedor externo (não implementado) T} .TE .TS tab(:); l l. rtm_protocol:Origem da rota _ RTPROT_UNSPEC:desconhecida RTPROT_REDIRECT:T{ por um redirecionamento de ICMP (não usado atualmente) T} RTPROT_KERNEL:pelo kernel RTPROT_BOOT:durante a inicialização RTPROT_STATIC:pelo administrador .TE .sp 1 Valores maiores que \fBRTPROT_STATIC\fP não são interpretados pelo kernel, eles são apenas para informação do usuário. Eles podem ser usados para marcar a origem de uma informação de roteamento ou para distinguir entre múltiplos daemons de roteamento. Veja \fI\fP para os identificadores de daemons de roteamento que já são atribuídos. .IP \fIrtm_scope\fP é a distância ao destino: .TS tab(:); l l. RT_SCOPE_UNIVERSE:rota global RT_SCOPE_SITE:T{ rota interior no sistema autônomo local T} RT_SCOPE_LINK:rota nesta ligação RT_SCOPE_HOST:rota no host local RT_SCOPE_NOWHERE:destino não existe .TE .sp 1 Os valores entre \fBRT_SCOPE_UNIVERSE\fP e \fBRT_SCOPE_SITE\fP são disponíveis para o usuário. .IP O \fIrtm_flags\fP tem os seguintes significados: .TS tab(:); l l. RTM_F_NOTIFY:T{ se a rota muda, notifica o usuário via rtnetlink T} RTM_F_CLONED:a rota é clonada a partir de outra rota RTM_F_EQUALIZE:a multipath equalizer (not yet implemented) .TE .sp 1 \fIrtm_table\fP especifica a tabela de roteamento .TS tab(:); l l. RT_TABLE_UNSPEC:uma tabela de roteamento não especificada RT_TABLE_DEFAULT:a tabela padrão RT_TABLE_MAIN:a tabela principal RT_TABLE_LOCAL:a tabela local .TE .sp 1 .\" Keep table on same page O usuário pode atribuir valores arbitrários entre \fBRT_TABLE_UNSPEC\fP e \fBRT_TABLE_DEFAULT\fP. .bp +1 .TS tab(:); c s s l l l. Atributos rta_type:tipo de valor:descrição _ RTA_UNSPEC:\-:ignorado. RTA_DST:ender. do protocolo:ender. de destino da rota RTA_SRC:ender. do protocolo:ender. da origem da rota RTA_IIF:int:índice\-interface de entrada RTA_OIF:int:índice\-interface de saída RTA_GATEWAY:ender. do protocolo:o gateway da rota RTA_PRIORITY:int:prioridade da rota RTA_PREFSRC:: RTA_METRICS:int:métrica da rota RTA_MULTIPATH:: RTA_PROTOINFO:: RTA_FLOW:: RTA_CACHEINFO:: .TE .sp 1 \fBPreencha esses valores!\fP .TP \fBRTM_NEWNEIGH\fP, \fBRTM_DELNEIGH\fP, \fBRTM_GETNEIGH\fP Acrescenta, remove ou recebe informação sobre uma entrada de tabela de vizinhança (por exemplo, uma entrada ARP). A mensagem contém uma estrutura \fIndmsg\fP. .IP .EX struct ndmsg { unsigned char ndm_family; int ndm_ifindex; /* Interface 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; }; .EE .IP \fIndm_state\fP é uma máscara de bits dos seguintes estados: .TS tab(:); l l. NUD_INCOMPLETE:uma entrada atualmente resolvida de 'cache' NUD_REACHABLE:uma entrada confirmada de 'cache' funcionando NUD_STALE:uma entrada expirada do 'cache' NUD_DELAY:uma entrada aguardando por um temporizador NUD_PROBE:uma entrada de 'cache' que é retestada atualmente NUD_FAILED:uma entrada de 'cache' inválida NUD_NOARP:um dispositivo sem 'cache' de destino NUD_PERMANENT:uma entrada estática .TE .sp 1 Os \fIndm_flags\fP válidos são: .TS tab(:); l l. NTF_PROXY:uma entrada de arp do proxy NTF_ROUTER:um roteador IPv6 .TE .sp 1 .\" FIXME . .\" document the members of the struct better The \fIrtattr\fP struct has the following meanings for the \fIrta_type\fP field: .TS tab(:); l l. NDA_UNSPEC:tipo desconhecido NDA_DST:a neighbor cache n/w layer destination address NDA_LLADDR:ender. vizinho da camada de ligação do 'cache' NDA_CACHEINFO:estatísticas do 'cache' .TE .sp 1 If the \fIrta_type\fP field is \fBNDA_CACHEINFO\fP, then a \fIstruct nda_cacheinfo\fP header follows .TP \fBRTM_NEWRULE\fP, \fBRTM_DELRULE\fP, \fBRTM_GETRULE\fP Add, delete or retrieve a routing rule. Carries a \fIstruct rtmsg\fP .TP \fBRTM_NEWQDISC\fP, \fBRTM_DELQDISC\fP, \fBRTM_GETQDISC\fP Add, remove or get a queueing discipline. The message contains a \fIstruct tcmsg\fP and may be followed by a series of attributes. .IP .EX struct tcmsg { unsigned char tcm_family; int tcm_ifindex; /* interface index */ __u32 tcm_handle; /* Qdisc handle */ __u32 tcm_parent; /* Parent qdisc */ __u32 tcm_info; }; .EE .TS tab(:); c s s l2 l2 l. Atributos rta_type:tipo de valor:Descrição _ TCA_UNSPEC:\-:não\-especificado TCA_KIND:cadeia asciiz:nome da disciplina de fila TCA_OPTIONS:seqüência de bytes:Qdisc\-specific options follow TCA_STATS:struct tc_stats:estatísticas do qdisc TCA_XSTATS:qdisc\-specific:Module\-specific statistics. TCA_RATE:struct tc_estimator:limite de taxa .TE .sp 1 In addition, various other qdisc\-module\-specific attributes are allowed. For more information see the appropriate include files. .TP \fBRTM_NEWTCLASS\fP, \fBRTM_DELTCLASS\fP, \fBRTM_GETTCLASS\fP Add, remove or get a traffic class. These messages contain a \fIstruct tcmsg\fP as described above. .TP \fBRTM_NEWTFILTER\fP, \fBRTM_DELTFILTER\fP, \fBRTM_GETTFILTER\fP Add, remove or receive information about a traffic filter. These messages contain a \fIstruct tcmsg\fP as described above. .SH VERSÕES \fBrtnetlink\fP é uma nova implementação do Linux 2.2. .SH BUGS This manual page is incomplete. .SH "VEJA TAMBÉM" \fBcmsg\fP(3), \fBrtnetlink\fP(3), \fBip\fP(7), \fBnetlink\fP(7) .SH COLOFÃO Esta página faz parte da versão 5.04 do projeto Linux \fIman\-pages\fP. Uma descrição do projeto, informações sobre relatórios de bugs e a versão mais recente desta página podem ser encontradas em \%https://www.kernel.org/doc/man\-pages/. .SH TRADUÇÃO A tradução para português brasileiro desta página man foi criada por Rubens de Jesus Nogueira e André Luiz Fassone . Esta tradução é uma documentação livre; leia a .UR https://www.gnu.org/licenses/gpl-3.0.html Licença Pública Geral GNU Versão 3 .UE ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita. Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para .MT debian-l10n-portuguese@\:lists.\:debian.\:org a lista de discussão de tradutores .ME .