summaryrefslogtreecommitdiffstats
path: root/man7/packet.7
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--man7/packet.752
1 files changed, 26 insertions, 26 deletions
diff --git a/man7/packet.7 b/man7/packet.7
index b2a264c..5d9d0cf 100644
--- a/man7/packet.7
+++ b/man7/packet.7
@@ -4,7 +4,7 @@
.\"
.\" $Id: packet.7,v 1.13 2000/08/14 08:03:45 ak Exp $
.\"
-.TH packet 7 2023-07-15 "Linux man-pages 6.05.01"
+.TH packet 7 2023-10-31 "Linux man-pages 6.7"
.SH NAME
packet \- packet interface on device level
.SH SYNOPSIS
@@ -12,7 +12,7 @@ packet \- packet interface on device level
.B #include <sys/socket.h>
.B #include <linux/if_packet.h>
.B #include <net/ethernet.h> /* the L2 protocols */
-.PP
+.P
.BI "packet_socket = socket(AF_PACKET, int " socket_type ", int "protocol );
.fi
.SH DESCRIPTION
@@ -20,7 +20,7 @@ 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.
-.PP
+.P
The
.I socket_type
is either
@@ -50,11 +50,11 @@ no packets are received.
can optionally be called with a nonzero
.I sll_protocol
to start receiving packets for the protocols specified.
-.PP
+.P
In order to create a packet socket, a process must have the
.B CAP_NET_RAW
capability in the user namespace that governs its network namespace.
-.PP
+.P
.B SOCK_RAW
packets are passed to and from the device driver without any changes in
the packet data.
@@ -72,7 +72,7 @@ Some device drivers always add other headers.
is similar to but not compatible with the obsolete
.B AF_INET/SOCK_PACKET
of Linux 2.0.
-.PP
+.P
.B SOCK_DGRAM
operates on a slightly higher level.
The physical header is removed before the packet is passed to the user.
@@ -82,7 +82,7 @@ packet socket get a suitable physical-layer header based on the
information in the
.I sockaddr_ll
destination address before they are queued.
-.PP
+.P
By default, all packets of the specified protocol type
are passed to a packet socket.
To get packets only from a specific interface use
@@ -97,11 +97,11 @@ Fields used for binding are
.IR sll_protocol ,
and
.IR sll_ifindex .
-.PP
+.P
The
.BR connect (2)
operation is not supported on packet sockets.
-.PP
+.P
When the
.B MSG_TRUNC
flag is passed to
@@ -115,7 +115,7 @@ even when it is longer than the buffer.
The
.I sockaddr_ll
structure is a device-independent physical-layer address.
-.PP
+.P
.in +4n
.EX
struct sockaddr_ll {
@@ -129,7 +129,7 @@ struct sockaddr_ll {
};
.EE
.in
-.PP
+.P
The fields of this structure are as follows:
.TP
.I sll_protocol
@@ -171,7 +171,7 @@ These types make sense only for receiving.
.I sll_halen
contain the physical-layer (e.g., IEEE 802.3) address and its length.
The exact interpretation depends on the device.
-.PP
+.P
When you send packets, it is enough to specify
.IR sll_family ,
.IR sll_addr ,
@@ -502,7 +502,7 @@ Argument is a
.I struct timeval
variable.
.\" FIXME Document SIOCGSTAMPNS
-.PP
+.P
In addition, all standard ioctls defined in
.BR netdevice (7)
and
@@ -546,7 +546,7 @@ Interface address contained an invalid interface index.
.TP
.B EPERM
User has insufficient privileges to carry out this operation.
-.PP
+.P
In addition, other errors may be generated by the low-level driver.
.SH VERSIONS
.B AF_PACKET
@@ -561,7 +561,7 @@ via
although this covers only a subset of the
.B AF_PACKET
features.
-.PP
+.P
The
.B SOCK_DGRAM
packet sockets make no attempt to create or parse the IEEE 802.2 LLC
@@ -582,17 +582,17 @@ bind to
instead and do the protocol multiplex yourself.
The default for sending is the standard Ethernet DIX
encapsulation with the protocol filled in.
-.PP
+.P
Packet sockets are not subject to the input or output firewall chains.
.SS Compatibility
In Linux 2.0, the only way to get a packet socket was with the call:
-.PP
+.P
.in +4n
.EX
socket(AF_INET, SOCK_PACKET, protocol)
.EE
.in
-.PP
+.P
This is still supported, but deprecated and strongly discouraged.
The main difference between the two methods is that
.B SOCK_PACKET
@@ -600,7 +600,7 @@ uses the old
.I struct sockaddr_pkt
to specify an interface, which doesn't provide physical-layer
independence.
-.PP
+.P
.in +4n
.EX
struct sockaddr_pkt {
@@ -610,7 +610,7 @@ struct sockaddr_pkt {
};
.EE
.in
-.PP
+.P
.I spkt_family
contains
the device type,
@@ -620,7 +620,7 @@ is the IEEE 802.3 protocol type as defined in
and
.I spkt_device
is the device name as a null-terminated string, for example, eth0.
-.PP
+.P
This structure is obsolete and should not be used in new code.
.SH BUGS
.SS LLC header handling
@@ -648,12 +648,12 @@ This means the names of network devices longer than 14 bytes
will be truncated to fit into
.IR spkt_device .
All these lengths include the terminating null byte (\[aq]\e0\[aq])).
-.PP
+.P
Issues from this with old code typically show up with
very long interface names used by the
.B Predictable Network Interface Names
feature enabled by default in many modern Linux distributions.
-.PP
+.P
The preferred solution is to rewrite code to avoid
.BR SOCK_PACKET .
Possible user solutions are to disable
@@ -676,14 +676,14 @@ Socket filters are not documented.
.BR raw (7),
.BR socket (7),
.BR ip (8),
-.PP
+.P
RFC\ 894 for the standard IP Ethernet encapsulation.
RFC\ 1700 for the IEEE 802.3 IP encapsulation.
-.PP
+.P
The
.I <linux/if_ether.h>
include file for physical-layer protocols.
-.PP
+.P
The Linux kernel source tree.
.I Documentation/networking/filter.rst
describes how to apply Berkeley Packet Filters to packet sockets.