summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/device.c b/device.c
index b29d73b..5d1dcac 100644
--- a/device.c
+++ b/device.c
@@ -62,6 +62,14 @@ void device_unlock(void)
static int set_device_state(struct device *dev, bool state)
{
+ if (state) {
+ /* Set ifindex for all devices being enabled so a valid */
+ /* ifindex is in place avoiding possible race conditions */
+ device_set_ifindex(dev, system_if_resolve(dev));
+ if (!dev->ifindex)
+ return -1;
+ }
+
if (dev->external)
return 0;