]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
nl80211: export supported commands
authorJohannes Berg <johannes@sipsolutions.net>
Sat, 14 Mar 2009 08:34:01 +0000 (09:34 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Mar 2009 00:12:53 +0000 (20:12 -0400)
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>
include/linux/nl80211.h
net/wireless/nl80211.c

index f33aa08dd9b37d6a7b8e1414ec99022ada1673a1..3700d927e2451206682c996f7c80085cd824a510 100644 (file)
@@ -349,6 +349,10 @@ enum nl80211_commands {
  * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently
  *     set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*)
  *
+ * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies
+ *     an array of command numbers (i.e. a mapping index to command number)
+ *     that the driver for the given wiphy supports.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -426,6 +430,8 @@ enum nl80211_attrs {
        NL80211_ATTR_REG_INITIATOR,
        NL80211_ATTR_REG_TYPE,
 
+       NL80211_ATTR_SUPPORTED_COMMANDS,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
index ab9d8f14e15103a4d762c08fdd132e1565c15df3..58ee1b1aff89bc4721e3266a263bab38de4f310c 100644 (file)
@@ -131,6 +131,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
        struct nlattr *nl_freqs, *nl_freq;
        struct nlattr *nl_rates, *nl_rate;
        struct nlattr *nl_modes;
+       struct nlattr *nl_cmds;
        enum ieee80211_band band;
        struct ieee80211_channel *chan;
        struct ieee80211_rate *rate;
@@ -242,6 +243,32 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
        }
        nla_nest_end(msg, nl_bands);
 
+       nl_cmds = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_COMMANDS);
+       if (!nl_cmds)
+               goto nla_put_failure;
+
+       i = 0;
+#define CMD(op, n)                                             \
+        do {                                                   \
+               if (dev->ops->op) {                             \
+                       i++;                                    \
+                       NLA_PUT_U32(msg, i, NL80211_CMD_ ## n); \
+               }                                               \
+       } while (0)
+
+       CMD(add_virtual_intf, NEW_INTERFACE);
+       CMD(change_virtual_intf, SET_INTERFACE);
+       CMD(add_key, NEW_KEY);
+       CMD(add_beacon, NEW_BEACON);
+       CMD(add_station, NEW_STATION);
+       CMD(add_mpath, NEW_MPATH);
+       CMD(set_mesh_params, SET_MESH_PARAMS);
+       CMD(change_bss, SET_BSS);
+       CMD(set_mgmt_extra_ie, SET_MGMT_EXTRA_IE);
+
+#undef CMD
+       nla_nest_end(msg, nl_cmds);
+
        return genlmsg_end(msg, hdr);
 
  nla_put_failure: