mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
The sim host usrsock backend only accepted INET/NETLINK domains and
translated socket addresses through plain struct sockaddr. That prevents
simulated applications from using POSIX AF_LOCAL sockets through the
standard socket API when CONFIG_NET_USRSOCK is used.
Add AF_LOCAL address conversion for struct sockaddr_un, allow PF_LOCAL
sockets through usrsock, handle NuttX socket type flags, and poll host
descriptors from the sim usrsock work item so nonblocking
connect/read/write readiness is reported back to NuttX. Use
sockaddr_storage for native address translation so larger address
structures are not truncated.
Testing:
- Host: Ubuntu 22.04 x86_64.
- Board/config: sim:nsh with CONFIG_NET_USRSOCK=y and
CONFIG_EXAMPLES_HELLO=y.
- make clean && make -j16.
- Ran a temporary hello example that connected to host AF_UNIX
SOCK_STREAM and SOCK_SEQPACKET sockets through NuttX socket(),
connect(), write(), and read(). Both received pong and printed
"AF_LOCAL usrsock test passed".
Assisted-by: Claude:Claude-Fable-5
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
|
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Kconfig | ||
| Make.defs | ||
| usrsock.h | ||
| usrsock_accept.c | ||
| usrsock_bind.c | ||
| usrsock_close.c | ||
| usrsock_conn.c | ||
| usrsock_connect.c | ||
| usrsock_devif.c | ||
| usrsock_event.c | ||
| usrsock_getpeername.c | ||
| usrsock_getsockname.c | ||
| usrsock_getsockopt.c | ||
| usrsock_ioctl.c | ||
| usrsock_listen.c | ||
| usrsock_poll.c | ||
| usrsock_recvmsg.c | ||
| usrsock_sendmsg.c | ||
| usrsock_setsockopt.c | ||
| usrsock_shutdown.c | ||
| usrsock_socket.c | ||
| usrsock_sockif.c | ||