Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 341588
b: refs/heads/master
c: 3475b09
h: refs/heads/master
v: v3
  • Loading branch information
Jouni Malinen authored and Johannes Berg committed Nov 19, 2012
1 parent ed4a70e commit e72af89
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90b9e446fbb64630c72cab48c007d7081aec2533
refs/heads/master: 3475b0946bd2057497628790d4b4fce4bfdcc304
19 changes: 19 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3593,6 +3593,25 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
enum nl80211_channel_type type);

/*
* cfg80211_tdls_oper_request - request userspace to perform TDLS operation
* @dev: the device on which the operation is requested
* @peer: the MAC address of the peer device
* @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
* NL80211_TDLS_TEARDOWN)
* @reason_code: the reason code for teardown request
* @gfp: allocation flags
*
* This function is used to request userspace to perform TDLS operation that
* requires knowledge of keys, i.e., link setup or teardown when the AP
* connection uses encryption. This is optional mechanism for the driver to use
* if it can automatically determine when a TDLS link could be useful (e.g.,
* based on traffic and signal strength for a peer).
*/
void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
enum nl80211_tdls_operation oper,
u16 reason_code, gfp_t gfp);

/*
* cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
* @rate: given rate_info to calculate bitrate from
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/uapi/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@
* of PMKSA caching dandidates.
*
* @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
* In addition, this can be used as an event to request userspace to take
* actions on TDLS links (set up a new link or tear down an existing one).
* In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested
* operation, %NL80211_ATTR_MAC contains the peer MAC address, and
* %NL80211_ATTR_REASON_CODE the reason code to be used (only with
* %NL80211_TDLS_TEARDOWN).
* @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
*
* @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
Expand Down
47 changes: 47 additions & 0 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -9027,6 +9027,53 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
}
EXPORT_SYMBOL(cfg80211_report_obss_beacon);

void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
enum nl80211_tdls_operation oper,
u16 reason_code, gfp_t gfp)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct sk_buff *msg;
void *hdr;
int err;

trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper,
reason_code);

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
if (!msg)
return;

hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_TDLS_OPER);
if (!hdr) {
nlmsg_free(msg);
return;
}

if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
nla_put_u8(msg, NL80211_ATTR_TDLS_OPERATION, oper) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, peer) ||
(reason_code > 0 &&
nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason_code)))
goto nla_put_failure;

err = genlmsg_end(msg, hdr);
if (err < 0) {
nlmsg_free(msg);
return;
}

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
return;

nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg);
}
EXPORT_SYMBOL(cfg80211_tdls_oper_request);

static int nl80211_netlink_notify(struct notifier_block * nb,
unsigned long state,
void *_notify)
Expand Down
23 changes: 23 additions & 0 deletions trunk/net/wireless/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,29 @@ TRACE_EVENT(cfg80211_report_obss_beacon,
WIPHY_PR_ARG, __entry->freq, __entry->sig_dbm)
);

TRACE_EVENT(cfg80211_tdls_oper_request,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer,
enum nl80211_tdls_operation oper, u16 reason_code),
TP_ARGS(wiphy, netdev, peer, oper, reason_code),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
MAC_ENTRY(peer)
__field(enum nl80211_tdls_operation, oper)
__field(u16, reason_code)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
MAC_ASSIGN(peer, peer);
__entry->oper = oper;
__entry->reason_code = reason_code;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", oper: %d, reason_code %u",
WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->oper,
__entry->reason_code)
);

TRACE_EVENT(cfg80211_scan_done,
TP_PROTO(struct cfg80211_scan_request *request, bool aborted),
TP_ARGS(request, aborted),
Expand Down

0 comments on commit e72af89

Please sign in to comment.