From owner-svn-src-projects@FreeBSD.ORG Sun Jun 21 17:06:06 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E11D1065673; Sun, 21 Jun 2009 17:06:06 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C57A8FC0C; Sun, 21 Jun 2009 17:06:06 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LH65Fc013084; Sun, 21 Jun 2009 17:06:05 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LH65Qv013081; Sun, 21 Jun 2009 17:06:05 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906211706.n5LH65Qv013081@svn.freebsd.org> From: Rui Paulo Date: Sun, 21 Jun 2009 17:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194596 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 17:06:06 -0000 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 */