aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-14 04:34:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-03-27 20:12:53 -0400
commit8fdc621dc743b87879ccf0177969864b09388d9a (patch)
treec68d6b8cf2dc0ad95b8c88e77238dbd0df506fca
parentec30415f7935f0ff92f93a4ac87233ca3007a78a (diff)
nl80211: export supported commands
This makes nl80211 export the supported commands (command groups) per wiphy so userspace has an idea what it can do -- this will be required reading for userspace when we introduce auth/assoc /or/ connect for older hardware that cannot separate auth and assoc. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h6
-rw-r--r--net/wireless/nl80211.c27
2 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index f33aa08dd9b3..3700d927e245 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -349,6 +349,10 @@ enum nl80211_commands {
349 * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently 349 * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently
350 * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) 350 * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*)
351 * 351 *
352 * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies
353 * an array of command numbers (i.e. a mapping index to command number)
354 * that the driver for the given wiphy supports.
355 *
352 * @NL80211_ATTR_MAX: highest attribute number currently defined 356 * @NL80211_ATTR_MAX: highest attribute number currently defined
353 * @__NL80211_ATTR_AFTER_LAST: internal use 357 * @__NL80211_ATTR_AFTER_LAST: internal use
354 */ 358 */
@@ -426,6 +430,8 @@ enum nl80211_attrs {
426 NL80211_ATTR_REG_INITIATOR, 430 NL80211_ATTR_REG_INITIATOR,
427 NL80211_ATTR_REG_TYPE, 431 NL80211_ATTR_REG_TYPE,
428 432
433 NL80211_ATTR_SUPPORTED_COMMANDS,
434
429 /* add attributes here, update the policy in nl80211.c */ 435 /* add attributes here, update the policy in nl80211.c */
430 436
431 __NL80211_ATTR_AFTER_LAST, 437 __NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ab9d8f14e151..58ee1b1aff89 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -131,6 +131,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
131 struct nlattr *nl_freqs, *nl_freq; 131 struct nlattr *nl_freqs, *nl_freq;
132 struct nlattr *nl_rates, *nl_rate; 132 struct nlattr *nl_rates, *nl_rate;
133 struct nlattr *nl_modes; 133 struct nlattr *nl_modes;
134 struct nlattr *nl_cmds;
134 enum ieee80211_band band; 135 enum ieee80211_band band;
135 struct ieee80211_channel *chan; 136 struct ieee80211_channel *chan;
136 struct ieee80211_rate *rate; 137 struct ieee80211_rate *rate;
@@ -242,6 +243,32 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
242 } 243 }
243 nla_nest_end(msg, nl_bands); 244 nla_nest_end(msg, nl_bands);
244 245
246 nl_cmds = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_COMMANDS);
247 if (!nl_cmds)
248 goto nla_put_failure;
249
250 i = 0;
251#define CMD(op, n) \
252 do { \
253 if (dev->ops->op) { \
254 i++; \
255 NLA_PUT_U32(msg, i, NL80211_CMD_ ## n); \
256 } \
257 } while (0)
258
259 CMD(add_virtual_intf, NEW_INTERFACE);
260 CMD(change_virtual_intf, SET_INTERFACE);
261 CMD(add_key, NEW_KEY);
262 CMD(add_beacon, NEW_BEACON);
263 CMD(add_station, NEW_STATION);
264 CMD(add_mpath, NEW_MPATH);
265 CMD(set_mesh_params, SET_MESH_PARAMS);
266 CMD(change_bss, SET_BSS);
267 CMD(set_mgmt_extra_ie, SET_MGMT_EXTRA_IE);
268
269#undef CMD
270 nla_nest_end(msg, nl_cmds);
271
245 return genlmsg_end(msg, hdr); 272 return genlmsg_end(msg, hdr);
246 273
247 nla_put_failure: 274 nla_put_failure: