[docs] document AF_PACKET socket address format (issue 25041)

vadmium+py at gmail.com vadmium+py at gmail.com
Sat Oct 31 00:01:45 EDT 2015

File Doc/library/socket.rst (right):

Doc/library/socket.rst:131: - A tuple ``(interface, eth_prot, pkttype,
ha_type, addr, addr_len``, )
Perhaps use the square bracket notation (as for AF_TIPC):

(ifname, proto[, pkttype[, hatype[, addr]]])

Doc/library/socket.rst:136: is an optional integer specifying the ARP
hardware type, ``addr`` and
Not sure but it might be more correct to refer to Linux’s ARPHRD_*
constants, some of which are “dummy types for non-ARP hardware”.
Otherwise, clarify that this is internal and not in network byte-order,
as would be the case for a real ARP packet.

Doc/library/socket.rst:137: ``addr_len``  are optional arguments
specifying the physical address
Address length is implied in the length of “addr”, right?

>>> s = socket(AF_PACKET, SOCK_RAW, proto=htons(3))
>>> s.getsockname()  # Only five parameters
('', 3, 0, 0, b'')
>>> s.bind(("wifi", 3, PACKET_HOST, 1, bytes(6), 6))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function takes at most 5 arguments (6 given)
>>> s.bind(("wifi", 3, PACKET_HOST, 1, bytes(6)))  # Length is implied

Doc/library/socket.rst:141: .. XXX document them!
Remove this


More information about the docs mailing list