I am trying to write a Linux kernel module that with the correct command, will bring down the the network interface (lets say wlan0) change its IP address to the one specified, then bring the interface back up. Before the comments begin, yes I know you can use ifconfig, and yes I know you can write user code to do this as well, however for my research project I am trying to learn how to do this in the Linux kernel.
After researching I found the net_device _ops struct which has the methods that I need to call for this (ndo_stop, and ndo_open). However I am struggling to find usage examples and thus tried:
dev->netdev_ops->ndo_stop(dev);
This compiled just fine, however when the module ran, the device was not brought down.
Can anyone provide a proper usage example or let me know what I am doing wrong?
Aucun commentaire:
Enregistrer un commentaire