PERFORCE change 66288 for review

Sam Leffler sam at FreeBSD.org
Thu Dec 2 16:41:44 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=66288

Change 66288 by sam at sam_ebb on 2004/12/03 00:40:43

	fix horrible braino

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#11 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#11 (text+ko) ====

@@ -40,6 +40,7 @@
 #include "opt_inet.h"
 
 #include <sys/param.h>
+#include <sys/kernel.h>
 #include <sys/systm.h> 
 #include <sys/linker.h>
  
@@ -84,26 +85,6 @@
 	"WME_UPSD",
 };
 
-#define	IEEE80211_AUTH_MAX	(IEEE80211_AUTH_WPA+1)
-/* XXX well-known names */
-static const char *auth_modnames[IEEE80211_AUTH_MAX] = {
-	"wlan_internal",	/* IEEE80211_AUTH_NONE */
-	"wlan_internal",	/* IEEE80211_AUTH_OPEN */
-	"wlan_internal",	/* IEEE80211_AUTH_SHARED */
-	"wlan_xauth",		/* IEEE80211_AUTH_8021X	 */
-	"wlan_internal",	/* IEEE80211_AUTH_AUTO */
-	"wlan_xauth",		/* IEEE80211_AUTH_WPA */
-};
-static const struct ieee80211_authenticator *authenticators[IEEE80211_AUTH_MAX];
-
-static const struct ieee80211_authenticator auth_internal = {
-	.ia_name		= "wlan_internal",
-	.ia_attach		= NULL,
-	.ia_detach		= NULL,
-	.ia_node_join		= NULL,
-	.ia_node_leave		= NULL,
-};
-
 static int ieee80211_newstate(struct ieee80211com *, enum ieee80211_state, int);
 
 void
@@ -135,10 +116,6 @@
 	/* initialize management frame handlers */
 	ic->ic_recv_mgmt = ieee80211_recv_mgmt;
 	ic->ic_send_mgmt = ieee80211_send_mgmt;
-
-	ieee80211_authenticator_register(IEEE80211_AUTH_OPEN, &auth_internal);
-	ieee80211_authenticator_register(IEEE80211_AUTH_SHARED, &auth_internal);
-	ieee80211_authenticator_register(IEEE80211_AUTH_AUTO, &auth_internal);
 }
 
 void
@@ -156,10 +133,6 @@
 	IF_DRAIN(&ic->ic_mgtq);
 	mtx_destroy(&ic->ic_mgtq.ifq_mtx);
 
-	ieee80211_authenticator_unregister(IEEE80211_AUTH_OPEN);
-	ieee80211_authenticator_unregister(IEEE80211_AUTH_SHARED);
-	ieee80211_authenticator_unregister(IEEE80211_AUTH_AUTO);
-
 	/*
 	 * Detach any ACL'ator.
 	 */
@@ -171,6 +144,38 @@
  * Simple-minded authenticator module support.
  */
 
+#define	IEEE80211_AUTH_MAX	(IEEE80211_AUTH_WPA+1)
+/* XXX well-known names */
+static const char *auth_modnames[IEEE80211_AUTH_MAX] = {
+	"wlan_internal",	/* IEEE80211_AUTH_NONE */
+	"wlan_internal",	/* IEEE80211_AUTH_OPEN */
+	"wlan_internal",	/* IEEE80211_AUTH_SHARED */
+	"wlan_xauth",		/* IEEE80211_AUTH_8021X	 */
+	"wlan_internal",	/* IEEE80211_AUTH_AUTO */
+	"wlan_xauth",		/* IEEE80211_AUTH_WPA */
+};
+static const struct ieee80211_authenticator *authenticators[IEEE80211_AUTH_MAX];
+
+static const struct ieee80211_authenticator auth_internal = {
+	.ia_name		= "wlan_internal",
+	.ia_attach		= NULL,
+	.ia_detach		= NULL,
+	.ia_node_join		= NULL,
+	.ia_node_leave		= NULL,
+};
+
+/*
+ * Setup internal authenticators once; they are never unregistered.
+ */
+static void
+ieee80211_auth_setup(void)
+{
+	ieee80211_authenticator_register(IEEE80211_AUTH_OPEN, &auth_internal);
+	ieee80211_authenticator_register(IEEE80211_AUTH_SHARED, &auth_internal);
+	ieee80211_authenticator_register(IEEE80211_AUTH_AUTO, &auth_internal);
+}
+SYSINIT(wlan_auth, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_auth_setup, NULL);
+
 const struct ieee80211_authenticator *
 ieee80211_authenticator_get(int auth)
 {


More information about the p4-projects mailing list