Netlink is a socket based inter process communication protocol for Linux systems. It is currently the preferred way, as of 2.6, of communicating with user space from the kernel.
Questions tagged [netlink]
337 questions
8
votes
1 answer
Netlink Sockets in C using the 3.X linux kernel
Hi, I've been working on trying to get Netlink sockets to work for the 3.2 linux kernel, but I cannot seem to figure out how to do it. I have looked around for examples of the basics of Netlink sockets, but it seems all of the examples I find are…

Zac Reynolds
- 113
- 2
- 6
7
votes
2 answers
How to get notified about network interface changes with Netlist and RTMGRP_LINK signal?
I write a program which needs to get notified if the network interfaces have changed, in particular new one appeared or existed one gone. My research brought to the netlink and its RTMGRP_LINK signal. This manpage gives an example which is not clear…

Ruslan Gerasimov
- 1,752
- 1
- 13
- 20
7
votes
1 answer
How do Netlink and security interact with each other?
I understand that Netlink is the modern and correct way to communicate kernel and userspace in Linux.
I have a kernel module that needs to be configurable, so I'm using Netlink to have it talk to a userspace application.
Everything works wonders,…

Yd Ahhrk
- 1,088
- 12
- 24
7
votes
2 answers
Live socket monitoring with netlink inet_diag
My goal is to monitor sockets and relate them to the applications that created them.
I am aware of netstat, ss, lsof and so on and that they can list all sockets with their application.
And I also know that I can parse /proc/net/tcp to get the…

BusDriverJoe
- 123
- 2
- 4
7
votes
2 answers
Where m flag and o flag will be stored in Linux
I want to know the value of m flag and o flag of recently received Router Advertisement. From the kernel source code I came to know that m flag and o flag are stored.
/*
* Remember the managed/otherconf flags from most recently
* received RA…

theB
- 2,048
- 2
- 20
- 29
7
votes
1 answer
How to query IPv6 NDP (neighbor discovery protocol) table for a specific neighbor
I am using Linux and trying to figure out how to query (via an API) the NDP table for a specific entry. The only example I have found so far (in the source for iproute2) uses Netlink and gets the entire table. Is there a way to query Netlink for a…

Tommy
- 245
- 4
- 11
6
votes
1 answer
Sending a struct from kernel to userland via netlink
I'm trying to send a struct from a LKM to userland, based on this answer: Netlink Sockets in C using the 3.X linux kernel
The code from the answer itself is perfectly compilable, but when I try to send a struct instead of a char *, I get segfaults…

alexandernst
- 14,352
- 22
- 97
- 197
6
votes
1 answer
AF_NETLINK (netlink) sockets using boost::asio
I'm writing multicast client/server application based on this and this; which work great.
However, I would also need to do something when the number of active network interfaces in the computer changes, something like what the program in the example…

deinocheirus
- 1,833
- 5
- 26
- 44
6
votes
1 answer
Is it possible to communicate between two linux kernel module via netlink?
As all know, netlink it's user/kernel space communication mechanism.
I want to communicate from my kernel module to an another. Another kernel module already has the netlink interface.
Is it possible to make connection from kernel module to netlink,…

AlexeyPerevalov
- 191
- 3
- 6
5
votes
1 answer
Linux - rtnetlink RTM_GETLINK - handle and understand answered data
I'am trying to understand how rtnetlink works, so I started playing with the idea to build a little library for my self to get into it.
I've got to the point where sending/receiving netlink messages works fine.
Right now I'am struggling on how to…

v01d
- 73
- 1
- 6
5
votes
2 answers
How can I use a NETLINK socket to data from kernel space in PYTHON?
How can I use a NETLINK socket to data from kernel space in PYTHON?

1.618
- 847
- 2
- 11
- 19
5
votes
2 answers
How to receive Kernel uevents with Netlink socket?
I'm trying to receive uevent from the kernel via a netlink socket, when a USB device is (dis)connects. I have a python script that does the same job and it works, but I need the same functionality in C. So far I have this:
#include…

Lasse Meyer
- 1,429
- 18
- 38
5
votes
2 answers
Get CAN bitrate
I want to read the currently configured CAN bitrate of my socketcan socket in C++.
I can see the bitrate with ip -det link show can0:
9: can0: mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can …

Laurenz
- 1,810
- 12
- 25
5
votes
2 answers
Can I have more than 32 netlink sockets in kernelspace?
I have several kernel modules which need to interact with userspace. Hence, each module has a Netlink socket.
My problem is that these sockets interfere with each other. This is because all of them register to the same Netlink address family…

Yd Ahhrk
- 1,088
- 12
- 24
5
votes
1 answer
Linux Kernel Generic Netlink - Is it concurrent?
Say that i have registered a generic netlink interface using genl_register_family_with_ops with multiple callbacks.
I don't see any warnings about it and I assume the callbacks are serially called but there is no information about how the callbacks…

Etherealone
- 3,488
- 2
- 37
- 56