diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-03-15 13:25:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-26 15:07:25 -0400 |
commit | 66266b3ab4871958ed6a1e43f502cadaf3becfc8 (patch) | |
tree | 202d9da52387cd9ea0997d79c9e83bed15a9fab1 /net | |
parent | e92109be7a6a04808c3ed586475ba1e5ea56ecbd (diff) |
cfg80211: allow CFG80211_SIGNAL_TYPE_UNSPEC in station_info
The station_info struct had demanded dBm signal values, but the
cfg80211 wireless extensions implementation was also accepting
"unspecified" (i.e. RSSI) unit values while the nl80211 code was
completely unaware of them. Resolve this by formally allowing the
"unspecified" units while making nl80211 ignore them.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/nl80211.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4c1eb9472ddb..e49da2797022 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2386,7 +2386,9 @@ nla_put_failure: | |||
2386 | } | 2386 | } |
2387 | 2387 | ||
2388 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | 2388 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, |
2389 | int flags, struct net_device *dev, | 2389 | int flags, |
2390 | struct cfg80211_registered_device *rdev, | ||
2391 | struct net_device *dev, | ||
2390 | const u8 *mac_addr, struct station_info *sinfo) | 2392 | const u8 *mac_addr, struct station_info *sinfo) |
2391 | { | 2393 | { |
2392 | void *hdr; | 2394 | void *hdr; |
@@ -2425,12 +2427,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2425 | if (sinfo->filled & STATION_INFO_PLINK_STATE) | 2427 | if (sinfo->filled & STATION_INFO_PLINK_STATE) |
2426 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, | 2428 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, |
2427 | sinfo->plink_state); | 2429 | sinfo->plink_state); |
2428 | if (sinfo->filled & STATION_INFO_SIGNAL) | 2430 | switch (rdev->wiphy.signal_type) { |
2429 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, | 2431 | case CFG80211_SIGNAL_TYPE_MBM: |
2430 | sinfo->signal); | 2432 | if (sinfo->filled & STATION_INFO_SIGNAL) |
2431 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) | 2433 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, |
2432 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | 2434 | sinfo->signal); |
2433 | sinfo->signal_avg); | 2435 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) |
2436 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | ||
2437 | sinfo->signal_avg); | ||
2438 | break; | ||
2439 | default: | ||
2440 | break; | ||
2441 | } | ||
2434 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { | 2442 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { |
2435 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, | 2443 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, |
2436 | NL80211_STA_INFO_TX_BITRATE)) | 2444 | NL80211_STA_INFO_TX_BITRATE)) |
@@ -2523,7 +2531,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
2523 | if (nl80211_send_station(skb, | 2531 | if (nl80211_send_station(skb, |
2524 | NETLINK_CB(cb->skb).pid, | 2532 | NETLINK_CB(cb->skb).pid, |
2525 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 2533 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
2526 | netdev, mac_addr, | 2534 | dev, netdev, mac_addr, |
2527 | &sinfo) < 0) | 2535 | &sinfo) < 0) |
2528 | goto out; | 2536 | goto out; |
2529 | 2537 | ||
@@ -2568,7 +2576,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | |||
2568 | return -ENOMEM; | 2576 | return -ENOMEM; |
2569 | 2577 | ||
2570 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, | 2578 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, |
2571 | dev, mac_addr, &sinfo) < 0) { | 2579 | rdev, dev, mac_addr, &sinfo) < 0) { |
2572 | nlmsg_free(msg); | 2580 | nlmsg_free(msg); |
2573 | return -ENOBUFS; | 2581 | return -ENOBUFS; |
2574 | } | 2582 | } |
@@ -7596,7 +7604,8 @@ void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | |||
7596 | if (!msg) | 7604 | if (!msg) |
7597 | return; | 7605 | return; |
7598 | 7606 | ||
7599 | if (nl80211_send_station(msg, 0, 0, 0, dev, mac_addr, sinfo) < 0) { | 7607 | if (nl80211_send_station(msg, 0, 0, 0, |
7608 | rdev, dev, mac_addr, sinfo) < 0) { | ||
7600 | nlmsg_free(msg); | 7609 | nlmsg_free(msg); |
7601 | return; | 7610 | return; |
7602 | } | 7611 | } |