wire / wire-format / netlink-message
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).
aka: Netlink message header
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).
| field | size | meaning |
|---|---|---|
| nlmsg_len | 4 bytes (__u32) | Total length of the message including header and padding to NLMSG_ALIGN (4 bytes). |
| nlmsg_type | 2 bytes (__u16) | Message type: NLMSG_NOOP, NLMSG_ERROR, NLMSG_DONE, NLMSG_OVERRUN, or subsystem-specific (RTM_NEWLINK, RTM_NEWADDR, ...). |
| nlmsg_flags | 2 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_seq | 4 bytes (__u32) | Sequence number for matching requests to responses. |
| nlmsg_pid | 4 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
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/netlink-message
or /wire-format/netlink-message.json