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

   ## Summary
   
   A netlink broadcast went to every netlink socket bound to its group number, 
whatever the protocol of the socket. The group numbers of the protocols 
overlap: `RTNLGRP_LINK` and `NFNLGRP_CONNTRACK_NEW` are both 1. So a 
`NETLINK_ROUTE` socket that waits for link changes also got the conntrack 
events of `NETLINK_NETFILTER`, which it cannot parse, and the reverse.
   
   The connection now keeps the protocol of its socket. The new internal 
`netlink_add_protocol_broadcast()` sends to the sockets of one protocol. 
`netlink_add_broadcast()` (used by the route code and the WLAN drivers) sends 
to `NETLINK_ROUTE` sockets, and the netfilter code sends to `NETLINK_NETFILTER` 
sockets.
   
   Commit 1 adds a blank line that nxstyle asks for in `netlink_netfilter.c` 
(no code change).
   
   ## Impact
   
   `net/netlink` only. A socket gets only the broadcasts of its own protocol, 
as on Linux. The signature of the public `netlink_add_broadcast()` does not 
change. No 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) with `CONFIG_NETLINK_NETFILTER=y`: a 
`NETLINK_ROUTE` socket bound to `RTMGRP_LINK` and a `NETLINK_NETFILTER` socket 
bound to `NF_NETLINK_CONNTRACK_NEW` (both group 1); then `ifdown` and `ifup` of 
`eth0`.
   
   - Before: each socket gets the same 8 messages (`RTM_NEWLINK`, 
`RTM_DELLINK`, `NLMSG_DONE`).
   - After: the route socket gets the 8 messages, the netfilter socket none.
   
   Builds with `-Werror` (CI image): `qemu-armv8a:netnsh_smp` (flat), 
`qemu-armv8a:knsh` with networking and virtio-net added (kernel), 
`rv-virt:netnsh64` (flat), `rv-virt:knetnsh64` (kernel), each with packet 
sockets, netlink route and netfilter, and the DNS client enabled. 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]

  • [PR] net/netlink: Send a broa... casaroli (via GitHub) via commits

Reply via email to