diff options
author | Arik Nemtsov <arik@wizery.com> | 2014-06-11 10:18:21 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-06-23 08:24:55 -0400 |
commit | 31fa97c5defca3895dc6c823096d7ba59df76125 (patch) | |
tree | efaa910e95103d25b3228fd96ed2bd71ac473d86 | |
parent | 17e6a59a365ac993c18f762d3a259635957f1026 (diff) |
cfg80211: pass TDLS initiator in tdls_mgmt operations
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>
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 3 | ||||
-rw-r--r-- | include/net/cfg80211.h | 2 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 5 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
-rw-r--r-- | net/mac80211/tdls.c | 3 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 4 | ||||
-rw-r--r-- | net/wireless/rdev-ops.h | 6 | ||||
-rw-r--r-- | net/wireless/trace.h | 10 |
8 files changed, 26 insertions, 10 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e95dec91a561..149d2e693bdd 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -2631,7 +2631,8 @@ static int | |||
2631 | mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | 2631 | mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
2632 | const u8 *peer, u8 action_code, u8 dialog_token, | 2632 | const u8 *peer, u8 action_code, u8 dialog_token, |
2633 | u16 status_code, u32 peer_capability, | 2633 | u16 status_code, u32 peer_capability, |
2634 | const u8 *extra_ies, size_t extra_ies_len) | 2634 | bool initiator, const u8 *extra_ies, |
2635 | size_t extra_ies_len) | ||
2635 | { | 2636 | { |
2636 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 2637 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
2637 | int ret; | 2638 | int ret; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 29cb4b2bee5a..b9eeae3990cf 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2500,7 +2500,7 @@ struct cfg80211_ops { | |||
2500 | int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, | 2500 | int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, |
2501 | const u8 *peer, u8 action_code, u8 dialog_token, | 2501 | const u8 *peer, u8 action_code, u8 dialog_token, |
2502 | u16 status_code, u32 peer_capability, | 2502 | u16 status_code, u32 peer_capability, |
2503 | const u8 *buf, size_t len); | 2503 | bool initiator, const u8 *buf, size_t len); |
2504 | int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, | 2504 | int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, |
2505 | const u8 *peer, enum nl80211_tdls_operation oper); | 2505 | const u8 *peer, enum nl80211_tdls_operation oper); |
2506 | 2506 | ||
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index be9519b52bb1..f1db15b9c041 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -1591,6 +1591,9 @@ enum nl80211_commands { | |||
1591 | * creation then the new interface will be owned by the netlink socket | 1591 | * creation then the new interface will be owned by the netlink socket |
1592 | * that created it and will be destroyed when the socket is closed | 1592 | * that created it and will be destroyed when the socket is closed |
1593 | * | 1593 | * |
1594 | * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is | ||
1595 | * the TDLS link initiator. | ||
1596 | * | ||
1594 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1597 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1595 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1598 | * @__NL80211_ATTR_AFTER_LAST: internal use |
1596 | */ | 1599 | */ |
@@ -1931,6 +1934,8 @@ enum nl80211_attrs { | |||
1931 | NL80211_ATTR_CSA_C_OFFSETS_TX, | 1934 | NL80211_ATTR_CSA_C_OFFSETS_TX, |
1932 | NL80211_ATTR_MAX_CSA_COUNTERS, | 1935 | NL80211_ATTR_MAX_CSA_COUNTERS, |
1933 | 1936 | ||
1937 | NL80211_ATTR_TDLS_INITIATOR, | ||
1938 | |||
1934 | /* add attributes here, update the policy in nl80211.c */ | 1939 | /* add attributes here, update the policy in nl80211.c */ |
1935 | 1940 | ||
1936 | __NL80211_ATTR_AFTER_LAST, | 1941 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index fc687d2a7518..75f79c168e90 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1867,7 +1867,8 @@ int ieee80211_max_num_channels(struct ieee80211_local *local); | |||
1867 | int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | 1867 | int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
1868 | const u8 *peer, u8 action_code, u8 dialog_token, | 1868 | const u8 *peer, u8 action_code, u8 dialog_token, |
1869 | u16 status_code, u32 peer_capability, | 1869 | u16 status_code, u32 peer_capability, |
1870 | const u8 *extra_ies, size_t extra_ies_len); | 1870 | bool initiator, const u8 *extra_ies, |
1871 | size_t extra_ies_len); | ||
1871 | int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, | 1872 | int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
1872 | const u8 *peer, enum nl80211_tdls_operation oper); | 1873 | const u8 *peer, enum nl80211_tdls_operation oper); |
1873 | 1874 | ||
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index cafcbde70018..0b3ca2ce7ea4 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c | |||
@@ -299,7 +299,8 @@ fail: | |||
299 | int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, | 299 | int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
300 | const u8 *peer, u8 action_code, u8 dialog_token, | 300 | const u8 *peer, u8 action_code, u8 dialog_token, |
301 | u16 status_code, u32 peer_capability, | 301 | u16 status_code, u32 peer_capability, |
302 | const u8 *extra_ies, size_t extra_ies_len) | 302 | bool initiator, const u8 *extra_ies, |
303 | size_t extra_ies_len) | ||
303 | { | 304 | { |
304 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 305 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
305 | struct ieee80211_local *local = sdata->local; | 306 | struct ieee80211_local *local = sdata->local; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ba4f1723c83a..8f46b8ffbcf6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -337,6 +337,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
337 | [NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 }, | 337 | [NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 }, |
338 | [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG }, | 338 | [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG }, |
339 | [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG }, | 339 | [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG }, |
340 | [NL80211_ATTR_TDLS_INITIATOR] = { .type = NLA_FLAG }, | ||
340 | [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG }, | 341 | [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG }, |
341 | [NL80211_ATTR_PROBE_RESP] = { .type = NLA_BINARY, | 342 | [NL80211_ATTR_PROBE_RESP] = { .type = NLA_BINARY, |
342 | .len = IEEE80211_MAX_DATA_LEN }, | 343 | .len = IEEE80211_MAX_DATA_LEN }, |
@@ -7365,6 +7366,7 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7365 | u32 peer_capability = 0; | 7366 | u32 peer_capability = 0; |
7366 | u16 status_code; | 7367 | u16 status_code; |
7367 | u8 *peer; | 7368 | u8 *peer; |
7369 | bool initiator; | ||
7368 | 7370 | ||
7369 | if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || | 7371 | if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || |
7370 | !rdev->ops->tdls_mgmt) | 7372 | !rdev->ops->tdls_mgmt) |
@@ -7381,12 +7383,14 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7381 | action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]); | 7383 | action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]); |
7382 | status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); | 7384 | status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); |
7383 | dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]); | 7385 | dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]); |
7386 | initiator = nla_get_flag(info->attrs[NL80211_ATTR_TDLS_INITIATOR]); | ||
7384 | if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]) | 7387 | if (info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]) |
7385 | peer_capability = | 7388 | peer_capability = |
7386 | nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]); | 7389 | nla_get_u32(info->attrs[NL80211_ATTR_TDLS_PEER_CAPABILITY]); |
7387 | 7390 | ||
7388 | return rdev_tdls_mgmt(rdev, dev, peer, action_code, | 7391 | return rdev_tdls_mgmt(rdev, dev, peer, action_code, |
7389 | dialog_token, status_code, peer_capability, | 7392 | dialog_token, status_code, peer_capability, |
7393 | initiator, | ||
7390 | nla_data(info->attrs[NL80211_ATTR_IE]), | 7394 | nla_data(info->attrs[NL80211_ATTR_IE]), |
7391 | nla_len(info->attrs[NL80211_ATTR_IE])); | 7395 | nla_len(info->attrs[NL80211_ATTR_IE])); |
7392 | } | 7396 | } |
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index f552b0abbd70..56c2240c30ce 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -751,15 +751,15 @@ static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev, | |||
751 | struct net_device *dev, u8 *peer, | 751 | struct net_device *dev, u8 *peer, |
752 | u8 action_code, u8 dialog_token, | 752 | u8 action_code, u8 dialog_token, |
753 | u16 status_code, u32 peer_capability, | 753 | u16 status_code, u32 peer_capability, |
754 | const u8 *buf, size_t len) | 754 | bool initiator, const u8 *buf, size_t len) |
755 | { | 755 | { |
756 | int ret; | 756 | int ret; |
757 | trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code, | 757 | trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code, |
758 | dialog_token, status_code, peer_capability, | 758 | dialog_token, status_code, peer_capability, |
759 | buf, len); | 759 | initiator, buf, len); |
760 | ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code, | 760 | ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code, |
761 | dialog_token, status_code, peer_capability, | 761 | dialog_token, status_code, peer_capability, |
762 | buf, len); | 762 | initiator, buf, len); |
763 | trace_rdev_return_int(&rdev->wiphy, ret); | 763 | trace_rdev_return_int(&rdev->wiphy, ret); |
764 | return ret; | 764 | return ret; |
765 | } | 765 | } |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 174559aade57..85474ee501eb 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -1454,9 +1454,9 @@ TRACE_EVENT(rdev_tdls_mgmt, | |||
1454 | TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, | 1454 | TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, |
1455 | u8 *peer, u8 action_code, u8 dialog_token, | 1455 | u8 *peer, u8 action_code, u8 dialog_token, |
1456 | u16 status_code, u32 peer_capability, | 1456 | u16 status_code, u32 peer_capability, |
1457 | const u8 *buf, size_t len), | 1457 | bool initiator, const u8 *buf, size_t len), |
1458 | TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code, | 1458 | TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code, |
1459 | peer_capability, buf, len), | 1459 | peer_capability, initiator, buf, len), |
1460 | TP_STRUCT__entry( | 1460 | TP_STRUCT__entry( |
1461 | WIPHY_ENTRY | 1461 | WIPHY_ENTRY |
1462 | NETDEV_ENTRY | 1462 | NETDEV_ENTRY |
@@ -1465,6 +1465,7 @@ TRACE_EVENT(rdev_tdls_mgmt, | |||
1465 | __field(u8, dialog_token) | 1465 | __field(u8, dialog_token) |
1466 | __field(u16, status_code) | 1466 | __field(u16, status_code) |
1467 | __field(u32, peer_capability) | 1467 | __field(u32, peer_capability) |
1468 | __field(bool, initiator) | ||
1468 | __dynamic_array(u8, buf, len) | 1469 | __dynamic_array(u8, buf, len) |
1469 | ), | 1470 | ), |
1470 | TP_fast_assign( | 1471 | TP_fast_assign( |
@@ -1475,13 +1476,16 @@ TRACE_EVENT(rdev_tdls_mgmt, | |||
1475 | __entry->dialog_token = dialog_token; | 1476 | __entry->dialog_token = dialog_token; |
1476 | __entry->status_code = status_code; | 1477 | __entry->status_code = status_code; |
1477 | __entry->peer_capability = peer_capability; | 1478 | __entry->peer_capability = peer_capability; |
1479 | __entry->initiator = initiator; | ||
1478 | memcpy(__get_dynamic_array(buf), buf, len); | 1480 | memcpy(__get_dynamic_array(buf), buf, len); |
1479 | ), | 1481 | ), |
1480 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, " | 1482 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, " |
1481 | "dialog_token: %u, status_code: %u, peer_capability: %u buf: %#.2x ", | 1483 | "dialog_token: %u, status_code: %u, peer_capability: %u " |
1484 | "initiator: %s buf: %#.2x ", | ||
1482 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), | 1485 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), |
1483 | __entry->action_code, __entry->dialog_token, | 1486 | __entry->action_code, __entry->dialog_token, |
1484 | __entry->status_code, __entry->peer_capability, | 1487 | __entry->status_code, __entry->peer_capability, |
1488 | BOOL_TO_STR(__entry->initiator), | ||
1485 | ((u8 *)__get_dynamic_array(buf))[0]) | 1489 | ((u8 *)__get_dynamic_array(buf))[0]) |
1486 | ); | 1490 | ); |
1487 | 1491 | ||