aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-18 17:54:36 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 10:35:43 -0500
commitcdc89b97bf23ae3a7869804b6dc13be011ec8f4c (patch)
tree6296fa56d6a553c5c14c893b3681ea2b1359e7b3
parent3713b4e364effef4b170c97d54528b1cdb16aa6b (diff)
nl80211: conditionally add back radar information
If userspace is updated to deal with large split wiphy information dumps, add back the radar information that could otherwise push the data over the limit of the netlink dump messages. Cc: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/nl80211.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f187a920ec71..7701538a0882 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -540,7 +540,8 @@ static inline void *nl80211hdr_put(struct sk_buff *skb, u32 portid, u32 seq,
540} 540}
541 541
542static int nl80211_msg_put_channel(struct sk_buff *msg, 542static int nl80211_msg_put_channel(struct sk_buff *msg,
543 struct ieee80211_channel *chan) 543 struct ieee80211_channel *chan,
544 bool large)
544{ 545{
545 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, 546 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ,
546 chan->center_freq)) 547 chan->center_freq))
@@ -555,9 +556,22 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
555 if ((chan->flags & IEEE80211_CHAN_NO_IBSS) && 556 if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
556 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS)) 557 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS))
557 goto nla_put_failure; 558 goto nla_put_failure;
558 if ((chan->flags & IEEE80211_CHAN_RADAR) && 559 if (chan->flags & IEEE80211_CHAN_RADAR) {
559 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) 560 if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
560 goto nla_put_failure; 561 goto nla_put_failure;
562 if (large) {
563 u32 time;
564
565 time = elapsed_jiffies_msecs(chan->dfs_state_entered);
566
567 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_STATE,
568 chan->dfs_state))
569 goto nla_put_failure;
570 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_TIME,
571 time))
572 goto nla_put_failure;
573 }
574 }
561 575
562 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 576 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
563 DBM_TO_MBM(chan->max_power))) 577 DBM_TO_MBM(chan->max_power)))
@@ -833,7 +847,8 @@ nla_put_failure:
833} 847}
834 848
835static int nl80211_put_iface_combinations(struct wiphy *wiphy, 849static int nl80211_put_iface_combinations(struct wiphy *wiphy,
836 struct sk_buff *msg) 850 struct sk_buff *msg,
851 bool large)
837{ 852{
838 struct nlattr *nl_combis; 853 struct nlattr *nl_combis;
839 int i, j; 854 int i, j;
@@ -882,6 +897,10 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy,
882 nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM, 897 nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM,
883 c->max_interfaces)) 898 c->max_interfaces))
884 goto nla_put_failure; 899 goto nla_put_failure;
900 if (large &&
901 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
902 c->radar_detect_widths))
903 goto nla_put_failure;
885 904
886 nla_nest_end(msg, nl_combi); 905 nla_nest_end(msg, nl_combi);
887 } 906 }
@@ -1231,7 +1250,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
1231 1250
1232 chan = &sband->channels[i]; 1251 chan = &sband->channels[i];
1233 1252
1234 if (nl80211_msg_put_channel(msg, chan)) 1253 if (nl80211_msg_put_channel(msg, chan,
1254 split))
1235 goto nla_put_failure; 1255 goto nla_put_failure;
1236 1256
1237 nla_nest_end(msg, nl_freq); 1257 nla_nest_end(msg, nl_freq);
@@ -1385,7 +1405,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
1385 dev->wiphy.software_iftypes)) 1405 dev->wiphy.software_iftypes))
1386 goto nla_put_failure; 1406 goto nla_put_failure;
1387 1407
1388 if (nl80211_put_iface_combinations(&dev->wiphy, msg)) 1408 if (nl80211_put_iface_combinations(&dev->wiphy, msg, split))
1389 goto nla_put_failure; 1409 goto nla_put_failure;
1390 1410
1391 (*split_start)++; 1411 (*split_start)++;
@@ -9377,7 +9397,7 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
9377 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE); 9397 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE);
9378 if (!nl_freq) 9398 if (!nl_freq)
9379 goto nla_put_failure; 9399 goto nla_put_failure;
9380 if (nl80211_msg_put_channel(msg, channel_before)) 9400 if (nl80211_msg_put_channel(msg, channel_before, false))
9381 goto nla_put_failure; 9401 goto nla_put_failure;
9382 nla_nest_end(msg, nl_freq); 9402 nla_nest_end(msg, nl_freq);
9383 9403
@@ -9385,7 +9405,7 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
9385 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER); 9405 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER);
9386 if (!nl_freq) 9406 if (!nl_freq)
9387 goto nla_put_failure; 9407 goto nla_put_failure;
9388 if (nl80211_msg_put_channel(msg, channel_after)) 9408 if (nl80211_msg_put_channel(msg, channel_after, false))
9389 goto nla_put_failure; 9409 goto nla_put_failure;
9390 nla_nest_end(msg, nl_freq); 9410 nla_nest_end(msg, nl_freq);
9391 9411