genetlink: Add per family bind/unbind callbacks
authorStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Mon, 12 Feb 2024 16:16:13 +0000 (17:16 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 16 Feb 2024 01:49:16 +0000 (17:49 -0800)
commit3de21a8990d3c2cc507e9cc4ed00f36358d5b93e
tree163b82bef94b2e60ea478a8aeec4128c69cb2b1f
parent841c35169323cd833294798e58b9bf63fa4fa1de
genetlink: Add per family bind/unbind callbacks

Add genetlink family bind()/unbind() callbacks when adding/removing
multicast group to/from netlink client socket via setsockopt() or
bind() syscall.

They can be used to track if consumers of netlink multicast messages
emerge or disappear. Thus, a client implementing callbacks, can now
send events only when there are active consumers, preventing unnecessary
work when none exist.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240212161615.161935-2-stanislaw.gruszka@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/genetlink.h
net/netlink/genetlink.c