Q: (rt)netlink documentation

From: Ulrich Windl
Date: Fri Jun 10 2022 - 03:07:53 EST


Hi!

I'm working with an older kernel (SLES12 SP5, 4.12.14), trying to implement a module to access rtnetlink data, specifically that returned for RTM_GETLINK.
However I have the problem that the documentation on the packet structure is very poor, if not to say absent. So I fail to parse the response correctly.
Furthermore I realized (when trying to contact the maintainer), that "netlink" is not present in the MAINTAINERS file.

To be honest, the only working example I have is derived from some C code someone had published.
>From the manual pages or header files (even from the kernel sources, or the Documentation directory) it's absolutely non-obvious how the data is structured and how to use those many macros defined.

NLMSG_ALIGN
RTA_ALIGN
RTA_OK
RTA_NEXT
RTA_LENGTH
RTA_SPACE
RTA_DATA
RTA_PAYLOAD
RTM_RTA
RTM_PAYLOAD
TCA_RTA
TCA_PAYLOAD
TA_RTA
TA_PAYLOAD
NFDN_RTMSG
NLMSG_LENGTH
NLMSG_SPACE
NLMSG_DATA
NLMSG_NEXT
NLMSG_OK
NLMSG_PAYLOAD
IFA_RTA
IFA_PAYLOAD
NFM_PAYLOAD
IFLA_RTA
IFLA_PAYLOAD
(This list is most likely not complete)

Regards,
Ulrich Windl
P.S.: Keep me on CC:, I'm not subscribed to LKML