summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-07-05 14:18:04 +0200
committerFelix Fietkau <nbd@openwrt.org>2012-07-05 15:10:43 +0200
commit6094417533d97662f693d134ab04595a292de30c (patch)
treefffff9ec567c011095f9d5239481baff78b985a3 /device.c
parent0be9a1d0c1db1164a296a70157c01d1e5165d6cc (diff)
fix ifname for alias+vlan chains
Diffstat (limited to 'device.c')
-rw-r--r--device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/device.c b/device.c
index 017fe03..cc41b20 100644
--- a/device.c
+++ b/device.c
@@ -163,6 +163,7 @@ alias_device_create(const char *name, struct blob_attr *attr)
alias = calloc(1, sizeof(*alias) + strlen(name) + 1);
strcpy(alias->name, name);
alias->dev.set_state = alias_device_set_state;
+ alias->dev.hidden = true;
device_init_virtual(&alias->dev, &alias_device_type, NULL);
alias->avl.key = alias->name;
avl_insert(&aliases, &alias->avl);
@@ -269,13 +270,19 @@ alias_notify_device(const char *name, struct device *dev)
device_remove_user(&alias->dep);
strcpy(alias->dev.ifname, dev->ifname);
device_add_user(&alias->dep, dev);
+ alias->dev.hidden = false;
+ device_broadcast_event(&alias->dev, DEV_EVENT_UPDATE_IFNAME);
}
}
device_set_present(&alias->dev, !!dev);
- if (!dev && alias->dep.dev && !alias->dep.dev->active)
+ if (!dev && alias->dep.dev && !alias->dep.dev->active) {
device_remove_user(&alias->dep);
+ alias->dev.hidden = true;
+ alias->dev.ifname[0] = 0;
+ device_broadcast_event(&alias->dev, DEV_EVENT_UPDATE_IFNAME);
+ }
device_unlock();
}