NETLINK_GENERIC is a protocol stacked on netlink protocol.
When a NETLINK_GENERIC subsystem registers its "family" name in the
kernel at run time, an integer value associated with this name is
assigned by the kernel. This integer value is specified in struct
nlmsghdr.nlmsg_type of subsequent communications with the
NETLINK_GENERIC subsystem.
This change implements decoding of NETLINK_GENERIC message types in
symbolic form, for example:
$ ./strace -yy -e 'sendto' ip tcp_metrics > /dev/null
sendto(4<NETLINK:[GENERIC:12345]>, {{len=20, type=tcp_metrics, ...
+++ exited with 0 +++
Note that type= specifying the NETLINK_GENERIC protocol family
is decoded properly.
* netlink.c (decode_nlmsg_type_generic): New function.
(nlmsg_types): Add NETLINK_GENERIC entry.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
printxval(xlat, type, dflt);
}
+static void
+decode_nlmsg_type_generic(const struct xlat *const xlat,
+ const uint16_t type,
+ const char *const dflt)
+{
+ printxval(genl_families_xlat(), type, dflt);
+}
+
static void
decode_nlmsg_type_netfilter(const struct xlat *const xlat,
const uint16_t type,
const char *const dflt;
} nlmsg_types[] = {
[NETLINK_AUDIT] = { NULL, nl_audit_types, "AUDIT_???" },
+ [NETLINK_GENERIC] = {
+ decode_nlmsg_type_generic,
+ NULL,
+ "GENERIC_FAMILY_???"
+ },
[NETLINK_NETFILTER] = {
decode_nlmsg_type_netfilter,
nl_netfilter_subsys_ids,