Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2004 12:03:41 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 46221 for review
Message-ID:  <200401302003.i0UK3fQE053051@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401302003.i0UK3fQE053051>