iproute2/genl
Jakub Kicinski 2a98bc1316 genl: print caps for all families
Back in 2006 kernel commit 334c29a64507 ("[GENETLINK]: Move
command capabilities to flags.") removed some attributes and
moved the capabilities to flags. Corresponding iproute2
commit 26328fc393 ("Add controller support for new features
exposed") added the ability to print those caps.

Printing is gated on version of the family, but we're checking
the version of each individual family rather than the control
family. The format of attributes in the control family
is dictated by the version of the control family alone.

In fact the entire version check is not strictly necessary.
The code is not using the old attributes, so on older kernels
it will simply print nothing either way.

Families can't use flags for random things, because kernel core
has a fixed interpretation.

Thanks to this change caps will be shown for all families
(assuming kernel newer than 2.6.19), not just those which
by coincidence have their local version >= 2.

For instance devlink, before:

  $ genl ctrl get name devlink
  Name: devlink
	ID: 0x15  Version: 0x1  header size: 0  max attribs: 179
	commands supported:
		#1:  ID-0x1
		#2:  ID-0x5
		#3:  ID-0x6
		...

after:

  $ genl ctrl get name devlink
  Name: devlink
	ID: 0x15  Version: 0x1  header size: 0  max attribs: 179
	commands supported:
		#1:  ID-0x1
		Capabilities (0xe):
 		  can doit; can dumpit; has policy

		#2:  ID-0x5
		Capabilities (0xe):
 		  can doit; can dumpit; has policy

		#3:  ID-0x6
		Capabilities (0xb):
 		  requires admin permission; can doit; has policy

Fixes: 26328fc393 ("Add controller support for new features exposed")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2023-03-03 18:10:03 -08:00
..
.gitignore Add ignore file for new genl 2006-08-08 12:14:09 -07:00
ctrl.c genl: print caps for all families 2023-03-03 18:10:03 -08:00
genl_utils.h genl: fix duplicate include guard 2022-06-17 10:08:19 -07:00
genl.c genl: use SPDX 2023-01-14 09:00:34 -08:00
Makefile genl: remove unused vars in Makefile 2022-10-26 08:53:02 -07:00
static-syms.c SPDX license identifiers 2017-11-24 12:21:35 -08:00