python / cpython

The Python programming language
https://www.python.org
Other
62.89k stars 30.13k forks source link

Problems with AF_PACKET sockets #90247

Open ad0d67ab-51fe-48a7-b2b3-b753bea68812 opened 2 years ago

ad0d67ab-51fe-48a7-b2b3-b753bea68812 commented 2 years ago
BPO 46089
Nosy @ethanfurman

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-feature', '3.8', 'docs'] title = 'Problems with AF_PACKET sockets' updated_at = user = 'https://bugs.python.org/gallard' ``` bugs.python.org fields: ```python activity = actor = 'ethan.furman' assignee = 'none' closed = False closed_date = None closer = None components = ['Documentation'] creation = creator = 'gallard' dependencies = [] files = [] hgrepos = [] issue_num = 46089 keywords = [] message_count = 4.0 messages = ['408638', '408645', '408652', '408747'] nosy_count = 3.0 nosy_names = ['docs@python', 'ethan.furman', 'gallard'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue46089' versions = ['Python 3.8'] ```

ad0d67ab-51fe-48a7-b2b3-b753bea68812 commented 2 years ago

For educational purposes, I'm developing my own IP stack in Python. It's going well but I'm stuck at a low level. I need to implement the following (simple) task:

Desperate, I tried to verify it wasn't a kernel problem. I wrote the C version of the above snippet.

First problem is that AF_PACKET sockets are broken in Python.

Second problem is inadequate documentation. Following issue ID 25041, some documentation has been added but there is still lot of room for improvements. For example:

When it's easier to program in C, it should tell you there is a problem on Python side.

ethanfurman commented 2 years ago

Thank you for the thorough report. Do you feel comfortable writing that missing documentation?

ad0d67ab-51fe-48a7-b2b3-b753bea68812 commented 2 years ago

Next 3 steps must be (in decreasing priorities):

For the 3rd step, I would accept to join a team.

ethanfurman commented 2 years ago

To contribute you'll need to sign a Contributor's License Agreement [1].

After that, anything you can do to help will move this forward. You may not be aware, but Python is developed primarily by volunteers, which unfortunately means that time is normally spent on bugs that the volunteers are interested in -- and nobody else seems interested in this one (which probably means not many people use this functionality).

If you have time, perhaps you could write some tests? They would obviously fail at the moment, but would help when somebody wants to fix the code itself.

[1] https://www.python.org/psf/contrib/contrib-form/

naweiss commented 2 years ago

Maybe I'm missing something but AF_PACKET sockets has a good documentation here.

Also, using AF_PACKET in Python seems to work as expected.