ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I dnt know how will u get net_device structure.. bt if u can get it then u can get pointer to pdev structure frm it (net_device->pdev), and get the Vendor ID / Device ID of the device from its config space and compare it with the wireless device which u want to find out.
-- r u writing a driver for wireless device or wt ???
No I am not writing a device driver. I am writing a kernel module that monitors the packets that arrive on the host. So, I registered my module with the IP_FORWARD kernel hook and now I have a callback function with the pointer to the packet, the network device it arrived on, and the network device it is leaving on. And the callback function gets called for every packet that traverses the host. So I have pointers to all these structures.
What I want to do is check the device the packet is leaving on to see if it is a wireless device or not. And I thought about checking
dev->wireless_handlers,
to see if it exists or not as I think it will only exist if the device is a wireless device. Is that correct???
I dont think I need to check the Vendor ID/Device ID as I am only checking to see if it is wireless or not.
hi,
You can use wireless_handlers, bt the problem is this field is not mandatory for wireless drivers, e.g. ray_cs.c is a wireless lan driver but it doesnt initialize wireless_handlers. You can check for "get_wireless_stats", but that is also not mandatory...... But i suggest you to read Vendor ID/ Device ID, whnever you find any new net_dev address you can go and read config space, if its Dev/Vendor ID matches thn store a flag for this net_dev struct. I couldnt find any other way.
Thanks Mehul for your reply. You have been a lot of help for me.
On another issue, isn't "get_wireless_stats" depracated or phased out. I read on the net that it is being phased out and will no longer be supported in Linux 2.6 kernel. Is that true??
hi,
i really dnt know if it is phased out, bt it is still there in the 2.6 kernel. As i told you tht u can read the config space, but again if the device is not pci than u are in big trouble .... I couldnt find any flag in dev structure which will tell whether the device is wireless or not ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.