aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/nl80211.h24
-rw-r--r--include/net/cfg80211.h7
-rw-r--r--net/wireless/nl80211.c29
3 files changed, 60 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8ad70dcac3f9..227ee9a0ff1a 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -161,6 +161,9 @@
161 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface 161 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
162 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, 162 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. 163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
164 * Following attributes are provided for drivers that generate full Beacon
165 * and Probe Response frames internally: %NL80211_ATTR_SSID,
166 * %NL80211_ATTR_HIDDEN_SSID.
164 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 167 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
165 * parameters are like for %NL80211_CMD_SET_BEACON. 168 * parameters are like for %NL80211_CMD_SET_BEACON.
166 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it 169 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -1019,6 +1022,10 @@ enum nl80211_commands {
1019 * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but 1022 * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but
1020 * without the length restriction (at most %NL80211_MAX_SUPP_RATES). 1023 * without the length restriction (at most %NL80211_MAX_SUPP_RATES).
1021 * 1024 *
1025 * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon
1026 * and Probe Response (when response to wildcard Probe Request); see
1027 * &enum nl80211_hidden_ssid, represented as a u32
1028 *
1022 * @NL80211_ATTR_MAX: highest attribute number currently defined 1029 * @NL80211_ATTR_MAX: highest attribute number currently defined
1023 * @__NL80211_ATTR_AFTER_LAST: internal use 1030 * @__NL80211_ATTR_AFTER_LAST: internal use
1024 */ 1031 */
@@ -1224,6 +1231,8 @@ enum nl80211_attrs {
1224 1231
1225 NL80211_ATTR_SCAN_SUPP_RATES, 1232 NL80211_ATTR_SCAN_SUPP_RATES,
1226 1233
1234 NL80211_ATTR_HIDDEN_SSID,
1235
1227 /* add attributes here, update the policy in nl80211.c */ 1236 /* add attributes here, update the policy in nl80211.c */
1228 1237
1229 __NL80211_ATTR_AFTER_LAST, 1238 __NL80211_ATTR_AFTER_LAST,
@@ -2430,4 +2439,19 @@ enum nl80211_rekey_data {
2430 MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 2439 MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
2431}; 2440};
2432 2441
2442/**
2443 * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
2444 * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in
2445 * Beacon frames)
2446 * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element
2447 * in Beacon frames
2448 * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID
2449 * element in Beacon frames but zero out each byte in the SSID
2450 */
2451enum nl80211_hidden_ssid {
2452 NL80211_HIDDEN_SSID_NOT_IN_USE,
2453 NL80211_HIDDEN_SSID_ZERO_LEN,
2454 NL80211_HIDDEN_SSID_ZERO_CONTENTS
2455};
2456
2433#endif /* __LINUX_NL80211_H */ 2457#endif /* __LINUX_NL80211_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index de140d428118..9ee93e7f0e31 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -346,11 +346,18 @@ struct survey_info {
346 * @dtim_period: DTIM period or zero if not changed 346 * @dtim_period: DTIM period or zero if not changed
347 * @head_len: length of @head 347 * @head_len: length of @head
348 * @tail_len: length of @tail 348 * @tail_len: length of @tail
349 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
350 * user space)
351 * @ssid_len: length of @ssid
352 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
349 */ 353 */
350struct beacon_parameters { 354struct beacon_parameters {
351 u8 *head, *tail; 355 u8 *head, *tail;
352 int interval, dtim_period; 356 int interval, dtim_period;
353 int head_len, tail_len; 357 int head_len, tail_len;
358 const u8 *ssid;
359 size_t ssid_len;
360 enum nl80211_hidden_ssid hidden_ssid;
354}; 361};
355 362
356/** 363/**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 080fd470fdec..fbb63d3ddc78 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -178,6 +178,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
178 [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 }, 178 [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 },
179 [NL80211_ATTR_REKEY_DATA] = { .type = NLA_NESTED }, 179 [NL80211_ATTR_REKEY_DATA] = { .type = NLA_NESTED },
180 [NL80211_ATTR_SCAN_SUPP_RATES] = { .type = NLA_NESTED }, 180 [NL80211_ATTR_SCAN_SUPP_RATES] = { .type = NLA_NESTED },
181 [NL80211_ATTR_HIDDEN_SSID] = { .type = NLA_U32 },
181}; 182};
182 183
183/* policy for the key attributes */ 184/* policy for the key attributes */
@@ -2010,6 +2011,34 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)
2010 if (err) 2011 if (err)
2011 return err; 2012 return err;
2012 2013
2014 /*
2015 * In theory, some of these attributes could be required for
2016 * NEW_BEACON, but since they were not used when the command was
2017 * originally added, keep them optional for old user space
2018 * programs to work with drivers that do not need the additional
2019 * information.
2020 */
2021 if (info->attrs[NL80211_ATTR_SSID]) {
2022 params.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);
2023 params.ssid_len =
2024 nla_len(info->attrs[NL80211_ATTR_SSID]);
2025 if (params.ssid_len == 0 ||
2026 params.ssid_len > IEEE80211_MAX_SSID_LEN)
2027 return -EINVAL;
2028 }
2029
2030 if (info->attrs[NL80211_ATTR_HIDDEN_SSID]) {
2031 params.hidden_ssid = nla_get_u32(
2032 info->attrs[NL80211_ATTR_HIDDEN_SSID]);
2033 if (params.hidden_ssid !=
2034 NL80211_HIDDEN_SSID_NOT_IN_USE &&
2035 params.hidden_ssid !=
2036 NL80211_HIDDEN_SSID_ZERO_LEN &&
2037 params.hidden_ssid !=
2038 NL80211_HIDDEN_SSID_ZERO_CONTENTS)
2039 return -EINVAL;
2040 }
2041
2013 call = rdev->ops->add_beacon; 2042 call = rdev->ops->add_beacon;
2014 break; 2043 break;
2015 case NL80211_CMD_SET_BEACON: 2044 case NL80211_CMD_SET_BEACON: