aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
commitccc580571cf0799d0460a085a7632b77753f083e (patch)
tree018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/wireless/airo.c
parent0f5cabba49021d36e9f76bd97d7fa0f4a408063f (diff)
wext: Emit event stream entries correctly when compat.
Three major portions to this change: 1) Add IW_EV_COMPAT_LCP_LEN, IW_EV_COMPAT_POINT_OFF, and IW_EV_COMPAT_POINT_LEN helper defines. 2) Delete iw_stream_check_add_*(), they are unused. 3) Add iw_request_info argument to iwe_stream_add_*(), and use it to size the event and pointer lengths correctly depending upon whether IW_REQUEST_FLAG_COMPAT is set or not. 4) The mechanical transformations to the drivers and wireless stack bits to get the iw_request_info passed down into the routines modified in #3. Also, explicit references to IW_EV_LCP_LEN are replaced with iwe_stream_lcp_len(info). With a lot of help and bug fixes from Masakazu Mokuno. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index e30f8b79ea89..73d66a80c4a3 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -7156,6 +7156,7 @@ out:
7156 * format that the Wireless Tools will understand - Jean II 7156 * format that the Wireless Tools will understand - Jean II
7157 */ 7157 */
7158static inline char *airo_translate_scan(struct net_device *dev, 7158static inline char *airo_translate_scan(struct net_device *dev,
7159 struct iw_request_info *info,
7159 char *current_ev, 7160 char *current_ev,
7160 char *end_buf, 7161 char *end_buf,
7161 BSSListRid *bss) 7162 BSSListRid *bss)
@@ -7172,7 +7173,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7172 iwe.cmd = SIOCGIWAP; 7173 iwe.cmd = SIOCGIWAP;
7173 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 7174 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
7174 memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); 7175 memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN);
7175 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); 7176 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
7177 &iwe, IW_EV_ADDR_LEN);
7176 7178
7177 /* Other entries will be displayed in the order we give them */ 7179 /* Other entries will be displayed in the order we give them */
7178 7180
@@ -7182,7 +7184,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7182 iwe.u.data.length = 32; 7184 iwe.u.data.length = 32;
7183 iwe.cmd = SIOCGIWESSID; 7185 iwe.cmd = SIOCGIWESSID;
7184 iwe.u.data.flags = 1; 7186 iwe.u.data.flags = 1;
7185 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); 7187 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
7188 &iwe, bss->ssid);
7186 7189
7187 /* Add mode */ 7190 /* Add mode */
7188 iwe.cmd = SIOCGIWMODE; 7191 iwe.cmd = SIOCGIWMODE;
@@ -7192,7 +7195,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7192 iwe.u.mode = IW_MODE_MASTER; 7195 iwe.u.mode = IW_MODE_MASTER;
7193 else 7196 else
7194 iwe.u.mode = IW_MODE_ADHOC; 7197 iwe.u.mode = IW_MODE_ADHOC;
7195 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); 7198 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
7199 &iwe, IW_EV_UINT_LEN);
7196 } 7200 }
7197 7201
7198 /* Add frequency */ 7202 /* Add frequency */
@@ -7203,7 +7207,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7203 */ 7207 */
7204 iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; 7208 iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000;
7205 iwe.u.freq.e = 1; 7209 iwe.u.freq.e = 1;
7206 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); 7210 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
7211 &iwe, IW_EV_FREQ_LEN);
7207 7212
7208 dBm = le16_to_cpu(bss->dBm); 7213 dBm = le16_to_cpu(bss->dBm);
7209 7214
@@ -7223,7 +7228,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7223 | IW_QUAL_DBM; 7228 | IW_QUAL_DBM;
7224 } 7229 }
7225 iwe.u.qual.noise = ai->wstats.qual.noise; 7230 iwe.u.qual.noise = ai->wstats.qual.noise;
7226 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 7231 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
7232 &iwe, IW_EV_QUAL_LEN);
7227 7233
7228 /* Add encryption capability */ 7234 /* Add encryption capability */
7229 iwe.cmd = SIOCGIWENCODE; 7235 iwe.cmd = SIOCGIWENCODE;
@@ -7232,11 +7238,12 @@ static inline char *airo_translate_scan(struct net_device *dev,
7232 else 7238 else
7233 iwe.u.data.flags = IW_ENCODE_DISABLED; 7239 iwe.u.data.flags = IW_ENCODE_DISABLED;
7234 iwe.u.data.length = 0; 7240 iwe.u.data.length = 0;
7235 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); 7241 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
7242 &iwe, bss->ssid);
7236 7243
7237 /* Rate : stuffing multiple values in a single event require a bit 7244 /* Rate : stuffing multiple values in a single event require a bit
7238 * more of magic - Jean II */ 7245 * more of magic - Jean II */
7239 current_val = current_ev + IW_EV_LCP_LEN; 7246 current_val = current_ev + iwe_stream_lcp_len(info);
7240 7247
7241 iwe.cmd = SIOCGIWRATE; 7248 iwe.cmd = SIOCGIWRATE;
7242 /* Those two flags are ignored... */ 7249 /* Those two flags are ignored... */
@@ -7249,10 +7256,12 @@ static inline char *airo_translate_scan(struct net_device *dev,
7249 /* Bit rate given in 500 kb/s units (+ 0x80) */ 7256 /* Bit rate given in 500 kb/s units (+ 0x80) */
7250 iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); 7257 iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000);
7251 /* Add new value to event */ 7258 /* Add new value to event */
7252 current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); 7259 current_val = iwe_stream_add_value(info, current_ev,
7260 current_val, end_buf,
7261 &iwe, IW_EV_PARAM_LEN);
7253 } 7262 }
7254 /* Check if we added any event */ 7263 /* Check if we added any event */
7255 if((current_val - current_ev) > IW_EV_LCP_LEN) 7264 if ((current_val - current_ev) > iwe_stream_lcp_len(info))
7256 current_ev = current_val; 7265 current_ev = current_val;
7257 7266
7258 /* Beacon interval */ 7267 /* Beacon interval */
@@ -7261,7 +7270,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
7261 iwe.cmd = IWEVCUSTOM; 7270 iwe.cmd = IWEVCUSTOM;
7262 sprintf(buf, "bcn_int=%d", bss->beaconInterval); 7271 sprintf(buf, "bcn_int=%d", bss->beaconInterval);
7263 iwe.u.data.length = strlen(buf); 7272 iwe.u.data.length = strlen(buf);
7264 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); 7273 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
7274 &iwe, buf);
7265 kfree(buf); 7275 kfree(buf);
7266 } 7276 }
7267 7277
@@ -7295,8 +7305,10 @@ static inline char *airo_translate_scan(struct net_device *dev,
7295 iwe.cmd = IWEVGENIE; 7305 iwe.cmd = IWEVGENIE;
7296 iwe.u.data.length = min(info_element->len + 2, 7306 iwe.u.data.length = min(info_element->len + 2,
7297 MAX_WPA_IE_LEN); 7307 MAX_WPA_IE_LEN);
7298 current_ev = iwe_stream_add_point(current_ev, end_buf, 7308 current_ev = iwe_stream_add_point(
7299 &iwe, (char *) info_element); 7309 info, current_ev,
7310 end_buf, &iwe,
7311 (char *) info_element);
7300 } 7312 }
7301 break; 7313 break;
7302 7314
@@ -7304,8 +7316,9 @@ static inline char *airo_translate_scan(struct net_device *dev,
7304 iwe.cmd = IWEVGENIE; 7316 iwe.cmd = IWEVGENIE;
7305 iwe.u.data.length = min(info_element->len + 2, 7317 iwe.u.data.length = min(info_element->len + 2,
7306 MAX_WPA_IE_LEN); 7318 MAX_WPA_IE_LEN);
7307 current_ev = iwe_stream_add_point(current_ev, end_buf, 7319 current_ev = iwe_stream_add_point(
7308 &iwe, (char *) info_element); 7320 info, current_ev, end_buf,
7321 &iwe, (char *) info_element);
7309 break; 7322 break;
7310 7323
7311 default: 7324 default:
@@ -7344,7 +7357,7 @@ static int airo_get_scan(struct net_device *dev,
7344 7357
7345 list_for_each_entry (net, &ai->network_list, list) { 7358 list_for_each_entry (net, &ai->network_list, list) {
7346 /* Translate to WE format this entry */ 7359 /* Translate to WE format this entry */
7347 current_ev = airo_translate_scan(dev, current_ev, 7360 current_ev = airo_translate_scan(dev, info, current_ev,
7348 extra + dwrq->length, 7361 extra + dwrq->length,
7349 &net->bss); 7362 &net->bss);
7350 7363