From 45e9f61642cc13368dbb1d84fbfd54ffb7b062b3 Mon Sep 17 00:00:00 2001 From: nightcityblade Date: Mon, 27 Jul 2026 00:28:23 +0800 Subject: [PATCH] gh-100231: Clarify AF_PACKET protocol byte order --- Doc/library/socket.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 836aa91bb0885b..ea339f249ae8a6 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -586,9 +586,10 @@ The AF_* and SOCK_* constants are now :class:`AddressFamily` and .. data:: ETH_P_ALL - :data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` - constructor as *proto* for the :const:`AF_PACKET` family in order to - capture every packet, regardless of protocol. + To capture every packet, regardless of protocol, with an + :const:`AF_PACKET` socket, pass ``htons(ETH_P_ALL)`` as *proto* to the + :class:`~socket.socket` constructor. The call to :func:`htons` converts + the protocol number to network byte order. For more information, see the :manpage:`packet(7)` manpage.