Date: Mon, 15 Dec 2003 11:45:38 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 43952 for review Message-ID: <200312151945.hBFJjci2020475@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=43952 Change 43952 by sam@sam_ebb on 2003/12/15 11:44:45 hookup shared key authentication support to the ioctl infrastructure Affected files ... .. //depot/projects/netperf/sys/net80211/ieee80211_ioctl.c#11 edit .. //depot/projects/netperf/sys/net80211/ieee80211_output.c#13 edit .. //depot/projects/netperf/sys/net80211/ieee80211_proto.c#11 edit .. //depot/projects/netperf/sys/net80211/ieee80211_var.h#12 edit Differences ... ==== //depot/projects/netperf/sys/net80211/ieee80211_ioctl.c#11 (text+ko) ==== @@ -213,7 +213,7 @@ wreq.wi_len = 1; break; case WI_RID_CNFAUTHMODE: - wreq.wi_val[0] = htole16(1); /* TODO: open system only */ + wreq.wi_val[0] = htole16(ic->ic_authmode); wreq.wi_len = 1; break; case WI_RID_ENCRYPTION: @@ -632,8 +632,14 @@ case WI_RID_CNFAUTHMODE: if (len != 2) return EINVAL; - if (le16toh(wreq.wi_val[0]) != 1) - return EINVAL; /* TODO: shared key auth */ + if (le16toh(wreq.wi_val[0]) > IEEE80211_AUTH_SHARED) + return EINVAL; + /* shared key authentication requires WEP */ + if (le16toh(wreq.wi_val[0]) == IEEE80211_AUTH_SHARED && + (ic->ic_flags & IEEE80211_F_WEPON) == 0) + return EINVAL; + ic->ic_authmode = le16toh(wreq.wi_val[0]); + error = ENETRESET; break; case WI_RID_ENCRYPTION: if (len != 2) @@ -830,7 +836,7 @@ ireq->i_val = ic->ic_wep_txkey; break; case IEEE80211_IOC_AUTHMODE: - ireq->i_val = IEEE80211_AUTH_OPEN; + ireq->i_val = ic->ic_authmode; break; case IEEE80211_IOC_CHANNEL: switch (ic->ic_state) { @@ -928,11 +934,23 @@ ic->ic_wep_txkey = kid; error = ENETRESET; break; -#if 0 case IEEE80211_IOC_AUTHMODE: - sc->wi_authmode = ireq->i_val; + if (!(IEEE80211_AUTH_NONE <= ireq->i_val && + ireq->i_val <= IEEE80211_AUTH_SHARED)) { + error = EINVAL; + break; + } + if (ireq->i_val == IEEE80211_AUTH_SHARED && + (ic->ic_flags & IEEE80211_F_WEPON) == 0) { + /* shared key authentication requires WEP */ + error = EINVAL; + break; + } + if (ic->ic_authmode != ireq->i_val) { + ic->ic_authmode = ireq->i_val; + error = ENETRESET; + } break; -#endif case IEEE80211_IOC_CHANNEL: /* XXX 0xffff overflows 16-bit signed */ if (ireq->i_val == 0 || ==== //depot/projects/netperf/sys/net80211/ieee80211_output.c#13 (text+ko) ==== @@ -451,8 +451,17 @@ arg == IEEE80211_AUTH_SHARED_RESPONSE) && ni->ni_challenge != NULL); - is_shared_key = has_challenge || (ni->ni_challenge != NULL && - arg == IEEE80211_AUTH_SHARED_PASS); + /* + * Deduce whether we're doing open authentication or + * shared key authentication. We do the latter if + * we're in the middle of a shared key authentication + * handshake or if we're initiating an authentication + * request and configured to use shared key. + */ + is_shared_key = has_challenge || + arg >= IEEE80211_AUTH_SHARED_RESPONSE || + (arg == IEEE80211_AUTH_SHARED_REQUEST && + ic->ic_authmode == IEEE80211_AUTH_SHARED); if (has_challenge) { MH_ALIGN(m, 2 * 3 + 2 + IEEE80211_CHALLENGE_LEN); ==== //depot/projects/netperf/sys/net80211/ieee80211_proto.c#11 (text+ko) ==== @@ -103,6 +103,7 @@ #endif ic->ic_fragthreshold = 2346; /* XXX not used yet */ ic->ic_fixed_rate = -1; /* no fixed rate */ + ic->ic_authmode = IEEE80211_AUTH_OPEN; mtx_init(&ic->ic_mgtq.ifq_mtx, ifp->if_xname, "mgmt send q", MTX_DEF); mtx_init(&ic->ic_pwrsaveq.ifq_mtx, ifp->if_xname, "power save q", MTX_DEF); ==== //depot/projects/netperf/sys/net80211/ieee80211_var.h#12 (text+ko) ==== @@ -203,6 +203,7 @@ u_int16_t ic_txlifetime; /* tx lifetime */ u_int16_t ic_txpower; /* tx power setting (dbM) */ u_int16_t ic_bmisstimeout;/* beacon miss threshold (ms) */ + u_int16_t ic_authmode; /* authentication mode */ int ic_mgt_timer; /* mgmt timeout */ int ic_inact_timer; /* inactivity timer wait */ int ic_des_esslen;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312151945.hBFJjci2020475>