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
5
votes
2 answers

Netlink Multicast Kernel Group

The task I am trying to achieve is actually quite simple (multicast the string "TEST" to a userland daemon), but the kernel module doesn't compile. It stops with the error: passing argument 4 of ‘genlmsg_multicast_allns’ makes integer from pointer…
user4122787
  • 51
  • 1
  • 4
5
votes
2 answers

Get all link and address information when listenning to a PF_NETLINK socket

I've written a peace of code that notifies me whenever relevant (to me) networking information changes (mainly listenning to RTM_NEWADDR, RTM_DELADDR, RTM_NEWLINK and RTM_DELLINK. this works pretty fine, each time I unplug, change ip or whatsoever I…
Ayman Khamouma
  • 976
  • 10
  • 24
5
votes
1 answer

how to use the libnl library to trigger nl80211 commands?

Please can someone give an simple example on how to use libnl to use nl80211. I tried to go through iw source code but it is very confusing. Can any one give a simple program on how to trigger nl80211 commands such as NL80211_CMD_GET_WIPHY using the…
5
votes
1 answer

getting source code for linux's /bin/ss tool

ss tool is analogue to netstat. ss uses NETLINK libraries documented really bad (man 7 netlink). I couldn't find online how properly use NETLINK_INET_DIAG feature. Source code for ss tool would help, but I can't find it either. Any advice would be…
wick
  • 1,995
  • 2
  • 20
  • 31
5
votes
1 answer

How to set up netem qdisc and tbf qdisc using libnl-route?

I'm trying to do network emulation on ubuntu 12.04 while the shell commands work: tc qdisc add dev eth1 root handle 1:0 tbf rate 200kbit buffer 1600 limit 3000 or tc qdisc change dev eth0 root netem loss 0.1% Now I want to do the same things in c…
bigtit
  • 93
  • 5
4
votes
4 answers

How do I create a "netlink" between kernel and userspace?

I want to use netlink to communicate between an application and kernel space. My Linux kernel version is 2.6.28, and the following is my wrong code: nf_sock=netlink_kernel_create(NL_PROTO,0,nl_user_skb,THIS_MODULE); The abbreviated error message…
Charlie Epps
  • 119
  • 2
  • 3
  • 8
4
votes
1 answer

Cannot bind() netlink socket when targeting Android API 30

I have been using the following for quite some time to create a netlink socket: NetLinkLocalNetworkInfo::NetLinkSocket::NetLinkSocket() : fd(0) { fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if(fd < 0) { throw…
Jordan
  • 4,133
  • 1
  • 27
  • 43
4
votes
1 answer

How to capture all Wifi SCAN/MLME events on Android using nl80211.h?

I am trying to write a simple native app on Android to capture all Wifi related Events through Netlink MLME and SCAN events(especially I need Wifi Scan, Association, DisAssociation, Authentication, DeAuthentication, Roaming, etc.. events). I…
4
votes
2 answers

How to use go receiver when struct is defined in imported package

currently working with the vishvananda/netns package trying to extract routes from a specific network namespace. There is a defined Handle struct which is returned when I request a 'handle' for a specific network namespace. As such: func…
Alex Turner
  • 470
  • 1
  • 4
  • 14
4
votes
0 answers

Linux C++ Network Session monitor

I'm trying to monitor the network sessions on server withe event driven programming (and not polling on /proc/net/tcp or udp). I was able to find this article but it only provide one time look at the current state and not an event on each change…
Amir Rossert
  • 226
  • 2
  • 15
4
votes
2 answers

Linux suspend/resume operations' userspace notification

I'm working on an embedded linux platform. When I do "echo "mem" > /sys/power/state", system will suspend. I know that kernel and driver can know that suspend operation's coming. But would it be possible that a user space process or application can…
4
votes
2 answers

Can kernel module take initiative to send message to user space with netlink?

I am trying to run following code, which was copied from here. I have made few changes to run it with older kernel versions. When I insert kernel module, nlmsg_multicast() fails and logs as nlmsg_multicast() error: -3 in /var/log/messages. While…
4
votes
1 answer

Can't use tc in docker container

I am using tc to limit send rate in a docker container. Added below script into Dockerfile: tc qdisc add dev eth0 root handle 1: htb default 2 tc class add dev eth0 parent 1:1 classid 1:2 htb rate 2mbit ceil 2mbit prio 2 tc qdisc add dev eth0 parent…
Andy Hu
  • 97
  • 1
  • 7
4
votes
1 answer

Vlan interface details using NETLINK

I understand that new interface addition can be detected using RTE_NEWLINK message type in NETLINK. Netlink sends a message with which we can get index and name of the interface using (if_indextoname & if_nametoindex). My question is , if we add…
user1762571
  • 1,888
  • 7
  • 28
  • 47
4
votes
2 answers

How to suppress multiple netlink events?

I have been using this code as a sample to receive interface up/down events on a Linux machine. I am able to receive the events correctly but when an interface comes up from a previous down state, I receive multiple netlink events like this: Event…
iqstatic
  • 2,322
  • 3
  • 21
  • 39
1 2
3
22 23