Skip to content

Commit 562d714

Browse files
authored
Correct documentation for AF_PACKET (#112339)
Protocol in the address tuple should *not* be in the network-byte-order, because it is converted internally[1]. [1] https://github.com/python/cpython/blob/89ddea4886942b0c27a778a0ad3f0d5ac5f518f0/Modules/socketmodule.c#L2144 network byte order doesn't make sense for a python level int anyways. It's a fixed size C serialization concept.
1 parent b90a5cf commit 562d714

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Doc/library/socket.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,14 @@ created. Socket addresses are represented as follows:
185185
.. versionadded:: 3.7
186186

187187
- :const:`AF_PACKET` is a low-level interface directly to network devices.
188-
The packets are represented by the tuple
188+
The addresses are represented by the tuple
189189
``(ifname, proto[, pkttype[, hatype[, addr]]])`` where:
190190

191191
- *ifname* - String specifying the device name.
192192
- *proto* - The Ethernet protocol number.
193193
May be :data:`ETH_P_ALL` to capture all protocols,
194194
one of the :ref:`ETHERTYPE_* constants <socket-ethernet-types>`
195195
or any other Ethernet protocol number.
196-
Value must be in network-byte-order.
197196
- *pkttype* - Optional integer specifying the packet type:
198197

199198
- ``PACKET_HOST`` (the default) - Packet addressed to the local host.

0 commit comments

Comments
 (0)