- Ubuntu 14.04, Kernel version 3.11
- Netlink sockets provide full duplex, asynchronous, low-overhead communication channel between user-kernel space processes.
- Other solutions such as ioctl(), sysfs, UDP sockets are either blocking (hence expensive) or slow (UDP has more overhead compared to Netlink) and complex.
- Netlink can carry data buffers on a return trip from kernel to user and vice-verse.
- By nature, netlink sockets are non-blocking.
- It provides sender and receiver queues to handle burst of messages.
- User space APIs are exactly like ordinary sockets. You have to specify socket family as AF_NETLINK.
- Kernel space API is netlink_kernel_create().
- Default netlink queue size is 208K. To set a higher size of queue, run the following commands:
#default buffer size = 212992 echo 425984 > /proc/sys/net/core/wmem_max echo 425984 > /proc/sys/net/core/wmem_default echo 425984 > /proc/sys/net/core/rmem_default echo 425984 > /proc/sys/net/core/rmem_max
- Netlink do not care about the data buffer you wish to send/receive.
- It allows unicasting, multicasting and broadcasting of messages.