aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-03-24 18:50:40 (GMT)
committerJouni Malinen <j@w1.fi>2009-04-20 08:56:15 (GMT)
commit651acf8ed7829fbcaea11bb3fe8aad624156070e (patch)
tree5d100ab395d7e546cd952ef4ce20180726684a4b
parent3d5c085e5c73d606952bc085e606064826eebdfa (diff)
downloadhostap-06-651acf8ed7829fbcaea11bb3fe8aad624156070e.zip
hostap-06-651acf8ed7829fbcaea11bb3fe8aad624156070e.tar.gz
hostap-06-651acf8ed7829fbcaea11bb3fe8aad624156070e.tar.bz2
driver_nl80211: Fix initial iftype change
Need to set drv->ifindex before calling set_mode(). In addition, set the mode before setting the interface up to avoid having to set it down again. Add more useful error message on mode changes. (cherry picked from commit a87c9d9609c0585bb667e67f01589e4adf88c5d9) Conflicts: src/drivers/driver_nl80211.c
-rw-r--r--src/drivers/driver_nl80211.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index ec26480..dd07ce6 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1517,6 +1517,12 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
{
int flags;
+ drv->ifindex = if_nametoindex(drv->ifname);
+
+ if (wpa_driver_nl80211_set_mode(drv, 0) < 0) {
+ printf("Could not configure driver to use managed mode\n");
+ }
+
if (wpa_driver_nl80211_get_ifflags(drv, &flags) != 0)
printf("Could not get interface '%s' flags\n", drv->ifname);
else if (!(flags & IFF_UP)) {
@@ -1531,14 +1537,8 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
*/
wpa_driver_nl80211_flush_pmkid(drv);
- if (wpa_driver_nl80211_set_mode(drv, 0) < 0) {
- printf("Could not configure driver to use managed mode\n");
- }
-
wpa_driver_nl80211_get_range(drv);
- drv->ifindex = if_nametoindex(drv->ifname);
-
wpa_driver_nl80211_send_oper_ifla(drv, 1, IF_OPER_DORMANT);
}
@@ -2252,7 +2252,8 @@ static int wpa_driver_nl80211_set_mode(void *priv, int mode)
goto try_again;
nla_put_failure:
- wpa_printf(MSG_ERROR, "nl80211: Failed to set interface mode");
+ wpa_printf(MSG_ERROR, "nl80211: Failed to set interface mode: %d (%s)",
+ ret, strerror(-ret));
return -1;
try_again:
@@ -2277,7 +2278,8 @@ try_again:
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret) {
wpa_printf(MSG_ERROR, "Failed to set interface %s "
- "mode", drv->ifname);
+ "mode(try_again): %d (%s)",
+ drv->ifname, ret, strerror(-ret));
}
/* Ignore return value of get_ifflags to ensure that the device