apache / apache/nuttx

connect() fails with EACCES error when CONFIG_NET_USRSOCK is enabled.

Open
#10,977 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

It seems that there is a bug that causes connect() to fail with an EACCES error when CONFIG_NET_USRSOCK is enabled.
This bug appears to have been introduced in the PR of https://github.com/apache/nuttx/pull/7291
When a UDP socket is created and connect() is executed, between usrsock_setup_request_callback() and do_connect_request(),
the USRSOCK_EVENT_SENDTO_READY event is sent by the usock daemon for that created socket, it seems that do_connect_request() will return EACCES.
Since a UDP socket can be sent anytime upon creation, it is a regular case that a USRSOCK_EVENT_SENDTO_READY event is sent at this time.
Therefore, I think the problem is that conncet() causes an error when the USRSOCK_EVENT_SENDTO_READY event is sent during the above gap.
Could you please consider a countermeasure?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.