ABOUT Netlink
The Netlink socket family is a Linux kernel interface used for inter-process communication (IPC) between both the kernel and userspace processes, and between different userspace processes, in a way similar to the Unix domain sockets. Similarly to the Unix domain sockets, and unlike INET sockets, Netlink communication cannot traverse host boundaries. However, while the Unix domain sockets use the file system namespace, Netlink processes are usually addressed by process identifiers (PIDs). [3] Netlink is designed and used for transferring miscellaneous networking information between the kernel space and userspace processes. Networking utilities, such as the iproute2 family and the utilities used for configuring mac80211-based wireless drivers, use Netlink to communicate with the Linux kernel from userspace. Netlink provides a standard socket-based interface for userspace processes, and a kernel-side API for internal use by kernel modules. Originally, Netlink used the AF_NETLINK socket family. Netlink is designed to be a more flexible successor to ioctl; RFC 3549 describes the protocol in detail.
TYPICAL COMMANDLINE SESSION
[bash]
$iw –debug wlan0 info
— Debug: Sent Message:
————————– BEGIN NETLINK MESSAGE —————————
[HEADER] 16 octets
.nlmsg_len = 28
.nlmsg_type = 22 <0x16>
.nlmsg_flags = 5 <request,ACK>
.nlmsg_seq = 1344974880
.nlmsg_pid = 41009
[PAYLOAD] 12 octets
05 00 00 00 08 00 03 00 02 00 00 00 …………
————————— END NETLINK MESSAGE —————————
— Debug: Received Message:
————————– BEGIN NETLINK MESSAGE —————————
[HEADER] 16 octets
.nlmsg_len = 64
.nlmsg_type = 22 <0x16>
.nlmsg_flags = 0 <>
.nlmsg_seq = 1344974880
.nlmsg_pid = 41009
[PAYLOAD] 48 octets
07 01 00 00 08 00 03 00 02 00 00 00 08 00 01 00 00 00 ………………
00 00 0a 00 04 00 77 6c 61 6e 30 00 00 00 08 00 05 00 ……wlan0…….
02 00 00 00 08 00 2e 00 05 00 00 00 …………
————————— END NETLINK MESSAGE —————————
Interface wlan0
ifindex 2
type managed
wiphy 2
— Debug: Received Message:
————————– BEGIN NETLINK MESSAGE —————————
[HEADER] 16 octets
.nlmsg_len = 36
.nlmsg_type = 2 <error>
.nlmsg_flags = 0 <>
.nlmsg_seq = 1344974880
.nlmsg_pid = 41009
[ERRORMSG] 20 octets
.error = 0 "Success"
[ORIGINAL MESSAGE] 16 octets
.nlmsg_len = 16
.nlmsg_type = 22 <0x16>
.nlmsg_flags = 5 <request,ACK>
.nlmsg_seq = 1344974880
.nlmsg_pid = 41009
————————— END NETLINK MESSAGE —————————
$
[/bash]
NOTE
These Notes Comes With NO WARRANTY Debug Using Application/Command That Support Debug Mode. I Call This "Inbuilt Debugging"