]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix OLBC non-HT AP detection to check channel
authorJouni Malinen <j@w1.fi>
Sat, 30 Mar 2013 16:05:18 +0000 (18:05 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 30 Mar 2013 16:05:18 +0000 (18:05 +0200)
A non-HT capable AP on any channel could have triggered us to enable
protection regardless of own operating channel if the driver delivered
Beacon frames from other channels. The channel detection in ap_list is
not exactly ideal, but most cases can be handled by checking ap->channel
against the currently configured channel (or secondary channel in case
of HT40).

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/ap_list.c

index 4260466d40a8f6711f9078804ac5b3124efeef35..9f02151f40409984e83311ba17a82301aca90ead 100644 (file)
@@ -200,6 +200,8 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
 
        if (elems->ds_params && elems->ds_params_len == 1)
                ap->channel = elems->ds_params[0];
+       else if (elems->ht_operation && elems->ht_operation_len >= 1)
+               ap->channel = elems->ht_operation[0];
        else if (fi)
                ap->channel = fi->channel;
 
@@ -221,17 +223,23 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
        if (!iface->olbc &&
            ap_list_beacon_olbc(iface, ap)) {
                iface->olbc = 1;
-               wpa_printf(MSG_DEBUG, "OLBC AP detected: " MACSTR " - enable "
-                          "protection", MAC2STR(ap->addr));
+               wpa_printf(MSG_DEBUG, "OLBC AP detected: " MACSTR
+                          " (channel %d) - enable protection",
+                          MAC2STR(ap->addr), ap->channel);
                set_beacon++;
        }
 
 #ifdef CONFIG_IEEE80211N
-       if (!iface->olbc_ht && !ap->ht_support) {
+       if (!iface->olbc_ht && !ap->ht_support &&
+           (ap->channel == 0 ||
+            ap->channel == iface->conf->channel ||
+            ap->channel == iface->conf->channel +
+            iface->conf->secondary_channel * 4)) {
                iface->olbc_ht = 1;
                hostapd_ht_operation_update(iface);
                wpa_printf(MSG_DEBUG, "OLBC HT AP detected: " MACSTR
-                          " - enable protection", MAC2STR(ap->addr));
+                          " (channel %d) - enable protection",
+                          MAC2STR(ap->addr), ap->channel);
                set_beacon++;
        }
 #endif /* CONFIG_IEEE80211N */