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

#25041: document AF_PACKET socket address format

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years, 1 month ago by tisdall
Modified:
4 years, 1 month ago
Reviewers:
berker.peksag, vadmium+py
CC:
haypo, Benjamin Peterson, docs_python.org, berkerpeksag, Martin Panter, Tim.Tisdall, azsorkin_gmail.com, Winterflower, csabella
Visibility:
Public.

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

Messages

Total messages: 2
berkerpeksag
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, 1 month ago #1
Martin Panter
4 years, 1 month ago #2
https://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst
File Doc/library/socket.rst (right):

https://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst#newcod...
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]]])

https://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst#newcod...
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.

https://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst#newcod...
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

https://bugs.python.org/review/25041/diff/15849/Doc/library/socket.rst#newcod...
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+