]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Correct documentation for AF_PACKET (#112339)
authorEugene Toder <eltoder@users.noreply.github.com>
Mon, 27 Nov 2023 23:42:37 +0000 (18:42 -0500)
committerGitHub <noreply@github.com>
Mon, 27 Nov 2023 23:42:37 +0000 (15:42 -0800)
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.

Doc/library/socket.rst

index e36fc17f89de24fa6451abe65b769bcbfcae5945..e0a75304ef16064ec71a2f2ec9be8534a04cc244 100644 (file)
@@ -185,7 +185,7 @@ created.  Socket addresses are represented as follows:
   .. versionadded:: 3.7
 
 - :const:`AF_PACKET` is a low-level interface directly to network devices.
-  The packets are represented by the tuple
+  The addresses are represented by the tuple
   ``(ifname, proto[, pkttype[, hatype[, addr]]])`` where:
 
   - *ifname* - String specifying the device name.
@@ -193,7 +193,6 @@ created.  Socket addresses are represented as follows:
     May be :data:`ETH_P_ALL` to capture all protocols,
     one of the :ref:`ETHERTYPE_* constants <socket-ethernet-types>`
     or any other Ethernet protocol number.
-    Value must be in network-byte-order.
   - *pkttype* - Optional integer specifying the packet type:
 
     - ``PACKET_HOST`` (the default) - Packet addressed to the local host.