diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
commit | ccc580571cf0799d0460a085a7632b77753f083e (patch) | |
tree | 018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/wireless/prism54 | |
parent | 0f5cabba49021d36e9f76bd97d7fa0f4a408063f (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/prism54')
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 5b375b289036..97fa14e0a479 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -571,8 +571,9 @@ prism54_set_scan(struct net_device *dev, struct iw_request_info *info, | |||
571 | */ | 571 | */ |
572 | 572 | ||
573 | static char * | 573 | static char * |
574 | prism54_translate_bss(struct net_device *ndev, char *current_ev, | 574 | prism54_translate_bss(struct net_device *ndev, struct iw_request_info *info, |
575 | char *end_buf, struct obj_bss *bss, char noise) | 575 | char *current_ev, char *end_buf, struct obj_bss *bss, |
576 | char noise) | ||
576 | { | 577 | { |
577 | struct iw_event iwe; /* Temporary buffer */ | 578 | struct iw_event iwe; /* Temporary buffer */ |
578 | short cap; | 579 | short cap; |
@@ -584,8 +585,8 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
584 | memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); | 585 | memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); |
585 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 586 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
586 | iwe.cmd = SIOCGIWAP; | 587 | iwe.cmd = SIOCGIWAP; |
587 | current_ev = | 588 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
588 | iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); | 589 | &iwe, IW_EV_ADDR_LEN); |
589 | 590 | ||
590 | /* The following entries will be displayed in the same order we give them */ | 591 | /* The following entries will be displayed in the same order we give them */ |
591 | 592 | ||
@@ -593,7 +594,7 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
593 | iwe.u.data.length = bss->ssid.length; | 594 | iwe.u.data.length = bss->ssid.length; |
594 | iwe.u.data.flags = 1; | 595 | iwe.u.data.flags = 1; |
595 | iwe.cmd = SIOCGIWESSID; | 596 | iwe.cmd = SIOCGIWESSID; |
596 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 597 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
597 | &iwe, bss->ssid.octets); | 598 | &iwe, bss->ssid.octets); |
598 | 599 | ||
599 | /* Capabilities */ | 600 | /* Capabilities */ |
@@ -610,9 +611,8 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
610 | iwe.u.mode = IW_MODE_ADHOC; | 611 | iwe.u.mode = IW_MODE_ADHOC; |
611 | iwe.cmd = SIOCGIWMODE; | 612 | iwe.cmd = SIOCGIWMODE; |
612 | if (iwe.u.mode) | 613 | if (iwe.u.mode) |
613 | current_ev = | 614 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
614 | iwe_stream_add_event(current_ev, end_buf, &iwe, | 615 | &iwe, IW_EV_UINT_LEN); |
615 | IW_EV_UINT_LEN); | ||
616 | 616 | ||
617 | /* Encryption capability */ | 617 | /* Encryption capability */ |
618 | if (cap & CAP_CRYPT) | 618 | if (cap & CAP_CRYPT) |
@@ -621,14 +621,15 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
621 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 621 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
622 | iwe.u.data.length = 0; | 622 | iwe.u.data.length = 0; |
623 | iwe.cmd = SIOCGIWENCODE; | 623 | iwe.cmd = SIOCGIWENCODE; |
624 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL); | 624 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
625 | &iwe, NULL); | ||
625 | 626 | ||
626 | /* Add frequency. (short) bss->channel is the frequency in MHz */ | 627 | /* Add frequency. (short) bss->channel is the frequency in MHz */ |
627 | iwe.u.freq.m = bss->channel; | 628 | iwe.u.freq.m = bss->channel; |
628 | iwe.u.freq.e = 6; | 629 | iwe.u.freq.e = 6; |
629 | iwe.cmd = SIOCGIWFREQ; | 630 | iwe.cmd = SIOCGIWFREQ; |
630 | current_ev = | 631 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
631 | iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); | 632 | &iwe, IW_EV_FREQ_LEN); |
632 | 633 | ||
633 | /* Add quality statistics */ | 634 | /* Add quality statistics */ |
634 | iwe.u.qual.level = bss->rssi; | 635 | iwe.u.qual.level = bss->rssi; |
@@ -636,20 +637,20 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
636 | /* do a simple SNR for quality */ | 637 | /* do a simple SNR for quality */ |
637 | iwe.u.qual.qual = bss->rssi - noise; | 638 | iwe.u.qual.qual = bss->rssi - noise; |
638 | iwe.cmd = IWEVQUAL; | 639 | iwe.cmd = IWEVQUAL; |
639 | current_ev = | 640 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
640 | iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); | 641 | &iwe, IW_EV_QUAL_LEN); |
641 | 642 | ||
642 | /* Add WPA/RSN Information Element, if any */ | 643 | /* Add WPA/RSN Information Element, if any */ |
643 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); | 644 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); |
644 | if (wpa_ie_len > 0) { | 645 | if (wpa_ie_len > 0) { |
645 | iwe.cmd = IWEVGENIE; | 646 | iwe.cmd = IWEVGENIE; |
646 | iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN); | 647 | iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN); |
647 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 648 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
648 | &iwe, wpa_ie); | 649 | &iwe, wpa_ie); |
649 | } | 650 | } |
650 | /* Do the bitrates */ | 651 | /* Do the bitrates */ |
651 | { | 652 | { |
652 | char * current_val = current_ev + IW_EV_LCP_LEN; | 653 | char *current_val = current_ev + iwe_stream_lcp_len(info); |
653 | int i; | 654 | int i; |
654 | int mask; | 655 | int mask; |
655 | 656 | ||
@@ -662,14 +663,14 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
662 | for(i = 0; i < sizeof(scan_rate_list); i++) { | 663 | for(i = 0; i < sizeof(scan_rate_list); i++) { |
663 | if(bss->rates & mask) { | 664 | if(bss->rates & mask) { |
664 | iwe.u.bitrate.value = (scan_rate_list[i] * 500000); | 665 | iwe.u.bitrate.value = (scan_rate_list[i] * 500000); |
665 | current_val = iwe_stream_add_value(current_ev, current_val, | 666 | current_val = iwe_stream_add_value( |
666 | end_buf, &iwe, | 667 | info, current_ev, current_val, |
667 | IW_EV_PARAM_LEN); | 668 | end_buf, &iwe, IW_EV_PARAM_LEN); |
668 | } | 669 | } |
669 | mask <<= 1; | 670 | mask <<= 1; |
670 | } | 671 | } |
671 | /* Check if we added any event */ | 672 | /* Check if we added any event */ |
672 | if ((current_val - current_ev) > IW_EV_LCP_LEN) | 673 | if ((current_val - current_ev) > iwe_stream_lcp_len(info)) |
673 | current_ev = current_val; | 674 | current_ev = current_val; |
674 | } | 675 | } |
675 | 676 | ||
@@ -710,7 +711,7 @@ prism54_get_scan(struct net_device *ndev, struct iw_request_info *info, | |||
710 | 711 | ||
711 | /* ok now, scan the list and translate its info */ | 712 | /* ok now, scan the list and translate its info */ |
712 | for (i = 0; i < (int) bsslist->nr; i++) { | 713 | for (i = 0; i < (int) bsslist->nr; i++) { |
713 | current_ev = prism54_translate_bss(ndev, current_ev, | 714 | current_ev = prism54_translate_bss(ndev, info, current_ev, |
714 | extra + dwrq->length, | 715 | extra + dwrq->length, |
715 | &(bsslist->bsslist[i]), | 716 | &(bsslist->bsslist[i]), |
716 | noise); | 717 | noise); |
@@ -2704,6 +2705,7 @@ prism2_ioctl_scan_req(struct net_device *ndev, | |||
2704 | struct prism2_hostapd_param *param) | 2705 | struct prism2_hostapd_param *param) |
2705 | { | 2706 | { |
2706 | islpci_private *priv = netdev_priv(ndev); | 2707 | islpci_private *priv = netdev_priv(ndev); |
2708 | struct iw_request_info info; | ||
2707 | int i, rvalue; | 2709 | int i, rvalue; |
2708 | struct obj_bsslist *bsslist; | 2710 | struct obj_bsslist *bsslist; |
2709 | u32 noise = 0; | 2711 | u32 noise = 0; |
@@ -2727,9 +2729,12 @@ prism2_ioctl_scan_req(struct net_device *ndev, | |||
2727 | rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); | 2729 | rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); |
2728 | bsslist = r.ptr; | 2730 | bsslist = r.ptr; |
2729 | 2731 | ||
2732 | info.cmd = PRISM54_HOSTAPD; | ||
2733 | info.flags = 0; | ||
2734 | |||
2730 | /* ok now, scan the list and translate its info */ | 2735 | /* ok now, scan the list and translate its info */ |
2731 | for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++) | 2736 | for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++) |
2732 | current_ev = prism54_translate_bss(ndev, current_ev, | 2737 | current_ev = prism54_translate_bss(ndev, &info, current_ev, |
2733 | extra + IW_SCAN_MAX_DATA, | 2738 | extra + IW_SCAN_MAX_DATA, |
2734 | &(bsslist->bsslist[i]), | 2739 | &(bsslist->bsslist[i]), |
2735 | noise); | 2740 | noise); |