-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-25041: Document AF_PACKET socket address format #4092
Conversation
Doc/library/socket.rst
Outdated
|
||
.. XXX document them! | ||
- The :const:`AF_PACKET` address family is a Linux-only packet address protocol | ||
represented by the tuple ``(ifname, proto[, pkttype[, hatype[, addr]]])`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven’t heard of “packet address protocols” before. What does it mean, and why did you add it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The man page for socket has:
Name Purpose Man page
AF_UNIX, AF_LOCAL Local communication unix(7)
AF_INET IPv4 Internet protocols ip(7)
AF_INET6 IPv6 Internet protocols ipv6(7)
AF_IPX IPX - Novell protocols
AF_NETLINK Kernel user interface device netlink(7)
AF_X25 ITU-T X.25 / ISO-8208 protocol x25(7)
AF_AX25 Amateur radio AX.25 protocol
AF_ATMPVC Access to raw ATM PVCs
AF_APPLETALK AppleTalk ddp(7)
AF_PACKET Low level packet interface packet(7)
AF_ALG Interface to kernel crypto API
I think I should have said Linux-only packet interface
or Linux-only low level packet interface
. I'm not sure why I changed that to protocol. I may have read it in a description somewhere, but I can't find the source now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the important thing here is to describe that it's a low-level interface directly to network devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Apart from the strange wording introducing the address tuple, the rest looks okay to me. |
Doc/library/socket.rst
Outdated
where: | ||
|
||
- *ifname* - String specifying the device name. | ||
- *proto* - An endian-corrected integer specifying the Ethernet protocol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say "in network byte order" rather than "endian-corrected".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Doc/library/socket.rst
Outdated
- *ifname* - String specifying the device name. | ||
- *proto* - An endian-corrected integer specifying the Ethernet protocol | ||
number. | ||
- *pkttype* - Optional constant integer specifying the packet type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "constant".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
PF_PACKET | ||
PACKET_* | ||
|
||
Many constants of these forms, documented in the Linux documentation, are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Linux documentation" -> "man pages"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Linux documentation" is used in the other definitions within this section, so I had used it for consistency. Should I change them all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, I didn't realize that term was already in use here. I suppose this is fine to leave as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at git blame, it seems that one person started it and then all the others continued it, presumably for consistency. If man pages
is better, then maybe it would be best to change it now instead of propagating Linux documentation
every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to change that, but that should probably be another change.
Doc/library/socket.rst
Outdated
|
||
.. XXX document them! | ||
- The :const:`AF_PACKET` address family is a Linux-only packet address protocol | ||
represented by the tuple ``(ifname, proto[, pkttype[, hatype[, addr]]])`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the important thing here is to describe that it's a low-level interface directly to network devices.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @benjaminp: please review the changes made to this pull request. |
Thanks @csabella for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
Sorry, @csabella and @benjaminp, I could not cleanly backport this to |
Sorry, @csabella and @benjaminp, I could not cleanly backport this to |
…-4092). (cherry picked from commit 731ff68) Co-authored-by: Cheryl Sabella <[email protected]>
…-4092). (cherry picked from commit 731ff68) Co-authored-by: Cheryl Sabella <[email protected]>
Add documentation for AF_PACKET.
Includes suggestions by @berkerpeksag and @vadmium from the ticket.
https://bugs.python.org/issue25041