.\" -*- coding: UTF-8 -*- .\" 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 .\" .\" $Id: netdevice.7,v 1.10 2000/08/17 10:09:54 ak Exp $ .\" .\" Modified, 2004-11-25, mtk, formatting and a few wording fixes .\" .\" Modified, 2011-11-02, , added many basic .\" but missing ioctls, such as SIOCGIFADDR. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH NETDEVICE 7 "13 agosto 2020" Linux "Manual do Programador do Linux" .SH NOME netdevice \- acesso de baixo nível a dispositivos de rede .SH SINOPSE \fB#include \fP .br \fB#include \fP .SH DESCRIÇÃO Esta man page descreve a interface de 'sockets' que é usada para configurar dispositivos de rede. .PP Linux supports some standard ioctls to configure network devices. They can be used on any socket's file descriptor regardless of the family or type. Most of them pass an \fIifreq\fP structure: .PP .in +4n .EX struct ifreq { char ifr_name[IFNAMSIZ]; /* Nome da interface */ union { struct sockaddr ifr_addr; struct sockaddr ifr_dstaddr; struct sockaddr ifr_broadaddr; struct sockaddr ifr_netmask; struct sockaddr ifr_hwaddr; short ifr_flags; int ifr_ifindex; int ifr_metric; int ifr_mtu; struct ifmap ifr_map; char ifr_slave[IFNAMSIZ]; char ifr_newname[IFNAMSIZ]; char *ifr_data; }; }; .EE .in .PP Normalmente, o usuário especifica qual dispositivo será afetado pela seleção \fIifr_name\fP para o nome da interface. Todos os outros membros da estrutura podem compartilhar memória. .SS Ioctls Se um ioctl é marcado como privilegiado, então o seu uso requer um ID efetivo de usuário, ou a propriedade \fBCAP_NET_ADMIN\fP. Se este não é o caso, \fBEPERM\fP será retornado. .TP \fBSIOCGIFNAME\fP Dado o \fIifr_ifindex\fP, returna o nome da interface em \fIifr_name\fP. Este é o único ioctl que retorna seu resultado em \fIifr_name\fP. .TP \fBSIOCGIFINDEX\fP Recupera o índice da interface para \fIifr_ifindex\fP. .TP \fBSIOCGIFFLAGS\fP, \fBSIOCSIFFLAGS\fP .\" Do not right adjust text blocks in tables Recebe ou seta a palavra de sinalização ativa do dispositivo. \fIifr_flags\fP contém uma máscara de bits com os seguintes valores: .na .TS tab(:); c s l l. Sinalizadores do dispositivo IFF_UP:Interface está rodando. IFF_BROADCAST:Conjunto de endereço de broadcast válido. IFF_DEBUG:Sinalizador de debugging interno. IFF_LOOPBACK:Interface é uma interface do tipo 'loopback'. IFF_POINTOPOINT:Interface é uma ligação do tipo ponto\-a\-ponto. IFF_RUNNING:Recursos alocados. IFF_NOARP:T{ Nenhum protocolo arp, endereço de destinação, L2 não especificado. T} IFF_PROMISC:Interface está em modo promíscuo. IFF_NOTRAILERS:Evita uso de 'trailers'. IFF_ALLMULTI:Recebe todos os pacotes multicast. IFF_MASTER:Mestre de um load balancing bundle. IFF_SLAVE:Escravo de um load balancing bundle. IFF_MULTICAST:Suporta multicast IFF_PORTSEL:É capaz de selecionar tipo de meio via ifmap. IFF_AUTOMEDIA:Auto\-seleção de meio ativa. IFF_DYNAMIC:T{ Os endereços são perdidos ao fechar a interface. T} IFF_LOWER_UP:Driver signals L1 up (since Linux 2.6.17) IFF_DORMANT:Driver signals dormant (since Linux 2.6.17) IFF_ECHO:Echo sent packets (since Linux 2.6.25) .TE .ad .PP Selecionar a palavra do sinalizador ativa é uma operação privilegiada, mas qualquer processo pode lê\-la. .TP \fBSIOCGIFPFLAGS\fP, \fBSIOCSIFPFLAGS\fP Get or set extended (private) flags for the device. \fIifr_flags\fP contains a bit mask of the following values: .TS tab(:); c s l l. Private flags IFF_802_1Q_VLAN:Interface is 802.1Q VLAN device. IFF_EBRIDGE:Interface is Ethernet bridging device. IFF_SLAVE_INACTIVE:Interface is inactive bonding slave. IFF_MASTER_8023AD:Interface is 802.3ad bonding master. IFF_MASTER_ALB:Interface is balanced\-alb bonding master. IFF_BONDING:Interface is a bonding master or slave. IFF_SLAVE_NEEDARP:Interface needs ARPs for validation. IFF_ISATAP:Interface is RFC4214 ISATAP interface. .TE .PP Setting the extended (private) interface flags is a privileged operation. .TP \fBSIOCGIFADDR\fP, \fBSIOCSIFADDR\fP Get or set the address of the device using \fIifr_addr\fP. Setting the interface address is a privileged operation. For compatibility, only \fBAF_INET\fP addresses are accepted or returned. .TP \fBSIOCGIFDSTADDR\fP, \fBSIOCSIFDSTADDR\fP Get or set the destination address of a point\-to\-point device using \fIifr_dstaddr\fP. For compatibility, only \fBAF_INET\fP addresses are accepted or returned. Setting the destination address is a privileged operation. .TP \fBSIOCGIFBRDADDR\fP, \fBSIOCSIFBRDADDR\fP Get or set the broadcast address for a device using \fIifr_brdaddr\fP. For compatibility, only \fBAF_INET\fP addresses are accepted or returned. Setting the broadcast address is a privileged operation. .TP \fBSIOCGIFNETMASK\fP, \fBSIOCSIFNETMASK\fP Get or set the network mask for a device using \fIifr_netmask\fP. For compatibility, only \fBAF_INET\fP addresses are accepted or returned. Setting the network mask is a privileged operation. .TP \fBSIOCGIFMETRIC\fP, \fBSIOCSIFMETRIC\fP Recebe ou seta a métrica do dispositivo usando \fIifr_metric\fP. Isto não está implementado atualmente; ele seta \fIifr_metric\fP em 0 se você tenta lê\-lo e retorna \fBEOPNOTSUPP\fP se você tenta selecioná\-lo. .TP \fBSIOCGIFMTU\fP, \fBSIOCSIFMTU\fP Recebe ou seta o Unidade Máxima de Transferência (MTU) de um dispositivo, usando \fIifr_mtu\fP. Setar o MTU é uma operação privilegiada. Selecionando a MTU para valores baixos pode\-se provocar erros no kernel. .TP \fBSIOCGIFHWADDR\fP, \fBSIOCSIFHWADDR\fP Recebe ou seta o endereço de hardware de um dispositivo, usando \fIifr_hwaddr\fP. O endereço de hardware é especificado na estrutura \fIsockaddr\fP. \fIsa_family\fP contém o tipo de dispositivo ARPHDR_*, \fIsa_data\fP o endereço de hardware inicia com o byte 0. Setar o endereço de hardware é uma operação privilegiada. .TP \fBSIOCSIFHWBROADCAST\fP Seta o endereço de hardware de broadcast de um dispositivo, de \fIifr_hwaddr\fP. Esta é uma operação privilegiada. .TP \fBSIOCGIFMAP\fP, \fBSIOCSIFMAP\fP Recebe ou seta os parâmetros de hardware da interface usando \fIifr_map\fP. Setar os parâmetros é uma operação privilegiada. .IP .in +4n .EX struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; }; .EE .in .IP A interpretação de uma estrutura ifmap depende do driver de dispositivo e da arquitetura. .TP \fBSIOCADDMULTI\fP, \fBSIOCDELMULTI\fP Acrescenta ou apaga um endereço dos filtros de multicast da camada de ligação do dispositivo, usando \fIifr_hwaddr\fP. Estas são operações privilegiadas. Veja também \fBpacket\fP(7) para uma alternativa. .TP \fBSIOCGIFTXQLEN\fP, \fBSIOCSIFTXQLEN\fP Recebe ou seta o comprimento da fila de transmissão de um dispositivo, usando \fIifr_qlen\fP. Setar o comprimento da fila de transmissão é uma operação privilegiada. .TP \fBSIOCSIFNAME\fP Muda o nome da interface especificada em \fIifr_name\fP para \fIifr_newname\fP. Esta é uma operação privilegiada. Ela só é permitida quando a interface não está ativada. .TP \fBSIOCGIFCONF\fP Return a list of interface (network layer) addresses. This currently means only addresses of the \fBAF_INET\fP (IPv4) family for compatibility. Unlike the others, this ioctl passes an \fIifconf\fP structure: .IP .in +4n .EX struct ifconf { int ifc_len; /* size of buffer */ union { char *ifc_buf; /* buffer address */ struct ifreq *ifc_req; /* array of structures */ }; }; .EE .in .IP If \fIifc_req\fP is NULL, \fBSIOCGIFCONF\fP returns the necessary buffer size in bytes for receiving all available addresses in \fIifc_len\fP. Otherwise, \fIifc_req\fP contains a pointer to an array of \fIifreq\fP structures to be filled with all currently active L3 interface addresses. \fIifc_len\fP contains the size of the array in bytes. Within each \fIifreq\fP structure, \fIifr_name\fP will receive the interface name, and \fIifr_addr\fP the address. The actual number of bytes transferred is returned in \fIifc_len\fP. .IP If the size specified by \fIifc_len\fP is insufficient to store all the addresses, the kernel will skip the exceeding ones and return success. There is no reliable way of detecting this condition once it has occurred. It is therefore recommended to either determine the necessary buffer size beforehand by calling \fBSIOCGIFCONF\fP with \fIifc_req\fP set to NULL, or to retry the call with a bigger buffer whenever \fIifc_len\fP upon return differs by less than \fIsizeof(struct ifreq)\fP from its original value. .IP .\" Slaving isn't supported in 2.2 .\" . .\" .TP .\" .BR SIOCGIFSLAVE ", " SIOCSIFSLAVE .\" Get or set the slave device using .\" .IR ifr_slave . .\" Setting the slave device is a privileged operation. .\" .PP .\" FIXME . add amateur radio stuff. If an error occurs accessing the \fIifconf\fP or \fIifreq\fP structures, \fBEFAULT\fP will be returned. .PP Muitos protocolos suportam seus próprios ioctls para configurar opções de interface específicas do protocolo. Veja as páginas de manual de protocolos para uma descrição. Para configuração de endereços IP ver \fBip\fP(7). .PP Além disso, alguns dispositivos suportam ioctls privados. Estes não são descritos aqui. .SH NOTAS \fBSIOCGIFCONF\fP and the other ioctls that accept or return only \fBAF_INET\fP socket addresses are IP\-specific and perhaps should rather be documented in \fBip\fP(7). .PP Os nomes das interfaces sem endereços ou que não tem um sinalizador \fBIFF_RUNNING\fP selecionado pode ser localizado através de \fI/proc/net/dev\fP. .PP Endereços locais IPv6 podem ser encontrados via \fI/proc/net\fP ou \fBrtnetlink\fP(7). .SH BUGS glibc 2.1 omite a macro \fIifr_newname\fP em \fI\fP. Adicione o seguinte em seu programa para contornar: .PP .in +4n .EX #ifndef ifr_newname #define ifr_newname ifr_ifru.ifru_slave #endif .EE .in .SH "VEJA TAMBÉM" \fBproc\fP(5), \fBcapabilities\fP(7), \fBip\fP(7), \fBrtnetlink\fP(7) .SH COLOFÃO Esta página faz parte da versão 5.10 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/. .PP .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 . .PP 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. .PP 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 .