Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented Mar 17, 2025

Pull changes needed to make AF_PACKET sockets work with PPP L2.

Instead of setting the upper protocol type in ethernet_send()
by checking the protocol type bits, use the ptype that is already
set by the caller. This allows new protocol types to be supported
and makes the system extensible.

Signed-off-by: Jukka Rissanen <[email protected]>
(cherry picked from commit 2f10d7d)
Signed-off-by: Robert Lubos <[email protected]>
The work in Ethernet send in commit 2f10d7d
("net: ethernet: Set the ptype by the caller in send")
introduced a bug because we could try to do ARP resolving
for ARP packets too. This is clearly a wrong thing to do.
So before trying to do ARP resolving, make sure the the
packet type is IP packet.

Signed-off-by: Jukka Rissanen <[email protected]>
(cherry picked from commit ed582c1)
Signed-off-by: Robert Lubos <[email protected]>
@rlubos rlubos force-pushed the ncs/net/ppp-packet-socket branch from b295ac0 to 11ad60a Compare March 18, 2025 11:01
Currently, the L2 PPP won't work with AF_PACKET socket family as it only
supports packets from AF_INET/AF_INET6 families. Because of this, it's
not possible to use AF_PACKET RAW or DGRAm sockets with PPP interfaces,
as the packets they generate have family field set to AF_PACKET.

Fix this, by verifying the LL protocol field in the PPP L2 before
passing the packet the respective PPP driver. If the AF_PACKET packet is
received, and the protocol field is set to IP/IPv6, update the packet
family to AF_INET/AF_INET6 accordingly.

Signed-off-by: Robert Lubos <[email protected]>
(cherry picked from commit 20faa0e)
@rlubos rlubos force-pushed the ncs/net/ppp-packet-socket branch from 11ad60a to e0d2127 Compare March 19, 2025 12:16
@SeppoTakalo
Copy link
Contributor

Seem to work OK on nRFf9160DK when tested with SLM <---> Zephyr Cellular sample.

@rlubos
Copy link
Contributor Author

rlubos commented Apr 28, 2025

Will come with the upmerge.

@rlubos rlubos closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants