casaroli opened a new pull request, #22428: URL: https://github.com/apache/nuttx/pull/22428
## Summary A netlink request with the `NLM_F_ACK` flag asks for an answer. Linux sends an `NLMSG_ERROR` message with error 0 (an ACK) when the request succeeds. NuttX sent nothing, so a program that waits for the ACK of a request (for example after `RTM_NEWADDR`) waited for ever. `netlink_sendmsg()` now adds the ACK to the responses of the socket when the request succeeded and has `NLM_F_ACK`. As on Linux, the ACK holds the header of the request (`NLM_F_CAPPED`), its sequence number and the port ID of the socket. A dump (`NLM_F_DUMP`) ends with `NLMSG_DONE` and gets no ACK, as on Linux. A request that fails still returns its error from `sendto()` and gets no message, as before. (Linux returns success and sends the error in the `NLMSG_ERROR` message. A program that checks the result of `sendto()` sees the error in both cases.) ## Impact `net/netlink` only: the new internal `netlink_add_ack()` and its call in `netlink_sendmsg()`, for all netlink protocols. A program that sets `NLM_F_ACK` on a request that is not a dump now gets one more message. In-tree users: no code in nuttx or nuttx-apps sets `NLM_F_ACK`. No API, ABI or Kconfig change. Common network code: the same in flat, protected and kernel builds and on all architectures. ## Testing `qemu-armv8a:netnsh_smp` (flat), a test program on a `NETLINK_ROUTE` socket: | Request | Before | After | |---|---|---| | `RTM_GETLINK` with `NLM_F_ACK` | 3 messages, no `NLMSG_ERROR` | 4 messages; the last is `NLMSG_ERROR` with error 0, the sequence number of the request and `NLM_F_CAPPED` | | `RTM_GETLINK` with `NLM_F_ACK` and `NLM_F_DUMP` | 3 messages (`NLMSG_DONE` last) | the same, no ACK | Builds with `-Werror` (CI image): `qemu-armv8a:netnsh_smp` (flat), `qemu-armv8a:knsh` with networking added (kernel), `rv-virt:netnsh64` (flat), `rv-virt:knetnsh64` (kernel), each with netlink route and netfilter. No new warnings (the only warning is the RWX linker warning of `rv-virt:netnsh64`, also on master). checkpatch (`-c -u -m -g`) passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
