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
0
votes
0 answers

Network Session monitoring linux

I'm using libnetfilter_conntrack to monitor network sessions in c++. The only thing that is missing is the PID that created the session (socket). Currently what i'm doing is get the inode of the session from /proc/net/tcp and then go over /proc//fd…
Amir Rossert
  • 226
  • 2
  • 15
0
votes
1 answer

libnl on macOS and iOS

I'm trying to migrate a Linux/Android C app to macOS/iOS. I have this problem, this app uses libnl library some times, in the source code you can see includes like: #include #include #include…
anacelto
  • 199
  • 1
  • 13
0
votes
1 answer

how to figure out what NL messages are exchanged

Hi Linux kernel/net guru, I'm looking for a way how to hook and print out NL(netlink) messages between wpa_supplicant and kernel. As of now I just inserted several printk messages to print those but it's very painful I think. Please let me know if…
windrg00
  • 457
  • 3
  • 9
0
votes
1 answer

NETLINK input function in kernel

When we invoke sendmsg API call from user process, input function is invoked and we have sent message to kernel. Ok, but when we call recvmsg API call, is input function invoked again? I saw this on example that I can not comment because I don't…
Bratic
  • 3
  • 1
0
votes
1 answer

Error in receving data from kernel using netlink at user-space

I writing a kernel module which accepts data(form of a structure) and passes back some data(same structure format) to the user-space. I can successfully receive the message from user but i get segmentation fault while i try tp dereference some of…
lone_wolf
  • 1
  • 1
  • 3
0
votes
1 answer

Installing a new route in linux routing table using rtnetlink socket

I have written a user space program that should install a new route in routing table. What i am noticing is , no if bytes sendmsg fn returns is correct, yet program is failing to install a new route. When i try to diagnose a problem using gdb on…
Abhishek Sagar
  • 1,189
  • 4
  • 20
  • 44
0
votes
1 answer

Monitoring ARP table changes

I'm trying to monitor my ARP table in linux using c++ and so far the only solution I have is polling the /proc/net/arp every interval and compare to the previous state. Can I use netlink sockets in order to receive events from the kernel on these…
Amir Rossert
  • 226
  • 2
  • 15
0
votes
0 answers

recvmsg() blocking on the first call but not on subsequent calls

I am having a problem with my client-server C program. There are 2 main parts to the program. In part one, a message is sent from a Kernel module to a Userspace listener via multicast. I have tried and tested this part of the program many times and…
S. Gill
  • 96
  • 8
0
votes
1 answer

Linux netlink mutlicast routing updates

My application should get netlink multicast route updates from kernel. I did some research and found mutlicast uses different family:RTNL_FAMILY_IPMR and group is RTMGRP_IPV4_MROUTE. However if I use: sfd = socket (AF_NETLINK, SOCK_RAW,…
Pramod
  • 371
  • 4
  • 13
0
votes
0 answers

Synchronizing Netlink Socket Communication

I am writing a kernel module that hooks some system calls (e.g. tcp_send() ) using jprobes and sends some information to the userspace using netlink sockets. netlink_unicast(nlsk, skb, pid, MSG_DONTWAIT); my callback call is: void nl_recv(struct…
Wheatley
  • 153
  • 1
  • 12
0
votes
2 answers

insmod: ERROR: could not insert module : No child processes

i am trying to run the linux kernel module in linux kernel. But what is happening, sometimes it succeeds and run, sometimes insertion of module fails with error : insmod: ERROR: could not insert module netlinkKernel.ko: No child processes and…
Abhishek Sagar
  • 1,189
  • 4
  • 20
  • 44
0
votes
0 answers

setsockopt() get EBADF in mmaped netlink

Im trying to use memory map I/O netlink to transfer bulk packets from kernel to user space, and I followed a guide document from Patrick McHardy 1. However, when I try to setup the shared ring buffer in user space by using: setsockopt(sock_fd,…
SQ Lai
  • 1
  • 2
0
votes
1 answer

Failure while unicast data from kernel to user space via netlink

I am new to kernel development and have a problem in uni casting the data from the kernel space to user space over netlink sockets. send_nat() function is to be called from a kernel module to write a user defined struct nat_mntr to netlink socket.…
Mazhar
  • 575
  • 5
  • 20
0
votes
1 answer

Using netlink to add/update iptables?

am trying to write a program which does the adds/updates the routes in the linux routing tables. For that I am using struct rtmsg to update the data & send it to fd opened as NETLINK_ROUTE. 179 struct { 180 struct nlmsghdr n; 181 struct…
vindyz
  • 1,079
  • 2
  • 11
  • 23
0
votes
1 answer

Query and modify advanced information about interfaces

I need to do following tasks: List the interfaces Set/remove/list IPv6 address Add/remove routing entries AFAIK I cannot use ioctl I need to use netlink. The problem is that I couldn't find good description how to use it (most netlink tutorials…
Maciej Piechotka
  • 7,028
  • 6
  • 39
  • 61