Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in

#25041: document AF_PACKET socket address format

Can't Edit
Can't Publish+Mail
Start Review
4 years, 2 months ago by tisdall
4 years, 2 months ago
berker.peksag, vadmium+py
haypo, Benjamin Peterson, docs_python.org, berkerpeksag, Martin Panter, Tim.Tisdall, azsorkin_gmail.com, Winterflower, csabella

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/socket.rst View 1 chunk +9 lines, -2 lines 7 comments Download


Total messages: 2
http://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst File Doc/library/socket.rst (right): http://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst#newcode131 Doc/library/socket.rst:131: - A tuple ``(interface, eth_prot, pkttype, ha_type, addr, addr_len``, ...
4 years, 2 months ago #1
Martin Panter
4 years, 2 months ago #2
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
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+