awx: variable initialization fix
[openwrt/staging/chunkeey.git] / package / madwifi / patches / 115-PR_1270_fix.patch
1 diff -urN madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_input.c madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_input.c
2 --- madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_input.c 2007-05-04 02:10:06.000000000 +0200
3 +++ madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_input.c 2007-05-13 18:17:56.027051632 +0200
4 @@ -2854,7 +2854,7 @@
5 IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3);
6 memcpy(ni->ni_tstamp.data, scan.tstamp,
7 sizeof(ni->ni_tstamp));
8 - ni->ni_intval = scan.bintval;
9 + ni->ni_intval = IEEE80211_BINTVAL_SANITISE(scan.bintval);
10 ni->ni_capinfo = scan.capinfo;
11 ni->ni_chan = ic->ic_curchan;
12 ni->ni_fhdwell = scan.fhdwell;
13 @@ -3279,7 +3279,7 @@
14 ni->ni_rssi = rssi;
15 ni->ni_rstamp = rstamp;
16 ni->ni_last_rx = jiffies;
17 - ni->ni_intval = bintval;
18 + ni->ni_intval = IEEE80211_BINTVAL_SANITISE(bintval);
19 ni->ni_capinfo = capinfo;
20 ni->ni_chan = ic->ic_curchan;
21 ni->ni_fhdwell = vap->iv_bss->ni_fhdwell;
22 diff -urN madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_node.c madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_node.c
23 --- madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_node.c 2007-05-13 18:17:55.862076712 +0200
24 +++ madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_node.c 2007-05-13 18:17:56.028051480 +0200
25 @@ -658,7 +658,7 @@
26 memcpy(ni->ni_essid, se->se_ssid + 2, ni->ni_esslen);
27 ni->ni_rstamp = se->se_rstamp;
28 ni->ni_tstamp.tsf = se->se_tstamp.tsf;
29 - ni->ni_intval = se->se_intval;
30 + ni->ni_intval = IEEE80211_BINTVAL_SANITISE(se->se_intval);
31 ni->ni_capinfo = se->se_capinfo;
32 ni->ni_chan = se->se_chan;
33 ni->ni_timoff = se->se_timoff;
34 @@ -1191,7 +1191,7 @@
35 memcpy(ni->ni_essid, sp->ssid + 2, sp->ssid[1]);
36 IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3);
37 memcpy(ni->ni_tstamp.data, sp->tstamp, sizeof(ni->ni_tstamp));
38 - ni->ni_intval = sp->bintval;
39 + ni->ni_intval = IEEE80211_BINTVAL_SANITISE(sp->bintval);
40 ni->ni_capinfo = sp->capinfo;
41 ni->ni_chan = ic->ic_curchan;
42 ni->ni_fhdwell = sp->fhdwell;
43 diff -urN madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_scan.h madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_scan.h
44 --- madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_scan.h 2007-04-04 04:39:58.000000000 +0200
45 +++ madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_scan.h 2007-05-13 18:17:56.029051328 +0200
46 @@ -131,7 +131,7 @@
47 u_int8_t bchan;
48 u_int8_t fhindex;
49 u_int8_t erp;
50 - u_int8_t bintval;
51 + u_int16_t bintval;
52 u_int8_t timoff;
53 u_int8_t *tim;
54 u_int8_t *tstamp;
55 diff -urN madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_var.h madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_var.h
56 --- madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_var.h 2007-04-25 22:29:55.000000000 +0200
57 +++ madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_var.h 2007-05-13 18:17:56.029051328 +0200
58 @@ -61,6 +61,12 @@
59 #define IEEE80211_BINTVAL_MAX 500 /* max beacon interval (TU's) */
60 #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */
61 #define IEEE80211_BINTVAL_DEFAULT 100 /* default beacon interval (TU's) */
62 +#define IEEE80211_BINTVAL_VALID(_bi) \
63 + ((IEEE80211_BINTVAL_MIN <= (_bi)) && \
64 + ((_bi) <= IEEE80211_BINTVAL_MAX))
65 +#define IEEE80211_BINTVAL_SANITISE(_bi) \
66 + (IEEE80211_BINTVAL_VALID(_bi) ? \
67 + (_bi) : IEEE80211_BINTVAL_DEFAULT)
68
69 #define IEEE80211_BGSCAN_INTVAL_MIN 15 /* min bg scan intvl (secs) */
70 #define IEEE80211_BGSCAN_INTVAL_DEFAULT (5*60) /* default bg scan intvl */
71 diff -urN madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_wireless.c madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_wireless.c
72 --- madwifi-ng-refcount-r2313-20070505.old/net80211/ieee80211_wireless.c 2007-05-04 02:10:06.000000000 +0200
73 +++ madwifi-ng-refcount-r2313-20070505.dev/net80211/ieee80211_wireless.c 2007-05-13 18:17:56.031051024 +0200
74 @@ -1271,12 +1271,16 @@
75 case IW_POWER_UNICAST_R:
76 case IW_POWER_ALL_R:
77 case IW_POWER_ON:
78 - ic->ic_flags |= IEEE80211_F_PMGTON;
79 -
80 + if (wrq->flags & IW_POWER_PERIOD) {
81 + if (IEEE80211_BINTVAL_VALID(wrq->value))
82 + ic->ic_lintval = IEEE80211_MS_TO_TU(wrq->value);
83 + else
84 + return -EINVAL;
85 + }
86 if (wrq->flags & IW_POWER_TIMEOUT)
87 ic->ic_holdover = IEEE80211_MS_TO_TU(wrq->value);
88 - if (wrq->flags & IW_POWER_PERIOD)
89 - ic->ic_lintval = IEEE80211_MS_TO_TU(wrq->value);
90 +
91 + ic->ic_flags |= IEEE80211_F_PMGTON;
92 break;
93 default:
94 return -EINVAL;
95 @@ -2364,8 +2368,7 @@
96 if (vap->iv_opmode != IEEE80211_M_HOSTAP &&
97 vap->iv_opmode != IEEE80211_M_IBSS)
98 return -EINVAL;
99 - if (IEEE80211_BINTVAL_MIN <= value &&
100 - value <= IEEE80211_BINTVAL_MAX) {
101 + if (IEEE80211_BINTVAL_VALID(value)) {
102 ic->ic_lintval = value; /* XXX multi-bss */
103 retv = ENETRESET; /* requires restart */
104 } else