#, fuzzy msgid "" msgstr "" "Project-Id-Version: man-pages-l10n VERSION\n" "POT-Creation-Date: 2014-07-17 17:57+0900\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: man-pages/man7/packet.7:12 #, no-wrap msgid "PACKET" msgstr "" #. type: TH #: man-pages/man7/packet.7:12 #, no-wrap msgid "2014-04-28" msgstr "" #. type: TH #: man-pages/man7/packet.7:12 #, no-wrap msgid "Linux" msgstr "" #. type: TH #: man-pages/man7/packet.7:12 #, no-wrap msgid "Linux Programmer's Manual" msgstr "" #. type: SH #: man-pages/man7/packet.7:13 #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:15 msgid "packet - packet interface on device level" msgstr "" #. type: SH #: man-pages/man7/packet.7:15 #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:18 #, no-wrap msgid "B<#include Esys/socket.hE>\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:20 #, no-wrap msgid "B<#include Enetpacket/packet.hE>\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:22 #, no-wrap msgid "B<#include Enet/ethernet.hE /* the L2 protocols */>\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:24 #, no-wrap msgid "" "BIB<, int " ">IB<);>\n" msgstr "" #. type: SH #: man-pages/man7/packet.7:25 #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:30 msgid "" "Packet sockets are used to receive or send raw packets at the device driver " "(OSI Layer 2) level. They allow the user to implement protocol modules in " "user space on top of the physical layer." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:51 msgid "" "The I is either B for raw packets including the link-" "level header or B for cooked packets with the link-level header " "removed. The link-level header information is available in a common format " "in a I. I is the IEEE 802.3 protocol number in " "network byte order. See the Ilinux/if_ether.hE> include file for " "a list of allowed protocols. When protocol is set to B " "then all protocols are received. All incoming packets of that protocol type " "will be passed to the packet socket before they are passed to the protocols " "implemented in the kernel." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:55 msgid "" "Only processes with effective UID 0 or the B capability may " "open packet sockets." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:73 msgid "" "B packets are passed to and from the device driver without any " "changes in the packet data. When receiving a packet, the address is still " "parsed and passed in a standard I address structure. When " "transmitting a packet, the user supplied buffer should contain the physical " "layer header. That packet is then queued unmodified to the network driver " "of the interface defined by the destination address. Some device drivers " "always add other headers. B is similar to but not compatible with " "the obsolete B of Linux 2.0." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:83 msgid "" "B operates on a slightly higher level. The physical header is " "removed before the packet is passed to the user. Packets sent through a " "B packet socket get a suitable physical layer header based on " "the information in the I destination address before they are " "queued." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:96 msgid "" "By default all packets of the specified protocol type are passed to a packet " "socket. To get packets only from a specific interface use B(2) " "specifying an address in a I to bind the packet socket " "to an interface. Only the I and the I address " "fields are used for purposes of binding." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:100 msgid "The B(2) operation is not supported on packet sockets." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:109 msgid "" "When the B flag is passed to B(2), B(2), " "B(2) the real length of the packet on the wire is always " "returned, even when it is longer than the buffer." msgstr "" #. type: SS #: man-pages/man7/packet.7:109 #, no-wrap msgid "Address types" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:113 msgid "The I is a device independent physical layer address." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:125 #, no-wrap msgid "" "struct sockaddr_ll {\n" " unsigned short sll_family; /* Always AF_PACKET */\n" " unsigned short sll_protocol; /* Physical layer protocol */\n" " int sll_ifindex; /* Interface number */\n" " unsigned short sll_hatype; /* ARP hardware type */\n" " unsigned char sll_pkttype; /* Packet type */\n" " unsigned char sll_halen; /* Length of address */\n" " unsigned char sll_addr[8]; /* Physical layer address */\n" "};\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:164 msgid "" "I is the standard ethernet protocol type in network byte order " "as defined in the Ilinux/if_ether.hE> include file. It defaults " "to the socket's protocol. I is the interface index of the " "interface (see B(7)); 0 matches any interface (only permitted for " "binding). I is an ARP type as defined in the Ilinux/" "if_arp.hE> include file. I contains the packet type. " "Valid types are B for a packet addressed to the local host, " "B for a physical layer broadcast packet, " "B for a packet sent to a physical layer multicast address, " "B for a packet to some other host that has been caught by " "a device driver in promiscuous mode, and B for a packet " "originated from the local host that is looped back to a packet socket. " "These types make sense only for receiving. I and I " "contain the physical layer (e.g., IEEE 802.3) address and its length. The " "exact interpretation depends on the device." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:180 msgid "" "When you send packets it is enough to specify I, I, " "I, I. The other fields should be 0. I " "and I are set on received packets for your information. For " "bind only I and I are used." msgstr "" #. type: SS #: man-pages/man7/packet.7:180 #, no-wrap msgid "Socket options" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:185 msgid "" "Packet socket options are configured by calling B(2) with level " "B." msgstr "" #. type: TP #: man-pages/man7/packet.7:185 #, no-wrap msgid "B" msgstr "" #. type: TP #: man-pages/man7/packet.7:188 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:200 msgid "" "Packet sockets can be used to configure physical layer multicasting and " "promiscuous mode. B adds a binding and " "B drops it. They both expect a I " "structure as argument:" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:209 #, no-wrap msgid "" "struct packet_mreq {\n" " int mr_ifindex; /* interface index */\n" " unsigned short mr_type; /* action */\n" " unsigned short mr_alen; /* address length */\n" " unsigned char mr_address[8]; /* physical layer address */\n" "};\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:230 msgid "" "B contains the interface index for the interface whose status " "should be changed. The B parameter specifies which action to " "perform. B enables receiving all packets on a shared " "medium (often known as \"promiscuous mode\"), B binds " "the socket to the physical layer multicast group specified in B " "and B, and B sets the socket up to receive all " "multicast packets arriving at the interface." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:236 msgid "" "In addition, the traditional ioctls B, B, " "B can be used for the same purpose." msgstr "" #. type: TP #: man-pages/man7/packet.7:236 #, no-wrap msgid "B (since Linux 2.6.21)" msgstr "" #. commit 8dc4194474159660d7f37c495e3fc3f10d0db8cc #. type: Plain text #: man-pages/man7/packet.7:246 msgid "" "If this binary option is enabled, the packet socket passes a metadata " "structure along with each packet in the B(2) control field. The " "structure can be read with B(3). It is defined as" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:258 #, no-wrap msgid "" "struct tpacket_auxdata {\n" " __u32 tp_status;\n" " __u32 tp_len; /* packet length */\n" " __u32 tp_snaplen; /* captured length */\n" " __u16 tp_mac;\n" " __u16 tp_net;\n" " __u16 tp_vlan_tci;\n" " __u16 tp_padding;\n" "};\n" msgstr "" #. type: TP #: man-pages/man7/packet.7:260 #, no-wrap msgid "B (since Linux 3.1)" msgstr "" #. commit dc99f600698dcac69b8f56dda9a8a00d645c5ffc #. type: Plain text #: man-pages/man7/packet.7:282 msgid "" "To scale processing across threads, packet sockets can form a fanout group. " "In this mode, each matching packet is enqueued onto only one socket in the " "group. A socket joins a fanout group by calling B(2) with " "level B and option B. Each network namespace can " "have up to 65536 independent groups. A socket selects a group by encoding " "the ID in the first 16 bits of the integer option value. The first packet " "socket to join a group implicitly creates it. To successfully join an " "existing group, subsequent packet sockets must have the same protocol, " "device settings, fanout mode and flags (see below). Packet sockets can " "leave a fanout group only by closing the socket. The group is deleted when " "the last socket is closed." msgstr "" #. commit 2d36097d26b5991d71a2cf4a20c1a158f0f1bfcd #. type: Plain text #: man-pages/man7/packet.7:305 msgid "" "Fanout supports multiple algorithms to spread traffic between sockets. The " "default mode, B, sends packets from the same flow to the " "same socket to maintain per-flow ordering. For each packet, it chooses a " "socket by taking the packet flow hash modulo the number of sockets in the " "group, where a flow hash is a hash over network-layer address and optional " "transport-layer port fields. The load-balance mode B " "implements a round-robin algorithm. B selects the socket " "based on the CPU that the packet arrived on. B " "processes all data on a single socket, moves to the next when one becomes " "backlogged. B selects the socket using a pseudo-random " "number generator. B (available since Linux 3.14) selects " "the socket using the recorded queue_mapping of the received skb." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:320 msgid "" "Fanout modes can take additional options. IP fragmentation causes packets " "from the same flow to have different flow hashes. The flag " "B, if set, causes packet to be defragmented " "before fanout is applied, to preserve order even in this case. Fanout mode " "and options are communicated in the second 16 bits of the integer option " "value. The flag B enables the roll over " "mechanism as a backup strategy: if the original fanout algorithm selects a " "backlogged socket, the packet rolls over to the next available one." msgstr "" #. type: TP #: man-pages/man7/packet.7:320 #, no-wrap msgid "B (with B)" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:343 msgid "" "When a malformed packet is encountered on a transmit ring, the default is to " "reset its I to B and abort the " "transmission immediately. The malformed packet blocks itself and " "subsequently enqueued packets from being sent. The format error must be " "fixed, the associated I reset to B, and " "the transmission process restarted via B(2). However, if " "B is set, any malformed packet will be skipped, its " "I reset to B, and the transmission process " "continued." msgstr "" #. type: TP #: man-pages/man7/packet.7:343 #, no-wrap msgid "B (with B)" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:348 msgid "" "By default, a packet receive ring writes packets immediately following the " "metadata structure and alignment padding. This integer option reserves " "additional headroom." msgstr "" #. type: TP #: man-pages/man7/packet.7:348 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:394 msgid "" "Create a memory-mapped ring buffer for asynchronous packet reception. The " "packet socket reserves a contiguous region of application address space, " "lays it out into an array of packet slots and copies packets (up to " "I) into subsequent slots. Each packet is preceded by a " "metadata structure similar to I. The protocol fields " "encode the offset to the data from the start of the metadata header. " "I stores the offset to the network layer. If the packet socket is " "of type B, then I is the same. If it is of type " "B, then that field stores the offset to the link-layer frame. " "Packet socket and application communicate the head and tail of the ring " "through the I field. The packet socket owns all slots with " "I equal to B. After filling a slot, it changes " "the status of the slot to transfer ownership to the application. During " "normal operation, the new I value has at least the " "B bit set to signal that a received packet has been stored. " "When the application has finished processing a packet, it transfers " "ownership of the slot back to the socket by setting I equal to " "B. Packet sockets implement multiple variants of the " "packet ring. The implementation details are described in I in the Linux kernel source tree." msgstr "" #. type: TP #: man-pages/man7/packet.7:394 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:397 msgid "Retrieve packet socket statistics in the form of a structure" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:404 #, no-wrap msgid "" "struct tpacket_stats {\n" " unsigned int tp_packets; /* Total packet count */\n" " unsigned int tp_drops; /* Dropped packet count */\n" "};\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:410 msgid "" "Receiving statistics resets the internal counters. The statistics structure " "differs when using a ring of variant B." msgstr "" #. type: TP #: man-pages/man7/packet.7:410 #, no-wrap msgid "B (with B; since Linux 2.6.36)" msgstr "" #. commit 614f60fa9d73a9e8fdff3df83381907fea7c5649 #. type: Plain text #: man-pages/man7/packet.7:420 msgid "" "The packet receive ring always stores a timestamp in the metadata header. " "By default, this is a software generated timestamp generated when the packet " "is copied into the ring. This integer option selects the type of timestamp. " " Besides the default, it support the two hardware formats described in " "I in the Linux kernel source tree." "" msgstr "" #. type: TP #: man-pages/man7/packet.7:420 #, no-wrap msgid "B (since Linux 2.6.31)" msgstr "" #. commit 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1 #. type: Plain text #: man-pages/man7/packet.7:455 msgid "" "Create a memory-mapped ring buffer for packet transmission. This option is " "similar to B and takes the same arguments. The application " "writes packets into slots with I equal to B " "and schedules them for transmission by changing I to " "B. When packets are ready to be transmitted, the " "application calls B(2) or a variant thereof. The I and I " "fields of this call are ignored. If an address is passed using B(2) " " or B(2), then that overrides the socket default. On successful " "transmission, the socket resets I to B. It " "immediately aborts the transmission on error unless B is set." msgstr "" #. type: TP #: man-pages/man7/packet.7:455 #, no-wrap msgid "B (with B; since Linux 2.6.27)" msgstr "" #. commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279 #. type: Plain text #: man-pages/man7/packet.7:464 msgid "" "By default, B creates a packet receive ring of variant " "B. To create another variant, configure the desired variant by " "setting this integer option before creating the ring." msgstr "" #. type: TP #: man-pages/man7/packet.7:464 #, no-wrap msgid "B (since Linux 3.14)" msgstr "" #. commit d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 #. type: Plain text #: man-pages/man7/packet.7:479 msgid "" "By default, packets sent through packet sockets pass through the kernel's " "qdisc (traffic control) layer, which is fine for the vast majority of use " "cases. For traffic generator appliances using packet sockets that intend to " "brute-force flood the network\\(emfor example, to test devices under load in " "a similar fashion to pktgen\\(emthis layer can be bypassed by setting this " "integer option to 1. A side effect is that packet buffering in the qdisc " "layer is avoided, which will lead to increased drops when network device " "transmit queues are busy; therefore, use at your own risk." msgstr "" #. type: SS #: man-pages/man7/packet.7:479 #, no-wrap msgid "Ioctls" msgstr "" #. FIXME Document SIOCGSTAMPNS #. type: Plain text #: man-pages/man7/packet.7:486 msgid "" "B can be used to receive the timestamp of the last received " "packet. Argument is a I variable." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:492 msgid "" "In addition, all standard ioctls defined in B(7) and " "B(7) are valid on packet sockets." msgstr "" #. type: SS #: man-pages/man7/packet.7:492 #, no-wrap msgid "Error handling" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:496 msgid "" "Packet sockets do no error handling other than errors occurred while passing " "the packet to the device driver. They don't have the concept of a pending " "error." msgstr "" #. type: SH #: man-pages/man7/packet.7:496 #, no-wrap msgid "ERRORS" msgstr "" #. type: TP #: man-pages/man7/packet.7:497 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:500 msgid "Unknown multicast group address passed." msgstr "" #. type: TP #: man-pages/man7/packet.7:500 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:503 msgid "User passed invalid memory address." msgstr "" #. type: TP #: man-pages/man7/packet.7:503 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:506 msgid "Invalid argument." msgstr "" #. type: TP #: man-pages/man7/packet.7:506 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:509 msgid "Packet is bigger than interface MTU." msgstr "" #. type: TP #: man-pages/man7/packet.7:509 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:512 msgid "Interface is not up." msgstr "" #. type: TP #: man-pages/man7/packet.7:512 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:515 msgid "Not enough memory to allocate the packet." msgstr "" #. type: TP #: man-pages/man7/packet.7:515 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:518 msgid "Unknown device name or interface index specified in interface address." msgstr "" #. type: TP #: man-pages/man7/packet.7:518 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:521 msgid "No packet received." msgstr "" #. type: TP #: man-pages/man7/packet.7:521 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:524 msgid "No interface address passed." msgstr "" #. type: TP #: man-pages/man7/packet.7:524 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:527 msgid "Interface address contained an invalid interface index." msgstr "" #. type: TP #: man-pages/man7/packet.7:527 #, no-wrap msgid "B" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:530 msgid "User has insufficient privileges to carry out this operation." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:532 msgid "In addition, other errors may be generated by the low-level driver." msgstr "" #. type: SH #: man-pages/man7/packet.7:532 #, no-wrap msgid "VERSIONS" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:537 msgid "" "B is a new feature in Linux 2.2. Earlier Linux versions " "supported only B." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:542 msgid "" "The include file Inetpacket/packet.hE> is present since glibc 2.1. " " Older systems need:" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:548 #, no-wrap msgid "" "#include Easm/types.hE\n" "#include Elinux/if_packet.hE\n" "#include Elinux/if_ether.hE /* The L2 protocols */\n" msgstr "" #. type: SH #: man-pages/man7/packet.7:550 #, no-wrap msgid "NOTES" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:558 msgid "" "For portable programs it is suggested to use B via B(3); " "although this covers only a subset of the B features." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:579 msgid "" "The B packet sockets make no attempt to create or parse the IEEE " "802.2 LLC header for a IEEE 802.3 frame. When B is specified " "as protocol for sending the kernel creates the 802.3 frame and fills out the " "length field; the user has to supply the LLC header to get a fully " "conforming packet. Incoming 802.3 packets are not multiplexed on the DSAP/" "SSAP protocol fields; instead they are supplied to the user as protocol " "B with the LLC header prefixed. It is thus not possible to " "bind to B; bind to B instead and do the protocol " "multiplex yourself. The default for sending is the standard Ethernet DIX " "encapsulation with the protocol filled in." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:581 msgid "Packet sockets are not subject to the input or output firewall chains." msgstr "" #. type: SS #: man-pages/man7/packet.7:581 #, no-wrap msgid "Compatibility" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:591 msgid "" "In Linux 2.0, the only way to get a packet socket was by calling " "BIB<)>. This is still supported " "but strongly deprecated. The main difference between the two methods is " "that B uses the old I to specify an " "interface, which doesn't provide physical layer independence." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:599 #, no-wrap msgid "" "struct sockaddr_pkt {\n" " unsigned short spkt_family;\n" " unsigned char spkt_device[14];\n" " unsigned short spkt_protocol;\n" "};\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:611 msgid "" "I contains the device type, I is the IEEE 802.3 " "protocol type as defined in Isys/if_ether.hE> and I " "is the device name as a null-terminated string, for example, eth0." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:613 msgid "This structure is obsolete and should not be used in new code." msgstr "" #. type: SH #: man-pages/man7/packet.7:613 #, no-wrap msgid "BUGS" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:617 msgid "" "glibc 2.1 does not have a define for B. The suggested " "workaround is to use:" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:623 #, no-wrap msgid "#ifndef SOL_PACKET\n" "#define SOL_PACKET 263\n" "#endif\n" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:628 msgid "" "This is fixed in later glibc versions and also does not occur on libc5 " "systems." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:630 msgid "The IEEE 802.2/803.3 LLC handling could be considered as a bug." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:632 msgid "Socket filters are not documented." msgstr "" #. .SH CREDITS #. This man page was written by Andi Kleen with help from Matthew Wilcox. #. AF_PACKET in Linux 2.2 was implemented #. by Alexey Kuznetsov, based on code by Alan Cox and others. #. type: Plain text #: man-pages/man7/packet.7:644 msgid "" "The B B(2) extension is an ugly hack and should be " "replaced by a control message. There is currently no way to get the " "original destination address of packets via B." msgstr "" #. type: SH #: man-pages/man7/packet.7:644 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:651 msgid "" "B(2), B(3), B(7), B(7), B(7), " "B(7)" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:654 msgid "" "RFC\\ 894 for the standard IP Ethernet encapsulation. RFC\\ 1700 for the " "IEEE 802.3 IP encapsulation." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:658 msgid "" "The Ilinux/if_ether.hE> include file for physical layer protocols." msgstr "" #. type: Plain text #: man-pages/man7/packet.7:667 msgid "" "The Linux kernel source tree. I " "describes how to apply Berkeley Packet Filters to packet sockets. I contains example source code for all " "available versions of B and B." msgstr "" #. type: SH #: man-pages/man7/packet.7:667 #, no-wrap msgid "COLOPHON" msgstr "" #. type: Plain text #: man-pages/man7/packet.7:675 msgid "" "This page is part of release 3.70 of the Linux I project. A " "description of the project, information about reporting bugs, and the latest " "version of this page, can be found at \\%http://www.kernel.org/doc/man-pages/" "." msgstr ""