socket.AF_PACKET doc: proto is *not* in network byte order
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Documentation
The documentation of socket.AF_PACKET says that the value of proto in the address representation must be in network-byte-order:
https://github.com/python/cpython/blame/v3.12.0a3/Doc/library/socket.rst#L196
Value must be in network-byte-order.
This is incorrect. It is true that the corresponding Linux field sll_protocol is in network byte order (see packet(7)), but Python automatically converts to/from host byte order:
https://github.com/python/cpython/blob/v3.12.0a3/Modules/socketmodule.c#L1483
https://github.com/python/cpython/blob/v3.12.0a3/Modules/socketmodule.c#L2104
Note: This applies to addresses passed to socket.bind() and returned from socket.recvfrom(), but does not apply to the proto parameter of socket.socket() -- Python doesn't automatically convert it, so the user must supply a value in network byte order (when using AF_PACKET). It might be a good idea to document this, e.g. the documentation of ETH_P_ALL could mention that it needs to be converted using socket.htons() before passing to socket.socket().
Bonus typo:
https://github.com/python/cpython/blame/v3.12.0a3/Doc/library/socket.rst#L188
The packets are represented by the tuple
"packets" is inaccurate and should be changed to "addresses" or "sockets".
Linked PRs
- gh-154741
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Abre Doc/library/socket.rst en la representación de direcciones de AF_PACKET y revisa las ubicaciones citadas de Modules/socketmodule.c para comprobar el comportamiento del orden de bytes. Actualiza la documentación para distinguir las direcciones de bind/recvfrom del parámetro proto de socket(), y corrige la redacción de “packets”; se considera terminado cuando las conversiones y la terminología documentadas coincidan con la implementación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- documentation, networking
- Tipo de issue
- Documentación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100