]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Allow TDLS use to be prohibited in the BSS
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 28 Jan 2011 17:21:59 +0000 (19:21 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 28 Jan 2011 17:21:59 +0000 (19:21 +0200)
tdls_prohibit=1 and tdls_prohibit_chan_switch=1 and now be used to
disable use of TDLS or TDLS channel switching in the BSS using
extended cabilities IE as defined in IEEE 802.11z.

hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/beacon.c
src/ap/ieee802_11.c
src/ap/ieee802_11.h
src/common/ieee802_11_defs.h

index 493861188cc391a04fc0d46f2b1bc9800d09ca5c..6d340d71458060cec3b35bc04be7f97248fd5e38 100644 (file)
@@ -2034,6 +2034,18 @@ struct hostapd_config * hostapd_config_read(const char *fname)
 #endif /* CONFIG_P2P_MANAGER */
                } else if (os_strcmp(buf, "disassoc_low_ack") == 0) {
                        bss->disassoc_low_ack = atoi(pos);
+               } else if (os_strcmp(buf, "tdls_prohibit") == 0) {
+                       int val = atoi(pos);
+                       if (val)
+                               bss->tdls |= TDLS_PROHIBIT;
+                       else
+                               bss->tdls &= ~TDLS_PROHIBIT;
+               } else if (os_strcmp(buf, "tdls_prohibit_chan_switch") == 0) {
+                       int val = atoi(pos);
+                       if (val)
+                               bss->tdls |= TDLS_PROHIBIT_CHAN_SWITCH;
+                       else
+                               bss->tdls &= ~TDLS_PROHIBIT_CHAN_SWITCH;
                } else {
                        wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
                                   "item '%s'", line, buf);
index 2090e9faa216866721fb45fe636379816b175162..3a79a944a785527532e8957835ffa436a667ace5 100644 (file)
@@ -995,6 +995,14 @@ own_ip_addr=127.0.0.1
 # Allow cross connection
 #allow_cross_connection=1
 
+#### TDLS (IEEE 802.11z-2010) #################################################
+
+# Prohibit use of TDLS in this BSS
+#tdls_prohibit=1
+
+# Prohibit use of TDLS Channel Switching in this BSS
+#tdls_prohibit_chan_switch=1
+
 ##### Multiple BSSID support ##################################################
 #
 # Above configuration is using the default interface (wlan#, or multi-SSID VLAN
index 0a929d66eb3d3f33f03f56450616dfa3f873c619..86ddc3a78ded13325ded539bd16cf16da3577397 100644 (file)
@@ -325,6 +325,10 @@ struct hostapd_bss_config {
        int p2p;
 
        int disassoc_low_ack;
+
+#define TDLS_PROHIBIT BIT(0)
+#define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
+       int tdls;
 };
 
 
index 380fb8d73b67eb0bf4eb6fcb4ead32575462ece1..554492528121aa9d4ae9ad6283d0e9453ceea6ee 100644 (file)
@@ -353,6 +353,8 @@ void handle_probe_req(struct hostapd_data *hapd,
        pos = hostapd_eid_ht_operation(hapd, pos);
 #endif /* CONFIG_IEEE80211N */
 
+       pos = hostapd_eid_ext_capab(hapd, pos);
+
        /* Wi-Fi Alliance WMM */
        pos = hostapd_eid_wmm(hapd, pos);
 
@@ -478,6 +480,8 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
        tailpos = hostapd_eid_ht_operation(hapd, tailpos);
 #endif /* CONFIG_IEEE80211N */
 
+       tailpos = hostapd_eid_ext_capab(hapd, tailpos);
+
        /* Wi-Fi Alliance WMM */
        tailpos = hostapd_eid_wmm(hapd, tailpos);
 
index f65b79e30d0b0361720b30569f4e232e35e5a662..908f191f4180353ae9a6d139e015187c944fe0c7 100644 (file)
@@ -151,6 +151,31 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
 }
 
 
+u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
+{
+       u8 *pos = eid;
+
+       if ((hapd->conf->tdls & (TDLS_PROHIBIT | TDLS_PROHIBIT_CHAN_SWITCH)) ==
+           0)
+               return eid;
+
+       *pos++ = WLAN_EID_EXT_CAPAB;
+       *pos++ = 5;
+       *pos++ = 0x00;
+       *pos++ = 0x00;
+       *pos++ = 0x00;
+       *pos++ = 0x00;
+       *pos = 0x00;
+       if (hapd->conf->tdls & TDLS_PROHIBIT)
+               *pos |= 0x40; /* Bit 38 - TDLS Prohibited */
+       if (hapd->conf->tdls & TDLS_PROHIBIT_CHAN_SWITCH)
+               *pos |= 0x80; /* Bit 39 - TDLS Channel Switching Prohibited */
+       pos++;
+
+       return pos;
+}
+
+
 #ifdef CONFIG_IEEE80211W
 static u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
                                            struct sta_info *sta, u8 *eid)
@@ -867,6 +892,8 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
        p = hostapd_eid_ht_operation(hapd, p);
 #endif /* CONFIG_IEEE80211N */
 
+       p = hostapd_eid_ext_capab(hapd, p);
+
        if (sta->flags & WLAN_STA_WMM)
                p = hostapd_eid_wmm(hapd, p);
 
index cfc069c8094ff920b37fbdc7cc032a05dc1280f9..b1f009cdae16dbbed3e38bc55de7cad180080801 100644 (file)
@@ -46,6 +46,7 @@ static inline int ieee802_11_get_mib_sta(struct hostapd_data *hapd,
 #endif /* NEED_AP_MLME */
 u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
                           int probe);
+u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
 u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid);
index 3f5dc7ae9ff06691ed1daabaa9992f702b3e165b..75268947de35f59b9b30b960dfb5cbe885662166 100644 (file)
 #define WLAN_EID_MMIE 76
 #define WLAN_EID_LINK_ID 101
 #define WLAN_EID_ADV_PROTO 108
+#define WLAN_EID_EXT_CAPAB 127
 #define WLAN_EID_VENDOR_SPECIFIC 221