net: socket: Change the protocol field for AF_PACKET sockets

In order to be compatible with Linux AF_PACKET socket calls, the
protocol field needs to be in network byte order.
So for example, if user wants to receive all packets, then the
protocol field needs to be set as "htons(ETH_P_ALL)".
See Linux manual page at
https://www.man7.org/linux/man-pages/man7/packet.7.html
for details.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2024-05-27 13:28:28 +03:00 committed by Carles Cufí
commit 99693bee5f
10 changed files with 40 additions and 24 deletions

View file

@ -534,6 +534,11 @@ Networking
:kconfig:option:`CONFIG_POSIX_MAX_FDS` are high enough. Unfortunately no exact values
for these can be given as it depends on application needs and usage. (:github:`72834`)
* The packet socket (type ``AF_PACKET``) protocol field in ``socket`` API call has changed.
The protocol field should be in network byte order so that we are compatible with Linux
socket calls. Linux expects the protocol field to be ``htons(ETH_P_ALL)`` if it is desired
to receive all the network packets. See details in
https://www.man7.org/linux/man-pages/man7/packet.7.html documentation. (:github:`73338`)
Other Subsystems
****************