Вопрос

I am working in Linux kernel module which is using NF_INET_PRE_ROUTING hook. In that hook I need to know the status of all my net_devices, specially wireless devices. I am able get some information about devices from net_device->flags i.e IFF_UP is device up or down. But I need some more detail about the wireless net_device.

  1. Is net_device wireless / wired?
  2. Is wireless devices connected to wireless access point?
  3. If yes which wireless access point (name of access point)?
  4. Gateway address associated with that device (I think, I need to get this from routing table?).
Это было полезно?

Решение

if(net_device->ieee80211_ptr != NULL)? The ieee80211_ptr is a struct wireless_dev*. This structure should give you access to most of the values you requested. In struct wireless_dev is struct wiphy *wiphy;, you can use this to get a cfg80211_registered_device with wiphy_to_dev().

The gateway address is unrelated to wireless. I doubt devices have any gateway information but you need the interface name in net_device to find the route. The route is IP related and has nothing to do with a device. Good luck.

Другие советы

See iwconfig, iwlist, and other utilities.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top