Which API provides Linux wireless notifications?

I would like to activate a callback every time my network card sends new information about available networks. I do not mind if I also need to interview this information. I just don't want to rely on spawning " iwlist scan last" every second, but exactly what I need (network name + channel + encryption type).

Is there a library that implements such a function? (or are there some ioctl calls for this?)

I'm only interested in the ndiswrapper module, if that matters.

+3
source share
2 answers

If NetworkManager is running, it is accessible through the DBUS API - see events WirelessNetworkAppearedand WirelessNetworkDisappeared.

Otherwise, you will have to deal with wext yourself (this is what NM uses under it), you will be interested in IWEVREGISTEREDand IWEVEXPIREDpassing through the NETLINK_ROUTE interface .

+3
source

If you do not want to use DBUS, you can also simply abandon the script / program in /etc/NetworkManager/dispatcher.d/where NetworkManager will call it when certain events occur.

See " man 8 NetworkManager" for event types and arguments passed to the script. The script will be executed as root, although perhaps this is not what you want.

+1
source

Source: https://habr.com/ru/post/1707881/


All Articles