diff options
-rw-r--r-- | net/wireless/nl80211.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 68c51022e9dd..7285bdc4e598 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -156,6 +156,30 @@ static inline void *nl80211hdr_put(struct sk_buff *skb, u32 pid, u32 seq, | |||
156 | return genlmsg_put(skb, pid, seq, &nl80211_fam, flags, cmd); | 156 | return genlmsg_put(skb, pid, seq, &nl80211_fam, flags, cmd); |
157 | } | 157 | } |
158 | 158 | ||
159 | static int nl80211_msg_put_channel(struct sk_buff *msg, | ||
160 | struct ieee80211_channel *chan) | ||
161 | { | ||
162 | NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_FREQ, | ||
163 | chan->center_freq); | ||
164 | |||
165 | if (chan->flags & IEEE80211_CHAN_DISABLED) | ||
166 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_DISABLED); | ||
167 | if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) | ||
168 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN); | ||
169 | if (chan->flags & IEEE80211_CHAN_NO_IBSS) | ||
170 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS); | ||
171 | if (chan->flags & IEEE80211_CHAN_RADAR) | ||
172 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR); | ||
173 | |||
174 | NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, | ||
175 | DBM_TO_MBM(chan->max_power)); | ||
176 | |||
177 | return 0; | ||
178 | |||
179 | nla_put_failure: | ||
180 | return -ENOBUFS; | ||
181 | } | ||
182 | |||
159 | /* netlink command implementations */ | 183 | /* netlink command implementations */ |
160 | 184 | ||
161 | static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | 185 | static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, |
@@ -234,20 +258,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
234 | goto nla_put_failure; | 258 | goto nla_put_failure; |
235 | 259 | ||
236 | chan = &dev->wiphy.bands[band]->channels[i]; | 260 | chan = &dev->wiphy.bands[band]->channels[i]; |
237 | NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_FREQ, | 261 | |
238 | chan->center_freq); | 262 | if (nl80211_msg_put_channel(msg, chan)) |
239 | 263 | goto nla_put_failure; | |
240 | if (chan->flags & IEEE80211_CHAN_DISABLED) | ||
241 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_DISABLED); | ||
242 | if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) | ||
243 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN); | ||
244 | if (chan->flags & IEEE80211_CHAN_NO_IBSS) | ||
245 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS); | ||
246 | if (chan->flags & IEEE80211_CHAN_RADAR) | ||
247 | NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR); | ||
248 | |||
249 | NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, | ||
250 | DBM_TO_MBM(chan->max_power)); | ||
251 | 264 | ||
252 | nla_nest_end(msg, nl_freq); | 265 | nla_nest_end(msg, nl_freq); |
253 | } | 266 | } |