Questions tagged [netlink]

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.

337 questions
4
votes
2 answers

Multicast from kernel to user space via Netlink in C

I was trying to write a simple program communicating between kernel and user space using Netlink. Basically here's what I wanted to achieve: User space program starts binding to a user defined multicast group. Insert kernel module Kernel module…
guoger
  • 197
  • 1
  • 2
  • 9
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,607
  • 3
  • 23
  • 41
4
votes
1 answer

Where to get device type constants description?

I'm getting the information about system network devices through netlink socket. I'm parsing three message types RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK defined in the ifinfomsg structure. struct ifinfomsg { unsigned char ifi_family; /*…
Anton Boritskiy
  • 1,539
  • 3
  • 21
  • 37
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
  • 185
  • 1
  • 2
  • 9
3
votes
1 answer

Netlink sockets and libnl - nl_recvmsgs_default returning -16 (EBUSY)

I'm trying to code some basic kernel module - userspace program communication using netlink sockets (libnl on user side). Userspace program sends a message to kernel and expects a reply. Unfortunately, receiving reply fails with return value -16…
ghik
  • 10,706
  • 1
  • 37
  • 50
3
votes
0 answers

not getting RTM_DELLINK netlink event

I have a small test code that checks for eth interface up/down events from the RTNLGRP_LINKmulticast group, but unfortunately, I'm always getting the RTM_NEWLINK event even when I unplug and replug the network cable. I expect RTM_DELLINK when I…
Vencat
  • 1,272
  • 11
  • 36
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
  • 83
  • 6
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
  • 8
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…
3
votes
1 answer

Leanest way to read Linux ARP table using code/Python

I have a Python script running on Linux that needs to repeatedly and reliably read the ARP table, in order to check some IP-MAC associations. I'm evaluating the possible options, and wondering which one of these is leanest/cleanest - primarily in…
Svet
  • 1,572
  • 10
  • 16
3
votes
1 answer

Netlink receive buffer alignment

PVS-Studio, a static analyzer, reports that in nh = (struct nlmsghdr *) buf, The pointer 'buf' is cast to a more strictly aligned pointer type. I think that the warning is correct. Is this a serious problem? The code needs to be portable on…
Antonin Décimo
  • 499
  • 3
  • 17
3
votes
1 answer

Change bridge flags with libnl

I'm trying to create bridge with libnl and change it's flags. Code: #include #include #include #include #define BRIDGE_NAME "brr" int main() { struct…
3
votes
0 answers

rtnetlink : how to implement "flush ip addr"

I am able to implement how to delete IP address delete per interface but I am not able to understand what option will make it work like "ip addr flush" command. Please find below my code for delete. Thanks for your help. int DeleteIpAddress(char…
3
votes
1 answer

Autonomically sending a message from kernel-module to user-space application without relying on the invoke of input. from user-space

I will give a detailed exp of the program and lead to the issue regarding the use of netlink socket communication. The last paragraph asks the actual question I need an answer for, so you might wanna start by peeking it first. Disclaimer before I…
Magmus
  • 207
  • 2
  • 11
3
votes
0 answers

Does recvmsg() which returns ENOBUFS also returns available messages?

I'm using NETLINK socket to receive NETLINK_ROUTE notifications in a user-space application. I understand that ENOBUFS error is returned from recvmsg() when: The user-space application is too slow to handle all the NETLINK messages that the kernel…
Chris Petrus
  • 193
  • 1
  • 3
  • 15