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]
312 questions
4
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,281
- 16
- 34
4
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,287
- 7
- 20
4
votes
0 answers
Linux C++ Network Session monitor
I'm trying to monitor the network sessions on server withe event driven programming (and not polling on /proc/net/tcp or udp).
I was able to find this article but it only provide one time look at the current state and not an event on each change…
Amir Rossert
- 206
- 2
- 14
4
votes
2 answers
Linux suspend/resume operations' userspace notification
I'm working on an embedded linux platform.
When I do "echo "mem" > /sys/power/state", system will suspend.
I know that kernel and driver can know that suspend operation's coming. But would it be possible that a user space process or application can…
uestclx
- 41
- 4
4
votes
2 answers
Can kernel module take initiative to send message to user space with netlink?
I am trying to run following code, which was copied from here. I have made few changes to run it with older kernel versions.
When I insert kernel module, nlmsg_multicast() fails and logs as nlmsg_multicast() error: -3 in /var/log/messages.
While…
Nitinkumar Ambekar
- 839
- 17
- 35
4
votes
1 answer
Vlan interface details using NETLINK
I understand that new interface addition can be detected using RTE_NEWLINK message type in NETLINK. Netlink sends a message with which we can get index and name of the interface using (if_indextoname & if_nametoindex).
My question is , if we add…
user1762571
- 1,629
- 4
- 23
- 41
4
votes
2 answers
How to suppress multiple netlink events?
I have been using this code as a sample to receive interface up/down events on a Linux machine. I am able to receive the events correctly but when an interface comes up from a previous down state, I receive multiple netlink events like this:
Event…
iqstatic
- 2,176
- 3
- 17
- 35
4
votes
2 answers
Netlink Multicast Kernel Group
The task I am trying to achieve is actually quite simple (multicast the string "TEST" to a userland daemon), but the kernel module doesn't compile. It stops with the error:
passing argument 4 of ‘genlmsg_multicast_allns’ makes integer from pointer…
user4122787
- 41
- 1
- 3
4
votes
2 answers
Get all link and address information when listenning to a PF_NETLINK socket
I've written a peace of code that notifies me whenever relevant (to me) networking information changes (mainly listenning to RTM_NEWADDR, RTM_DELADDR, RTM_NEWLINK and RTM_DELLINK.
this works pretty fine, each time I unplug, change ip or whatsoever I…
Ayman Khamouma
- 896
- 8
- 24
4
votes
1 answer
How are netlink sockets in the Linux kernel different from polling from userland?
I have doubt about the functioning of netlink socket in kernel-application interaction context. As I have read that netlink socket is used for event based notification from kernel to application. The benefit of this is Application is not required to…
Rahul
- 1,541
- 3
- 19
- 32
4
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
- 161
- 3
- 6
4
votes
3 answers
NetlinkListener and NetlinkEvent error messages
My application does not break during Runtime. However, the following error messages always show up
NetlinkListener: ignoring non-kernel netlink multicast message
NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found
The app I'm…
nanoeng
- 57
- 1
- 2
- 6
3
votes
1 answer
cannot understand this "message sequence mismatch error"
I've used the program answered in this link with some modifications.
Below is my modified code:
#include
#include
#include
#include
#include…
ram
- 75
- 5
3
votes
0 answers
Different package present in /usr/lib/x86_64-linux-gnu/
I'm running this command nl-qdisc-add --dev=veth-host --parent=root plug --limit=32768
It throws an error of Error: Unable to load module "/usr/lib/x86_64-linux-gnu/libnl/cli/qdisc/plug.so": /usr/lib/x86_64-linux-gnu/libnl/cli/qdisc/plug.so: cannot…
user13145713
- 109
- 7
3
votes
1 answer
Network-packets buffering in kernel qdiscs module
I want to buffer output packets originating from a container's network interface.
This netlink library file named sch_plug.c https://code.woboq.org/linux/linux/net/sched/sch_plug.c.html looks like it can solve the problem but i'm finding it hard to…
user13145713
- 109
- 7