Author martin.panter
Recipients Tim.Tisdall, Winterflower, azsorkin, berker.peksag, docs@python, martin.panter, vstinner
Date 2015-10-31.04:02:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446264169.64.0.0480173224324.issue25041@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-10-31 04:02:49martin.pantersetrecipients: + martin.panter, vstinner, docs@python, berker.peksag, Tim.Tisdall, azsorkin, Winterflower
2015-10-31 04:02:49martin.pantersetmessageid: <1446264169.64.0.0480173224324.issue25041@psf.upfronthosting.co.za>
2015-10-31 04:02:49martin.panterlinkissue25041 messages
2015-10-31 04:02:47martin.pantercreate