diff options
author | John Crispin <blogic@openwrt.org> | 2016-01-01 21:19:41 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2016-01-01 21:19:41 +0000 |
commit | 2dd91ae771b1722fb49d86a116725da6c9bac452 (patch) | |
tree | 55f7a956c11d574da08fca1ee455f80141b78775 /target/linux/generic/files/drivers | |
parent | 8ffae09db7b8825391302f745eb0728be412d6ff (diff) | |
download | master-187ad058-2dd91ae771b1722fb49d86a116725da6c9bac452.tar.gz master-187ad058-2dd91ae771b1722fb49d86a116725da6c9bac452.tar.bz2 master-187ad058-2dd91ae771b1722fb49d86a116725da6c9bac452.zip |
ledtrig-netdev: add support for renamed devices
The ppp0 interface is renamed after the connection is established. Due
to a missing NETDEV_REGISTER event, the ledtrig-netdev isn't aware of
the renamed interface and literally ignores the device
(no tx/rx indication, led isn't switched off with 'ifdown wan').
Signed-off-by: Mathias Kresin <openwrt@kresin.me>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48048 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r-- | target/linux/generic/files/drivers/leds/ledtrig-netdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/leds/ledtrig-netdev.c b/target/linux/generic/files/drivers/leds/ledtrig-netdev.c index 4e0fd667b0..5d0f95499b 100644 --- a/target/linux/generic/files/drivers/leds/ledtrig-netdev.c +++ b/target/linux/generic/files/drivers/leds/ledtrig-netdev.c @@ -265,7 +265,7 @@ static int netdev_trig_notify(struct notifier_block *nb, struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); - if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) + if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER && evt != NETDEV_CHANGENAME) return NOTIFY_DONE; spin_lock_bh(&trigger_data->lock); @@ -274,9 +274,10 @@ static int netdev_trig_notify(struct notifier_block *nb, if (strcmp(dev->name, trigger_data->device_name)) goto done; - if (evt == NETDEV_REGISTER) { + if (evt == NETDEV_REGISTER || evt == NETDEV_CHANGENAME) { if (trigger_data->net_dev != NULL) dev_put(trigger_data->net_dev); + dev_hold(dev); trigger_data->net_dev = dev; trigger_data->link_up = 0; |