Martin Panter added the comment:

Quickly looking through the history (annotate function on Mercurial web 
frontend):

* Revisions 3d4a7cd0bf17, c8ef864ba861 (2001): AF_PACKET support added on 
Linux. Partially documented in C comment and socket.bind() docstring. 
AF/PF_PACKET, PACKET_* constants also added.

* #947352 (Python 2.4), 8b3288f607e1: Support specifying hardware address, for 
sendto().

Here are some more things might be good to tease out:

1. Please don’t invent new parameter names without a good reason. I suggest 
(ifname, proto, pkttype, hatype, addr). These are already used in the bind() 
doc string, most are consistent with Linux’s struct sockaddr_ll fields, and 
“proto” is consistent with Python’s socket() constructor.

2. There is an error message mentioning “protoNumber” which could also be 
adjusted for consistency

3. When Python generates the ifname string, it uses the empty string for 
ifindex zero (matching any interface), although it does not look like parsing 
this back is supported

4. proto is endian-corrected, in contrast with Linux’s version being in network 
byte-order

5. Default pkttype is zero. This is equal to PACKET_HOST, so could be useful. 
Might also be worth changing the source code to explicitly use PACKET_HOST.

6. addr has to be a bytes-like object

7. Packet support is specific to Linux, and may not be compiled in

8. Existence of *_PACKET and PACKET_* constants

9. socket.bind() doc string needs updating since revision c8ef864ba861 (missing 
fifth parameter, addr)

----------
nosy: +martin.panter

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to