문제

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