From 70231e3d0a08fb3d2a40f79939df8bcd60bf55e6 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 22 Jul 2005 17:00:48 +0000 Subject: [PATCH] o add IEEE80211_IOC_FRAGTHRESHOLD for getting+setting the tx fragmentation threshold o fix bounds checking on IEEE80211_IOC_RTSTHRESHOLD MFC after: 3 days --- sys/net80211/ieee80211_ioctl.c | 17 +++++++++++++++-- sys/net80211/ieee80211_ioctl.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 017c927b7fea..2a479205c6c0 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -1454,6 +1454,9 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re case IEEE80211_IOC_PUREG: ireq->i_val = (ic->ic_flags & IEEE80211_F_PUREG) != 0; break; + case IEEE80211_IOC_FRAGTHRESHOLD: + ireq->i_val = ic->ic_fragthreshold; + break; default: error = EINVAL; break; @@ -2089,8 +2092,8 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0; break; case IEEE80211_IOC_RTSTHRESHOLD: - if (!(IEEE80211_RTS_MIN < ireq->i_val && - ireq->i_val < IEEE80211_RTS_MAX)) + if (!(IEEE80211_RTS_MIN <= ireq->i_val && + ireq->i_val <= IEEE80211_RTS_MAX)) return EINVAL; ic->ic_rtsthreshold = ireq->i_val; error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0; @@ -2328,6 +2331,16 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re if (ic->ic_curmode == IEEE80211_MODE_11G) error = ENETRESET; break; + case IEEE80211_IOC_FRAGTHRESHOLD: + if ((ic->ic_caps & IEEE80211_C_TXFRAG) == 0 && + ireq->i_val != IEEE80211_FRAG_MAX) + return EINVAL; + if (!(IEEE80211_FRAG_MIN <= ireq->i_val && + ireq->i_val <= IEEE80211_FRAG_MAX)) + return EINVAL; + ic->ic_fragthreshold = ireq->i_val; + error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0; + break; default: error = EINVAL; break; diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h index 658bd56b04c1..34300201872d 100644 --- a/sys/net80211/ieee80211_ioctl.h +++ b/sys/net80211/ieee80211_ioctl.h @@ -427,6 +427,7 @@ struct ieee80211req { #define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */ #define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */ #define IEEE80211_IOC_PUREG 56 /* pure 11g (no 11b stations) */ +#define IEEE80211_IOC_FRAGTHRESHOLD 73 /* tx fragmentation threshold */ /* * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.