| 1 |
$FreeWRT$ |
| 2 |
--- madwifi-0.9.2.1.orig/net80211/ieee80211_wireless.c 2006-12-07 14:47:17.000000000 +0100 |
| 3 |
+++ madwifi-0.9.2.1/net80211/ieee80211_wireless.c 2007-06-26 18:54:01.000000000 +0200 |
| 4 |
@@ -1248,35 +1248,37 @@ ieee80211_ioctl_siwpower(struct net_devi |
| 5 |
{ |
| 6 |
struct ieee80211vap *vap = dev->priv; |
| 7 |
struct ieee80211com *ic = vap->iv_ic; |
| 8 |
+ |
| 9 |
+ /* XXX: These values, flags, and caps do not seem to be used elsewhere |
| 10 |
+ * at all? */ |
| 11 |
|
| 12 |
+ if ((ic->ic_caps & IEEE80211_C_PMGT) == 0) |
| 13 |
+ return -EOPNOTSUPP; |
| 14 |
+ |
| 15 |
if (wrq->disabled) { |
| 16 |
- if (ic->ic_flags & IEEE80211_F_PMGTON) { |
| 17 |
+ if (ic->ic_flags & IEEE80211_F_PMGTON) |
| 18 |
ic->ic_flags &= ~IEEE80211_F_PMGTON; |
| 19 |
- goto done; |
| 20 |
+ } else { |
| 21 |
+ switch (wrq->flags & IW_POWER_MODE) { |
| 22 |
+ case IW_POWER_UNICAST_R: |
| 23 |
+ case IW_POWER_ALL_R: |
| 24 |
+ case IW_POWER_ON: |
| 25 |
+ if (wrq->flags & IW_POWER_PERIOD) { |
| 26 |
+ if (IEEE80211_BINTVAL_VALID(wrq->value)) |
| 27 |
+ ic->ic_lintval = IEEE80211_MS_TO_TU(wrq->value); |
| 28 |
+ else |
| 29 |
+ return -EINVAL; |
| 30 |
+ } |
| 31 |
+ if (wrq->flags & IW_POWER_TIMEOUT) |
| 32 |
+ ic->ic_holdover = IEEE80211_MS_TO_TU(wrq->value); |
| 33 |
+ |
| 34 |
+ ic->ic_flags |= IEEE80211_F_PMGTON; |
| 35 |
+ break; |
| 36 |
+ default: |
| 37 |
+ return -EINVAL; |
| 38 |
} |
| 39 |
- return 0; |
| 40 |
} |
| 41 |
- |
| 42 |
- if ((ic->ic_caps & IEEE80211_C_PMGT) == 0) |
| 43 |
- return -EOPNOTSUPP; |
| 44 |
- switch (wrq->flags & IW_POWER_MODE) { |
| 45 |
- case IW_POWER_UNICAST_R: |
| 46 |
- case IW_POWER_ALL_R: |
| 47 |
- case IW_POWER_ON: |
| 48 |
- ic->ic_flags |= IEEE80211_F_PMGTON; |
| 49 |
- break; |
| 50 |
- default: |
| 51 |
- return -EINVAL; |
| 52 |
- } |
| 53 |
- if (wrq->flags & IW_POWER_TIMEOUT) { |
| 54 |
- ic->ic_holdover = IEEE80211_MS_TO_TU(wrq->value); |
| 55 |
- ic->ic_flags |= IEEE80211_F_PMGTON; |
| 56 |
- } |
| 57 |
- if (wrq->flags & IW_POWER_PERIOD) { |
| 58 |
- ic->ic_lintval = IEEE80211_MS_TO_TU(wrq->value); |
| 59 |
- ic->ic_flags |= IEEE80211_F_PMGTON; |
| 60 |
- } |
| 61 |
-done: |
| 62 |
+ |
| 63 |
return IS_UP(ic->ic_dev) ? ic->ic_reset(ic->ic_dev) : 0; |
| 64 |
} |
| 65 |
|
| 66 |
@@ -2266,8 +2268,7 @@ ieee80211_ioctl_setparam(struct net_devi |
| 67 |
if (vap->iv_opmode != IEEE80211_M_HOSTAP && |
| 68 |
vap->iv_opmode != IEEE80211_M_IBSS) |
| 69 |
return -EINVAL; |
| 70 |
- if (IEEE80211_BINTVAL_MIN <= value && |
| 71 |
- value <= IEEE80211_BINTVAL_MAX) { |
| 72 |
+ if (IEEE80211_BINTVAL_VALID(value)) { |
| 73 |
ic->ic_lintval = value; /* XXX multi-bss */ |
| 74 |
retv = ENETRESET; /* requires restart */ |
| 75 |
} else |
| 76 |
@@ -3300,7 +3301,8 @@ ieee80211_ioctl_setwmmparams(struct net_ |
| 77 |
{ |
| 78 |
struct ieee80211vap *vap = dev->priv; |
| 79 |
int *param = (int *) extra; |
| 80 |
- int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE; |
| 81 |
+ int ac = (param[1] >= 0 && param[1] < WME_NUM_AC) ? |
| 82 |
+ param[1] : WME_AC_BE; |
| 83 |
int bss = param[2]; |
| 84 |
struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme; |
| 85 |
|
| 86 |
@@ -3388,7 +3390,8 @@ ieee80211_ioctl_getwmmparams(struct net_ |
| 87 |
{ |
| 88 |
struct ieee80211vap *vap = dev->priv; |
| 89 |
int *param = (int *) extra; |
| 90 |
- int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE; |
| 91 |
+ int ac = (param[1] >= 0 && param[1] < WME_NUM_AC) ? |
| 92 |
+ param[1] : WME_AC_BE; |
| 93 |
struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme; |
| 94 |
struct chanAccParams *chanParams = (param[2] == 0) ? |
| 95 |
&(wme->wme_chanParams) : &(wme->wme_bssChanParams); |