0

On my system, to find out the quality of the connected wifi signal I'd have to run sudo iwconfig wlp6s0 where wlp6s0 is the name of the device interface I'm using to connect to the wifi. The output doesn't show the link quality or signal level if I don't run the command with sudo. However, I can get the signal strength of the wifi using nmcli without using sudo e.g. nmcli dev wifi.

Running sudo strace iwconfig wlp6s0, I had found that it uses ioctl system call as indicated in a line the strace output:

ioctl(3, SIOCGIWSTATS, 0x7ffd1bd7e960) = 0

But it turns out strace nmcli dev wifi doesn't use the same system call to obtain the wifi signal strength or relevant informations.

I want to know how nmcli obtain the information it need to be able to show the wifi signal strength without using sudo.

EDIT: Output of both straces:

  1. Full output of strace nmcli dev wifi: https://pastebin.com/NdqBfC8W

  2. Full output of sudo strace iwconfig wlp6s0: https://pastebin.com/5w0Grwze

0

It likely contacts the Network Manager service using D-Bus, and the Network Manager service runs as root.

~ ps -o pid,user,cmd -C NetworkManager
  PID USER     CMD
  894 root     /usr/sbin/NetworkManager --no-daemon
  • Thank you, my life make sense now. This seems to be the case for me. – amenji Dec 16 '17 at 3:47
0

I'm not running network manager, and /sbin/iw wlan0 station dump can show the signal strength just fine without being root.

If I do an strace, I see it creates a NETLINK socket and seems to get the data from this socket. For more details, I suppose one should read the source of iw.

  • It doesn't output anything for me, with or without being root. – amenji Dec 16 '17 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.