casaroli opened a new pull request, #22437:
URL: https://github.com/apache/nuttx/pull/22437

   ## Summary
   
   A `NETLINK_ROUTE` dump request of `RTM_GETADDR`, `RTM_GETROUTE` or 
`RTM_GETNEIGH` with the family `AF_UNSPEC` failed with `EAFNOSUPPORT`. Linux 
dumps the entries of all families for `AF_UNSPEC`, and the `getifaddrs()` of 
other C libraries sends such a request.
   
   These requests now dump the IPv4 entries, then the IPv6 entries, and end 
with one `NLMSG_DONE`. The routes of one family are listed by 
`netlink_list_ipv4_route()` or `netlink_list_ipv6_route()`, and the new 
`netlink_list_route()` adds the `NLMSG_DONE`. An `AF_UNSPEC` neighbor dump of 
empty tables is only `NLMSG_DONE`, as on Linux. The empty table of one family 
is still an `ENOENT` error, as before.
   
   ## Impact
   
   `net/netlink/netlink_route.c` only. Requests with `AF_INET` or `AF_INET6` 
give the same messages as before. A request with `AF_UNSPEC` now succeeds. 
In-tree users (`netutils/netlib`) ask for `AF_INET` or `AF_INET6` only. No API, 
ABI or Kconfig change. Common network code: the same in flat, protected and 
kernel builds and on all architectures.
   
   ## Testing
   
   `qemu-armv8a:nsh` (flat) with IPv4, IPv6, loopback, `NETLINK_ROUTE` and RAM 
routes, one IPv4 route added with `addroute`, a test program that dumps each 
type with `AF_INET`, `AF_INET6` and `AF_UNSPEC`:
   
   | Request (messages: IPv4 / IPv6) | `AF_INET` | `AF_INET6` | `AF_UNSPEC` 
master | `AF_UNSPEC` this PR |
   |---|---|---|---|---|
   | `RTM_GETADDR` | 1 / 0, `NLMSG_DONE` | 0 / 1, `NLMSG_DONE` | `EAFNOSUPPORT` 
| 1 / 1, `NLMSG_DONE` |
   | `RTM_GETROUTE` | 1 / 0, `NLMSG_DONE` | 0 / 0, `NLMSG_DONE` | 
`EAFNOSUPPORT` | 1 / 0, `NLMSG_DONE` |
   | `RTM_GETNEIGH` (empty tables) | `ENOENT` | `ENOENT` | `EAFNOSUPPORT` | 
`NLMSG_DONE` only |
   
   The `AF_INET` and `AF_INET6` columns are the same on master and with this PR.
   
   Builds with `-Werror` (CI image): `qemu-armv8a:netnsh` with netlink route 
and RAM routes (flat; also without IPv6, without IPv4 and without ARP), 
`qemu-armv8a:knsh` with networking and netlink route (kernel), 
`rv-virt:netnsh64` (flat; the RWX linker warning is also on master), 
`rv-virt:knetnsh64` (kernel), all OK with no new warnings. Without IPv4, master 
fails to build (`unused variable 'resp'` in `netlink_addr_callback()`): the 
first commit fixes this. 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]

  • [PR] net/netlink: Dump all fa... casaroli (via GitHub) via commits

Reply via email to