]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Clean up info on netdev or nl80211 not found errors
authorJouni Malinen <j@w1.fi>
Sun, 11 Dec 2011 16:51:55 +0000 (18:51 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 11 Dec 2011 16:51:55 +0000 (18:51 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index a7ae166b871a42868f927c835ad99b05f5405d64..a797a3ebe3d29e4de958df732caeec03d7f2c5aa 100644 (file)
@@ -2636,6 +2636,7 @@ err:
        nl_destroy_handles(&global->nl_event);
        nl_destroy_handles(&global->nl);
        nl_cb_put(global->nl_cb);
+       global->nl_cb = NULL;
        return -1;
 }
 
@@ -6680,13 +6681,18 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
        int ret = -1;
        int i;
        int was_ap = is_ap_interface(drv->nlmode);
+       int res;
 
-       if (nl80211_set_mode(drv, drv->ifindex, nlmode) == 0) {
+       res = nl80211_set_mode(drv, drv->ifindex, nlmode);
+       if (res == 0) {
                drv->nlmode = nlmode;
                ret = 0;
                goto done;
        }
 
+       if (res == -ENODEV)
+               return -1;
+
        if (nlmode == drv->nlmode) {
                wpa_printf(MSG_DEBUG, "nl80211: Interface already in "
                           "requested mode - ignore error");
@@ -6701,7 +6707,6 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
        wpa_printf(MSG_DEBUG, "nl80211: Try mode change after setting "
                   "interface down");
        for (i = 0; i < 10; i++) {
-               int res;
                res = linux_set_iface_flags(drv->global->ioctl_sock,
                                            bss->ifname, 0);
                if (res == -EACCES || res == -ENODEV)