linux/net/netlink
Jakub Kicinski 261e8a37ec genetlink: report the real command id for dump-only ops in policy dumps
The op-to-policy map a CTRL_CMD_GETPOLICY dump returns is the only way
for userspace to find out which policy index belongs to which command.
ctrl_dumppolicy_put_op() tags the nest with doit->cmd, but an op which
only has a dumpit has no doit and every path which fills the split ops
in zeroes it out, so those entries all claim to be command 0.  nlctrl's
own CTRL_CMD_GETPOLICY and NETDEV_CMD_QSTATS_GET are both in that group:

  [{'family-id': 16, 'op-policy': {'do': 0, 'dump': 0, 'op-id': 3}},
   {'family-id': 16, 'op-policy': {'dump': 1, 'op-id': 0}},

ctrl_fill_info() gets this right - it uses the iterator's cmd for
CTRL_ATTR_OP_ID - so the two introspection interfaces of the same family
contradict each other today.

Pass the command in rather than reconstructing it from
doit->cmd | dumpit->cmd inside the helper, both callers already have it.

Fixes: 26588edbef ("genetlink: support split policies in ctrl_dumppolicy_put_op()")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20260918222949.4190284-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-22 15:21:32 +02:00
..
af_netlink.c netlink: do not free nlk->groups while lockless readers can use it 2026-09-15 18:44:02 -07:00
af_netlink.h netlink: terminate outstanding dump on socket close 2024-11-07 13:45:34 -08:00
diag.c netlink: do not free nlk->groups while lockless readers can use it 2026-09-15 18:44:02 -07:00
genetlink.c genetlink: report the real command id for dump-only ops in policy dumps 2026-09-22 15:21:32 +02:00
genetlink.h netlink: create a new header for internal genetlink symbols 2024-04-01 21:44:34 -07:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile netlink: add infrastructure to expose policies to userspace 2020-04-30 17:51:42 -07:00
policy.c genetlink: use maxattr of 0 for the reject policy 2026-03-12 18:02:13 -07:00