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>
This commit is contained in:
@@ -4046,6 +4046,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
|
||||
* format that the Wireless Tools will understand - Jean II
|
||||
* Return message length or -errno for fatal errors */
|
||||
static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
char *current_ev,
|
||||
char *end_buf,
|
||||
union hermes_scan_info *bss,
|
||||
@@ -4062,7 +4063,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
iwe.cmd = SIOCGIWAP;
|
||||
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
|
||||
memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN);
|
||||
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
|
||||
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
|
||||
&iwe, IW_EV_ADDR_LEN);
|
||||
|
||||
/* Other entries will be displayed in the order we give them */
|
||||
|
||||
@@ -4072,7 +4074,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
iwe.u.data.length = 32;
|
||||
iwe.cmd = SIOCGIWESSID;
|
||||
iwe.u.data.flags = 1;
|
||||
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid);
|
||||
current_ev = iwe_stream_add_point(info, current_ev, end_buf,
|
||||
&iwe, bss->a.essid);
|
||||
|
||||
/* Add mode */
|
||||
iwe.cmd = SIOCGIWMODE;
|
||||
@@ -4082,7 +4085,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
iwe.u.mode = IW_MODE_MASTER;
|
||||
else
|
||||
iwe.u.mode = IW_MODE_ADHOC;
|
||||
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
|
||||
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
|
||||
&iwe, IW_EV_UINT_LEN);
|
||||
}
|
||||
|
||||
channel = bss->s.channel;
|
||||
@@ -4091,7 +4095,7 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
iwe.cmd = SIOCGIWFREQ;
|
||||
iwe.u.freq.m = channel_frequency[channel-1] * 100000;
|
||||
iwe.u.freq.e = 1;
|
||||
current_ev = iwe_stream_add_event(current_ev, end_buf,
|
||||
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
|
||||
&iwe, IW_EV_FREQ_LEN);
|
||||
}
|
||||
|
||||
@@ -4106,7 +4110,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
|
||||
else
|
||||
iwe.u.qual.qual = 0;
|
||||
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
|
||||
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
|
||||
&iwe, IW_EV_QUAL_LEN);
|
||||
|
||||
/* Add encryption capability */
|
||||
iwe.cmd = SIOCGIWENCODE;
|
||||
@@ -4115,7 +4120,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
else
|
||||
iwe.u.data.flags = IW_ENCODE_DISABLED;
|
||||
iwe.u.data.length = 0;
|
||||
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid);
|
||||
current_ev = iwe_stream_add_point(info, current_ev, end_buf,
|
||||
&iwe, bss->a.essid);
|
||||
|
||||
/* Add EXTRA: Age to display seconds since last beacon/probe response
|
||||
* for given network. */
|
||||
@@ -4126,11 +4132,12 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
jiffies_to_msecs(jiffies - last_scanned));
|
||||
iwe.u.data.length = p - custom;
|
||||
if (iwe.u.data.length)
|
||||
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom);
|
||||
current_ev = iwe_stream_add_point(info, current_ev, end_buf,
|
||||
&iwe, custom);
|
||||
|
||||
/* Bit rate is not available in Lucent/Agere firmwares */
|
||||
if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
|
||||
char *current_val = current_ev + IW_EV_LCP_LEN;
|
||||
char *current_val = current_ev + iwe_stream_lcp_len(info);
|
||||
int i;
|
||||
int step;
|
||||
|
||||
@@ -4149,12 +4156,13 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
|
||||
break;
|
||||
/* Bit rate given in 500 kb/s units (+ 0x80) */
|
||||
iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000);
|
||||
current_val = iwe_stream_add_value(current_ev, current_val,
|
||||
current_val = iwe_stream_add_value(info, current_ev,
|
||||
current_val,
|
||||
end_buf, &iwe,
|
||||
IW_EV_PARAM_LEN);
|
||||
}
|
||||
/* Check if we added any event */
|
||||
if ((current_val - current_ev) > IW_EV_LCP_LEN)
|
||||
if ((current_val - current_ev) > iwe_stream_lcp_len(info))
|
||||
current_ev = current_val;
|
||||
}
|
||||
|
||||
@@ -4190,7 +4198,7 @@ static int orinoco_ioctl_getscan(struct net_device *dev,
|
||||
|
||||
list_for_each_entry(bss, &priv->bss_list, list) {
|
||||
/* Translate to WE format this entry */
|
||||
current_ev = orinoco_translate_scan(dev, current_ev,
|
||||
current_ev = orinoco_translate_scan(dev, info, current_ev,
|
||||
extra + srq->length,
|
||||
&bss->bss,
|
||||
bss->last_scanned);
|
||||
|
Reference in New Issue
Block a user