diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7285bdc4e598..85b5aa3c76f8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3491,6 +3491,60 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, | |||
3491 | nlmsg_free(msg); | 3491 | nlmsg_free(msg); |
3492 | } | 3492 | } |
3493 | 3493 | ||
3494 | void nl80211_send_beacon_hint_event(struct wiphy *wiphy, | ||
3495 | struct ieee80211_channel *channel_before, | ||
3496 | struct ieee80211_channel *channel_after) | ||
3497 | { | ||
3498 | struct sk_buff *msg; | ||
3499 | void *hdr; | ||
3500 | struct nlattr *nl_freq; | ||
3501 | |||
3502 | msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); | ||
3503 | if (!msg) | ||
3504 | return; | ||
3505 | |||
3506 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_BEACON_HINT); | ||
3507 | if (!hdr) { | ||
3508 | nlmsg_free(msg); | ||
3509 | return; | ||
3510 | } | ||
3511 | |||
3512 | /* | ||
3513 | * Since we are applying the beacon hint to a wiphy we know its | ||
3514 | * wiphy_idx is valid | ||
3515 | */ | ||
3516 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)); | ||
3517 | |||
3518 | /* Before */ | ||
3519 | nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE); | ||
3520 | if (!nl_freq) | ||
3521 | goto nla_put_failure; | ||
3522 | if (nl80211_msg_put_channel(msg, channel_before)) | ||
3523 | goto nla_put_failure; | ||
3524 | nla_nest_end(msg, nl_freq); | ||
3525 | |||
3526 | /* After */ | ||
3527 | nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER); | ||
3528 | if (!nl_freq) | ||
3529 | goto nla_put_failure; | ||
3530 | if (nl80211_msg_put_channel(msg, channel_after)) | ||
3531 | goto nla_put_failure; | ||
3532 | nla_nest_end(msg, nl_freq); | ||
3533 | |||
3534 | if (genlmsg_end(msg, hdr) < 0) { | ||
3535 | nlmsg_free(msg); | ||
3536 | return; | ||
3537 | } | ||
3538 | |||
3539 | genlmsg_multicast(msg, 0, nl80211_regulatory_mcgrp.id, GFP_ATOMIC); | ||
3540 | |||
3541 | return; | ||
3542 | |||
3543 | nla_put_failure: | ||
3544 | genlmsg_cancel(msg, hdr); | ||
3545 | nlmsg_free(msg); | ||
3546 | } | ||
3547 | |||
3494 | /* initialisation/exit functions */ | 3548 | /* initialisation/exit functions */ |
3495 | 3549 | ||
3496 | int nl80211_init(void) | 3550 | int nl80211_init(void) |