add preliminary 2.6.32 support
[openwrt.git] / package / madwifi / patches / 409-wext_compat.patch
1 --- a/net80211/ieee80211_wireless.c
2 +++ b/net80211/ieee80211_wireless.c
3 @@ -73,6 +73,13 @@
4          (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO)
5  #define        RESCAN  1
6  
7 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
8 +#define IWE(func, ...) func(&iweinfo, __VA_ARGS__)
9 +static struct iw_request_info iweinfo = { 0, 0 };
10 +#else
11 +#define IWE(func, ...) func(__VA_ARGS__)
12 +#endif
13 +
14  static void
15  pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt);
16  
17 @@ -1800,7 +1807,7 @@ giwscan_cb(void *arg, const struct ieee8
18                 IEEE80211_ADDR_COPY(iwe.u.ap_addr.sa_data, se->se_macaddr);
19         else
20                 IEEE80211_ADDR_COPY(iwe.u.ap_addr.sa_data, se->se_bssid);
21 -       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
22 +       current_ev = IWE(iwe_stream_add_event, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
23  
24         /* We ran out of space in the buffer. */
25         if (last_ev == current_ev)
26 @@ -1811,7 +1818,7 @@ giwscan_cb(void *arg, const struct ieee8
27         iwe.cmd = SIOCGIWESSID;
28         iwe.u.data.flags = 1;
29         iwe.u.data.length = se->se_ssid[1];
30 -       current_ev = iwe_stream_add_point(current_ev,
31 +       current_ev = IWE(iwe_stream_add_point, current_ev,
32                 end_buf, &iwe, (char *) se->se_ssid+2);
33  
34         /* We ran out of space in the buffer. */
35 @@ -1824,7 +1831,7 @@ giwscan_cb(void *arg, const struct ieee8
36                 iwe.cmd = SIOCGIWMODE;
37                 iwe.u.mode = se->se_capinfo & IEEE80211_CAPINFO_ESS ?
38                         IW_MODE_MASTER : IW_MODE_ADHOC;
39 -               current_ev = iwe_stream_add_event(current_ev,
40 +               current_ev = IWE(iwe_stream_add_event, current_ev,
41                         end_buf, &iwe, IW_EV_UINT_LEN);
42  
43                 /* We ran out of space in the buffer. */
44 @@ -1837,7 +1844,7 @@ giwscan_cb(void *arg, const struct ieee8
45         iwe.cmd = SIOCGIWFREQ;
46         iwe.u.freq.m = se->se_chan->ic_freq * 100000;
47         iwe.u.freq.e = 1;
48 -       current_ev = iwe_stream_add_event(current_ev,
49 +       current_ev = IWE(iwe_stream_add_event, current_ev,
50                 end_buf, &iwe, IW_EV_FREQ_LEN);
51  
52         /* We ran out of space in the buffer. */
53 @@ -1848,7 +1855,7 @@ giwscan_cb(void *arg, const struct ieee8
54         last_ev = current_ev;
55         iwe.cmd = IWEVQUAL;
56         set_quality(&iwe.u.qual, se->se_rssi, ATH_DEFAULT_NOISE);
57 -       current_ev = iwe_stream_add_event(current_ev,
58 +       current_ev = IWE(iwe_stream_add_event, current_ev,
59                 end_buf, &iwe, IW_EV_QUAL_LEN);
60  
61         /* We ran out of space in the buffer */
62 @@ -1863,7 +1870,7 @@ giwscan_cb(void *arg, const struct ieee8
63         else
64                 iwe.u.data.flags = IW_ENCODE_DISABLED;
65         iwe.u.data.length = 0;
66 -       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, "");
67 +       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf, &iwe, "");
68  
69         /* We ran out of space in the buffer. */
70         if (last_ev == current_ev)
71 @@ -1878,7 +1885,7 @@ giwscan_cb(void *arg, const struct ieee8
72                 int r = se->se_rates[2 + j] & IEEE80211_RATE_VAL;
73                 if (r != 0) {
74                         iwe.u.bitrate.value = r * (1000000 / 2);
75 -                       current_val = iwe_stream_add_value(current_ev,
76 +                       current_val = IWE(iwe_stream_add_value, current_ev,
77                                 current_val, end_buf, &iwe,
78                                 IW_EV_PARAM_LEN);
79                 }
80 @@ -1887,7 +1894,7 @@ giwscan_cb(void *arg, const struct ieee8
81                 int r = se->se_xrates[2+j] & IEEE80211_RATE_VAL;
82                 if (r != 0) {
83                         iwe.u.bitrate.value = r * (1000000 / 2);
84 -                       current_val = iwe_stream_add_value(current_ev,
85 +                       current_val = IWE(iwe_stream_add_value, current_ev,
86                                 current_val, end_buf, &iwe,
87                                 IW_EV_PARAM_LEN);
88                 }
89 @@ -1906,7 +1913,7 @@ giwscan_cb(void *arg, const struct ieee8
90         iwe.cmd = IWEVCUSTOM;
91         snprintf(buf, sizeof(buf), "bcn_int=%d", se->se_intval);
92         iwe.u.data.length = strlen(buf);
93 -       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
94 +       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf, &iwe, buf);
95  
96         /* We ran out of space in the buffer. */
97         if (last_ev == current_ev)
98 @@ -1930,7 +1937,7 @@ giwscan_cb(void *arg, const struct ieee8
99                                 rsn_leader, sizeof(rsn_leader) - 1);
100  #endif
101                 if (iwe.u.data.length != 0) {
102 -                       current_ev = iwe_stream_add_point(current_ev, end_buf,
103 +                       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
104                                 &iwe, buf);
105  
106                         /* We ran out of space in the buffer */
107 @@ -1956,7 +1963,7 @@ giwscan_cb(void *arg, const struct ieee8
108                         wpa_leader, sizeof(wpa_leader) - 1);
109  #endif
110                 if (iwe.u.data.length != 0) {
111 -                       current_ev = iwe_stream_add_point(current_ev, end_buf,
112 +                       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
113                                 &iwe, buf);
114  
115                         /* We ran out of space in the buffer. */
116 @@ -1975,7 +1982,7 @@ giwscan_cb(void *arg, const struct ieee8
117                         se->se_wme_ie, se->se_wme_ie[1] + 2,
118                         wme_leader, sizeof(wme_leader) - 1);
119                 if (iwe.u.data.length != 0) {
120 -                       current_ev = iwe_stream_add_point(current_ev, end_buf,
121 +                       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
122                                 &iwe, buf);
123  
124                         /* We ran out of space in the buffer. */
125 @@ -1993,7 +2000,7 @@ giwscan_cb(void *arg, const struct ieee8
126                         se->se_ath_ie, se->se_ath_ie[1] + 2,
127                         ath_leader, sizeof(ath_leader) - 1);
128                 if (iwe.u.data.length != 0) {
129 -                       current_ev = iwe_stream_add_point(current_ev, end_buf,
130 +                       current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
131                                 &iwe, buf);
132  
133                         /* We ran out of space in the buffer. */