wire / wire-format / netlink-message

Netlink message header

Netlink is the Linux kernel's socket-based IPC mechanism for network configuration, routing, firewall, and (via generic netlink) many subsystems. Every netlink message starts with a 16-byte header: length (including header and padding), type, flags, sequence number, and port ID (PID).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: Netlink message header

wire format

spec: Linux kernel (netlink)

Netlink is the Linux kernel's socket-based IPC mechanism for network configuration, routing, firewall, and (via generic netlink) many subsystems. Every netlink message starts with a 16-byte header: length (including header and padding), type, flags, sequence number, and port ID (PID).

fieldsizemeaning
nlmsg_len4 bytes (__u32)Total length of the message including header and padding to NLMSG_ALIGN (4 bytes).
nlmsg_type2 bytes (__u16)Message type: NLMSG_NOOP, NLMSG_ERROR, NLMSG_DONE, NLMSG_OVERRUN, or subsystem-specific (RTM_NEWLINK, RTM_NEWADDR, ...).
nlmsg_flags2 bytes (__u16)Flags: NLM_F_REQUEST, NLM_F_MULTI, NLM_F_ACK, NLM_F_ECHO, NLM_F_ROOT, NLM_F_MATCH, NLM_F_ATOMIC, NLM_F_DUMP, ... .
nlmsg_seq4 bytes (__u32)Sequence number for matching requests to responses.
nlmsg_pid4 bytes (__u32)Port ID of the sender (usually the process PID; 0 for kernel).

example:

3c 00 00 00 10 00 05 00 01 00 00 00 00 00 00 00

Netlink message: length 60, type 0x0010 (RTM_GETLINK), flags 0x0005 (REQUEST|ACK), seq 1, pid 0


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/netlink-message or /wire-format/netlink-message.json