Date: Wed, 24 Jun 2009 18:00:34 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r194866 - in projects/mesh11s: sbin/ifconfig sys/net80211 Message-ID: <200906241800.n5OI0ZVP022861@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Wed Jun 24 18:00:34 2009 New Revision: 194866 URL: http://svn.freebsd.org/changeset/base/194866 Log: Move the rootmode var to vap and let ifconfig control it. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sbin/ifconfig/ifieee80211.c projects/mesh11s/sys/net80211/ieee80211_hwmp.c projects/mesh11s/sys/net80211/ieee80211_ioctl.h Modified: projects/mesh11s/sbin/ifconfig/ifieee80211.c ============================================================================== --- projects/mesh11s/sbin/ifconfig/ifieee80211.c Wed Jun 24 17:41:29 2009 (r194865) +++ projects/mesh11s/sbin/ifconfig/ifieee80211.c Wed Jun 24 18:00:34 2009 (r194866) @@ -1845,6 +1845,12 @@ DECL_CMD_FUNC(set80211meshpeering, val, set80211(s, IEEE80211_IOC_MESH_AP, atoi(val), 0, NULL); } +static +DECL_CMD_FUNC(set80211hwmprootmode, val, d) +{ + set80211(s, IEEE80211_IOC_HWMP_ROOTMODE, atoi(val), 0, NULL); +} + static int regdomain_sort(const void *a, const void *b) { @@ -4793,6 +4799,25 @@ end: else LINE_CHECK("-meshforward"); } + if (get80211val(s, IEEE80211_IOC_HWMP_ROOTMODE, &val) != -1) { + switch (val) { + case IEEE80211_HWMP_ROOTMODE_DISABLED: + LINE_CHECK("rootmode DISABLED"); + break; + case IEEE80211_HWMP_ROOTMODE_NORMAL: + LINE_CHECK("rootmode NORMAL"); + break; + case IEEE80211_HWMP_ROOTMODE_PROACTIVE: + LINE_CHECK("rootmode PROACTIVE"); + break; + case IEEE80211_HWMP_ROOTMODE_RANN: + LINE_CHECK("rootmode RANN"); + break; + default: + LINE_CHECK("rootmode UNKNOWN(%d)", val); + break; + } + } } LINE_BREAK(); @@ -5199,6 +5224,7 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("-meshforward", 0, set80211meshforward), DEF_CMD("meshpeering", 1, set80211meshpeering), DEF_CMD("-meshpeering", 0, set80211meshpeering), + DEF_CMD_ARG("rootmode", set80211hwmprootmode), /* vap cloning support */ DEF_CLONE_CMD_ARG("wlanaddr", set80211clone_wlanaddr), Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jun 24 17:41:29 2009 (r194865) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jun 24 18:00:34 2009 (r194866) @@ -103,7 +103,6 @@ static inline int hwmp_send_rann(struct struct ieee80211_meshrann_ie *); static int ieee80211_hwmp_maxhops = 31; -static int ieee80211_hwmp_rootmode = 0; /* XXX move to vap */ static int ieee80211_hwmp_targetonly = 0; static int ieee80211_hwmp_replyforward = 1; static const int ieee80211_hwmp_maxprepretries = 3; @@ -143,10 +142,6 @@ SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, tar &ieee80211_hwmp_targetonly, 0, "Set TO bit on generated PREQs"); SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, replyforward, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_replyforward, 0, "Set RF bit on generated PREQs"); -SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, rootmode, CTLTYPE_INT | CTLFLAG_RW, - &ieee80211_hwmp_rootmode, 0, "0 = Not a Root, " - "2 = Root with normal PREPs, 3 = Root with proactive PREPs, " - "3 = Root with RANNs"); MALLOC_DEFINE(M_80211_HWMP, "80211hwmp", "802.11 HWMP routing table"); @@ -1087,44 +1082,49 @@ hwmp_ioctl_get80211(struct ieee80211vap uint8_t *p; int error; - if (vap->iv_opmode != IEEE80211_M_MBSS || - ireq->i_type != IEEE80211_IOC_HWMP_CMD) + if (vap->iv_opmode != IEEE80211_M_MBSS) return ENOSYS; error = 0; - switch (ireq->i_val) { - case IEEE80211_HWMP_CMD_LIST: - len = 0; - HWMP_LOCK(hs); - TAILQ_FOREACH(fi, &hs->hs_head, fi_next) { - len += sizeof(*fi); - } - HWMP_UNLOCK(hs); - if (len > ireq->i_len || ireq->i_len < sizeof(*fi)) - return ENOMEM; - ireq->i_len = len; - p = malloc(len, M_TEMP, M_NOWAIT | M_ZERO); - if (p == NULL) - return ENOMEM; - off = 0; - HWMP_LOCK(hs); - TAILQ_FOREACH(fi, &hs->hs_head, fi_next) { - if (off >= len) - break; - memcpy(p + off, fi, sizeof(*fi)); - off += sizeof(*fi); + switch (ireq->i_type) { + case IEEE80211_IOC_HWMP_CMD: + switch (ireq->i_val) { + case IEEE80211_HWMP_CMD_LIST: + len = 0; + HWMP_LOCK(hs); + TAILQ_FOREACH(fi, &hs->hs_head, fi_next) { + len += sizeof(*fi); + } + HWMP_UNLOCK(hs); + if (len > ireq->i_len || ireq->i_len < sizeof(*fi)) + return ENOMEM; + ireq->i_len = len; + p = malloc(len, M_TEMP, M_NOWAIT | M_ZERO); + if (p == NULL) + return ENOMEM; + off = 0; + HWMP_LOCK(hs); + TAILQ_FOREACH(fi, &hs->hs_head, fi_next) { + if (off >= len) + break; + memcpy(p + off, fi, sizeof(*fi)); + off += sizeof(*fi); + } + HWMP_UNLOCK(hs); + 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; } - HWMP_UNLOCK(hs); - error = copyout(p, (uint8_t *) ireq->i_data, ireq->i_len); - free(p, M_TEMP); + case IEEE80211_IOC_HWMP_ROOTMODE: + ireq->i_val = hs->hs_rootmode; break; - case IEEE80211_HWMP_CMD_FLUSH: - case IEEE80211_HWMP_CMD_ADD: - case IEEE80211_HWMP_CMD_DELETE: - return EINVAL; - default: - return ENOSYS; } - return error; } IEEE80211_IOCTL_GET(hwmp, hwmp_ioctl_get80211); @@ -1136,38 +1136,49 @@ hwmp_ioctl_set80211(struct ieee80211vap struct ieee80211_hwmp_fi *fi, *next; int error; - if (vap->iv_opmode != IEEE80211_M_MBSS || - ireq->i_type != IEEE80211_IOC_HWMP_CMD) + if (vap->iv_opmode != IEEE80211_M_MBSS) return ENOSYS; error = 0; - switch (ireq->i_val) { - case IEEE80211_HWMP_CMD_LIST: - return EINVAL; - case IEEE80211_HWMP_CMD_FLUSH: - hwmp_rt_flush(vap); - 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); + switch (ireq->i_type) { + case IEEE80211_IOC_HWMP_CMD: + switch (ireq->i_val) { + case IEEE80211_HWMP_CMD_LIST: + return EINVAL; + case IEEE80211_HWMP_CMD_FLUSH: + hwmp_rt_flush(vap); + 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; } - HWMP_UNLOCK(hs); + break; + case IEEE80211_IOC_HWMP_ROOTMODE: + if (ireq->i_val < 0 || ireq->i_val > 3) + return EINVAL; + hs->hs_rootmode = ireq->i_val; break; default: return ENOSYS; } - return error; } IEEE80211_IOCTL_SET(hwmp, hwmp_ioctl_set80211); Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jun 24 17:41:29 2009 (r194865) +++ projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jun 24 18:00:34 2009 (r194866) @@ -313,6 +313,15 @@ enum { IEEE80211_HWMP_CMD_ADD = 2, /* add entry to the table */ IEEE80211_HWMP_CMD_DELETE = 3, /* delete an entry from the table */ }; +/* + * HWMP root modes + */ +enum { + IEEE80211_HWMP_ROOTMODE_DISABLED = 0, /* disabled */ + IEEE80211_HWMP_ROOTMODE_NORMAL = 1, /* normal PREPs */ + IEEE80211_HWMP_ROOTMODE_PROACTIVE = 2, /* proactive PREPS */ + IEEE80211_HWMP_ROOTMODE_RANN = 3, /* use RANN elemid */ +}; /* @@ -658,6 +667,7 @@ struct ieee80211req { #define IEEE80211_IOC_MESH_PROTO 193 /* mesh protocols */ #define IEEE80211_IOC_MESH_TTL 194 /* mesh TTL */ #define IEEE80211_IOC_HWMP_CMD 195 /* HWMP table commands */ +#define IEEE80211_IOC_HWMP_ROOTMODE 196 /* HWMP root mode */ #define IEEE80211_IOC_TDMA_SLOT 201 /* TDMA: assigned slot */ #define IEEE80211_IOC_TDMA_SLOTCNT 202 /* TDMA: slots in bss */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906241800.n5OI0ZVP022861>