summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2008-08-09 05:46:01 +0000
committerimp <imp@FreeBSD.org>2008-08-09 05:46:01 +0000
commit38a3b8ee43fac3f029495ef12f790b4300865e08 (patch)
tree30a52668abc8e0a3b8d40052ed777b803f9b7672
parent3c96d1d858bfd748db2dc24bb7112518e4a04dcd (diff)
downloadFreeBSD-src-38a3b8ee43fac3f029495ef12f790b4300865e08.zip
FreeBSD-src-38a3b8ee43fac3f029495ef12f790b4300865e08.tar.gz
Verify that the WPA flags set are actually compatible with the
driver's set of valid flags. Otherwise, wpa_supplicant wouldn't report an error for old wi cards that can't do WPA. Reviewed by: sam@
-rw-r--r--sys/net80211/ieee80211_ioctl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 786c815..053e480 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -2448,6 +2448,7 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211r
uint8_t tmpbssid[IEEE80211_ADDR_LEN];
struct ieee80211_key *k;
u_int kid;
+ uint32_t flags;
error = 0;
switch (ireq->i_type) {
@@ -2656,18 +2657,26 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211r
if (ireq->i_val > 3)
return EINVAL;
/* XXX verify ciphers available */
- vap->iv_flags &= ~IEEE80211_F_WPA;
+ flags = vap->iv_flags & ~IEEE80211_F_WPA;
switch (ireq->i_val) {
case 1:
- vap->iv_flags |= IEEE80211_F_WPA1;
+ if (!(vap->iv_caps & IEEE80211_C_WPA1))
+ return EOPNOTSUPP;
+ flags |= IEEE80211_F_WPA1;
break;
case 2:
- vap->iv_flags |= IEEE80211_F_WPA2;
+ if (!(vap->iv_caps & IEEE80211_C_WPA2))
+ return EOPNOTSUPP;
+ flags |= IEEE80211_F_WPA2;
break;
case 3:
- vap->iv_flags |= IEEE80211_F_WPA1 | IEEE80211_F_WPA2;
+ if ((vap->iv_caps & IEEE80211_C_WPA) != IEEE80211_C_WPA)
+ flags |= IEEE80211_F_WPA1 | IEEE80211_F_WPA2;
break;
+ default: /* Can't set any -> error */
+ return EOPNOTSUPP;
}
+ vap->iv_flags = flags;
error = ERESTART; /* NB: can change beacon frame */
break;
case IEEE80211_IOC_WME:
OpenPOWER on IntegriCloud