Date: Wed, 24 Jun 2009 17:31:38 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r194864 - in projects/mesh11s: sbin/ifconfig sys/net80211 Message-ID: <200906241731.n5OHVcrn022155@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Wed Jun 24 17:31:37 2009 New Revision: 194864 URL: http://svn.freebsd.org/changeset/base/194864 Log: Retire the global mesh TTL and introduce a per vap TTL. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sbin/ifconfig/ifieee80211.c projects/mesh11s/sys/net80211/ieee80211_hwmp.c projects/mesh11s/sys/net80211/ieee80211_hwmp.h projects/mesh11s/sys/net80211/ieee80211_ioctl.h projects/mesh11s/sys/net80211/ieee80211_mesh.c projects/mesh11s/sys/net80211/ieee80211_output.c projects/mesh11s/sys/net80211/ieee80211_var.h Modified: projects/mesh11s/sbin/ifconfig/ifieee80211.c ============================================================================== --- projects/mesh11s/sbin/ifconfig/ifieee80211.c Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sbin/ifconfig/ifieee80211.c Wed Jun 24 17:31:37 2009 (r194864) @@ -1828,6 +1828,12 @@ DECL_CMD_FUNC(set80211tdmabintval, val, } static +DECL_CMD_FUNC(set80211meshttl, val, d) +{ + set80211(s, IEEE80211_IOC_MESH_TTL, atoi(val), 0, NULL); +} + +static DECL_CMD_FUNC(set80211meshforward, val, d) { set80211(s, IEEE80211_IOC_MESH_FWRD, atoi(val), 0, NULL); @@ -4772,6 +4778,9 @@ end: } if (opmode == IEEE80211_M_MBSS) { + if (get80211val(s, IEEE80211_IOC_MESH_TTL, &val) != -1) { + LINE_CHECK("meshttl %u", val); + } if (get80211val(s, IEEE80211_IOC_MESH_AP, &val) != -1) { if (val) LINE_CHECK("meshpeering"); @@ -5185,6 +5194,7 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD_ARG("tdmaslotlen", set80211tdmaslotlen), DEF_CMD_ARG("tdmabintval", set80211tdmabintval), + DEF_CMD_ARG("meshttl", set80211meshttl), DEF_CMD("meshforward", 1, set80211meshforward), DEF_CMD("-meshforward", 0, set80211meshforward), DEF_CMD("meshpeering", 1, set80211meshpeering), Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jun 24 17:31:37 2009 (r194864) @@ -150,8 +150,6 @@ SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, roo MALLOC_DEFINE(M_80211_HWMP, "80211hwmp", "802.11 HWMP routing table"); -extern int ieee80211_mesh_ttl; - /* * Helper functions to manipulate the HWMP routing table. */ @@ -614,7 +612,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, */ prep.prep_flags = 0; prep.prep_hopcount = 0; - prep.prep_ttl = ieee80211_mesh_ttl; + prep.prep_ttl = vap->iv_meshttl; IEEE80211_ADDR_COPY(prep.prep_targetaddr, preq->preq_origaddr); prep.prep_targetseq = preq->preq_origseq; prep.prep_lifetime = preq->preq_lifetime; @@ -680,7 +678,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, ether_sprintf(preq->preq_origaddr)); prep.prep_flags = 0; prep.prep_hopcount = 0; - prep.prep_ttl = ieee80211_mesh_ttl; + prep.prep_ttl = vap->iv_meshttl; IEEE80211_ADDR_COPY(&prep.prep_targetaddr, preq->preq_origaddr); prep.prep_targetseq = fi->fi_seq; @@ -940,7 +938,7 @@ hwmp_recv_rann(struct ieee80211vap *vap, */ preq.preq_flags = 0; preq.preq_hopcount = 0; - preq.preq_ttl = ieee80211_mesh_ttl; + preq.preq_ttl = vap->iv_meshttl; IEEE80211_ADDR_COPY(&preq.preq_origaddr, vap->iv_myaddr); preq.preq_origseq = hs->hs_seq++; @@ -1030,7 +1028,7 @@ ieee80211_hwmp_discover(struct ieee80211 */ preq.preq_flags = 0; preq.preq_hopcount = 0; - preq.preq_ttl = ieee80211_mesh_ttl; + preq.preq_ttl = vap->iv_meshttl; preq.preq_id = fi->fi_preqid; IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr); preq.preq_origseq = fi->fi_seq; Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.h Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.h Wed Jun 24 17:31:37 2009 (r194864) @@ -62,6 +62,7 @@ struct ieee80211_hwmp_state { struct timeval hs_lastprep; /* last time we sent a PREP */ struct timeval hs_lastperr; /* last time we sent a PERR */ struct mtx hs_lock; /* lock for the fi table */ + int hs_rootmode; /* proactive HWMP */ }; void ieee80211_hwmp_vattach(struct ieee80211vap *); Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jun 24 17:31:37 2009 (r194864) @@ -652,10 +652,11 @@ struct ieee80211req { #define IEEE80211_IOC_GREENFIELD 112 /* Greenfield (on, off) */ #define IEEE80211_IOC_STBC 113 /* STBC Tx/RX (on, off) */ -#define IEEE80211_IOC_MESH_ID 190 /* Mesh identifier */ +#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_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_TDMA_SLOT 201 /* TDMA: assigned slot */ Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed Jun 24 17:31:37 2009 (r194864) @@ -90,12 +90,9 @@ static const int ieee80211_mesh_holdingt static const int ieee80211_mesh_confirmtimeout = 4000; #define CONFIRM_TIMEOUT msecs_to_ticks(ieee80211_mesh_confirmtimeout) static const int ieee80211_mesh_maxretries = 2; -int ieee80211_mesh_ttl = 31; SYSCTL_NODE(_net_wlan, OID_AUTO, mesh, CTLFLAG_RD, 0, "IEEE 802.11s parameters"); -SYSCTL_INT(_net_wlan_mesh, OID_AUTO, ttl, CTLTYPE_INT | CTLFLAG_RW, - &ieee80211_mesh_ttl, 0, "TTL for mesh packets"); void ieee80211_mesh_attach(struct ieee80211com *ic) @@ -109,7 +106,7 @@ ieee80211_mesh_detach(struct ieee80211co } static void -mesh_detach_stoptimers(void *arg, struct ieee80211_node *ni) +mesh_vdetach_stoptimers(void *arg, struct ieee80211_node *ni) { callout_stop(&ni->ni_mltimer); } @@ -118,7 +115,7 @@ mesh_detach_stoptimers(void *arg, struct static void mesh_vdetach(struct ieee80211vap *vap) { - ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_detach_stoptimers, + ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_vdetach_stoptimers, NULL); ieee80211_hwmp_vdetach(vap); } @@ -132,6 +129,7 @@ mesh_vattach(struct ieee80211vap *vap) vap->iv_recv_mgmt = mesh_recv_mgmt; vap->iv_meshseq = 0; vap->iv_meshflags = (IEEE80211_MFLAGS_AP | IEEE80211_MFLAGS_FWRD); + vap->iv_meshttl = 31; /* default TTL */ ieee80211_hwmp_vattach(vap); } @@ -1571,6 +1569,9 @@ mesh_ioctl_get80211(struct ieee80211vap case IEEE80211_IOC_MESH_FWRD: ireq->i_val = (vap->iv_meshflags & IEEE80211_MFLAGS_FWRD) != 0; break; + case IEEE80211_IOC_MESH_TTL: + ireq->i_val = vap->iv_meshttl; + break; default: return ENOSYS; } @@ -1612,6 +1613,9 @@ mesh_ioctl_set80211(struct ieee80211vap else vap->iv_meshflags &= ~IEEE80211_MFLAGS_FWRD; break; + case IEEE80211_IOC_MESH_TTL: + vap->iv_meshttl = (uint8_t) ireq->i_val; + break; default: return ENOSYS; } Modified: projects/mesh11s/sys/net80211/ieee80211_output.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_output.c Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_output.c Wed Jun 24 17:31:37 2009 (r194864) @@ -73,8 +73,6 @@ __FBSDID("$FreeBSD$"); #define ETHER_HEADER_COPY(dst, src) \ memcpy(dst, src, sizeof(struct ether_header)) -extern uint32_t ieee80211_mesh_ttl; - static int ieee80211_fragment(struct ieee80211vap *, struct mbuf *, u_int hdrsize, u_int ciphdrsize, u_int mtu); static void ieee80211_tx_mgt_cb(struct ieee80211_node *, void *, int); @@ -1470,7 +1468,7 @@ ieee80211_encap(struct ieee80211vap *vap KASSERT(0, ("meshae %d", meshae)); break; } - mc->mc_ttl = ieee80211_mesh_ttl; + mc->mc_ttl = vap->iv_meshttl; seq = vap->iv_meshseq++; mc->mc_seq[0] = seq & 0xff; mc->mc_seq[1] = (seq >> 8) & 0xff; Modified: projects/mesh11s/sys/net80211/ieee80211_var.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_var.h Wed Jun 24 17:23:10 2009 (r194863) +++ projects/mesh11s/sys/net80211/ieee80211_var.h Wed Jun 24 17:31:37 2009 (r194864) @@ -397,6 +397,7 @@ struct ieee80211vap { int iv_meshidlen; uint8_t iv_meshid[IEEE80211_MESHID_LEN]; uint32_t iv_meshseq; /* seq no for meshcntl */ + uint8_t iv_meshttl; /* mesh ttl set in packets */ #define IEEE80211_MFLAGS_AP 0x01 /* accept peers */ #define IEEE80211_MFLAGS_MP 0x02 /* mesh portal role */ #define IEEE80211_MFLAGS_FWRD 0x04 /* forward packets */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906241731.n5OHVcrn022155>