cfg80211: pass TDLS initiator in tdls_mgmt operations
authorArik Nemtsov <arik@wizery.com>
Wed, 11 Jun 2014 14:18:21 +0000 (17:18 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Jun 2014 12:24:55 +0000 (14:24 +0200)
The TDLS initiator is set once during link setup. If determines the
address ordering in the link identifier IE.

Fix dependent drivers - mwifiex and mac80211.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mwifiex/cfg80211.c
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/mac80211/ieee80211_i.h
net/mac80211/tdls.c
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/trace.h

index e95dec91a561e1172289dca0d6bbfb35b38add56..149d2e693bdd27e6869773b456656df52ca5553b 100644 (file)
@@ -2631,7 +2631,8 @@ static int
 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                           const u8 *peer, u8 action_code, u8 dialog_token,
                           u16 status_code, u32 peer_capability,
-                          const u8 *extra_ies, size_t extra_ies_len)
+                          bool initiator, const u8 *extra_ies,
+                          size_t extra_ies_len)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        int ret;
index 29cb4b2bee5a530b2aa34a6af106bfa5d8ab24bf..b9eeae3990cf3106b311797d41e2bc2cb3ad8c9b 100644 (file)
@@ -2500,7 +2500,7 @@ struct cfg80211_ops {
        int     (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
                             const u8 *peer, u8 action_code,  u8 dialog_token,
                             u16 status_code, u32 peer_capability,
-                            const u8 *buf, size_t len);
+                            bool initiator, const u8 *buf, size_t len);
        int     (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
                             const u8 *peer, enum nl80211_tdls_operation oper);
 
index be9519b52bb10edef5e5be12ddd3ff2065d706ac..f1db15b9c041ccad0f13a4206e73245b59e7c236 100644 (file)
@@ -1591,6 +1591,9 @@ enum nl80211_commands {
  *     creation then the new interface will be owned by the netlink socket
  *     that created it and will be destroyed when the socket is closed
  *
+ * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
+ *     the TDLS link initiator.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1931,6 +1934,8 @@ enum nl80211_attrs {
        NL80211_ATTR_CSA_C_OFFSETS_TX,
        NL80211_ATTR_MAX_CSA_COUNTERS,
 
+       NL80211_ATTR_TDLS_INITIATOR,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
index fc687d2a7518549510d5ee7955ec71a57e9adb27..75f79c168e90bc51aa9e87ec25552a972132d545 100644 (file)
@@ -1867,7 +1867,8 @@ int ieee80211_max_num_channels(struct ieee80211_local *local);
 int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                        const u8 *peer, u8 action_code, u8 dialog_token,
                        u16 status_code, u32 peer_capability,
-                       const u8 *extra_ies, size_t extra_ies_len);
+                       bool initiator, const u8 *extra_ies,
+                       size_t extra_ies_len);
 int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
                        const u8 *peer, enum nl80211_tdls_operation oper);
 
index cafcbde70018ac50791c02c6d4ea10dac5c914d4..0b3ca2ce7ea4abdac5f27a852ac5910f818a163f 100644 (file)
@@ -299,7 +299,8 @@ fail:
 int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                        const u8 *peer, u8 action_code, u8 dialog_token,
                        u16 status_code, u32 peer_capability,
-                       const u8 *extra_ies, size_t extra_ies_len)
+                       bool initiator, const u8 *extra_ies,
+                       size_t extra_ies_len)
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        struct ieee80211_local *local = sdata->local;
index ba4f1723c83ad2eb094c15a8794fedb7b6f7a404..8f46b8ffbcf607e458acf34f1a12a5ba24366eee 100644 (file)
@@ -337,6 +337,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
        [NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 },
        [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG },
        [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG },
+       [NL80211_ATTR_TDLS_INITIATOR] = { .type = NLA_FLAG },
        [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG },
        [NL80211_ATTR_PROBE_RESP] = { .type = NLA_BINARY,
                                      .len = IEEE80211_MAX_DATA_LEN },
@@ -7365,6 +7366,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
        u32 peer_capability = 0;
        u16 status_code;
        u8 *peer;
+       bool initiator;
 
        if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) ||
            !rdev->ops->tdls_mgmt)
@@ -7381,12 +7383,14 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
        action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]);
        status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
        dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]);
+       initiator = nla_get_flag(info->attrs[NL80211_ATTR_TDLS_INITIATOR]);
        if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY])
                peer_capability =
                        nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]);
 
        return rdev_tdls_mgmt(rdev, dev, peer, action_code,
                              dialog_token, status_code, peer_capability,
+                             initiator,
                              nla_data(info->attrs[NL80211_ATTR_IE]),
                              nla_len(info->attrs[NL80211_ATTR_IE]));
 }
index f552b0abbd70ceb4af86cedbc4c44413cb9aeea7..56c2240c30cefcc5a386b4da67a0e49686e47e4a 100644 (file)
@@ -751,15 +751,15 @@ static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
                                 struct net_device *dev, u8 *peer,
                                 u8 action_code, u8 dialog_token,
                                 u16 status_code, u32 peer_capability,
-                                const u8 *buf, size_t len)
+                                bool initiator, const u8 *buf, size_t len)
 {
        int ret;
        trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
                             dialog_token, status_code, peer_capability,
-                            buf, len);
+                            initiator, buf, len);
        ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
                                   dialog_token, status_code, peer_capability,
-                                  buf, len);
+                                  initiator, buf, len);
        trace_rdev_return_int(&rdev->wiphy, ret);
        return ret;
 }
index 174559aade577e52b4e86415eb2a65436e30a016..85474ee501ebbe95599f8ca3f14ba037be690c74 100644 (file)
@@ -1454,9 +1454,9 @@ TRACE_EVENT(rdev_tdls_mgmt,
        TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
                 u8 *peer, u8 action_code, u8 dialog_token,
                 u16 status_code, u32 peer_capability,
-                const u8 *buf, size_t len),
+                bool initiator, const u8 *buf, size_t len),
        TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code,
-               peer_capability, buf, len),
+               peer_capability, initiator, buf, len),
        TP_STRUCT__entry(
                WIPHY_ENTRY
                NETDEV_ENTRY
@@ -1465,6 +1465,7 @@ TRACE_EVENT(rdev_tdls_mgmt,
                __field(u8, dialog_token)
                __field(u16, status_code)
                __field(u32, peer_capability)
+               __field(bool, initiator)
                __dynamic_array(u8, buf, len)
        ),
        TP_fast_assign(
@@ -1475,13 +1476,16 @@ TRACE_EVENT(rdev_tdls_mgmt,
                __entry->dialog_token = dialog_token;
                __entry->status_code = status_code;
                __entry->peer_capability = peer_capability;
+               __entry->initiator = initiator;
                memcpy(__get_dynamic_array(buf), buf, len);
        ),
        TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, "
-                 "dialog_token: %u, status_code: %u, peer_capability: %u buf: %#.2x ",
+                 "dialog_token: %u, status_code: %u, peer_capability: %u "
+                 "initiator: %s buf: %#.2x ",
                  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer),
                  __entry->action_code, __entry->dialog_token,
                  __entry->status_code, __entry->peer_capability,
+                 BOOL_TO_STR(__entry->initiator),
                  ((u8 *)__get_dynamic_array(buf))[0])
 );