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
1
vote
0 answers

Listen on nftables firewall ULOG logs

On nftables config logging is set with some group number in a rule: table inet filter { chain INPUT { type filter hook input priority 0; policy drop; # Log all counter packets 0 bytes 0 log group 1 prefix "input drop" …
raspi
  • 5,962
  • 3
  • 34
  • 51
1
vote
2 answers

What is the difference between nl_pid in sockaddr_nl and nlmsg_pid in nlmsghdr?

When sending a netlink message, I guess both nl_pid in sockaddr_nl structure and nlmsg_pid in nlmsghdr structure are used to show the origin of message. Isn't it redundant? Or it has another purpose?
shahriar
  • 49
  • 4
1
vote
0 answers

Not accessing the correct package

I have to use qdiscs in some part of my project. so i was using the below command and got this error. the problem is there is libnl3 package prersent but it is searhing for libnl version. nl-qdisc-add --dev=veth-host --parent=root --update plug…
ram
  • 83
  • 6
1
vote
1 answer

netlink socket in threads: value for nl_pid

I'm trying to use netlink sockets in a pthread. I googled some examples and most of them use the following pattern to identify a "local" end of the socket: struct sockaddr_nl local = {}; local.nl_family = AF_NETLINK; local.nl_pid = pthread_self()…
Mark
  • 6,052
  • 8
  • 61
  • 129
1
vote
2 answers

Netlink : Receiving data multiple times from kernel

I recently encounter a problem when I'm using netlink to transfer many data between userspace and kernelspace. For example, function in userspace releases a request(by sendto) to kernel that it wants some data, and kernelspace replies(by…
Dylan Liu
  • 11
  • 2
1
vote
1 answer

Why am I not receiving my messages from kernel?

I'm trying to send a message from kernel to user space using generic netlink and libnl, the part of my code which does this is implemented as follow: int struct my_callback(struct sk_buff *skb, struct genl_info *info) { struct sk_buff *obuff; …
Matheus
  • 195
  • 1
  • 1
  • 11
1
vote
1 answer

Error trying to send an abstract data through libnl and generic netlink

I'm trying to send an abstract data using libnl and generic netlink, when I run the following code: struct nl_msg *msg; struct nl_data *abstract; int err = -1; if ((msg = nlmsg_alloc()) == NULL) return err; if ((genlmsg_put(msg, ctrl->pid,…
Matheus
  • 195
  • 1
  • 1
  • 11
1
vote
1 answer

Why so many NETLINK rtm_newlink messages when starting docker container

I am working on a packet sniffer app and have it setup so that there is one capture thread per interface (as opposed to one thread capturing on 'all'). It works fine but the code needs to listen to changes to the list of interfaces so that it can…
incubus
  • 681
  • 1
  • 5
  • 21
1
vote
0 answers

What is the maximum buffer size that can be passed from user space to kernel space using libnl?

In my homework I came to know that we can send a buffer of size 4096(kernel page size) between user space and kernel space. How can we send more sized buffer? I think fragmentation is a way to increase the buffer size. Is there any other method?
1
vote
0 answers

Use the same struct msghdr object between sendmsg and recvmsg in Netlink

I have some code snippet where I send then receive message through netlink API. //... struct msghdr msg = {0}; //... // some other structures initialization msg.msg_name = &sa; msg.msg_namelen = sizeof sa; msg.msg_iov = &iov; …
z0lupka
  • 236
  • 4
  • 19
1
vote
2 answers

Problem with netlink socket: kernel freeze

I'm trying to use netlink sockets to exchange messages between user-space and kernel space...i send a message from user-space to kernel-space and all works well but when i try to reply from kernel-space, system freezes. In particular i schedule with…
MirkoBanchi
  • 2,173
  • 5
  • 35
  • 52
1
vote
1 answer

How to use netlink for IPC?

My project needs to do IPC by using Netlink and the reference is Netlink unicast. I had done some changes in code. Firstly, I started both receiver and sender, then I inputted the sender's pid to receiver and later inputted receiver's pid to sender.…
I'm Shyan
  • 35
  • 1
  • 6
1
vote
0 answers

Can we have zero as a netlink multicast group id?

The genl_bind() fails, I am using linux kernel 4.12. In this code, I see that the condition is never met - if (group >= f->mcgrp_offset && group < f->mcgrp_offset + f->n_mcgrps) Also, the ->mcast_bind function pointer is always zero. I…
Prawn Hongs
  • 441
  • 1
  • 5
  • 17
1
vote
0 answers

How to use libnl with netlink socket for connect devices to AP with WPA2?

I've developed in C language, some function for managing wifi programmatically, on my embedded device. The code below shows the function that I use to associate and connect my device to an open AP (with no auth encryption). static int ap_conn() { …
kwroot
  • 47
  • 2
  • 7
1
vote
1 answer

Calling netlink_broadcast() cause BUG scheduling while atomic

I'm working on custom dahdi driver for hardware phone module. This module connected to pc via usb (userspace libusb D2XX ftdi driver). So driver was splitted into 2 parts: kernel mode dahdi driver and userspace service. Userspace daemon detects usb…
Alexandr Shutko
  • 1,857
  • 2
  • 20
  • 27