svn commit: r195526 - projects/mesh11s/sys/net80211

Sam Leffler sam at FreeBSD.org
Fri Jul 10 02:16:00 UTC 2009


Author: sam
Date: Fri Jul 10 02:15:59 2009
New Revision: 195526
URL: http://svn.freebsd.org/changeset/base/195526

Log:
  revert all of r195520 except packing the acl struct; linker sets for
  modules are not merged into existing linker sets so we cannot use
  it to handle ioctl methods

Modified:
  projects/mesh11s/sys/net80211/ieee80211_acl.c
  projects/mesh11s/sys/net80211/ieee80211_ioctl.c
  projects/mesh11s/sys/net80211/ieee80211_proto.h

Modified: projects/mesh11s/sys/net80211/ieee80211_acl.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_acl.c	Fri Jul 10 00:40:55 2009	(r195525)
+++ projects/mesh11s/sys/net80211/ieee80211_acl.c	Fri Jul 10 02:15:59 2009	(r195526)
@@ -277,18 +277,20 @@ acl_getpolicy(struct ieee80211vap *vap)
 }
 
 static int
-acl_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
+acl_setioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {
-	struct aclstate *as;
+
+	return EINVAL;
+}
+
+static int
+acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
+{
+	struct aclstate *as = vap->iv_as;
 	struct acl *acl;
 	struct ieee80211req_maclist *ap;
 	int error, space, i;
 
-	if (ireq->i_type != IEEE80211_IOC_MACCMD)
-		return ENOSYS;
-	if (vap->iv_acl == NULL)
-		return EINVAL;
-	as = vap->iv_as;
 	switch (ireq->i_val) {
 	case IEEE80211_MACCMD_POLICY:
 		ireq->i_val = as->as_policy;
@@ -320,85 +322,6 @@ acl_ioctl_get80211(struct ieee80211vap *
 	}
 	return EINVAL;
 }
-IEEE80211_IOCTL_GET(acl, acl_ioctl_get80211);
-
-static int
-acl_ioctl_macmac(struct ieee80211vap *vap, struct ieee80211req *ireq)
-{
-	uint8_t mac[IEEE80211_ADDR_LEN];
-	const struct ieee80211_aclator *acl = vap->iv_acl;
-	int error;
-
-	if (ireq->i_len != sizeof(mac))
-		return EINVAL;
-	error = copyin(ireq->i_data, mac, ireq->i_len);
-	if (error)
-		return error;
-	if (acl == NULL) {
-		acl = ieee80211_aclator_get("mac");
-		if (acl == NULL || !acl_attach(vap))
-			return EINVAL;
-		vap->iv_acl = acl;
-	}
-	if (ireq->i_type == IEEE80211_IOC_ADDMAC)
-		acl_add(vap, mac);
-	else
-		acl_remove(vap, mac);
-	return 0;
-}
-
-static int
-acl_ioctl_setmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
-{
-	const struct ieee80211_aclator *acl = vap->iv_acl;
-
-	switch (ireq->i_val) {
-	case IEEE80211_MACCMD_POLICY_OPEN:
-	case IEEE80211_MACCMD_POLICY_ALLOW:
-	case IEEE80211_MACCMD_POLICY_DENY:
-	case IEEE80211_MACCMD_POLICY_RADIUS:
-		if (acl == NULL) {
-			acl = ieee80211_aclator_get("mac");
-			if (acl == NULL || !acl_attach(vap))
-				return EINVAL;
-			vap->iv_acl = acl;
-		}
-		acl_setpolicy(vap, ireq->i_val);
-		break;
-	case IEEE80211_MACCMD_FLUSH:
-		if (acl != NULL)
-			acl_free_all(vap);
-		/* NB: silently ignore when not in use */
-		break;
-	case IEEE80211_MACCMD_DETACH:
-		if (acl != NULL) {
-			vap->iv_acl = NULL;
-			acl_detach(vap);
-		}
-		break;
-	default:
-		return EINVAL;
-	}
-	return 0;
-}
-
-static int
-acl_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
-{
-	switch (ireq->i_type) {
-	case IEEE80211_IOC_ADDMAC:
-	case IEEE80211_IOC_DELMAC:
-		return acl_ioctl_macmac(vap, ireq);
-		break;
-	case IEEE80211_IOC_MACCMD:
-		return acl_ioctl_setmaccmd(vap, ireq);
-		break;
-	default:
-		return ENOSYS;
-	}
-	return 0;
-}
-IEEE80211_IOCTL_SET(acl, acl_ioctl_set80211);
 
 static const struct ieee80211_aclator mac = {
 	.iac_name	= "mac",
@@ -410,5 +333,7 @@ static const struct ieee80211_aclator ma
 	.iac_flush	= acl_free_all,
 	.iac_setpolicy	= acl_setpolicy,
 	.iac_getpolicy	= acl_getpolicy,
+	.iac_setioctl	= acl_setioctl,
+	.iac_getioctl	= acl_getioctl,
 };
 IEEE80211_ACL_MODULE(wlan_acl, mac, 1);

Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_ioctl.c	Fri Jul 10 00:40:55 2009	(r195525)
+++ projects/mesh11s/sys/net80211/ieee80211_ioctl.c	Fri Jul 10 02:15:59 2009	(r195526)
@@ -585,6 +585,14 @@ ieee80211_ioctl_getwmeparam(struct ieee8
 }
 
 static __noinline int
+ieee80211_ioctl_getmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
+{
+	const struct ieee80211_aclator *acl = vap->iv_acl;
+
+	return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq));
+}
+
+static __noinline int
 ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {
 	struct ieee80211com *ic = vap->iv_ic;
@@ -977,6 +985,9 @@ ieee80211_ioctl_get80211(struct ieee8021
 	case IEEE80211_IOC_FRAGTHRESHOLD:
 		ireq->i_val = vap->iv_fragthreshold;
 		break;
+	case IEEE80211_IOC_MACCMD:
+		error = ieee80211_ioctl_getmaccmd(vap, ireq);
+		break;
 	case IEEE80211_IOC_BURST:
 		ireq->i_val = (vap->iv_flags & IEEE80211_F_BURST) != 0;
 		break;
@@ -1503,6 +1514,69 @@ ieee80211_ioctl_setmlme(struct ieee80211
 }
 
 static __noinline int
+ieee80211_ioctl_macmac(struct ieee80211vap *vap, struct ieee80211req *ireq)
+{
+	uint8_t mac[IEEE80211_ADDR_LEN];
+	const struct ieee80211_aclator *acl = vap->iv_acl;
+	int error;
+
+	if (ireq->i_len != sizeof(mac))
+		return EINVAL;
+	error = copyin(ireq->i_data, mac, ireq->i_len);
+	if (error)
+		return error;
+	if (acl == NULL) {
+		acl = ieee80211_aclator_get("mac");
+		if (acl == NULL || !acl->iac_attach(vap))
+			return EINVAL;
+		vap->iv_acl = acl;
+	}
+	if (ireq->i_type == IEEE80211_IOC_ADDMAC)
+		acl->iac_add(vap, mac);
+	else
+		acl->iac_remove(vap, mac);
+	return 0;
+}
+
+static __noinline int
+ieee80211_ioctl_setmaccmd(struct ieee80211vap *vap, struct ieee80211req *ireq)
+{
+	const struct ieee80211_aclator *acl = vap->iv_acl;
+
+	switch (ireq->i_val) {
+	case IEEE80211_MACCMD_POLICY_OPEN:
+	case IEEE80211_MACCMD_POLICY_ALLOW:
+	case IEEE80211_MACCMD_POLICY_DENY:
+	case IEEE80211_MACCMD_POLICY_RADIUS:
+		if (acl == NULL) {
+			acl = ieee80211_aclator_get("mac");
+			if (acl == NULL || !acl->iac_attach(vap))
+				return EINVAL;
+			vap->iv_acl = acl;
+		}
+		acl->iac_setpolicy(vap, ireq->i_val);
+		break;
+	case IEEE80211_MACCMD_FLUSH:
+		if (acl != NULL)
+			acl->iac_flush(vap);
+		/* NB: silently ignore when not in use */
+		break;
+	case IEEE80211_MACCMD_DETACH:
+		if (acl != NULL) {
+			vap->iv_acl = NULL;
+			acl->iac_detach(vap);
+		}
+		break;
+	default:
+		if (acl == NULL)
+			return EINVAL;
+		else
+			return acl->iac_setioctl(vap, ireq);
+	}
+	return 0;
+}
+
+static __noinline int
 ieee80211_ioctl_setchanlist(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {
 	struct ieee80211com *ic = vap->iv_ic;
@@ -2759,6 +2833,13 @@ ieee80211_ioctl_set80211(struct ieee8021
 			ieee80211_syncflag_ht(vap, -IEEE80211_FHT_USEHT40);
 		error = ENETRESET;
 		break;
+	case IEEE80211_IOC_ADDMAC:
+	case IEEE80211_IOC_DELMAC:
+		error = ieee80211_ioctl_macmac(vap, ireq);
+		break;
+	case IEEE80211_IOC_MACCMD:
+		error = ieee80211_ioctl_setmaccmd(vap, ireq);
+		break;
 	case IEEE80211_IOC_STA_STATS:
 		error = ieee80211_ioctl_setstastats(vap, ireq);
 		break;

Modified: projects/mesh11s/sys/net80211/ieee80211_proto.h
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_proto.h	Fri Jul 10 00:40:55 2009	(r195525)
+++ projects/mesh11s/sys/net80211/ieee80211_proto.h	Fri Jul 10 02:15:59 2009	(r195526)
@@ -177,6 +177,7 @@ void	ieee80211_authenticator_register(in
 void	ieee80211_authenticator_unregister(int type);
 const struct ieee80211_authenticator *ieee80211_authenticator_get(int auth);
 
+struct ieee80211req;
 /*
  * Template for an MAC ACL policy module.  Such modules
  * register with the protocol code and are passed the sender's
@@ -195,6 +196,8 @@ struct ieee80211_aclator {
 	int	(*iac_flush)(struct ieee80211vap *);
 	int	(*iac_setpolicy)(struct ieee80211vap *, int);
 	int	(*iac_getpolicy)(struct ieee80211vap *);
+	int	(*iac_setioctl)(struct ieee80211vap *, struct ieee80211req *);
+	int	(*iac_getioctl)(struct ieee80211vap *, struct ieee80211req *);
 };
 void	ieee80211_aclator_register(const struct ieee80211_aclator *);
 void	ieee80211_aclator_unregister(const struct ieee80211_aclator *);


More information about the svn-src-projects mailing list