.\" -*- 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 del Programador de Linux" .SH NOMBRE netdevice \- acceso de bajo nivel a los dispositivos de red de Linux .SH SINOPSIS \fB#include \fP .br \fB#include \fP .SH DESCRIPCIÓN Esta página de manual describe la interfaz de conectores que se usa para configurar los dispositivos de red. .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]; /* Nombre de la interfaz */ 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, el usuario especifica a qué dispositivo va a afectar asignando a \fIifr_name\fP el nombre de la interfaz. Todos los otros miembros de la estructura pueden compartir memoria. .SS Ioctls Si se marca una ioctl como privilegiada entonces su uso requiere un identificador de usuario efectivo 0 o la capacidad \fBCAP_NET_ADMIN\fP. Si éste no es el caso se devuelve \fBEPERM\fP. .TP \fBSIOCGIFNAME\fP Dado un \fIifr_ifindex\fP, devuelve el nombre de la interfaz en \fIifr_name\fP. Ésta es la única ioctl que devuelve su resultado en \fIifr_name\fP. .TP \fBSIOCGIFINDEX\fP Devuelve el índice de interfaz de la interfaz en \fIifr_ifindex\fP. .TP \fBSIOCGIFFLAGS\fP, \fBSIOCSIFFLAGS\fP .\" Do not right adjust text blocks in tables Obtiene o establece la palabra de banderas activas del dispositivo. \fIifr_flags\fP contiene una máscara de bits de los siguientes valores: .na .TS tab(:); c s l l. Significado de las banderas IFF_UP:La interfaz está funcionando. IFF_BROADCAST:Dirección de difusión válida asignada. IFF_DEBUG:Bandera de depuración interna. IFF_LOOPBACK:Ésta es una interfaz loopback. IFF_POINTOPOINT:La interfaz es un enlace punto a punto. IFF_RUNNING:Recursos necesarios reservados. IFF_NOARP:T{ Sin protocolo ARP, la dirección de destino de Nivel 2 no está configurada. T} IFF_PROMISC:La interfaz se encuentra en modo promiscuo. IFF_NOTRAILERS:Evitar el uso de terminadores. IFF_ALLMULTI:Recibir todos los paquetes multidestino. IFF_MASTER:Interfaz maestra de un grupo de balanceo de carga. IFF_SLAVE:Interfaz esclava de un grupo de balanceo de carga. IFF_MULTICAST:La interfaz soporta multidestino. IFF_PORTSEL:La interfaz es capaz de seleccionar el tipo de medio mediante ifmap. IFF_AUTOMEDIA:Autoselección de medios activa. IFF_DYNAMIC:T{ Las direcciones se pierden cuando la interfaz se desactiva. 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 La configuración de la palabra de banderas activas es una operación privilegiada pero cualquier proceso puede leerla. .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 Obtiene o establece la métrica del dispositivo usando \fIifr_metric\fP. Todavía no implementado. Asigna un 0 a \fIifr_metric\fP cuando se intenta leer y devuelve \fBEOPNOTSUPP\fP cuando se intenta asignarle un valor. .TP \fBSIOCGIFMTU\fP, \fBSIOCSIFMTU\fP Obtiene o establece la MTU (unidad de transferencia máxima) del dispositivo usando \fIifr_mtu\fP. La configuración de la MTU es una operación privilegiada. Configurar la MTU con valores demasiado pequeños puede provocar un fallo del núcleo. .TP \fBSIOCGIFHWADDR\fP, \fBSIOCSIFHWADDR\fP Obtiene o establece la dirección hardware del dispositivo usando \fIifr_hwaddr\fP. La configuración de la dirección hardware es una operación privilegiada. .TP \fBSIOCSIFHWBROADCAST\fP Establece la dirección de difusión hardware del dispositivo a partir de \fIifr_hwaddr\fP. Es una operación privilegiada. .TP \fBSIOCGIFMAP\fP, \fBSIOCSIFMAP\fP Obtiene o establece los parámetros hardware de la interfaz usando \fIifr_map\fP. La configuración de los parámetros es una operación 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 La interpretación de la estructura ifmap depende del manejador del dispositivo y de la arquitectura. .TP \fBSIOCADDMULTI\fP, \fBSIOCDELMULTI\fP Añade una dirección a o borra una dirección de los filtros multidestino de la capa de enlace de la interfaz usando \fIifr_hwaddr\fP. Estas operaciones son privilegiadas. Si quiere una alternativa, vea también \fBpacket\fP(7). .TP \fBSIOCGIFTXQLEN\fP, \fBSIOCSIFTXQLEN\fP Obtiene o establece la longitud de la cola de transmisión de un dispositivo usando \fIifr_qlen\fP. La configuración de la longitud de la cola de transmisión es una operación privilegiada. .TP \fBSIOCSIFNAME\fP Cambia el nombre de la interfaz indicada en \fIifr_name\fP a \fIifr_newname\fP. Es una operación privilegiada. Sólo está permitida cuando la interfaz no está activada. .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 La mayoría de los protocolos soportan sus propias ioctls para configurar las opciones de la interfaz específicas del protocolo. Vea las páginas de manual de los protocolos para una descripción más amplia. Para la configuración de direcciones IP, vea \fBip\fP(7). .PP Además, algunos dispositivos soportan ioctls privadas. Éstas no se describen aquí. .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 Los nombres de interfaces que no tiene dirección o que no tienen la opción \fBIFF_RUNNING\fP activa, se pueden encontrar a través de \fI/proc/net/dev\fP. .PP Las direcciones IP locales versión 6 (IPv6) se pueden obtener vía \fI/proc/net\fP o vía \fBrtnetlink\fP(7). .SH ERRORES glibc 2.1 no posee la macro \fIifr_newname\fP en \fI\fP. Añada lo siguiente a su programa como solución: .PP .in +4n .EX #ifndef ifr_newname #define ifr_newname ifr_ifru.ifru_slave #endif .EE .in .SH "VÉASE TAMBIÉN" \fBproc\fP(5), \fBcapabilities\fP(7), \fBip\fP(7), \fBrtnetlink\fP(7) .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Juan Piernas . Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org>. .ME .