X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=device.c;h=5d1dcacd6f17901ddc47395d092436d42b7ac292;hb=fe08cfd2bfb389f7c174e2dd1561ba4a381db213;hp=b29d73b122704206b95325228b84900b12bda562;hpb=248ec27b62439662f28deab08adb9ee4e906f3b6;p=project%2Fnetifd.git 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;