Skip to content
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

Merged
merged 3 commits into from
Sep 12, 2018

Conversation

csabella
Copy link
Contributor

@csabella csabella commented Oct 23, 2017

Add documentation for AF_PACKET.

Includes suggestions by @berkerpeksag and @vadmium from the ticket.

https://bugs.python.org/issue25041


.. 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]]])``
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vadmium
Copy link
Member

vadmium commented Oct 29, 2017

Apart from the strange wording introducing the address tuple, the rest looks okay to me.

where:

- *ifname* - String specifying the device name.
- *proto* - An endian-corrected integer specifying the Ethernet protocol
Copy link
Contributor

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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

- *ifname* - String specifying the device name.
- *proto* - An endian-corrected integer specifying the Ethernet protocol
number.
- *pkttype* - Optional constant integer specifying the packet type:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "constant".

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Linux documentation" -> "man pages"

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.


.. 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]]])``
Copy link
Contributor

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.

@bedevere-bot
Copy link

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. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@csabella
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@benjaminp: please review the changes made to this pull request.

@benjaminp benjaminp merged commit 731ff68 into python:master Sep 12, 2018
@miss-islington
Copy link
Contributor

Thanks @csabella for the PR, and @benjaminp for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @csabella and @benjaminp, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 731ff68eeef58babdf2b32dc9a73b141760c2be9 3.7

@miss-islington
Copy link
Contributor

Sorry, @csabella and @benjaminp, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 731ff68eeef58babdf2b32dc9a73b141760c2be9 3.6

benjaminp pushed a commit that referenced this pull request Sep 12, 2018
benjaminp pushed a commit that referenced this pull request Sep 12, 2018
@csabella csabella deleted the bpo25041 branch September 12, 2018 11:32
@serhiy-storchaka serhiy-storchaka added the docs Documentation in the Doc dir label Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants