From 016dcd52d85ba6aa1e16dbc28451b8bb7c9e0d66 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Mon, 27 Nov 2017 15:34:23 +0100 Subject: [PATCH] device: Fix an autoconnect corner case Make sure device->autoconnect is set when entering the autoconnect state after netdev UP event. Otherwise the next time device_set_autoconnect(device, false) is called it will exit early seeing that device->autoconnect is false and not switch the device state. --- src/device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/device.c b/src/device.c index 1b6e2850..ff7fe0dd 100644 --- a/src/device.c +++ b/src/device.c @@ -2162,6 +2162,7 @@ static void device_netdev_notify(struct netdev *netdev, switch (event) { case NETDEV_WATCH_EVENT_UP: + device->autoconnect = true; device_enter_state(device, DEVICE_STATE_AUTOCONNECT); WATCHLIST_NOTIFY(&device_watches, device_watch_func_t,