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
2
votes
1 answer
What is the best way to use netlink from C++?
What is the best way to send and receive netlink messages from userspace in C++? I don't want to use C. I'm wanting to connect with the inet_diag module.

Thoughtful Dragon
- 250
- 2
- 21
1
vote
1 answer
Python Linux Netlink Recv Buffer
When I create a try to socket.recv() from a NETLINK_ROUTE socket if I don't recv ALL the data available, it seems the data not recv'd is lost.
For example:
>>> import socket
>>> sock = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM,…

tMC
- 18,105
- 14
- 62
- 98
1
vote
1 answer
how do you use libnl nl_sock?
#include
#include
struct nl_sock *sock;
sock = nl_socket_alloc();
The above code always fails to compile with the following error:
/home/micah/Documents/C++/Socket_fun/Socket_fun/src/main.cpp|5|error:…

Thoughtful Dragon
- 250
- 2
- 21
1
vote
0 answers
Does NLM_F_DUMP on AF_XDP support filtering?
I'm issuing a SOCK_DIAG_BY_FAMILY DLM_F_DUMP on a NETLINK_INET_DIAG netlink socket for the AF_XDP family. I successfully get back a dump of the currently open XSKs. So I think I got the basics correct it seems.
Now I want to query in some situations…

TheDiveO
- 2,183
- 2
- 19
- 38
1
vote
2 answers
Connection between "IFA_CACHEINFO" rtnetlink attribute and "IFA_F_PERMANENT" flag in Linux kernel
If I add a new IPv4 address to a network interface(for example, ip -4 addr add 192.0.2.1/24 dev eth0) without rtnetlink IFA_CACHEINFO attribute and then ask for IPv4 addresses configured on that interface(for example, ip -4 addr show dev eth0), then…

Martin
- 957
- 7
- 25
- 38
1
vote
1 answer
Android Netlink socket recv() or recvmsg() not working
I am trying to get ARP cache through Netlink socket in android.
This similar code is working fine in Linux machine, so I try the same code in Android NDK.
But when I run this code, recv() gives -1 everytime with the errno of 11.
Can anyone know why…

Jongyong Park
- 11
- 2
1
vote
0 answers
How to access link slave table ID in go
Using https://godoc.org/github.com/vishvananda/netlink, I'm trying to access the table ID of a link that has been set as a slave to a VRF. If I add the link and then get it, I can see that the Slave field of netlink.LinkAttrs is set; printing it…

Jeff Learman
- 2,914
- 1
- 22
- 31
1
vote
0 answers
How can I get libusb hotplug events to a docker container?
TD;DR
I would like to know if there is a way to get AP_NETLINK/NETLINK_KOBJECT_UEVENT messages in a docker container without using --net host. So I can make libusb hotplug feature to work...
Partially answer, read Edit 1 and Edit 2
I am trying to…

Lord_Rafa
- 33
- 7
1
vote
0 answers
linux rtnetlink: appropriate function of RTM_NEWQDISC is not called
I tried to create a new qdisk through rtnetlink sockets and followed the manpage on how to do so.
My program opens a netlink socket, binds a sockaddr_nl to the socket and sends a message containing the rtnetlink data. I set type of the nlmsghdr to…

BitFriends
- 379
- 5
- 18
1
vote
0 answers
How to prepare the "correct" buffer size when receiving netlink responses?
Implementing a netlink (rtnetlink) module I ran into a problem:
Like for UDP, a part of the message (packet) is lost when the receive buffer is not big enough (e.g. when the buffer is 1024 bytes and you received 1024 bytes).
So I wondered how to…

U. Windl
- 3,480
- 26
- 54
1
vote
0 answers
How to get link status using netlink in polling mode?
Is it possible to use netlink api to get link status immediately (without waiting when kernel throws the message)? I used ioctl SIOCGIFFLAGS for getting the status of the link. Is it possible to do the same with netlink or it's complete event-based…

Andy
- 187
- 2
- 11
1
vote
0 answers
conntrack events(conntrack -E) show 0.0.0.0 as source and destination addresses
These are the logs down below.
[DESTROY] udp 17 src=0.0.0.0 dst=0.0.0.0 sport=0 dport=0 packets=3 bytes=216 [UNREPLIED] src=0.0.0.0 dst=0.0.0.0 sport=0 dport=0 packets=0 bytes=0
[NEW] udp 17 30 src=0.0.0.0 dst=0.0.0.0 sport=0 dport=0…

jatinBatra
- 41
- 4
1
vote
1 answer
How random is a linux socket file description assignment?
I am writing a C# app to communicate with my wireless card using netlink protocol (via libnl library), in Linux.
Basically I am mimicking iw's functionality.
At this initial state, I want to make sure the initial ported calls results are the same as…

Veverke
- 9,208
- 4
- 51
- 95
1
vote
0 answers
What is the 'Input' for BPF in Relation to Sockets?
Currently, I'm listening to NETLINK_KOBJECT_UEVENT messages with the following code:
union UeventBuffer {
struct nlmsghdr netlink_header;
char raw[8192];
};
int sock = socket(PF_NETLINK, SOCK_RAW | SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
struct…

Edward Chamberlain
- 274
- 6
- 23
1
vote
1 answer
strace can't parse my netlink message, but it appears valid
I'm taking my first stab at using the NetLink API in linux. I'm using Rust because it hasn't bitten me in the ass enough for me to go back to C yet. I figured a good place to start would be to enumerate the netlink devices, since there's already a…

Huckle
- 1,810
- 3
- 26
- 40