From owner-p4-projects@FreeBSD.ORG Fri Jan 30 12:03:49 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F089D16A4D0; Fri, 30 Jan 2004 12:03:48 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3E6016A4CF for ; Fri, 30 Jan 2004 12:03:48 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9689F43D2D for ; Fri, 30 Jan 2004 12:03:42 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i0UK3g0B053054 for ; Fri, 30 Jan 2004 12:03:42 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i0UK3fQE053051 for perforce@freebsd.org; Fri, 30 Jan 2004 12:03:41 -0800 (PST) (envelope-from sam@freebsd.org) Date: Fri, 30 Jan 2004 12:03:41 -0800 (PST) Message-Id: <200401302003.i0UK3fQE053051@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 46221 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2004 20:03:49 -0000 http://perforce.freebsd.org/chv.cgi?CH=46221 Change 46221 by sam@sam_ebb on 2004/01/30 12:03:05 o move authentication mode and transmit power from per-ap to per-instance; each station automatically inherits the default setting from ic_bss o update ioctl authemod checks to allow 802.1x o relax check on setting shared key authentication: instead of requiring wep be enabled, settle for wep being supported; this allows folks to set things out of order (otherwise folks will get confused when setting shared key auth fails because wep hasn't yet been enabled) Affected files ... .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.c#12 edit .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.c#5 edit Differences ... ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.c#12 (text+ko) ==== @@ -225,7 +225,7 @@ wreq.wi_len = 1; break; case WI_RID_CNFAUTHMODE: - wreq.wi_val[0] = htole16(ic->ic_authmode); + wreq.wi_val[0] = htole16(ic->ic_bss->ni_authmode); wreq.wi_len = 1; break; case WI_RID_ENCRYPTION: @@ -657,13 +657,15 @@ case WI_RID_CNFAUTHMODE: if (len != 2) return EINVAL; - if (le16toh(wreq.wi_val[0]) > IEEE80211_AUTH_SHARED) + /* XXX no AUTO mode support yet */ + if (le16toh(wreq.wi_val[0]) > IEEE80211_AUTH_8021X) return EINVAL; - /* shared key authentication requires WEP */ - if (le16toh(wreq.wi_val[0]) == IEEE80211_AUTH_SHARED && - (ic->ic_flags & IEEE80211_F_WEPON) == 0) + /* shared key/802.1x authentication requires WEP support */ + if ((le16toh(wreq.wi_val[0]) == IEEE80211_AUTH_SHARED || + le16toh(wreq.wi_val[0]) == IEEE80211_AUTH_8021X) && + (ic->ic_caps & IEEE80211_C_WEP) == 0) return EINVAL; - ic->ic_authmode = le16toh(wreq.wi_val[0]); + ic->ic_bss->ni_authmode = le16toh(wreq.wi_val[0]); error = ieee80211_reset(ic); break; case WI_RID_ENCRYPTION: @@ -878,7 +880,7 @@ ireq->i_val = ic->ic_wep_txkey; break; case IEEE80211_IOC_AUTHMODE: - ireq->i_val = ic->ic_authmode; + ireq->i_val = ic->ic_bss->ni_authmode; break; case IEEE80211_IOC_CHANNEL: ireq->i_val = ieee80211_chan2ieee(ic, getcurchan(ic)); @@ -971,18 +973,19 @@ break; case IEEE80211_IOC_AUTHMODE: if (!(IEEE80211_AUTH_NONE <= ireq->i_val && - ireq->i_val <= IEEE80211_AUTH_SHARED)) { + ireq->i_val <= IEEE80211_AUTH_8021X)) { error = EINVAL; break; } - if (ireq->i_val == IEEE80211_AUTH_SHARED && - (ic->ic_flags & IEEE80211_F_WEPON) == 0) { - /* shared key authentication requires WEP */ + /* shared key/802.1x authentication requires WEP */ + if ((ireq->i_val == IEEE80211_AUTH_SHARED || + ireq->i_val == IEEE80211_AUTH_8021X) && + (ic->ic_caps & IEEE80211_C_WEP) == 0) { error = EINVAL; break; } - if (ic->ic_authmode != ireq->i_val) { - ic->ic_authmode = ireq->i_val; + if (ic->ic_bss->ni_authmode != ireq->i_val) { + ic->ic_bss->ni_authmode = ireq->i_val; error = ieee80211_reset(ic); } break; ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.c#5 (text+ko) ==== @@ -98,10 +98,19 @@ void ieee80211_node_lateattach(struct ieee80211com *ic) { + struct ieee80211_node *ni; - ic->ic_bss = (*ic->ic_node_alloc)(ic); - KASSERT(ic->ic_bss != NULL, ("unable to setup inital BSS node")); - ic->ic_bss->ni_chan = IEEE80211_CHAN_ANYC; + /* NB: allocator is responsible for initializing the structure */ + ni = (*ic->ic_node_alloc)(ic); + KASSERT(ni != NULL, ("unable to setup inital BSS node")); + /* + * Setup "global settings" in the bss node so that + * each new station automatically inherits them. + */ + ni->ni_chan = IEEE80211_CHAN_ANYC; + ni->ni_authmode = ic->ic_authmode; + ni->ni_txpower = ic->ic_txpower; + ic->ic_bss = ni; } void