aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-28 17:21:59 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-28 17:21:59 (GMT)
commit1161ff1ef5e4bdc0e1727a039d6b23ac74b863d0 (patch)
treec9f120472070c3a574321147170f82ad0610b9b1 /src
parent9a994178f19a3632c7a12b892c508e323de18cdb (diff)
downloadhostap-1161ff1ef5e4bdc0e1727a039d6b23ac74b863d0.zip
hostap-1161ff1ef5e4bdc0e1727a039d6b23ac74b863d0.tar.gz
hostap-1161ff1ef5e4bdc0e1727a039d6b23ac74b863d0.tar.bz2
hostapd: Allow TDLS use to be prohibited in the BSS
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.
Diffstat (limited to 'src')
-rw-r--r--src/ap/ap_config.h4
-rw-r--r--src/ap/beacon.c4
-rw-r--r--src/ap/ieee802_11.c27
-rw-r--r--src/ap/ieee802_11.h1
-rw-r--r--src/common/ieee802_11_defs.h1
5 files changed, 37 insertions, 0 deletions
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 0a929d6..86ddc3a 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -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;
};
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 380fb8d..5544925 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -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);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index f65b79e..908f191 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -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);
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index cfc069c..b1f009c 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -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);
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 3f5dc7a..7526894 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -216,6 +216,7 @@
#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