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
3
votes
1 answer
How to work with NETLINK_KOBJECT_UEVENT protocol in user space?
Let's consider this example code:
#include
#include
#include
#include
#include
#define BUF_SIZE 4096
int main() {
int fd, res;
unsigned int i, len;
char buf[BUF_SIZE];
…

ArturFH
- 1,697
- 15
- 28
3
votes
1 answer
Filter IPv6 local address using netlink
I write C code using netlink to get information about IP route table and detect new IP address of given interface.
Using IPv4, I can filter local address using 'IFA_LOCAL'.
But using IPv6, I can't get local address: rta_type is never equal to…

imen bhiri
- 395
- 1
- 6
- 19
3
votes
1 answer
Windows IPC analog to Linux Unix domain and Netlink sockets
On Linux a fairly common method for IPC between userland processes and services is, for example, a socket interface (either Unix domain or netlink).
Simply -- What is the Windows analog of this and how do userland processes communicate with…

sherrellbc
- 4,650
- 9
- 48
- 77
3
votes
1 answer
Sending Netlink Taskstats message using libnl-3
I want to read out linux kernel statistics of a single thread using netlink socket and taskstats.
I could get taskstats to work using a python wrapper (https://github.com/facebook/gnlpy) but I want to do a C implementation.
After setting up the…

bkk
- 87
- 7
3
votes
1 answer
How to restrict receiving a generic netlink multicast to the root user?
I wrote a kernel module that sends generic Netlink multicasts, and wrote a userland client using libmnl that receives them.
That all works fine, but my client works even when it's not the root user, and I want to prevent that.
man 7 netlink…

craig65535
- 3,439
- 1
- 23
- 49
3
votes
1 answer
Listening for netlink broadcasts in a kernel module
The SELinux module sends out a netlink broadcast to any listening sockets. I'm wondering if it's possible to listen for netlink broadcast from within another kernel module?
From SELinux netlink code:
netlink_broadcast(selnl, skb, 0, SELNLGRP_AVC,…

MarkP
- 4,168
- 10
- 43
- 84
3
votes
2 answers
How to use netlink sockets for kernel - userspace communication Android
I'm trying to write kernel module for android to communicate with userspace Service so my app can display some information about the kernel. So far I've tried several examples I found on the web and none of them works. The idea is for kernel to send…

TheMole
- 31
- 1
- 2
3
votes
2 answers
Set wireless channel using netlink API
I am developing a WiFi tool in Ubuntu Linux 12.04 environment and I need to switch the WiFi interface between different channels.
Currently I found the solution in Wireshark source code ws80211_utils.c in function called ws80211_set_freq but I do…

jrpathfinder
- 41
- 1
- 9
3
votes
0 answers
netlink connector sockets
I have worked with network programming before. But this is my first foray into netlink sockets.
I have chosen to study the 'connector' type of netlink sockets. As with any kernel component, it has a user counterpart as well. The Linux kernel has a…

AjB
- 890
- 13
- 34
3
votes
1 answer
grant a user privileges to setup qdisc's with netlink sockets
I have a program which uses Libnl and tries to setup some qdisc over netlink sockets.
How do i manage the program to get the privileges to setup qdisc?
I know i could run it with sudo but this is not an option for me.
Is there any configuration file…

phschoen
- 2,021
- 16
- 25
2
votes
1 answer
How to use sockets netlink with a new netlink family
I have some issues using the netlink sockets with a new netlink family...in particular with groups. I use netlink_broadcast or nlmsg_multicast methods in kernel space to send messages to userspace. I have an header, for example, with the defs:
…

MirkoBanchi
- 2,173
- 5
- 35
- 52
2
votes
1 answer
frequency of netlink messages
I am using the inet_diag module and libpcap to get the uid of the user who accessed the url I captured using libpcap. As there may be many urls captured per second, I was wondering if there was a limit to how many netlink msgs should be sent per…

Thoughtful Dragon
- 250
- 2
- 21
2
votes
2 answers
Netlink: sending from kernel to user - EAGAIN and ENOBUFS
I'm having a lot of trouble sending netlink messages from kernel module to userspace-daemon. They randomly fail. On the kernel side, the genlmsg_unicast fails with EAGAIN while on the user-side, nl_recvmsgs_default (function from libnl) fails with…

ghik
- 10,706
- 1
- 37
- 50
2
votes
0 answers
Getting the MAC address from nftables nflog in go
I want to push my netfilter logs into Grafana Loki but I could not get a format I liked, between ulogd and promtail, so I decided to
write my own little utility to do the job for me. It works pretty well except for one thing: I would like to be…

wz2b
- 1,017
- 7
- 24
2
votes
0 answers
RTNETLINK - How to query a table other than RT_TABLE_MAIN
I have a Linux (Ubuntu 20.04, in this test) system with multiple routing tables.
> sudo cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
1 mytable
The table mytable has a…

bananaslug
- 21
- 2