I need to read certain statistics from iw_statistics structure, here’s the code:
struct net_device *dev;
struct iw_statistics *wi_stats;
dev = first_net_device(&init_net);
while (dev)
{
if (strncmp(dev->name , "wlan",4)==0 )
{
if (dev->wireless_handlers->get_wireless_stats(dev) !=NULL ) // <--- here's where the code crashes.
{
wi_stats = dev-wireless_handlers->get_wireless_stats(dev);
printk(KERN_INFO "wi_stats = dev-wireless_handlers->get_wireless_stats(dev); worked!!! :D\n");
}
}
}
I’m working on linux kernel 2.6.35 and I’m writing a kernel module. What am I doing wrong here?
Looks like
wireless_handlersstruct isNull… Just because a net device has it’snamefield filled doesn’t mean it’s configured.This is where
wireless_handlersgets set:You should check the value called
CONFIG_WIRELESS_EXTif it’s not set , thewireless_handlerstruct is not set and thus you”ll be pointing to aNulland your module will get stuck