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
1
vote
0 answers
Get device monitor notifications in Linux using C++
I wrote a C++ program in Linux that notifies me whenever an external device is connected or disconnected from my system. I used netlink for the purpose and poll function call is used to wait for events. But now I am facing a major problem:
When I…

Jackzz
- 1,417
- 4
- 24
- 53
1
vote
2 answers
ip route get from a different routing table
Why does "ip route get" not provide a TABLE_ID SELECTOR?
I am actually using netlink to get routes from a routing table (table ID 2) and I want to get a specific route and not dump the entire routing table and filter in user land.
I was looking at…

NetCubist
- 61
- 2
- 6
1
vote
1 answer
How to get all physical interfaces
I want to get all the physical interfaces on a system, I saw a lot of references to getifaddrss but it gets all interfaces, disregarding whether it's vlan / macvlan or physical interface.
I can only assume netlink will be able to do so (when a…

SagiLow
- 5,721
- 9
- 60
- 115
1
vote
1 answer
Is netlink socket a client/server mode?
Now I am meeting a trouble:My netlink is used for kernel and user space communication. When I only start the user space's netlink socket, it will give me an error:
proctol not supported
My source code is:
if((sk_fd = socket(PF_NETLINK, SOCK_RAW,…

cwfighter
- 502
- 1
- 5
- 20
1
vote
0 answers
Unable to create netlink socket in centOS — protocol not supported
I am using a CentOS Linux release 7.0.1406 (Core)
I am using kernel version 3.10.0-123.el7.x86_64
When I am creating a netlink socket,it fails.
int sock_fd = socket(PF_NETLINK, SOCK_RAW, 1)
value of sock_fd is -1
When I was using 3.1 kernel…

Nikesh Kumar Mahalka
- 11
- 2
1
vote
1 answer
Problems in receiving a struct with more than 2 fields from kernel to userland via generic netlink
I'm trying to send/receive a struct from an LKM to userland, (and vice versa), based on this example http://www.electronicsfaq.com/2014/02/generic-netlink-sockets-example-code.html.
I send a struct to the kernel. It receives the structure ok, it…
1
vote
1 answer
Getting and setting interface addresses
Is there a way to get and set IP address on an interface in family agnostic way?
I have found about getifaddrs. Is there something similar but for setting addresses, or I need to use ioclt?
Here is my case: I need to extend an IPv4 application…

Aby Aaa Asdda
- 67
- 1
- 5
1
vote
1 answer
Using rtnetlink, reply message type to RTM_GETROUTE message?
I have sent an RTM_GETROUTE message to the kernel using netlink sockets. Now I am listening to kernel for messages.
Kernel sends nlmsghdr structure in reply via netlink sockets. I need to know what is the message type (nlmsg_type) for it? (my code…

JuliandotNut
- 1,169
- 1
- 12
- 22
1
vote
0 answers
Trying to send a packet to a terminated process, by using netlink
I am writing a linux module which exchanges data with a user process.
Perhaps the system may crash if module try to send data to a terminated user process. For avoiding crash we can use kill() function for checking availability of pid. But it…

Nishant
- 267
- 3
- 11
1
vote
1 answer
Why do I receive an "RTMGRP_LINK undeclared" error even when "rtnetlink.h" is included?
I have written a kernel module where I want to send interface up/down notifications to the user space program. I have assigned the message group as RTMGRP_LINK and also included linux/rtnetlink.h header file. But still when I compile the module I…

iqstatic
- 2,322
- 3
- 21
- 39
1
vote
0 answers
How to send messages from a kernel module to a user-space program using NETLINK_ROUTE?
I have written a user-space program to listen on the NETLINK_ROUTE socket protocol family. Now I want to write a kernel module to send messages over NETLINK_ROUTE so that the user-space program can receive those messages. I have gone through many…

iqstatic
- 2,322
- 3
- 21
- 39
1
vote
1 answer
Can NETLINK_ROUTE channel be used to send messages from kernel module to a user-space program?
I have written a user-space program that polls for the status of the available Ethernet interfaces for their operational status using netlink sockets with NETLINK_ROUTE protocol.
But now I want to write a kernel module which uses the NETLINK_ROUTE…

iqstatic
- 2,322
- 3
- 21
- 39
1
vote
0 answers
How to pass a nullable decimal from Mathematica to .Net via NETLink
I have no problems invoking methods with decimal parameters, as follows:
//public void MyMethod(decimal d){
myWrapper@MyMethod[1.23];
However, I need to change the signature of MyMethod as follows:
//public void MyMethod(decimal? d){
// this call…

A-K
- 16,804
- 8
- 54
- 74
1
vote
1 answer
How to know when scan is finished
I trigger the scan with following code
struct nl_msg *msg = nlmsg_alloc();
struct nlmsghdr *hdr;
struct genlmsghdr cmd = { .cmd = NL80211_CMD_TRIGGER_SCAN };
struct nl_sock *sock = nl_socket_alloc();
int dev =…

Ikakok
- 103
- 1
- 10
1
vote
1 answer
How to send command to network interface with netlink library
I'm starting wifi related project and i've completed one with linux ioctl calls. Now i must do the same with help of libnl as ioctl is now deprecated, i've already read all the core documentation but still don't understand how to send command on…

Ikakok
- 103
- 1
- 10