Skip to content

Conversation

@rlubos
Copy link
Contributor

@rlubos rlubos commented Aug 24, 2023

The previous patch to address race condition on STREAM sockets had a
side effect on DGRAM socket, where net_context_recv() is not only
installing recv callback, but also registering a connection at net_conn
level. Doing so before setting remote address first (which is done in
net_context_connect()) had an impact on the connected DGRAM socket
operation, which now accepted packets from any remote peer, and not only
the one socket was connected to.

Also adds test cases to cover this scenario.

rlubos added 2 commits August 24, 2023 12:45
Add test cases which verify that when UDP socket is connected, it only
accepts datagrams from a remote peer it was connected to, and not
others.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The previous patch to address race condition on STREAM sockets had a
side effect on DGRAM socket, where net_context_recv() is not only
installing recv callback, but also registering a connection at net_conn
level. Doing so before setting remote address first (which is done in
net_context_connect()) had an impact on the connected DGRAM socket
operation, which now accepted packets from any remote peer, and not only
the one socket was connected to.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
@divin-raj
Copy link
Contributor

Looks good to me.

@carlescufi carlescufi merged commit 6e1a205 into zephyrproject-rtos:main Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants