[PATCH] /proc entries and renaming interfaces
Ian Rawley
chrysis
Mon Jan 30 18:58:01 PST 2006
Attached is a patch that relocates /proc entries when an interface has its
name changed. The appropriate devices are identified by checking if the
functions used by the device match the functions defined by the driver for
use by its devices.
Upon receiving a name change event for an appropriate device it cleans up
all existing /proc entries for that device as well as local AP data (this
shouldn't be a problem as an interface needs to be "down" before it can be
renamed) before placing new /proc entries and reinitialising the AP for the
new name.
Thanks for your time,
Ian Rawley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20060131/9285ba8a/attachment.htm
-------------- next part --------------
Index: hostap_working/driver/modules/hostap.c
===================================================================
RCS file: /cvs/hostap/driver/modules/hostap.c,v
retrieving revision 1.78
diff -n -w -b -B -r1.78 hostap.c
a1172 43
/*
* Callback function for the receipt of net device events.
* Only deals with events related to interface names changing.
* When one of the hostap interfaces has it's name changed
* remove all of its /proc entries and put new ones in the
* right place.
*/
static int hostap_rcv_dev_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
struct net_device *dev = ptr;
struct hostap_interface *iface = NULL;
local_info_t * local = NULL;
if(event == NETDEV_CHANGENAME)
{
/*
* Only hostap interfaces will be using this
* particular function, so this identifies
* the device as a hostap device.
*/
if( dev->do_ioctl != hostap_ioctl) return NOTIFY_DONE;
iface = dev->priv;
local = iface->local;
if(local->ddev == dev)
{
hostap_free_data(local->ap);
hostap_remove_proc(local);
hostap_init_proc(local);
hostap_init_data(local);
hostap_init_ap_proc(local);
}
}
return NOTIFY_DONE;
}
static struct notifier_block hostap_dev_notifier = {
.notifier_call = hostap_rcv_dev_event,
};
a1187 6
/*
* Register for net device events so we can relocate
* /proc entries on name changes.
*/
register_netdevice_notifier(&hostap_dev_notifier);
a1193 8
/*
* Unregister our desire to receive net device
* events as we are packing up, and no longer need
* to know if interfaces have their names changed.
*/
unregister_netdevice_notifier(&hostap_dev_notifier);
More information about the Hostap
mailing list