svn commit: r194596 - projects/mesh11s/sys/net80211
Rui Paulo
rpaulo at FreeBSD.org
Sun Jun 21 17:06:06 UTC 2009
Author: rpaulo
Date: Sun Jun 21 17:06:05 2009
New Revision: 194596
URL: http://svn.freebsd.org/changeset/base/194596
Log:
Add ioctl commands to manipulae the HWMP table (like MAC ACL commands).
Sponsored by: The FreeBSD Foundation
Modified:
projects/mesh11s/sys/net80211/ieee80211_hwmp.c
projects/mesh11s/sys/net80211/ieee80211_ioctl.h
Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Sun Jun 21 16:56:49 2009 (r194595)
+++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Sun Jun 21 17:06:05 2009 (r194596)
@@ -1049,11 +1049,12 @@ hwmp_ioctl_get80211(struct ieee80211vap
struct ieee80211_hwmp_fi *fi;
uint8_t *p;
- if (vap->iv_opmode != IEEE80211_M_MBSS)
+ if (vap->iv_opmode != IEEE80211_M_MBSS ||
+ ireq->i_type != IEEE80211_IOC_HWMP_CMD)
return EINVAL;
error = 0;
- switch (ireq->i_type) {
- case IEEE80211_IOC_HWMP_TABLE:
+ switch (ireq->i_val) {
+ case IEEE80211_HWMP_CMD_LIST:
len = 0;
HWMP_LOCK(hs);
TAILQ_FOREACH(fi, &hs->hs_head, fi_next) {
@@ -1078,6 +1079,10 @@ hwmp_ioctl_get80211(struct ieee80211vap
error = copyout(p, (uint8_t *) ireq->i_data, ireq->i_len);
free(p, M_TEMP);
break;
+ case IEEE80211_HWMP_CMD_FLUSH:
+ case IEEE80211_HWMP_CMD_ADD:
+ case IEEE80211_HWMP_CMD_DELETE:
+ return EINVAL;
default:
return ENOSYS;
}
@@ -1089,14 +1094,43 @@ IEEE80211_IOCTL_GET(hwmp, hwmp_ioctl_get
static int
hwmp_ioctl_set80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
{
+ struct ieee80211_hwmp_state *hs = vap->iv_hwmp;
+ struct ieee80211_hwmp_fi *fi, *next;
int error;
- if (vap->iv_opmode != IEEE80211_M_MBSS)
+ if (vap->iv_opmode != IEEE80211_M_MBSS ||
+ ireq->i_type != IEEE80211_IOC_HWMP_CMD)
return EINVAL;
-
error = 0;
- switch (ireq->i_type) {
- case IEEE80211_IOC_HWMP_TABLE:
+ switch (ireq->i_val) {
+ case IEEE80211_HWMP_CMD_LIST:
+ return EINVAL;
+ case IEEE80211_HWMP_CMD_FLUSH:
+ HWMP_LOCK(hs);
+ TAILQ_FOREACH_SAFE(fi, &hs->hs_head, fi_next, next) {
+ TAILQ_REMOVE(&hs->hs_head, fi, fi_next);
+ free(fi, M_80211_HWMP);
+ }
+ HWMP_UNLOCK(hs);
+ break;
+ case IEEE80211_HWMP_CMD_ADD:
+ HWMP_LOCK(hs);
+ TAILQ_FOREACH(fi, &hs->hs_head, fi_next) {
+ if (IEEE80211_ADDR_EQ(fi->fi_dest, ireq->i_data))
+ return EINVAL;
+ }
+ HWMP_UNLOCK(hs);
+ break;
+ case IEEE80211_HWMP_CMD_DELETE:
+ HWMP_LOCK(hs);
+ TAILQ_FOREACH_SAFE(fi, &hs->hs_head, fi_next, next) {
+ if (IEEE80211_ADDR_EQ(fi->fi_dest, ireq->i_data)) {
+ TAILQ_REMOVE(&hs->hs_head, fi, fi_next);
+ free(fi, M_80211_HWMP);
+ }
+ }
+ HWMP_UNLOCK(hs);
+ break;
default:
return ENOSYS;
}
Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.h
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_ioctl.h Sun Jun 21 16:56:49 2009 (r194595)
+++ projects/mesh11s/sys/net80211/ieee80211_ioctl.h Sun Jun 21 17:06:05 2009 (r194596)
@@ -305,6 +305,17 @@ struct ieee80211req_maclist {
};
/*
+ * HWMP table operations.
+ */
+enum {
+ IEEE80211_HWMP_CMD_LIST = 0, /* list HWMP routing table */
+ IEEE80211_HWMP_CMD_FLUSH = 1, /* flush HWMP routing table */
+ IEEE80211_HWMP_CMD_ADD = 2, /* add entry to the table */
+ IEEE80211_HWMP_CMD_DELETE = 3, /* delete an entry from the table */
+};
+
+
+/*
* Set the active channel list by IEEE channel #: each channel
* to be marked active is set in a bit vector. Note this list is
* intersected with the available channel list in calculating
@@ -642,9 +653,10 @@ struct ieee80211req {
#define IEEE80211_IOC_STBC 113 /* STBC Tx/RX (on, off) */
#define IEEE80211_IOC_MESH_ID 190 /* Mesh identifier */
-#define IEEE80211_IOC_MESH_AP 191 /* Accepting Peerings */
-#define IEEE80211_IOC_MESH_FWRD 192 /* Forward frames */
-#define IEEE80211_IOC_HWMP_TABLE 195 /* HWMP Forwarding Table */
+#define IEEE80211_IOC_MESH_AP 191 /* accepting peerings */
+#define IEEE80211_IOC_MESH_FWRD 192 /* forward frames */
+#define IEEE80211_IOC_MESH_PROTO 193 /* mesh protocols */
+#define IEEE80211_IOC_HWMP_CMD 195 /* HWMP table commands */
#define IEEE80211_IOC_TDMA_SLOT 201 /* TDMA: assigned slot */
#define IEEE80211_IOC_TDMA_SLOTCNT 202 /* TDMA: slots in bss */
More information about the svn-src-projects
mailing list