]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not try to remove non-existing STA WDS interface
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 10 Feb 2010 09:29:53 +0000 (11:29 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 10 Feb 2010 09:29:53 +0000 (11:29 +0200)
This removes confusing error messages from the default (no WDS) case.

src/drivers/driver_nl80211.c

index 1f04779fb1be0ebd3414b38f9509a8ab2595b4e3..25f18e498c2ada658c7a5a37e38c1b66830f7681 100644 (file)
@@ -2664,8 +2664,7 @@ static void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv,
        if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
                return;
  nla_put_failure:
-       wpa_printf(MSG_ERROR, "Failed to remove interface (ifidx=%d).\n",
-                  ifidx);
+       wpa_printf(MSG_ERROR, "Failed to remove interface (ifidx=%d)", ifidx);
 }
 
 
@@ -4218,9 +4217,11 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
 static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val)
 {
        struct wpa_driver_nl80211_data *drv = priv;
-       char name[16];
+       char name[IFNAMSIZ + 1];
 
        os_snprintf(name, sizeof(name), "%s.sta%d", drv->ifname, aid);
+       wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
+                  " aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
        if (val) {
                if (nl80211_create_iface(priv, name, NL80211_IFTYPE_AP_VLAN,
                                         NULL, 1) < 0)
@@ -4537,6 +4538,10 @@ static int wpa_driver_nl80211_if_remove(void *priv,
        struct wpa_driver_nl80211_data *drv = priv;
        int ifindex = if_nametoindex(ifname);
 
+       wpa_printf(MSG_DEBUG, "nl80211: %s(type=%d ifname=%s) ifindex=%d",
+                  __func__, type, ifname, ifindex);
+       if (ifindex <= 0)
+               return -1;
        nl80211_remove_iface(drv, ifindex);
 
 #ifdef HOSTAPD