svn commit: r234230 - head/share/misc
Author: monthadar Date: Fri Apr 13 16:53:00 2012 New Revision: 234230 URL: http://svn.freebsd.org/changeset/base/234230 Log: Add myself as a new committer and add adrian as my mentor. Approved by: adrian (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Fri Apr 13 16:42:54 2012 (r234229) +++ head/share/misc/committers-src.dot Fri Apr 13 16:53:00 2012 (r234230) @@ -195,6 +195,7 @@ mdodd [label="Matthew N. Dodd\nmdodd@Fre melifaro [label="Alexander V. Chernikov\nmelif...@freebsd.org\n2011/10/04"] mjacob [label="Matt Jacob\nmja...@freebsd.org\n1997/08/13"] mlaier [label="Max Laier\nmla...@freebsd.org\n2004/02/10"] +monthadar [label="Monthadar Al Jaberi\nmontha...@freebsd.org\n2012/04/02"] mr [label="Michael Reifenberger\n...@freebsd.org\n2001/09/30"] mux [label="Maxime Henrion\n...@freebsd.org\n2002/03/03"] neel [label="Neel Natu\nn...@freebsd.org\n2009/09/20"] @@ -280,6 +281,7 @@ day1 -> rgrimes day1 -> alm day1 -> dg +adrian -> monthadar adrian -> ray adrian -> rmh ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234874 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:35:10 2012 New Revision: 234874 URL: http://svn.freebsd.org/changeset/base/234874 Log: Added Self-protected action category (including MPM). * Added new action category IEEE80211_ACTION_CAT_SELF_PROT which is used by 11s for Mesh Peering Management; * Updated Self protected enum Action codes to start from 1 instead of 0 according to the standard spec; * Removed old and wrong action categories IEEE80211_ACTION_CAT_MESHPEERING; * Modified ieee80211_mesh.c and ieee80211_action.c to use the new action category code; * Added earlier verification code in ieee80211_input; Approved by: adrian Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_input.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Tue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211.h Tue May 1 15:35:10 2012 (r234874) @@ -333,6 +333,8 @@ struct ieee80211_action { #defineIEEE80211_ACTION_CAT_BA 3 /* BA */ #defineIEEE80211_ACTION_CAT_HT 7 /* HT */ #defineIEEE80211_ACTION_CAT_MESH 13 /* Mesh */ +#defineIEEE80211_ACTION_CAT_SELF_PROT 15 /* Self-protected */ +/* 16 - 125 reserved */ #defineIEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */ #defineIEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ Modified: head/sys/net80211/ieee80211_action.c == --- head/sys/net80211/ieee80211_action.cTue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211_action.cTue May 1 15:35:10 2012 (r234874) @@ -94,7 +94,7 @@ ieee80211_send_action_register(int cat, break; ht_send_action[act] = f; return 0; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act >= N(meshpl_send_action)) break; meshpl_send_action[act] = f; @@ -144,7 +144,7 @@ ieee80211_send_action(struct ieee80211_n if (act < N(ht_send_action)) f = ht_send_action[act]; break; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act < N(meshpl_send_action)) f = meshpl_send_action[act]; break; @@ -215,7 +215,7 @@ ieee80211_recv_action_register(int cat, break; ht_recv_action[act] = f; return 0; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act >= N(meshpl_recv_action)) break; meshpl_recv_action[act] = f; @@ -269,7 +269,7 @@ ieee80211_recv_action(struct ieee80211_n if (ia->ia_action < N(ht_recv_action)) f = ht_recv_action[ia->ia_action]; break; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (ia->ia_action < N(meshpl_recv_action)) f = meshpl_recv_action[ia->ia_action]; break; Modified: head/sys/net80211/ieee80211_input.c == --- head/sys/net80211/ieee80211_input.c Tue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211_input.c Tue May 1 15:35:10 2012 (r234874) @@ -792,6 +792,24 @@ ieee80211_parse_action(struct ieee80211_ return EINVAL; } break; + case IEEE80211_ACTION_CAT_SELF_PROT: + /* If TA or RA group address discard silently */ + if (IEEE80211_IS_MULTICAST(wh->i_addr1) || + IEEE80211_IS_MULTICAST(wh->i_addr2)) + return EINVAL; + /* +* XXX: Should we verify complete length now or it is +* to varying in sizes? +*/ + switch (ia->ia_action) { + case IEEE80211_ACTION_MESHPEERING_CONFIRM: + case IEEE80211_ACTION_MESHPEERING_CLOSE: + /* is not a peering candidate (yet) */ + if (ni == vap->iv_bss) + return EINVAL; + break; + } + break; #endif } return 0; Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 14:48
svn commit: r234875 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:39:16 2012 New Revision: 234875 URL: http://svn.freebsd.org/changeset/base/234875 Log: Modified structure and code that handles Mesh peering management. * Old struct ieee80211_meshpeer_ie had wrong peer_proto field size; * Added IEEE80211_MPM_* size macros; * Created an enum for the Mesh Peering Protocol Identifier field according to the standard spec and removed old defines; * Abbreviated Handshake Protocol is not used by the standard anymore; * Modified mesh_verify_meshpeer to use IEEE80211_MPM_* macros for verification; * Modified mesh_parse_meshpeering_action to parse complete frame, also to parse it according to the standard spec; * Modified ieee80211_add_meshpeer to construct correct MPM frames according to the standard spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:35:10 2012 (r234874) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:39:16 2012 (r234875) @@ -1573,8 +1573,7 @@ mesh_recv_ctl(struct ieee80211_node *ni, } /* - * Parse meshpeering action ie's for open+confirm frames; the - * important bits are returned in the supplied structure. + * Parse meshpeering action ie's for open+confirm frames */ static const struct ieee80211_meshpeer_ie * mesh_parse_meshpeering_action(struct ieee80211_node *ni, @@ -1600,15 +1599,27 @@ mesh_parse_meshpeering_action(struct iee meshpeer = frm; mpie = (const struct ieee80211_meshpeer_ie *) frm; memset(mp, 0, sizeof(*mp)); + mp->peer_proto = LE_READ_2(&mpie->peer_proto); mp->peer_llinkid = LE_READ_2(&mpie->peer_llinkid); - /* NB: peer link ID is optional on these frames */ - if (subtype == IEEE80211_ACTION_MESHPEERING_CLOSE && - mpie->peer_len == 8) { - mp->peer_linkid = 0; - mp->peer_rcode = LE_READ_2(&mpie->peer_linkid); - } else { - mp->peer_linkid = LE_READ_2(&mpie->peer_linkid); - mp->peer_rcode = LE_READ_2(&mpie->peer_rcode); + switch (subtype) { + case IEEE80211_ACTION_MESHPEERING_CONFIRM: + mp->peer_linkid = + LE_READ_2(&mpie->peer_linkid); + break; + case IEEE80211_ACTION_MESHPEERING_CLOSE: + /* NB: peer link ID is optional */ + if (mpie->peer_len == + (IEEE80211_MPM_BASE_SZ + 2)) { + mp->peer_linkid = 0; + mp->peer_rcode = + LE_READ_2(&mpie->peer_linkid); + } else { + mp->peer_linkid = + LE_READ_2(&mpie->peer_linkid); + mp->peer_rcode = + LE_READ_2(&mpie->peer_rcode); + } + break; } break; } @@ -2337,22 +2348,31 @@ mesh_verify_meshpeer(struct ieee80211vap const struct ieee80211_meshpeer_ie *meshpeer = (const struct ieee80211_meshpeer_ie *) ie; - if (meshpeer == NULL || meshpeer->peer_len < 6 || - meshpeer->peer_len > 10) + if (meshpeer == NULL || + meshpeer->peer_len < IEEE80211_MPM_BASE_SZ || + meshpeer->peer_len > IEEE80211_MPM_MAX_SZ) return 1; + if (meshpeer->peer_proto != IEEE80211_MPPID_MPM) { + IEEE80211_DPRINTF(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + "Only MPM protocol is supported (proto: 0x%02X)", + meshpeer->peer_proto); + return 1; + } switch (subtype) { case IEEE80211_ACTION_MESHPEERING_OPEN: - if (meshpeer->peer_len != 6) + if (meshpeer->peer_len != IEEE80211_MPM_BASE_SZ) return 1; break; case IEEE80211_ACTION_MESHPEERING_CONFIRM: - if (meshpeer->peer_len != 8) + if (meshpeer->peer_len != IEEE80211_MPM_BASE_SZ + 2) return 1; break; case IEEE80211_ACTION_MESHPEERING_CLOSE: - if (meshpeer->peer_len < 8) + if (meshpeer->peer_le
svn commit: r234876 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:42:41 2012 New Revision: 234876 URL: http://svn.freebsd.org/changeset/base/234876 Log: Fixed some MPM reason codes and max number of neighbors check * Added IEEE80211_MESH_MAX_NEIGHBORS and it is set to 15, same as before; * Modified mesh_parse_meshpeering_action to verify MPM frame and send correct reason code for when a frame is rejected according to standard spec; * Modified mesh_recv_action_meshpeering_* according to the standard spec; * Modified mesh_peer_timeout_cb to always send CLOSE frame when in CONFIRMRCV state according to the standard spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:39:16 2012 (r234875) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:42:41 2012 (r234876) @@ -1573,7 +1573,7 @@ mesh_recv_ctl(struct ieee80211_node *ni, } /* - * Parse meshpeering action ie's for open+confirm frames + * Parse meshpeering action ie's for MPM frames */ static const struct ieee80211_meshpeer_ie * mesh_parse_meshpeering_action(struct ieee80211_node *ni, @@ -1583,7 +1583,9 @@ mesh_parse_meshpeering_action(struct iee { struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_meshpeer_ie *mpie; + uint16_t args[3]; const uint8_t *meshid, *meshconf, *meshpeer; + uint8_t sendclose = 0; /* 1 = MPM frame rejected, close will be sent */ meshid = meshconf = meshpeer = NULL; while (efrm - frm > 1) { @@ -1599,6 +1601,7 @@ mesh_parse_meshpeering_action(struct iee meshpeer = frm; mpie = (const struct ieee80211_meshpeer_ie *) frm; memset(mp, 0, sizeof(*mp)); + mp->peer_len = mpie->peer_len; mp->peer_proto = LE_READ_2(&mpie->peer_proto); mp->peer_llinkid = LE_READ_2(&mpie->peer_llinkid); switch (subtype) { @@ -1627,22 +1630,46 @@ mesh_parse_meshpeering_action(struct iee } /* -* Verify the contents of the frame. Action frames with -* close subtype don't have a Mesh Configuration IE. -* If if fails validation, close the peer link. +* Verify the contents of the frame. +* If it fails validation, close the peer link. */ - KASSERT(meshpeer != NULL && - subtype != IEEE80211_ACTION_MESHPEERING_CLOSE, - ("parsing close action")); - - if (mesh_verify_meshid(vap, meshid) || - mesh_verify_meshpeer(vap, subtype, meshpeer) || - mesh_verify_meshconf(vap, meshconf)) { - uint16_t args[3]; + if (mesh_verify_meshpeer(vap, subtype, (const uint8_t *)mp)) { + sendclose = 1; + IEEE80211_DISCARD(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + wh, NULL, "%s", "MPM validation failed"); + } + /* If meshid is not the same reject any frames type. */ + if (sendclose == 0 && mesh_verify_meshid(vap, meshid)) { + sendclose = 1; IEEE80211_DISCARD(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, wh, NULL, "%s", "not for our mesh"); + if (subtype == IEEE80211_ACTION_MESHPEERING_CLOSE) { + /* +* Standard not clear about this, if we dont ignore +* there will be an endless loop between nodes sending +* CLOSE frames between each other with wrong meshid. +* Discard and timers will bring FSM to IDLE state. +*/ + return NULL; + } + } + + /* +* Close frames are accepted if meshid is the same. +* Verify the other two types. +*/ + if (sendclose == 0 && subtype != IEEE80211_ACTION_MESHPEERING_CLOSE && + mesh_verify_meshconf(vap, meshconf)) { + sendclose = 1; + IEEE80211_DISCARD(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + wh, NULL, "%s", "configuration missmatch"); + } + + if (sendclose) { vap->iv_stats.is_rx_mgtdiscard++; switch (ni->ni_mlstate) { case IEEE80211_NODE_MESH_IDLE: @@ -1655,7 +1682,15 @@ mesh_parse_meshpeering_action(struct iee case IEEE80211_NODE_MESH_CONFIRMRCV: args[0] = ni->ni_mlpid; args[1] = ni->ni_mllid; - args[2] = IEEE80211_REASON_PEER_LINK_CANCELED; + /* Reason codes for rejection */ + switch (s
svn commit: r234877 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:47:30 2012 New Revision: 234877 URL: http://svn.freebsd.org/changeset/base/234877 Log: Implemented so that Mesh forwarding information lifetime is dynamic. * Introduced ieee80211_mesh_rt_update that updates a route with the maximum(lifetime left, new lifetime); * Modified ieee80211_mesh_route struct by adding a lock that will be used by both ieee80211_mesh_rt_update and precursor code (added in future commit); * Modified in ieee80211_hwmp.c HWMP code to use new ieee80211_mesh_rt_update; * Modified mesh_rt_flush_invalid to use new ieee80211_mesh_rt_update; * mesh_rt_flush also checks that lifetime == 0, this gives route discovery a change to complete; * Modified mesh_recv_mgmt case IEEE80211_FC0_SUBTYPE_BEACON: when ever we received a beacon from a neighbor we update route lifetime; Approved by: adrian Modified: head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_ddb.c == --- head/sys/net80211/ieee80211_ddb.c Tue May 1 15:42:41 2012 (r234876) +++ head/sys/net80211/ieee80211_ddb.c Tue May 1 15:47:30 2012 (r234877) @@ -870,8 +870,10 @@ _db_show_mesh(const struct ieee80211_mes TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { db_printf("entry %d:\tdest: %6D nexthop: %6D metric: %u", i, rt->rt_dest, ":", rt->rt_nexthop, ":", rt->rt_metric); + db_printf("\tlifetime: %u lastseq: %u priv: %p\n", - rt->rt_lifetime, rt->rt_lastmseq, rt->rt_priv); + ieee80211_mesh_rt_update(rt, 0), + rt->rt_lastmseq, rt->rt_priv); i++; } } Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:42:41 2012 (r234876) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:47:30 2012 (r234877) @@ -143,9 +143,6 @@ typedef uint32_t ieee80211_hwmp_seq; #defineHWMP_SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) #defineHWMP_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) -/* The longer one of the lifetime should be stored as new lifetime */ -#define MESH_ROUTE_LIFETIME_MAX(a, b) (a > b ? a : b) - /* * Private extension of ieee80211_mesh_route. */ @@ -938,7 +935,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ - if(HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || + if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && preq->preq_metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; @@ -946,8 +943,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig->rt_metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); rtorig->rt_nhops = preq->preq_hopcount + 1; - rtorig->rt_lifetime = MESH_ROUTE_LIFETIME_MAX( - preq->preq_lifetime, rtorig->rt_lifetime); + ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; }else if(hrtarg != NULL && @@ -1124,7 +1120,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, } } rt->rt_metric = preq->preq_metric; - rt->rt_lifetime = preq->preq_lifetime; + ieee80211_mesh_rt_update(rt, preq->preq_lifetime); hrorig = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); hrorig->hr_seq = preq->preq_origseq; @@ -1221,7 +1217,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, } IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); rt->rt_nhops = prep->prep_hopcount; - rt->rt_lifetime = prep->prep_lifetime; + ieee80211_mesh_rt_update(rt, prep->prep_lifetime); rt->rt_metric = prep->prep_metric; rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1300,7 +1296,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric, prep->prep_metric); IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); rt->rt_nhops = prep->prep_hopcount + 1; - rt->rt_lifetime = prep->prep_l
svn commit: r234878 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:56:26 2012 New Revision: 234878 URL: http://svn.freebsd.org/changeset/base/234878 Log: Mesh forwarding with proxy support. * Modified HWMP PREP/PREQ to contain a proxy entry and also changed PREP frame processing according to amendment as following: o Fixed PREP to always update/create if acceptance criteria is meet; o PREQ processing to reply if request is for a proxy entry that is proxied by us; o Removed hwmp_discover call from PREQ, because sending a PREP will build the forward path, and by receving and accepting a PREQ we have already built the reverse path (non-proactive code); * Disabled code for pro-active in PREP for now (will make a separate patch for pro-active HWMP routing later) * Added proxy information for a Mesh route, mesh gate to use and proxy seqno; * Modified ieee80211_encap according to amendment; * Introduced Mesh control address extension enum and removed unused struct, also rename some structure element names. * Modified mesh_input and added mesh_recv_* that should verify and process mesh data frames according to 9.32 Mesh forwarding framework in amendment; * Modified mesh_decap accordingly to changes done in mesh control AE struct; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:47:30 2012 (r234877) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:56:26 2012 (r234878) @@ -143,6 +143,8 @@ typedef uint32_t ieee80211_hwmp_seq; #defineHWMP_SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) #defineHWMP_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) +#define HWMP_SEQ_MAX(a, b) (a > b ? a : b) + /* * Private extension of ieee80211_mesh_route. */ @@ -866,7 +868,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq) { struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211_mesh_route *rt = NULL; + struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; struct ieee80211_mesh_route *rttarg = NULL; struct ieee80211_hwmp_route *hrorig = NULL; @@ -963,31 +965,44 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * Check if the PREQ is addressed to us. +* or a Proxy currently supplied by us. */ - if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "reply to %6D", preq->preq_origaddr, ":"); + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || + (rttarg != NULL && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { /* -* Build and send a PREP frame. +* When we are the target we shall update our own HWMP seq +* number with max of (current and preq->seq) + 1 */ + hs->hs_seq = HWMP_SEQ_MAX(hs->hs_seq, PREQ_TSEQ(0)) + 1; + prep.prep_flags = 0; + if (rttarg != NULL && /* if NULL it means we are the target */ + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "reply for proxy %6D", rttarg->rt_dest, ":"); + prep.prep_flags |= IEEE80211_MESHPREP_FLAGS_AE; + IEEE80211_ADDR_COPY(prep.prep_target_ext_addr, + rttarg->rt_dest); + /* update proxy seqno to HWMP seqno */ + rttarg->rt_ext_seq = hs->hs_seq; + } + /* +* Build and send a PREP frame. +*/ prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); - prep.prep_targetseq = ++hs->hs_seq; + prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; + + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "reply to %6D", preq->preq_origaddr, ":"); hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep); - /* -* Build the reverse path, if we don't have it al
svn commit: r234879 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:58:10 2012 New Revision: 234879 URL: http://svn.freebsd.org/changeset/base/234879 Log: Added route lifetime update for destination and source mesh along a mesh path; * In mesh_recv_indiv_data_to_fwd update route entry for both meshDA and meshSA; * In mesh_recv_indiv_data_to_me update route entry for meshSA; * in ieee80211_mesh_rt_update put code so that a proxy entry that is gated by us (number of hops == 0) is never invalidated; * Fixed so that we always call ieee80211_mesh_rt_update with lifetime in ms; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:56:26 2012 (r234878) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:58:10 2012 (r234879) @@ -241,6 +241,13 @@ ieee80211_mesh_rt_update(struct ieee8021 now = ticks; RT_ENTRY_LOCK(rt); + + /* dont clobber a proxy entry gated by us */ + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && rt->rt_nhops == 0) { + RT_ENTRY_UNLOCK(rt); + return rt->rt_lifetime; + } + timesince = ticks_to_msecs(now - rt->rt_updtime); rt->rt_updtime = now; if (timesince >= rt->rt_lifetime) { @@ -1115,16 +1122,31 @@ static int mesh_recv_indiv_data_to_fwrd(struct ieee80211vap *vap, struct mbuf *m, struct ieee80211_frame *wh, const struct ieee80211_meshcntl *mc) { + struct ieee80211_qosframe_addr4 *qwh; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_route *rt_meshda, *rt_meshsa; + + qwh = (struct ieee80211_qosframe_addr4 *)wh; /* * TODO: * o verify addr2 is a legitimate transmitter -* o set lifetime of addr3 to initial value -* o set lifetime of addr4 to initial value * o lifetime of precursor of addr3 (addr2) is max(init, curr) * o lifetime of precursor of addr4 (nexthop) is max(init, curr) */ + /* set lifetime of addr3 (meshDA) to initial value */ + rt_meshda = ieee80211_mesh_rt_find(vap, qwh->i_addr3); + KASSERT(rt_meshda != NULL, ("no route")); + ieee80211_mesh_rt_update(rt_meshda, ticks_to_msecs( + ms->ms_ppath->mpp_inact)); + + /* set lifetime of addr4 (meshSA) to initial value */ + rt_meshsa = ieee80211_mesh_rt_find(vap, qwh->i_addr4); + KASSERT(rt_meshsa != NULL, ("no route")); + ieee80211_mesh_rt_update(rt_meshsa, ticks_to_msecs( + ms->ms_ppath->mpp_inact)); + mesh_forward(vap, m, mc); return (1); /* dont process locally */ } @@ -1144,6 +1166,7 @@ mesh_recv_indiv_data_to_me(struct ieee80 { struct ieee80211_qosframe_addr4 *qwh; const struct ieee80211_meshcntl_ae10 *mc10; + struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; int ae; @@ -1153,10 +1176,15 @@ mesh_recv_indiv_data_to_me(struct ieee80 /* * TODO: * o verify addr2 is a legitimate transmitter -* o set lifetime of addr4 to initial value * o lifetime of precursor entry is max(init, curr) */ + /* set lifetime of addr4 (meshSA) to initial value */ + rt = ieee80211_mesh_rt_find(vap, qwh->i_addr4); + KASSERT(rt != NULL, ("no route")); + ieee80211_mesh_rt_update(rt, ticks_to_msecs(ms->ms_ppath->mpp_inact)); + rt = NULL; + ae = mc10->mc_flags & IEEE80211_MESH_AE_MASK; KASSERT(ae == IEEE80211_MESH_AE_00 || ae == IEEE80211_MESH_AE_10, ("bad AE %d", ae)); @@ -1673,7 +1701,8 @@ mesh_recv_mgmt(struct ieee80211_node *ni rt = ieee80211_mesh_rt_find(vap, wh->i_addr2); if(rt != NULL) { ieee80211_mesh_rt_update(rt, - ms->ms_ppath->mpp_inact); + ticks_to_msecs( + ms->ms_ppath->mpp_inact)); } break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234880 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:00:31 2012 New Revision: 234880 URL: http://svn.freebsd.org/changeset/base/234880 Log: * MeshForwarding update mesh_recv_indiv_data_to_fwrd to silently discard unknown meshDA instead of panic, which is allowed per amendment spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:58:10 2012 (r234879) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 16:00:31 2012 (r234880) @@ -1137,7 +1137,19 @@ mesh_recv_indiv_data_to_fwrd(struct ieee /* set lifetime of addr3 (meshDA) to initial value */ rt_meshda = ieee80211_mesh_rt_find(vap, qwh->i_addr3); - KASSERT(rt_meshda != NULL, ("no route")); + if (rt_meshda == NULL) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, qwh->i_addr2, + "no route to meshDA(%6D)", qwh->i_addr3, ":"); + /* +* [Optional] any of the following three actions: +* o silently discard [X] +* o trigger a path discovery [ ] +* o inform TA that meshDA is unknown. [ ] +*/ + /* XXX: stats */ + return (-1); + } + ieee80211_mesh_rt_update(rt_meshda, ticks_to_msecs( ms->ms_ppath->mpp_inact)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234881 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:02:31 2012 New Revision: 234881 URL: http://svn.freebsd.org/changeset/base/234881 Log: PREP update * Added assertion in mesh_rt_update; * Fixed some prep propagation that where multicast, ALL PREPS ARE UNICAST; * Fixed PREP acceptance criteria; * Fixed some PREP debug messages; * HWMP intermediate reply (PREP) should only be sent if we have newer forwarding infomration (FI) about target; * Fixed PREP propagation condition and PREP w/ AE handling; * Ignore PREPs that have unknown originator. * Removed old code inside PREP that was for proactive path building to root mesh; Other errors include: * use seq number of target and not orig mesh STA; * Metric is what we have stored in our FI; * Error in amendment, Hop count is not 0 but equals FI hopcount for target; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:00:31 2012 (r234880) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:02:31 2012 (r234881) @@ -887,7 +887,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, return; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "received PREQ, source %6D", preq->preq_origaddr, ":"); + "received PREQ, orig %6D, targ(0) %6D", preq->preq_origaddr, ":", + PREQ_TADDR(0), ":"); /* * Acceptance criteria: if the PREQ is not for us or not broadcast @@ -1010,9 +1011,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, * root STA if requested. */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && - (PREQ_TFLAGS(0) & - ((IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF) == - (IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF { + (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { uint8_t rootmac[IEEE80211_ADDR_LEN]; IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr); @@ -1096,26 +1095,26 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Check if we can send an intermediate Path Reply, * i.e., Target Only bit is not set. */ - if (!(PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { + if (!(PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO) && + HWMP_SEQ_GEQ(hrtarg->hr_seq, PREQ_TSEQ(0))) { struct ieee80211_meshprep_ie prep; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "intermediate reply for PREQ from %6D", preq->preq_origaddr, ":"); prep.prep_flags = 0; - prep.prep_hopcount = rt->rt_nhops + 1; + prep.prep_hopcount = rttarg->rt_nhops; prep.prep_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(&prep.prep_targetaddr, PREQ_TADDR(0)); - prep.prep_targetseq = hrorig->hr_seq; + prep.prep_targetseq = hrtarg->hr_seq; prep.prep_lifetime = preq->preq_lifetime; - prep.prep_metric = rt->rt_metric + - ms->ms_pmetric->mpm_metric(ni); + prep.prep_metric =rttarg->rt_metric; IEEE80211_ADDR_COPY(&prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = hrorig->hr_seq; hwmp_send_prep(ni, vap->iv_myaddr, - broadcastaddr, &prep); + rtorig->rt_nexthop, &prep); } /* * We have no information about this path, @@ -1191,6 +1190,9 @@ static void hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshprep_ie *prep) { +#defineIS_PROXY(rt)(rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) +#definePROXIED_BY_US(rt) \ +(IEEE80211_ADDR_EQ(vap->iv_myaddr, rt->rt_mesh_gate)) struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_mesh_route *rt = NULL; @@ -1203,63 +1205,31 @@ hwmp_recv_prep(struct ieee80211vap *vap, uint32_t metric = 0; const uint8_t *addr; - /* -* Acceptance criteria: If the corresponding PREP was not generated -* by us or g
svn commit: r234882 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:03:27 2012 New Revision: 234882 URL: http://svn.freebsd.org/changeset/base/234882 Log: Change how we enforce PREQ minimum interval. * Moved hs_lastpreq to be hr_lastpreq cause this rate check should be per target mesh STA according to amendment (NB: not applicable for PERR); * Modified hwmp_send_preq to use two extra arguments for last sent PREQ and minimum PREQ interval; * hwmp_send_preq is called with last two arguments equal to NULL when sending Proactive PREQs cause the call back task enforces the rate check; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:02:31 2012 (r234881) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:03:27 2012 (r234882) @@ -89,7 +89,8 @@ static void hwmp_recv_preq(struct ieee80 static int hwmp_send_preq(struct ieee80211_node *, const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], - struct ieee80211_meshpreq_ie *); + struct ieee80211_meshpreq_ie *, + struct timeval *, struct timeval *); static voidhwmp_recv_prep(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshprep_ie *); @@ -152,14 +153,14 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_seq; /* last HWMP seq seen from dst*/ ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ + struct timeval hr_lastpreq;/* last time we sent a PREQ */ int hr_preqretries; }; struct ieee80211_hwmp_state { ieee80211_hwmp_seq hs_seq; /* next seq to be used */ ieee80211_hwmp_seq hs_preqid; /* next PREQ ID to be used */ - struct timeval hs_lastpreq;/* last time we sent a PREQ */ - struct timeval hs_lastperr;/* last time we sent a PERR */ int hs_rootmode;/* proactive HWMP */ + struct timeval hs_lastperr;/* last time we sent a PERR */ struct callout hs_roottimer; uint8_t hs_maxhops; /* max hop count */ }; @@ -824,7 +825,8 @@ hwmp_rootmode_cb(void *arg) IEEE80211_MESHPREQ_TFLAGS_RF; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq); + hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, + NULL, NULL);/* NB: we enforce rate check ourself */ hwmp_rootmode_setup(vap); } #undef PREQ_TFLAGS @@ -1051,7 +1053,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, hwmp_discover(vap, rootmac, NULL); return; } - rt = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); /* * Forwarding and Intermediate reply for PREQs with 1 target. @@ -1063,8 +1064,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * We have a valid route to this node. */ - if (rt != NULL && - (rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { + if (rttarg != NULL && + (rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { if (preq->preq_ttl > 1 && preq->preq_hopcount < hs->hs_maxhops) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1072,7 +1073,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, preq->preq_origaddr, ":"); /* * Propagate the original PREQ. -* PREQ is unicast now to rt->rt_nexthop +* PREQ is unicast now to rttarg->rt_nexthop */ ppreq.preq_flags &= ~IEEE80211_MESHPREQ_FLAGS_AM; @@ -1089,7 +1090,9 @@ hwmp_recv_preq(struct ieee80211vap *vap, ppreq.preq_targets[0].target_flags &= ~IEEE80211_MESHPREQ_TFLAGS_RF; hwmp_send_preq(ni, vap->iv_myaddr, - rt->rt_nexthop, &ppreq); + rttarg->rt_nexthop, &ppreq, + &hrtarg->hr_lastpreq, + &ieee80211_hwmp_preqminint); } /* * Check if we can send an intermedi
svn commit: r234883 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:05:09 2012 New Revision: 234883 URL: http://svn.freebsd.org/changeset/base/234883 Log: * Added a mesh max PREQ retires sysctl that governous how many times we try to discover an address; * Added a mesh net travelse time across an MBSS, which is used to enforce discovery rate check; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:03:27 2012 (r234882) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:05:09 2012 (r234883) @@ -154,7 +154,8 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ struct timeval hr_lastpreq;/* last time we sent a PREQ */ - int hr_preqretries; + int hr_preqretries; /* number of discoveries */ + int hr_lastdiscovery; /* last discovery in ticks */ }; struct ieee80211_hwmp_state { ieee80211_hwmp_seq hs_seq; /* next seq to be used */ @@ -177,6 +178,15 @@ static int ieee80211_hwmp_pathtimeout = SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "path entry lifetime (ms)"); +static int ieee80211_hwmp_maxpreq_retries = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, maxpreq_retries, CTLTYPE_INT | CTLFLAG_RW, +&ieee80211_hwmp_maxpreq_retries, 0, ieee80211_sysctl_msecs_ticks, "I", +"maximum number of preq retries"); +static int ieee80211_hwmp_net_diameter_traversaltime = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, net_diameter_traversal_time, +CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_net_diameter_traversaltime, 0, +ieee80211_sysctl_msecs_ticks, "I", +"estimate travelse time across the MBSS (ms)"); static int ieee80211_hwmp_roottimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, roottimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_roottimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -212,10 +222,17 @@ SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, in static void ieee80211_hwmp_init(void) { + /* Default values as per amendment */ ieee80211_hwmp_pathtimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_rootint = msecs_to_ticks(2*1000); ieee80211_hwmp_rannint = msecs_to_ticks(1*1000); + ieee80211_hwmp_maxpreq_retries = 3; + /* +* (TU): A measurement of time equal to 1024 μs, +* 500 TU is 512 ms. +*/ + ieee80211_hwmp_net_diameter_traversaltime = msecs_to_ticks(512); /* * Register action frame handler. @@ -1288,6 +1305,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; + hr->hr_preqretries = 0; IEEE80211_ADDR_COPY(rt->rt_nexthop, ni->ni_macaddr); rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; @@ -1648,13 +1666,31 @@ hwmp_discover(struct ieee80211vap *vap, hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + if (hr->hr_lastdiscovery != 0 && + (ticks - hr->hr_lastdiscovery < + (ieee80211_hwmp_net_diameter_traversaltime * 2))) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "too frequent discovery requeust"); + /* XXX: stats? */ + goto done; + } + hr->hr_lastdiscovery = ticks; + if (hr->hr_preqretries >= + ieee80211_hwmp_maxpreq_retries) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "no valid path , max number of discovery"); + vap->iv_stats.is_mesh_fwd_nopath++; + goto done; + } + hr->hr_preqretries++; if (hr->hr_origseq == 0) hr->hr_origseq = ++hs->hs_seq; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; /* XXX: special discovery timeout, larger lifetime? */ ieee80211_mesh_rt_update(rt, ticks_to_msecs(ieee80211_hwmp_pathtimeout)); -
svn commit: r234884 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:06:20 2012 New Revision: 234884 URL: http://svn.freebsd.org/changeset/base/234884 Log: * Fixed PREQ flag field Adressing mode subfiled according to amendment specs; Approved by: adria Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:05:09 2012 (r234883) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:06:20 2012 (r234884) @@ -824,7 +824,7 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PR; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) @@ -1092,8 +1092,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Propagate the original PREQ. * PREQ is unicast now to rttarg->rt_nexthop */ - ppreq.preq_flags &= - ~IEEE80211_MESHPREQ_FLAGS_AM; + ppreq.preq_flags |= + IEEE80211_MESHPREQ_FLAGS_AM; ppreq.preq_hopcount += 1; ppreq.preq_ttl -= 1; ppreq.preq_metric += @@ -1701,7 +1701,7 @@ hwmp_discover(struct ieee80211vap *vap, * Try to discover the path for this node. * Group addressed PREQ Case A */ - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; preq.preq_hopcount = 0; preq.preq_ttl = ms->ms_ttl; preq.preq_id = ++hs->hs_preqid; Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Tue May 1 16:05:09 2012 (r234883) +++ head/sys/net80211/ieee80211_mesh.h Tue May 1 16:06:20 2012 (r234884) @@ -230,7 +230,7 @@ struct ieee80211_meshpreq_ie { uint8_t preq_len; uint8_t preq_flags; #defineIEEE80211_MESHPREQ_FLAGS_PR 0x01/* Portal Role */ -#defineIEEE80211_MESHPREQ_FLAGS_AM 0x02/* 0 = ucast / 1 = bcast */ +#defineIEEE80211_MESHPREQ_FLAGS_AM 0x02/* 0 = bcast / 1 = ucast */ #defineIEEE80211_MESHPREQ_FLAGS_PP 0x04/* Proactive PREP */ #defineIEEE80211_MESHPREQ_FLAGS_AE 0x40/* Address Extension */ uint8_t preq_hopcount; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234885 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:07:35 2012 New Revision: 234885 URL: http://svn.freebsd.org/changeset/base/234885 Log: * Fixed hwmp_discover code to populate a PREQ packet correctly; * Removed IEEE80211_MESHPREQ_TFLAGS_RF which is no longer part of the amendment spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:06:20 2012 (r234884) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:07:35 2012 (r234885) @@ -171,9 +171,6 @@ static SYSCTL_NODE(_net_wlan, OID_AUTO, static int ieee80211_hwmp_targetonly = 0; SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, targetonly, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_targetonly, 0, "Set TO bit on generated PREQs"); -static int ieee80211_hwmp_replyforward = 1; -SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, replyforward, CTLTYPE_INT | CTLFLAG_RW, -&ieee80211_hwmp_replyforward, 0, "Set RF bit on generated PREQs"); static int ieee80211_hwmp_pathtimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -838,8 +835,7 @@ hwmp_rootmode_cb(void *arg) preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr); - PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO | - IEEE80211_MESHPREQ_TFLAGS_RF; + PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, @@ -1104,8 +1100,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, */ ppreq.preq_targets[0].target_flags |= IEEE80211_MESHPREQ_TFLAGS_TO; - ppreq.preq_targets[0].target_flags &= - ~IEEE80211_MESHPREQ_TFLAGS_RF; hwmp_send_preq(ni, vap->iv_myaddr, rttarg->rt_nexthop, &ppreq, &hrtarg->hr_lastpreq, @@ -1709,16 +1703,14 @@ hwmp_discover(struct ieee80211vap *vap, preq.preq_origseq = hr->hr_origseq; preq.preq_lifetime = ticks_to_msecs(ieee80211_hwmp_pathtimeout); - preq.preq_metric = rt->rt_metric; + preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), dest); PREQ_TFLAGS(0) = 0; if (ieee80211_hwmp_targetonly) PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_TO; - if (ieee80211_hwmp_replyforward) - PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_RF; PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; - PREQ_TSEQ(0) = hr->hr_seq; + PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ /* XXX check return value */ hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, &hr->hr_lastpreq, Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Tue May 1 16:06:20 2012 (r234884) +++ head/sys/net80211/ieee80211_mesh.h Tue May 1 16:07:35 2012 (r234885) @@ -246,7 +246,6 @@ struct ieee80211_meshpreq_ie { struct { uint8_t target_flags; #defineIEEE80211_MESHPREQ_TFLAGS_TO0x01/* Target Only */ -#defineIEEE80211_MESHPREQ_TFLAGS_RF0x02/* Reply and Forward */ #defineIEEE80211_MESHPREQ_TFLAGS_USN 0x04/* Unknown HWMP seq number */ uint8_t target_addr[IEEE80211_ADDR_LEN]; uint32_ttarget_seq; /* HWMP Sequence Number */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234886 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:08:46 2012 New Revision: 234886 URL: http://svn.freebsd.org/changeset/base/234886 Log: * Proactive PREQ (original transmission) must also set IEEE80211_MESHPREQ_TFLAGS_USN flag in target_flag field; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:07:35 2012 (r234885) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:08:46 2012 (r234886) @@ -835,7 +835,8 @@ hwmp_rootmode_cb(void *arg) preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr); - PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO; + PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO | + IEEE80211_MESHPREQ_TFLAGS_USN; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234887 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:09:44 2012 New Revision: 234887 URL: http://svn.freebsd.org/changeset/base/234887 Log: * PREQ acceptance criteria updated to check for proxy condition as in amendment; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:08:46 2012 (r234886) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:09:44 2012 (r234887) @@ -907,13 +907,17 @@ hwmp_recv_preq(struct ieee80211vap *vap, PREQ_TADDR(0), ":"); /* -* Acceptance criteria: if the PREQ is not for us or not broadcast +* Acceptance criteria: (if the PREQ is not for us or not broadcast, +* or an external mac address not proxied by us), * AND forwarding is disabled, discard this PREQ. -* XXX: need to check PROXY */ - if ((!IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || - !IEEE80211_IS_MULTICAST(PREQ_TADDR(0))) && - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) { + rttarg = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); + if (!(ms->ms_flags & IEEE80211_MESHFLAGS_FWD) && + (!IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || + !IEEE80211_IS_MULTICAST(PREQ_TADDR(0)) || + (rttarg != NULL && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && + IEEE80211_ADDR_EQ(vap->iv_myaddr, rttarg->rt_mesh_gate { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_HWMP, preq->preq_origaddr, NULL, "%s", "not accepting PREQ"); return; @@ -922,7 +926,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Acceptance criteria: if unicast addressed * AND no valid forwarding for Target of PREQ, discard this PREQ. */ - rttarg = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); if(rttarg != NULL) hrtarg = IEEE80211_MESH_ROUTE_PRIV(rttarg, struct ieee80211_hwmp_route); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234888 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:10:32 2012 New Revision: 234888 URL: http://svn.freebsd.org/changeset/base/234888 Log: Updated PREQ propagation code; * When receiving a Proactive PREQ dont return after processing it but propagate; * When we propagate we should not enforce ratechecking; * Added checking for multiple pred ID detection; * Storing proxy orig address when PREQ is not for us; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:09:44 2012 (r234887) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:10:32 2012 (r234888) @@ -886,11 +886,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; + struct ieee80211_mesh_route *rtorig_ext = NULL; struct ieee80211_mesh_route *rttarg = NULL; struct ieee80211_hwmp_route *hrorig = NULL; struct ieee80211_hwmp_route *hrtarg = NULL; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; + ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -945,15 +947,22 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig = ieee80211_mesh_rt_find(vap, preq->preq_origaddr); if (rtorig == NULL) { rtorig = ieee80211_mesh_rt_add(vap, preq->preq_origaddr); + if (rtorig == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add orig path to %6D", + preq->preq_origaddr, ":"); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "adding originator %6D", preq->preq_origaddr, ":"); } - if (rtorig == NULL) { - /* XXX stat */ - return; - } hrorig = IEEE80211_MESH_ROUTE_PRIV(rtorig, struct ieee80211_hwmp_route); + /* record last seen preqid */ + preqid = hrorig->hr_preqid; + hrorig->hr_preqid = HWMP_SEQ_MAX(hrorig->hr_preqid, preq->preq_id); + /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ @@ -968,13 +977,16 @@ hwmp_recv_preq(struct ieee80211vap *vap, ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; - }else if(hrtarg != NULL && - HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && - (rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + }else if ((hrtarg != NULL && + HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && + ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || + preqid >= preq->preq_id) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREQ from %6D, old seq no %u <= %u", + "discard PREQ from %6D, old seqno %u <= %u," + " or old preqid %u < %u", preq->preq_origaddr, ":", - preq->preq_origseq, hrorig->hr_seq); + preq->preq_origseq, hrorig->hr_seq, + preq->preq_id, preqid); return; } @@ -1025,6 +1037,26 @@ hwmp_recv_preq(struct ieee80211vap *vap, hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep); return; } + /* we may update our proxy information for the orig external */ + else if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AE) { + rtorig_ext = + ieee80211_mesh_rt_find(vap, preq->preq_orig_ext_addr); + if (rtorig_ext == NULL) { + rtorig_ext = ieee80211_mesh_rt_add(vap, + preq->preq_orig_ext_addr); + if (rtorig_ext == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add orig ext proxy to %6D", + preq->preq_orig_ext_addr, ":"); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } + IEEE80211_ADDR_COPY(rtorig_ext->rt_mesh_gate, + preq->preq_origaddr); + } + rtorig_ext->rt_ext_seq = preq->preq_origseq; + ieee80211_mesh_rt_update(rtorig_ex
svn commit: r234889 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:11:47 2012 New Revision: 234889 URL: http://svn.freebsd.org/changeset/base/234889 Log: * Modified PERR acceptance criteria according to amendment; * Modified how PERR is handled and propagated according to amendment; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:10:32 2012 (r234888) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:11:47 2012 (r234889) @@ -1450,7 +1450,7 @@ hwmp_peerdown(struct ieee80211_node *ni) PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_USN; PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_RC; IEEE80211_ADDR_COPY(PERR_DADDR(0), rt->rt_dest); - PERR_DSEQ(0) = hr->hr_seq; + PERR_DSEQ(0) = ++hr->hr_seq; PERR_DRCODE(0) = IEEE80211_REASON_MESH_PERR_DEST_UNREACH; /* NB: flush everything passing through peer */ ieee80211_mesh_rt_flush_peer(vap, ni->ni_macaddr); @@ -1461,60 +1461,117 @@ hwmp_peerdown(struct ieee80211_node *ni) #undef PERR_DSEQ #undef PERR_DRCODE -#definePERR_DFLAGS(n) perr->perr_dests[n].dest_flags -#definePERR_DADDR(n) perr->perr_dests[n].dest_addr -#definePERR_DSEQ(n)perr->perr_dests[n].dest_seq -#definePERR_DRCODE(n) perr->perr_dests[n].dest_rcode +#definePERR_DFLAGS(n) perr->perr_dests[n].dest_flags +#definePERR_DADDR(n) perr->perr_dests[n].dest_addr +#definePERR_DSEQ(n)perr->perr_dests[n].dest_seq +#definePERR_DEXTADDR(n)perr->perr_dests[n].dest_ext_addr +#definePERR_DRCODE(n) perr->perr_dests[n].dest_rcode static void hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshperr_ie *perr) { struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt = NULL; + struct ieee80211_mesh_route *rt_ext = NULL; struct ieee80211_hwmp_route *hr; - struct ieee80211_meshperr_ie pperr; - int i, forward = 0; + struct ieee80211_meshperr_ie *pperr = NULL; + int i, j = 0, forward = 0; - /* -* Acceptance criteria: check if we received a PERR from a -* neighbor and forwarding is enabled. -*/ if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) + ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) return; + + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "received PERR from %6D", wh->i_addr2, ":"); + + /* +* if forwarding is true, prepare pperr +*/ + if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD) { + forward = 1; + pperr = malloc(sizeof(*perr) + 31*sizeof(*perr->perr_dests), + M_80211_MESH_PERR, M_NOWAIT); /* XXX: magic number, 32 err dests */ + } + /* -* Find all routing entries that match and delete them. +* Acceptance criteria: check if we have forwarding information +* stored about destination, and that nexthop == TA of this PERR. +* NB: we also build a new PERR to propagate in case we should forward. */ for (i = 0; i < perr->perr_ndests; i++) { rt = ieee80211_mesh_rt_find(vap, PERR_DADDR(i)); - if (rt == NULL) + if (rt == NULL || rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) continue; + if (!IEEE80211_ADDR_EQ(rt->rt_nexthop, wh->i_addr2)) + continue; + + /* found and accepted a PERR ndest element, process it... */ + if (forward) + memcpy(&pperr->perr_dests[j], &perr->perr_dests[i], + sizeof(*perr->perr_dests)); hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); - if (!(PERR_DFLAGS(0) & IEEE80211_MESHPERR_DFLAGS_USN) && - HWMP_SEQ_GEQ(PERR_DSEQ(i), hr->hr_seq)) { - ieee80211_mesh_rt_del(vap, rt->rt_dest); - ieee80211_mesh_rt_flush_peer(vap, rt->rt_dest); - rt = NULL; - forward = 1; + switch(PERR_DFLAGS(i)) { + case (IEEE80211_REASON_MESH_PERR_NO_FI): + if (PERR_DSEQ(i) == 0) { + hr->hr_seq++; + if (forward) { + pperr->perr_dests[j].dest_seq = + hr->hr_seq; + } + } else { + hr->hr_seq = PERR
svn commit: r234890 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:12:39 2012 New Revision: 234890 URL: http://svn.freebsd.org/changeset/base/234890 Log: PERR update to be called from mesh code. * Added mpp_senderror for Mesh Path Selection protocol; * Added hwmp_senderror that will send an HWMP PERR according to the supplied reason code; * Call mpp_senderror when deleting a route with correct reason code for whether the route is marked proxy or not; * Call mpp_senderror when trying to forward an individually addressed frame and there is no forwarding information; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:11:47 2012 (r234889) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:12:39 2012 (r234890) @@ -105,6 +105,9 @@ static int hwmp_send_perr(struct ieee802 const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *); +static voidhwmp_senderror(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN], + struct ieee80211_mesh_route *, int); static voidhwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshrann_ie *); @@ -206,6 +209,7 @@ static struct ieee80211_mesh_proto_path .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, + .mpp_senderror = hwmp_senderror, .mpp_vattach= hwmp_vattach, .mpp_vdetach= hwmp_vdetach, .mpp_newstate = hwmp_newstate, @@ -1569,7 +1573,7 @@ done: free(pperr, M_80211_MESH_PERR); } #undef PERR_DFLAGS -#undef PEER_DADDR +#undef PERR_DADDR #undef PERR_DSEQ #undef PERR_DEXTADDR #undef PERR_DRCODE @@ -1614,6 +1618,64 @@ hwmp_send_perr(struct ieee80211_node *ni return hwmp_send_action(ni, sa, da, (uint8_t *)perr, perr->perr_len+2); } +/* + * Called from the rest of the net80211 code (mesh code for example). + * NB: IEEE80211_REASON_MESH_PERR_DEST_UNREACH can be trigger by the fact that + * a mesh STA is unable to forward an MSDU/MMPDU to a next-hop mesh STA. + */ +#definePERR_DFLAGS(n) perr.perr_dests[n].dest_flags +#definePERR_DADDR(n) perr.perr_dests[n].dest_addr +#definePERR_DSEQ(n)perr.perr_dests[n].dest_seq +#definePERR_DEXTADDR(n)perr.perr_dests[n].dest_ext_addr +#definePERR_DRCODE(n) perr.perr_dests[n].dest_rcode +static void +hwmp_senderror(struct ieee80211vap *vap, +const uint8_t addr[IEEE80211_ADDR_LEN], +struct ieee80211_mesh_route *rt, int rcode) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_hwmp_route *hr = NULL; + struct ieee80211_meshperr_ie perr; + + if (rt != NULL) + hr = IEEE80211_MESH_ROUTE_PRIV(rt, + struct ieee80211_hwmp_route); + + perr.perr_ndests = 1; + perr.perr_ttl = ms->ms_ttl; + PERR_DFLAGS(0) = 0; + PERR_DRCODE(0) = rcode; + + switch (rcode) { + case IEEE80211_REASON_MESH_PERR_NO_FI: + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = 0; /* reserved */ + break; + case IEEE80211_REASON_MESH_PERR_NO_PROXY: + KASSERT(rt != NULL, ("no proxy info for sending PERR")); + KASSERT(rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY, + ("route is not marked proxy")); + PERR_DFLAGS(0) |= IEEE80211_MESHPERR_FLAGS_AE; + IEEE80211_ADDR_COPY(PERR_DADDR(0), vap->iv_myaddr); + PERR_DSEQ(0) = rt->rt_ext_seq; + IEEE80211_ADDR_COPY(PERR_DEXTADDR(0), addr); + break; + case IEEE80211_REASON_MESH_PERR_DEST_UNREACH: + KASSERT(rt != NULL, ("no route info for sending PERR")); + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = hr->hr_seq; + break; + default: + KASSERT(0, ("unknown reason code for HWMP PERR (%u)", rcode)); + } + hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &perr); +} +#undef PERR_DFLAGS +#undef PEER_DADDR +#undef PERR_DSEQ +#undef PERR_DEXTADDR +#undef PERR_DRCODE + static void hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshrann_ie *rann) Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.
svn commit: r234891 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:13:22 2012 New Revision: 234891 URL: http://svn.freebsd.org/changeset/base/234891 Log: RANN update * Introduced a new HWMP sysctl, Root Confirmation Interval; * Added hr_lastrootconf to hwmp_route, is for ratecheck for a specific ROOT; * We missed reading RANN.interval subfield from a RANN frame before; * Updated hwmp_recv_rann according to amendment, see comments; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:12:39 2012 (r234890) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:13:22 2012 (r234891) @@ -157,6 +157,7 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ struct timeval hr_lastpreq;/* last time we sent a PREQ */ + struct timeval hr_lastrootconf; /* last sent PREQ root conf */ int hr_preqretries; /* number of discoveries */ int hr_lastdiscovery; /* last discovery in ticks */ }; @@ -199,6 +200,11 @@ static int ieee80211_hwmp_rannint = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rannint, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_rannint, 0, ieee80211_sysctl_msecs_ticks, "I", "root announcement interval (ms)"); +static struct timeval ieee80211_hwmp_rootconfint = { 0, 0 }; +static int ieee80211_hwmp_rootconfint_internal = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rootconfint, CTLTYPE_INT | CTLFLAG_RD, +&ieee80211_hwmp_rootconfint_internal, 0, ieee80211_sysctl_msecs_ticks, "I", +"root confirmation interval (ms) (read-only)"); #defineIEEE80211_HWMP_DEFAULT_MAXHOPS 31 @@ -228,6 +234,7 @@ ieee80211_hwmp_init(void) ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_rootint = msecs_to_ticks(2*1000); ieee80211_hwmp_rannint = msecs_to_ticks(1*1000); + ieee80211_hwmp_rootconfint_internal = msecs_to_ticks(2*1000); ieee80211_hwmp_maxpreq_retries = 3; /* * (TU): A measurement of time equal to 1024 μs, @@ -236,6 +243,13 @@ ieee80211_hwmp_init(void) ieee80211_hwmp_net_diameter_traversaltime = msecs_to_ticks(512); /* +* NB: I dont know how to make SYSCTL_PROC that calls ms to ticks +* and return a struct timeval... +*/ + ieee80211_hwmp_rootconfint.tv_usec = + ieee80211_hwmp_rootconfint_internal * 1000; + + /* * Register action frame handler. */ ieee80211_recv_action_register(IEEE80211_ACTION_CAT_MESH, @@ -555,6 +569,7 @@ hwmp_recv_action_meshpath(struct ieee802 } memcpy(&rann, mrann, sizeof(rann)); rann.rann_seq = LE_READ_4(&mrann->rann_seq); + rann.rann_interval = LE_READ_4(&mrann->rann_interval); rann.rann_metric = LE_READ_4(&mrann->rann_metric); hwmp_recv_rann(vap, ni, wh, &rann); found++; @@ -873,6 +888,7 @@ hwmp_rootmode_rann_cb(void *arg) rann.rann_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(rann.rann_addr, vap->iv_myaddr); rann.rann_seq = ++hs->hs_seq; + rann.rann_interval = ieee80211_hwmp_rannint; rann.rann_metric = IEEE80211_MESHLMETRIC_INITIALVAL; vap->iv_stats.is_hwmp_rootrann++; @@ -1684,7 +1700,9 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_mesh_route *rt = NULL; struct ieee80211_hwmp_route *hr; + struct ieee80211_meshpreq_ie preq; struct ieee80211_meshrann_ie prann; + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || @@ -1692,27 +1710,74 @@ hwmp_recv_rann(struct ieee80211vap *vap, return; rt = ieee80211_mesh_rt_find(vap, rann->rann_addr); - /* -* Discover the path to the root mesh STA. -* If we already know it, propagate the RANN element. -*/ + if (rt != NULL && rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) { + hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + + /* Acceptance criteria: if RANN.seq < stored seq, discard RANN */ + if (HWMP_SEQ_LT(rann->rann_seq, hr->hr_seq)) { + IEEE80211_DISCARD(vap, IEEE80211_MSG_HWMP, wh, NULL, + "RANN seq %u < %u", rann->rann_seq, hr->hr_seq); + return; + } + + /* Acceptance criteria: if RANN.seq == stored seq AND + * RANN.me
svn commit: r234892 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:14:18 2012 New Revision: 234892 URL: http://svn.freebsd.org/changeset/base/234892 Log: Net80211s update: Mesh Gate Announcement and removal of Portal Announcement. * Renamed IEEE80211_ELEMID_MESHPANN to IEEE80211_ELEMID_MESHGANN according to amendment; * Added IEEE80211_IOC_MESH_GATE that controls whether Mesh Gate Announcement is activated or not; * Renamed all flags from Portal to Gate in HWMP frames; * Removed IEEE80211_ACTION_MESHPANN enum cause its part of the Mesh Action category now as per amendment; * Renamed IEEE80211_MESHFLAGS_PORTAL to IEEE80211_MESHFLAGS_GATE in ieee80211_mesh_state flags; * Modified ieee80211_hwmp.c/ieee80211_mesh.c to use new GATE flags; Approved by: adrian Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211.h Tue May 1 16:14:18 2012 (r234892) @@ -734,7 +734,7 @@ enum { IEEE80211_ELEMID_MESHAWAKEW = 119, IEEE80211_ELEMID_MESHBEACONT= 120, /* 121-124 MMCAOP not implemented yet */ - IEEE80211_ELEMID_MESHPANN = 125, /* XXX: is GANN now, not used */ + IEEE80211_ELEMID_MESHGANN = 125, IEEE80211_ELEMID_MESHRANN = 126, /* 127 Extended Capabilities */ /* 128-129 reserved */ Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:14:18 2012 (r234892) @@ -840,9 +840,9 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = 0; - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) - preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PR; + preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) + preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_GATE; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PP; preq.preq_hopcount = 0; @@ -882,8 +882,8 @@ hwmp_rootmode_rann_cb(void *arg) "%s", "send broadcast RANN"); rann.rann_flags = 0; - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) - rann.rann_flags |= IEEE80211_MESHRANN_FLAGS_PR; + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) + rann.rann_flags |= IEEE80211_MESHFLAGS_GATE; rann.rann_hopcount = 0; rann.rann_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(rann.rann_addr, vap->iv_myaddr); Modified: head/sys/net80211/ieee80211_ioctl.h == --- head/sys/net80211/ieee80211_ioctl.h Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_ioctl.h Tue May 1 16:14:18 2012 (r234892) @@ -709,6 +709,7 @@ struct ieee80211req { #defineIEEE80211_IOC_MESH_PR_SIG 178 /* mesh sig protocol */ #defineIEEE80211_IOC_MESH_PR_CC179 /* mesh congestion protocol */ #defineIEEE80211_IOC_MESH_PR_AUTH 180 /* mesh auth protocol */ +#defineIEEE80211_IOC_MESH_GATE 181 /* mesh gate XXX: 173? */ #defineIEEE80211_IOC_HWMP_ROOTMODE 190 /* HWMP root mode */ #defineIEEE80211_IOC_HWMP_MAXHOPS 191 /* number of hops before drop */ Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 16:14:18 2012 (r234892) @@ -1262,7 +1262,7 @@ mesh_recv_group_data(struct ieee80211vap * This happens by delivering the packet, and a bridge * will sent it on another port member. */ - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL && + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE && ms->ms_flags & IEEE80211_MESHFLAGS_FWD) IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, MC01(mc)->mc_addr4, "%s", @@ -2768,8 +2768,8 @@ ieee80211_add_meshconf(uint8_t *frm, str /* NB: set the number of neighbors before the rest */ *frm = (ms->ms_neighbors > IEEE80211_MESH_MAX_NEIGHBORS ? I
svn commit: r234893 - head/sbin/ifconfig
Author: monthadar Date: Tue May 1 16:15:34 2012 New Revision: 234893 URL: http://svn.freebsd.org/changeset/base/234893 Log: * Added new command to ifconfig to activate Mesh Gate Announcement called meshgate with corresponding explanation; Approved by: adrian Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Tue May 1 16:14:18 2012 (r234892) +++ head/sbin/ifconfig/ifconfig.8 Tue May 1 16:15:34 2012 (r234893) @@ -1979,6 +1979,12 @@ Enable or disable forwarding packets by By default .Cm meshforward is enabled. +.It Cm meshgate +This attribute specifies whether or not the mesh STA activates mesh gate +announcements. +By default +.Cm meshgate +is disabled. .It Cm meshmetric Ar protocol Set the specified .Ar protocol Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cTue May 1 16:14:18 2012 (r234892) +++ head/sbin/ifconfig/ifieee80211.cTue May 1 16:15:34 2012 (r234893) @@ -1883,6 +1883,12 @@ DECL_CMD_FUNC(set80211meshforward, val, } static +DECL_CMD_FUNC(set80211meshgate, val, d) +{ + set80211(s, IEEE80211_IOC_MESH_GATE, d, 0, NULL); +} + +static DECL_CMD_FUNC(set80211meshpeering, val, d) { set80211(s, IEEE80211_IOC_MESH_AP, d, 0, NULL); @@ -4832,6 +4838,12 @@ end: else LINE_CHECK("-meshforward"); } + if (get80211val(s, IEEE80211_IOC_MESH_GATE, &val) != -1) { + if (val) + LINE_CHECK("meshgate"); + else + LINE_CHECK("-meshgate"); + } if (get80211len(s, IEEE80211_IOC_MESH_PR_METRIC, data, 12, &len) != -1) { data[len] = '\0'; @@ -5271,6 +5283,8 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD_ARG("meshttl", set80211meshttl), DEF_CMD("meshforward", 1, set80211meshforward), DEF_CMD("-meshforward", 0, set80211meshforward), + DEF_CMD("meshgate", 1, set80211meshgate), + DEF_CMD("-meshgate",0, set80211meshgate), DEF_CMD("meshpeering", 1, set80211meshpeering), DEF_CMD("-meshpeering", 0, set80211meshpeering), DEF_CMD_ARG("meshmetric", set80211meshmetric), ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234894 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:16:20 2012 New Revision: 234894 URL: http://svn.freebsd.org/changeset/base/234894 Log: PREQ discovery update. * Added a new discovery flag IEEE80211_MESHRT_FLAGS_DISCOVER; * Modified ieee80211_ioctl.h to include IEEE80211_MESHRT_FLAGS_DISCOVER; * Added hwmp_rediscover_cb, which will be called by a timeout to do rediscovery if we have not reach max number of preq discovery; * Modified hwmp_discover to setup a callout for path rediscovery; * Added to ieee80211req_mesh_route to have a back pointer to ieee80211vap for the discovery callout context; * Modified mesh_rt_add_locked arguemnt from ieee80211_mesh_state to ieee80211vap, this because we have to initialize the above back pointer; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:15:34 2012 (r234893) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:16:20 2012 (r234894) @@ -1319,7 +1319,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; ieee80211_mesh_rt_update(rt, prep->prep_lifetime); - rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ /* * If it's NOT for us, propagate the PREP @@ -1805,6 +1805,64 @@ hwmp_send_rann(struct ieee80211_node *ni #definePREQ_TFLAGS(n) preq.preq_targets[n].target_flags #definePREQ_TADDR(n) preq.preq_targets[n].target_addr #definePREQ_TSEQ(n)preq.preq_targets[n].target_seq +static void +hwmp_rediscover_cb(void *arg) +{ + struct ieee80211_mesh_route *rt = arg; + struct ieee80211vap *vap = rt->rt_vap; + struct ieee80211_hwmp_state *hs = vap->iv_hwmp; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_hwmp_route *hr; + struct ieee80211_meshpreq_ie preq; /* Optimize: storing first preq? */ + + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) + return ; /* nothing to do */ + + hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + if (hr->hr_preqretries >= + ieee80211_hwmp_maxpreq_retries) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + rt->rt_dest, NULL, "%s", + "no valid path , max number of discovery, send GATE"); + /* TODO: send to known gates */ + vap->iv_stats.is_mesh_fwd_nopath++; + rt->rt_flags = 0; /* Mark invalid */ + return ; /* XXX: flush queue? */ + } + + hr->hr_preqretries++; + + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt->rt_dest, + "start path rediscovery , target seq %u", hr->hr_seq); + /* +* Try to discover the path for this node. +* Group addressed PREQ Case A +*/ + preq.preq_flags = 0; + preq.preq_hopcount = 0; + preq.preq_ttl = ms->ms_ttl; + preq.preq_id = ++hs->hs_preqid; + IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr); + preq.preq_origseq = hr->hr_origseq; + preq.preq_lifetime = ticks_to_msecs(ieee80211_hwmp_pathtimeout); + preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; + preq.preq_tcount = 1; + IEEE80211_ADDR_COPY(PREQ_TADDR(0), rt->rt_dest); + PREQ_TFLAGS(0) = 0; + if (ieee80211_hwmp_targetonly) + PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_TO; + PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; + PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ + /* XXX check return value */ + hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, + broadcastaddr, &preq, &hr->hr_lastpreq, + &ieee80211_hwmp_preqminint); + callout_reset(&rt->rt_discovery, + ieee80211_hwmp_net_diameter_traversaltime * 2, + hwmp_rediscover_cb, rt); +} + static struct ieee80211_node * hwmp_discover(struct ieee80211vap *vap, const uint8_t dest[IEEE80211_ADDR_LEN], struct mbuf *m) @@ -1857,13 +1915,11 @@ hwmp_discover(struct ieee80211vap *vap, vap->iv_stats.is_mesh_fwd_nopath++; goto done; } + rt->rt_flags = IEEE80211_MESHRT_FLAGS_DISCOVER; hr->hr_preqretries++; if (hr->hr_origseq == 0) hr->hr_origseq = ++hs->hs_seq; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; - /* XXX: special discovery timeout, larger lifetime? */ -
svn commit: r234895 - head/sbin/ifconfig
Author: monthadar Date: Tue May 1 16:17:17 2012 New Revision: 234895 URL: http://svn.freebsd.org/changeset/base/234895 Log: * Modified ifconfig to show the IEEE80211_MESHRT_FLAGS_DISCOVER flag with a 'D'; Approved by: adrian Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cTue May 1 16:16:20 2012 (r234894) +++ head/sbin/ifconfig/ifieee80211.cTue May 1 16:17:17 2012 (r234895) @@ -4020,6 +4020,8 @@ list_mesh(int s) ether_ntoa((const struct ether_addr *)rt->imr_nexthop), rt->imr_nhops, rt->imr_metric, rt->imr_lifetime, rt->imr_lastmseq, + (rt->imr_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) ? + 'D' : (rt->imr_flags & IEEE80211_MESHRT_FLAGS_VALID) ? 'V' : '!', (rt->imr_flags & IEEE80211_MESHRT_FLAGS_PROXY) ? ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234896 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:18:38 2012 New Revision: 234896 URL: http://svn.freebsd.org/changeset/base/234896 Log: Update HWMP Proactive code and mesh route flags. * Modified hwmp_recv_preq: o cleaned up code, removed rootmac variable because preq->origaddr is the root when we recevie a Proactive PREQ; o Modified so that a PREP in response of a Proactive PREQ is unicast, a PREP is ALWAYS unicast; * Modified hwmp_recv_prep: o Before we mark a route to be valid we should remove the discovery flag and then mark it valid in such a way we wont lose the isgate flag; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:17:17 2012 (r234895) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:18:38 2012 (r234896) @@ -904,7 +904,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq) { struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; struct ieee80211_mesh_route *rtorig_ext = NULL; struct ieee80211_mesh_route *rttarg = NULL; @@ -1083,33 +1082,20 @@ hwmp_recv_preq(struct ieee80211vap *vap, */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { - uint8_t rootmac[IEEE80211_ADDR_LEN]; - - IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr); - rt = ieee80211_mesh_rt_find(vap, rootmac); - if (rt == NULL) { - rt = ieee80211_mesh_rt_add(vap, rootmac); - if (rt == NULL) { - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "unable to add root mesh path to %6D", - rootmac, ":"); - vap->iv_stats.is_mesh_rtaddfailed++; - return; - } - } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "root mesh station @ %6D", rootmac, ":"); + "root mesh station @ %6D", preq->preq_origaddr, ":"); /* * Reply with a PREP if we don't have a path to the root * or if the root sent us a proactive PREQ. */ - if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || + if ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP)) { prep.prep_flags = 0; prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_origaddr, rootmac); + IEEE80211_ADDR_COPY(prep.prep_origaddr, + preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; @@ -1117,7 +1103,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, vap->iv_myaddr); prep.prep_targetseq = ++hs->hs_seq; hwmp_send_prep(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &prep); + rtorig->rt_nexthop, &prep); } } @@ -1319,7 +1305,11 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; ieee80211_mesh_rt_update(rt, prep->prep_lifetime); - rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) { + /* discovery complete */ + rt->rt_flags &= ~IEEE80211_MESHRT_FLAGS_DISCOVER; + } + rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ /* * If it's NOT for us, propagate the PREP ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r234933 - head/sbin/ifconfig
Author: monthadar Date: Wed May 2 20:01:28 2012 New Revision: 234933 URL: http://svn.freebsd.org/changeset/base/234933 Log: Update man page date to the date of the last commit. Approved by: adrian Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Wed May 2 19:32:11 2012 (r234932) +++ head/sbin/ifconfig/ifconfig.8 Wed May 2 20:01:28 2012 (r234933) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd April 3, 2012 +.Dd May 1, 2012 .Dt IFCONFIG 8 .Os .Sh NAME ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r234893 - head/sbin/ifconfig
On Tue, May 1, 2012 at 11:05 PM, Bjoern A. Zeeb wrote: > > On 1. May 2012, at 16:15 , Monthadar Al Jaberi wrote: > >> Author: monthadar >> Date: Tue May 1 16:15:34 2012 >> New Revision: 234893 >> URL: http://svn.freebsd.org/changeset/base/234893 >> >> Log: >> * Added new command to ifconfig to activate Mesh Gate Announcement called >> meshgate with corresponding explanation; >> >> Approved by: adrian >> >> Modified: >> head/sbin/ifconfig/ifconfig.8 >> head/sbin/ifconfig/ifieee80211.c >> >> Modified: head/sbin/ifconfig/ifconfig.8 >> == >> --- head/sbin/ifconfig/ifconfig.8 Tue May 1 16:14:18 2012 >> (r234892) >> +++ head/sbin/ifconfig/ifconfig.8 Tue May 1 16:15:34 2012 >> (r234893) > > > Please update .Dd as well. Done. Thank you. > >> @@ -1979,6 +1979,12 @@ Enable or disable forwarding packets by >> By default >> .Cm meshforward >> is enabled. >> +.It Cm meshgate >> +This attribute specifies whether or not the mesh STA activates mesh gate >> +announcements. >> +By default >> +.Cm meshgate >> +is disabled. >> .It Cm meshmetric Ar protocol >> Set the specified >> .Ar protocol > > -- > Bjoern A. Zeeb You have to have visions! > It does not matter how good you are. It matters what good you do! > -- Monthadar Al Jaberi ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r244388 - head/sys/dev/wtap
Author: monthadar Date: Tue Dec 18 08:41:23 2012 New Revision: 244388 URL: http://svnweb.freebsd.org/changeset/base/244388 Log: wtap: fix clang warning. * The warning message was: 'warning error: format string is not a string literal'; * Changed how make_dev is called, now a string literal for formatting is used; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:14:16 2012(r244387) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012(r244388) @@ -348,7 +348,7 @@ wtap_vap_create(struct ieee80211com *ic, /* complete setup */ ieee80211_vap_attach(vap, wtap_media_change, ieee80211_media_status); avp->av_dev = make_dev(&wtap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - (const char *)ic->ic_ifp->if_xname); + "%s", (const char *)ic->ic_ifp->if_xname); /* TODO this is a hack to force it to choose the rate we want */ ni = ieee80211_ref_node(vap->iv_bss); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r244389 - head/sys/dev/wtap
Author: monthadar Date: Tue Dec 18 08:44:59 2012 New Revision: 244389 URL: http://svnweb.freebsd.org/changeset/base/244389 Log: wtap should check if ieee80211_vap_setup fails. * If ieee80211_vap_setup fails, we free allocated M_80211_VAP memory and return NULL; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012(r244388) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012(r244389) @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, vap = (struct ieee80211vap *) avp; error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + if (error) { + free((struct wtap_vap*) vap, M_80211_VAP); + return NULL; + } /* override various methods */ avp->av_recv_mgmt = vap->iv_recv_mgmt; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r244389 - head/sys/dev/wtap
On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff wrote: > Monthadar, > > On Tue, Dec 18, 2012 at 08:44:59AM +, Monthadar Al Jaberi wrote: > M> Author: monthadar > M> Date: Tue Dec 18 08:44:59 2012 > M> New Revision: 244389 > M> URL: http://svnweb.freebsd.org/changeset/base/244389 > M> > M> Log: > M> wtap should check if ieee80211_vap_setup fails. > M> > M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP > M> memory and return NULL; > M> > M> Approved by: adrian (mentor) > M> > M> Modified: > M> head/sys/dev/wtap/if_wtap.c > M> > M> Modified: head/sys/dev/wtap/if_wtap.c > M> > == > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 > (r244388) > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 > (r244389) > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, > M> vap = (struct ieee80211vap *) avp; > M> error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > M> +if (error) { > M> +free((struct wtap_vap*) vap, M_80211_VAP); > M> +return NULL; > M> +} > M> > M> /* override various methods */ > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; > > You don't need to cast first argument of free(9). And you don't need a cast > before malloc(9) as well. > > If you are calling malloc(9) with M_NOWAIT, you need to check return result. > > Also, more stylish would be to supply to free() the same variable that was > assigned at malloc(9) call, in this particular case it is "avp". > > Patch attached. Thank you for the patch, I can commit it for you, if you havn't done it yet? br, > > -- > Totus tuus, Glebius. -- Monthadar Al Jaberi ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r244399 - head/sys/dev/wtap
Author: monthadar Date: Tue Dec 18 16:11:13 2012 New Revision: 244399 URL: http://svnweb.freebsd.org/changeset/base/244399 Log: wtap fix malloc/free. * Remove malloc/free pointer cast; * Check return value from malloc; Submitted by: glebius Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 14:32:53 2012(r244398) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:11:13 2012(r244399) @@ -326,8 +326,9 @@ wtap_vap_create(struct ieee80211com *ic, DWTAP_PRINTF("%s\n", __func__); - avp = (struct wtap_vap *) malloc(sizeof(struct wtap_vap), - M_80211_VAP, M_NOWAIT | M_ZERO); + avp = malloc(sizeof(struct wtap_vap), M_80211_VAP, M_NOWAIT | M_ZERO); + if (avp == NULL) + return (NULL); avp->id = sc->id; avp->av_md = sc->sc_md; avp->av_bcinterval = msecs_to_ticks(BEACON_INTRERVAL + 100*sc->id); @@ -335,8 +336,8 @@ wtap_vap_create(struct ieee80211com *ic, error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS, flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); if (error) { - free((struct wtap_vap*) vap, M_80211_VAP); - return NULL; + free(avp, M_80211_VAP); + return (NULL); } /* override various methods */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r244400 - head/sys/dev/wtap
Author: monthadar Date: Tue Dec 18 16:15:20 2012 New Revision: 244400 URL: http://svnweb.freebsd.org/changeset/base/244400 Log: wtap should not set the IEEE80211_F_DATAPAD flag; Approved by: adrian (mentor) Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:11:13 2012(r244399) +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 16:15:20 2012(r244400) @@ -808,11 +808,7 @@ wtap_attach(struct wtap_softc *sc, const ic->ic_regdomain.location = 1; /* Indoors */ ic->ic_regdomain.isocc[0] = 'S'; ic->ic_regdomain.isocc[1] = 'E'; - /* -* Indicate we need the 802.11 header padded to a -* 32-bit boundary for 4-address and QoS frames. -*/ - ic->ic_flags |= IEEE80211_F_DATAPAD; + ic->ic_nchans = 1; ic->ic_channels[0].ic_flags = IEEE80211_CHAN_B; ic->ic_channels[0].ic_freq = 2412; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r244389 - head/sys/dev/wtap
On Tue, Dec 18, 2012 at 2:13 PM, Gleb Smirnoff wrote: > On Tue, Dec 18, 2012 at 12:30:53PM +0100, Monthadar Al Jaberi wrote: > M> On Tue, Dec 18, 2012 at 9:53 AM, Gleb Smirnoff wrote: > M> > Monthadar, > M> > > M> > On Tue, Dec 18, 2012 at 08:44:59AM +, Monthadar Al Jaberi wrote: > M> > M> Author: monthadar > M> > M> Date: Tue Dec 18 08:44:59 2012 > M> > M> New Revision: 244389 > M> > M> URL: http://svnweb.freebsd.org/changeset/base/244389 > M> > M> > M> > M> Log: > M> > M> wtap should check if ieee80211_vap_setup fails. > M> > M> > M> > M> * If ieee80211_vap_setup fails, we free allocated M_80211_VAP > M> > M> memory and return NULL; > M> > M> > M> > M> Approved by: adrian (mentor) > M> > M> > M> > M> Modified: > M> > M> head/sys/dev/wtap/if_wtap.c > M> > M> > M> > M> Modified: head/sys/dev/wtap/if_wtap.c > M> > M> > == > M> > M> --- head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:41:23 2012 > (r244388) > M> > M> +++ head/sys/dev/wtap/if_wtap.c Tue Dec 18 08:44:59 2012 > (r244389) > M> > M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic, > M> > M> vap = (struct ieee80211vap *) avp; > M> > M> error = ieee80211_vap_setup(ic, vap, name, unit, > IEEE80211_M_MBSS, > M> > M> flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); > M> > M> +if (error) { > M> > M> +free((struct wtap_vap*) vap, M_80211_VAP); > M> > M> +return NULL; > M> > M> +} > M> > M> > M> > M> /* override various methods */ > M> > M> avp->av_recv_mgmt = vap->iv_recv_mgmt; > M> > > M> > You don't need to cast first argument of free(9). And you don't need a > cast > M> > before malloc(9) as well. > M> > > M> > If you are calling malloc(9) with M_NOWAIT, you need to check return > result. > M> > > M> > Also, more stylish would be to supply to free() the same variable that > was > M> > assigned at malloc(9) call, in this particular case it is "avp". > M> > > M> > Patch attached. > M> > M> Thank you for the patch, I can commit it for you, if you havn't done it > yet? > > Please commit, I'm not confident with wtap. Done, thank you! > > -- > Totus tuus, Glebius. -- Monthadar Al Jaberi ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r245112 - head/sys/mips/atheros
Author: monthadar Date: Sun Jan 6 20:50:31 2013 New Revision: 245112 URL: http://svnweb.freebsd.org/changeset/base/245112 Log: Mips Atheros AR71XX: make PCI base slot configurable through hints. * Mikrotik RouterBoard 433AH have PCI slot 18 wired to INT0 on the PCI Bus. This is different from e.g. Atheros PB42 and Ubiquiti boards. * Check for hint hint.pcib.0.baseslot=X, where X is number of base slot; * If hint not supplied print a warning and use default AR71XX_PCI_BASE_SLOT; PR: kern/174978 Approved by: adrian (mentor) Modified: head/sys/mips/atheros/ar71xx_pci.c Modified: head/sys/mips/atheros/ar71xx_pci.c == --- head/sys/mips/atheros/ar71xx_pci.c Sun Jan 6 19:27:28 2013 (r245111) +++ head/sys/mips/atheros/ar71xx_pci.c Sun Jan 6 20:50:31 2013 (r245112) @@ -81,6 +81,7 @@ struct ar71xx_pci_softc { device_tsc_dev; int sc_busno; + int sc_baseslot; struct rman sc_mem_rman; struct rman sc_irq_rman; @@ -395,6 +396,16 @@ ar71xx_pci_attach(device_t dev) AR71XX_PCI_IRQ_END) != 0) panic("ar71xx_pci_attach: failed to set up IRQ rman"); + /* +* Check if there is a base slot hint. Otherwise use default value. +*/ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "baseslot", &sc->sc_baseslot) != 0) { + device_printf(dev, + "%s: missing hint '%s', default to AR71XX_PCI_BASE_SLOT\n", + __func__, "baseslot"); + sc->sc_baseslot = AR71XX_PCI_BASE_SLOT; + } ATH_WRITE_REG(AR71XX_PCI_INTR_STATUS, 0); ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, 0); @@ -648,11 +659,13 @@ ar71xx_pci_maxslots(device_t dev) static int ar71xx_pci_route_interrupt(device_t pcib, device_t device, int pin) { - if (pci_get_slot(device) < AR71XX_PCI_BASE_SLOT) + struct ar71xx_pci_softc *sc = device_get_softc(pcib); + + if (pci_get_slot(device) < sc->sc_baseslot) panic("%s: PCI slot %d is less then AR71XX_PCI_BASE_SLOT", __func__, pci_get_slot(device)); - return (pci_get_slot(device) - AR71XX_PCI_BASE_SLOT); + return (pci_get_slot(device) - sc->sc_baseslot); } static device_method_t ar71xx_pci_methods[] = { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246497 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:12:55 2013 New Revision: 246497 URL: http://svnweb.freebsd.org/changeset/base/246497 Log: Stop a mesh STA from flooding with peer frames. This problem happens when using ACL policy to filter mesh STA but two nodes have different policy. Then one of them will try to peer all the time. This can also help if for any reason one of the peering mesh STA have problems sending/receiving peer frames. * Modified struct ieee80211_node to include two new fields: + struct callout ni_mlhtimer /* link mesh backoff timer */ + uint8_t ni_mlhcnt /* link mesh holding counter */ * Added two new sysctl (check sysctl -d for more info): + net.wlan.mesh.backofftimeout=5000 + net.wlan.mesh.maxholding=2; * When receiving a beacon and we are in IEEE80211_NODE_MESH_IDLE check if ni_mlhcnt >= ieee80211_mesh_maxholding, if so do not do anything; * In mesh_peer_timeout_cb when transitioning from IEEE80211_NODE_MESH_HOLDING to IEEE80211_NODE_MESH_IDLE increment ni_mlhcnt, and eventually start ieee80211_mesh_backofftimeout; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_node.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 19:09:10 2013 (r246496) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:12:55 2013 (r246497) @@ -111,10 +111,20 @@ static int ieee80211_mesh_confirmtimeout SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, confirmtimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_confirmtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "Confirm state timeout (msec)"); +static int ieee80211_mesh_backofftimeout = -1; +SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, backofftimeout, CTLTYPE_INT | CTLFLAG_RW, +&ieee80211_mesh_backofftimeout, 0, ieee80211_sysctl_msecs_ticks, "I", +"Backoff timeout (msec). This is to throutles peering forever when " +"not receving answer or is rejected by a neighbor"); static int ieee80211_mesh_maxretries = 2; SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxretries, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_maxretries, 0, "Maximum retries during peer link establishment"); +static int ieee80211_mesh_maxholding = 2; +SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxholding, CTLTYPE_INT | CTLFLAG_RW, +&ieee80211_mesh_maxholding, 0, +"Maximum times we are allowed to transition to HOLDING state before " +"backinoff during peer link establishment"); static const uint8_t broadcastaddr[IEEE80211_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -500,6 +510,7 @@ ieee80211_mesh_init(void) ieee80211_mesh_retrytimeout = msecs_to_ticks(40); ieee80211_mesh_holdingtimeout = msecs_to_ticks(40); ieee80211_mesh_confirmtimeout = msecs_to_ticks(40); + ieee80211_mesh_backofftimeout = msecs_to_ticks(5000); /* * Register action frame handlers. @@ -1696,7 +1707,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni } /* * Automatically peer with discovered nodes if possible. -* XXX backoff on repeated failure */ if (ni != vap->iv_bss && (ms->ms_flags & IEEE80211_MESHFLAGS_AP)) { @@ -1705,6 +1715,10 @@ mesh_recv_mgmt(struct ieee80211_node *ni { uint16_t args[1]; + /* Wait for backoff callout to reset counter */ + if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding) + return; + ni->ni_mlpid = mesh_generateid(vap); if (ni->ni_mlpid == 0) return; @@ -2578,6 +2592,15 @@ mesh_peer_timeout_stop(struct ieee80211_ callout_drain(&ni->ni_mltimer); } +static void +mesh_peer_backoff_cb(void *arg) +{ + struct ieee80211_node *ni = (struct ieee80211_node *)arg; + + /* After backoff timeout, try to peer automatically again. */ + ni->ni_mlhcnt = 0; +} + /* * Mesh Peer Link Management FSM timeout handling. */ @@ -2625,6 +2648,11 @@ mesh_peer_timeout_cb(void *arg) mesh_peer_timeout_setup(ni); break; case IEEE80211_NODE_MESH_HOLDING: + ni->ni_mlhcnt++; + if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding) + callout_reset(&ni->ni_mlhtimer, + ieee80211_mesh_backofftimeout, + mesh_peer_backoff_cb, ni); mesh_linkchange(ni, IEEE80211_NODE_MESH_IDLE); break; } @@ -2889,6 +2917,7 @@ ieee80211_mesh_node_init(struct ieee8021 { ni->ni_flags |= IEEE80211_NODE_QOS; callout_init(&ni->ni_mltimer, CALLOUT_MPS
svn commit: r246498 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:17:35 2013 New Revision: 246498 URL: http://svnweb.freebsd.org/changeset/base/246498 Log: Fix mesh path flag. * A bug occurs while in discovery mode which leaves a path marked with both Discover and Valid flag. This happens when receiving/sending PREQ and PREP in a particular order. Solution is to assign the Valid bit instead of oring it; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:12:55 2013 (r246497) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:17:35 2013 (r246498) @@ -995,8 +995,11 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); - /* path to orig is valid now */ - rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; + /* Path to orig is valid now. +* NB: we know it can't be Proxy, and if it is GATE +* it will be marked below. +*/ + rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; }else if ((hrtarg != NULL && HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246499 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:18:22 2013 New Revision: 246499 URL: http://svnweb.freebsd.org/changeset/base/246499 Log: Add mesh debug for interarction between DS & MBSS. * Add mesh debug information when frames enter or leave the MBSS; * Set IEEE80211_MSG_OUTPUT bit to enable output; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:17:35 2013 (r246498) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:18:22 2013 (r246499) @@ -1246,6 +1246,9 @@ mesh_recv_indiv_data_to_me(struct ieee80 * All other cases: forward of MSDUs from the MBSS to DS indiv. * addressed according to 13.11.3.2. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_OUTPUT, qwh->i_addr2, + "forward frame to DS, SA(%6D) DA(%6D)", + mc10->mc_addr6, ":", mc10->mc_addr5, ":"); } return (0); /* process locally */ } Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cThu Feb 7 21:17:35 2013 (r246498) +++ head/sys/net80211/ieee80211_output.cThu Feb 7 21:18:22 2013 (r246499) @@ -262,6 +262,10 @@ ieee80211_start(struct ifnet *ifp) m_freem(m); continue; } + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, + "forward frame from DS SA(%6D), DA(%6D)\n", + eh->ether_dhost, ":", + eh->ether_shost, ":"); ieee80211_mesh_proxy_check(vap, eh->ether_shost); } ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246500 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:19:44 2013 New Revision: 246500 URL: http://svnweb.freebsd.org/changeset/base/246500 Log: HWMP: Accept a PERR even if path is valid. * An HWMP PERR should be accepted even if path is valid. Because we check if we recevied it from a neighbour that we use as a next hop; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:18:22 2013 (r246499) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:19:44 2013 (r246500) @@ -1528,7 +1528,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, */ for (i = 0; i < perr->perr_ndests; i++) { rt = ieee80211_mesh_rt_find(vap, PERR_DADDR(i)); - if (rt == NULL || rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) + if (rt == NULL) continue; if (!IEEE80211_ADDR_EQ(rt->rt_nexthop, wh->i_addr2)) continue; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246501 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:20:28 2013 New Revision: 246501 URL: http://svnweb.freebsd.org/changeset/base/246501 Log: Update net80211 mesh struct ieee80211_meshgann_ie. * Change all field prefix from pann_ to gann_; * Added IEEE80211_MESHGANN_BASE_SZ macro to be used in the length field of a GANN frame according to 802.11 standard; * Changed gann_seq field type to uint32_t; * Added a Gate Announcement interval field according to IEEE802.11 2012 standard; * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211_mesh_route; * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211req_mesh_route; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_ioctl.h == --- head/sys/net80211/ieee80211_ioctl.h Thu Feb 7 21:19:44 2013 (r246500) +++ head/sys/net80211/ieee80211_ioctl.h Thu Feb 7 21:20:28 2013 (r246501) @@ -342,6 +342,7 @@ struct ieee80211req_mesh_route { #defineIEEE80211_MESHRT_FLAGS_DISCOVER 0x01 #defineIEEE80211_MESHRT_FLAGS_VALID0x02 #defineIEEE80211_MESHRT_FLAGS_PROXY0x04 +#defineIEEE80211_MESHRT_FLAGS_GATE 0x08 uint8_t imr_dest[IEEE80211_ADDR_LEN]; uint8_t imr_nexthop[IEEE80211_ADDR_LEN]; uint16_timr_nhops; Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:19:44 2013 (r246500) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:20:28 2013 (r246501) @@ -194,14 +194,20 @@ struct ieee80211_meshbeacont_ie { #endif /* Gate (GANN) Annoucement */ +/* + * NB: these macros used for the length in the IEs does not include 2 bytes + * for _ie and _len fields as is defined by the standard. + */ +#defineIEEE80211_MESHGANN_BASE_SZ (15) struct ieee80211_meshgann_ie { - uint8_t pann_ie;/* IEEE80211_ELEMID_MESHGANN */ - uint8_t pann_len; - uint8_t pann_flags; - uint8_t pann_hopcount; - uint8_t pann_ttl; - uint8_t pann_addr[IEEE80211_ADDR_LEN]; - uint8_t pann_seq; /* PANN Sequence Number */ + uint8_t gann_ie;/* IEEE80211_ELEMID_MESHGANN */ + uint8_t gann_len; + uint8_t gann_flags; + uint8_t gann_hopcount; + uint8_t gann_ttl; + uint8_t gann_addr[IEEE80211_ADDR_LEN]; + uint32_tgann_seq; /* GANN Sequence Number */ + uint16_tgann_interval; /* GANN Interval */ } __packed; /* Root (MP) Annoucement */ @@ -423,6 +429,7 @@ struct ieee80211_mesh_route { #defineIEEE80211_MESHRT_FLAGS_DISCOVER 0x01/* path discovery */ #defineIEEE80211_MESHRT_FLAGS_VALID0x02/* path discovery complete */ #defineIEEE80211_MESHRT_FLAGS_PROXY0x04/* proxy entry */ +#defineIEEE80211_MESHRT_FLAGS_GATE 0x08/* mesh gate entry */ uint32_trt_lifetime;/* route timeout */ uint32_trt_lastmseq;/* last seq# seen dest */ uint32_trt_ext_seq; /* proxy seq number */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246502 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:21:05 2013 New Revision: 246502 URL: http://svnweb.freebsd.org/changeset/base/246502 Log: Update in ieee80211_action.c for mesh code handlers. * Removed meshlm_send_action and hwmp_send_action. Introduced one common for all Mesh Action frames meshaction_send_action. According to 802.11 standard Link Metric and HWMP are all under Mesh Action category; * Did similar changes to recv_action part; * The size of meshaction_*_action is set to 12. This is to make room for the rest of Mesh Action category subtypes; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_action.c Modified: head/sys/net80211/ieee80211_action.c == --- head/sys/net80211/ieee80211_action.cThu Feb 7 21:20:28 2013 (r246501) +++ head/sys/net80211/ieee80211_action.cThu Feb 7 21:21:05 2013 (r246502) @@ -67,10 +67,8 @@ static ieee80211_send_action_func *meshp send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, }; -static ieee80211_send_action_func *meshlm_send_action[4] = { +static ieee80211_send_action_func *meshaction_send_action[12] = { send_inval, send_inval, send_inval, send_inval, -}; -static ieee80211_send_action_func *hwmp_send_action[8] = { send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, }; @@ -100,18 +98,10 @@ ieee80211_send_action_register(int cat, meshpl_send_action[act] = f; return 0; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act >= N(meshlm_send_action)) - break; - meshlm_send_action[act] = f; - return 0; - case IEEE80211_ACTION_MESH_HWMP: - if (act >= N(hwmp_send_action)) - break; - hwmp_send_action[act] = f; - return 0; - } + if (act >= N(meshaction_send_action)) + break; + meshaction_send_action[act] = f; + return 0; break; case IEEE80211_ACTION_CAT_VENDOR: if (act >= N(vendor_send_action)) @@ -149,16 +139,8 @@ ieee80211_send_action(struct ieee80211_n f = meshpl_send_action[act]; break; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act < N(meshlm_send_action)) - f = meshlm_send_action[act]; - break; - case IEEE80211_ACTION_MESH_HWMP: - if (act < N(hwmp_send_action)) - f = hwmp_send_action[act]; - break; - } + if (act < N(meshaction_send_action)) + f = meshaction_send_action[act]; break; case IEEE80211_ACTION_CAT_VENDOR: if (act < N(vendor_send_action)) @@ -188,10 +170,8 @@ static ieee80211_recv_action_func *meshp recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, }; -static ieee80211_recv_action_func *meshlm_recv_action[4] = { +static ieee80211_recv_action_func *meshaction_recv_action[12] = { recv_inval, recv_inval, recv_inval, recv_inval, -}; -static ieee80211_recv_action_func *hwmp_recv_action[8] = { recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, }; @@ -221,19 +201,10 @@ ieee80211_recv_action_register(int cat, meshpl_recv_action[act] = f; return 0; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act >= N(meshlm_recv_action)) - break; - meshlm_recv_action[act] = f; - return 0; - case IEEE80211_ACTION_MESH_HWMP: - if (act >= N(hwmp_recv_action)) - break; - hwmp_recv_action[act] = f; - return 0; - } - break; + if (act >= N(meshaction_recv_action)) + break; + meshaction_recv_action[act] = f; + return 0; case IEEE80211_ACTION_CAT_VENDOR: if (act >= N(vendor_recv_action)) break; @@ -274,16 +245,8 @@ ieee80211_recv_action(struct ieee80211_n f = meshpl_recv_action[ia->ia_action]; brea
svn commit: r246503 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:21:40 2013 New Revision: 246503 URL: http://svnweb.freebsd.org/changeset/base/246503 Log: Mesh: management mesh action frames are to be discarded when not peered. * Modified ieee80211_recv_action to check if neighbour is peered for IEEE80211_ACTION_CAT_MESH frames, if not frame is discarded. This is according to IEEE802.11 2012 standard; * Removed duplicate checks in each hwmp_recv_* handlers because HWMP is a subtype of mesh action; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_action.c == --- head/sys/net80211/ieee80211_action.cThu Feb 7 21:21:05 2013 (r246502) +++ head/sys/net80211/ieee80211_action.cThu Feb 7 21:21:40 2013 (r246503) @@ -228,6 +228,7 @@ ieee80211_recv_action(struct ieee80211_n { #defineN(a)(sizeof(a) / sizeof(a[0])) ieee80211_recv_action_func *f = recv_inval; + struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_action *ia = (const struct ieee80211_action *) frm; @@ -245,6 +246,15 @@ ieee80211_recv_action(struct ieee80211_n f = meshpl_recv_action[ia->ia_action]; break; case IEEE80211_ACTION_CAT_MESH: + if (ni == vap->iv_bss || + ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, + "peer link not yet established (%d), cat %s act %u", + ni->ni_mlstate, "mesh action", ia->ia_action); + vap->iv_stats.is_mesh_nolink++; + break; + } if (ia->ia_action < N(meshaction_recv_action)) f = meshaction_recv_action[ia->ia_action]; break; Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:21:05 2013 (r246502) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:21:40 2013 (r246503) @@ -914,9 +914,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ uint32_t metric = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; /* * Ignore PREQs from us. Could happen because someone forward it * back to us. @@ -1233,10 +1230,6 @@ hwmp_recv_prep(struct ieee80211vap *vap, int is_encap; struct ieee80211_node *ni_encap; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":", prep->prep_targetaddr, ":"); @@ -1505,10 +1498,6 @@ hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_meshperr_ie *pperr = NULL; int i, j = 0, forward = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "received PERR from %6D", wh->i_addr2, ":"); @@ -1712,9 +1701,7 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_meshrann_ie prann; uint32_t metric = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || - IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr)) + if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr)) return; rt = ieee80211_mesh_rt_find(vap, rann->rann_addr); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246504 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:22:14 2013 New Revision: 246504 URL: http://svnweb.freebsd.org/changeset/base/246504 Log: Start accepting IEEE80211_ACTION_MESH_GANN frames; * Add IEEE80211_ACTION_MESH_GANN Action frame verification in ieee80211_parse_action; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_input.c == --- head/sys/net80211/ieee80211_input.c Thu Feb 7 21:21:40 2013 (r246503) +++ head/sys/net80211/ieee80211_input.c Thu Feb 7 21:22:14 2013 (r246504) @@ -776,6 +776,10 @@ ieee80211_parse_action(struct ieee80211_ /* verify something */ break; case IEEE80211_ACTION_MESH_GANN: + IEEE80211_VERIFY_LENGTH(efrm - frm, + sizeof(struct ieee80211_meshgann_ie), + return EINVAL); + break; case IEEE80211_ACTION_MESH_CC: case IEEE80211_ACTION_MESH_MCCA_SREQ: case IEEE80211_ACTION_MESH_MCCA_SREP: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246505 - head/sbin/ifconfig
Author: monthadar Date: Thu Feb 7 21:23:03 2013 New Revision: 246505 URL: http://svnweb.freebsd.org/changeset/base/246505 Log: Mark a mesh path to a mesh gate with a 'G'. Approved by: adrian (mentor) Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cThu Feb 7 21:22:14 2013 (r246504) +++ head/sbin/ifconfig/ifieee80211.cThu Feb 7 21:23:03 2013 (r246505) @@ -4025,7 +4025,9 @@ list_mesh(int s) (rt->imr_flags & IEEE80211_MESHRT_FLAGS_VALID) ? 'V' : '!', (rt->imr_flags & IEEE80211_MESHRT_FLAGS_PROXY) ? - 'P' : ' '); + 'P' : + (rt->imr_flags & IEEE80211_MESHRT_FLAGS_GATE) ? + 'G' :' '); } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246506 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:23:43 2013 New Revision: 246506 URL: http://svnweb.freebsd.org/changeset/base/246506 Log: Mesh update: add base Mesh Gate functionality. A Mesh Gate should transmit a Mesh Action frame containing ieee80211_meshgann_ie as its only information element periodically every ieee80211_mesh_gateint ms. Unless the mesh gate is also configure as a ROOT, then these frames should not be send. This is according to 802.11 2012 standard; * Introduce new SYSCTL net.wlan.mesh.gateint, with 10s default; * Add two new functions mesh_gatemode_setup and mesh_gatemode_cb. This is similar to how HWMP setups up a callout; * Add two new action handlers mesh_recv_action_meshgate and mesh_send_action_meshgate; * Added ieee80211_add_meshgate to ieee80211_mesh.h; * Modified mesh_send_action to look similar to hwmp_send_action. This is because we need to send out broadcast management frames. * Introduced a new flag for mesh state IEEE80211_MESHFLAGS_ROOT. This flag is now set by HWMP code when a mesh STA is configured as a ROOT. This is then checked by mesh_gatemode_cb before scheduling a new callout; * Added to new field to ieee80211_mesh_state: + struct callout ms_gatetimer + ieee80211_mesh_seq ms_gateseq; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:23:03 2013 (r246505) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:23:43 2013 (r246506) @@ -805,19 +805,23 @@ static void hwmp_rootmode_setup(struct ieee80211vap *vap) { struct ieee80211_hwmp_state *hs = vap->iv_hwmp; + struct ieee80211_mesh_state *ms = vap->iv_mesh; switch (hs->hs_rootmode) { case IEEE80211_HWMP_ROOTMODE_DISABLED: callout_drain(&hs->hs_roottimer); + ms->ms_flags &= ~IEEE80211_MESHFLAGS_ROOT; break; case IEEE80211_HWMP_ROOTMODE_NORMAL: case IEEE80211_HWMP_ROOTMODE_PROACTIVE: callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rootint, hwmp_rootmode_cb, vap); + ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT; break; case IEEE80211_HWMP_ROOTMODE_RANN: callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rannint, hwmp_rootmode_rann_cb, vap); + ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT; break; } } Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:23:03 2013 (r246505) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:23:43 2013 (r246506) @@ -68,6 +68,8 @@ static intmesh_select_proto_metric(stru static voidmesh_vattach(struct ieee80211vap *); static int mesh_newstate(struct ieee80211vap *, enum ieee80211_state, int); static voidmesh_rt_cleanup_cb(void *); +static voidmesh_gatemode_setup(struct ieee80211vap *); +static voidmesh_gatemode_cb(void *); static voidmesh_linkchange(struct ieee80211_node *, enum ieee80211_mesh_mlstate); static voidmesh_checkid(void *, struct ieee80211_node *); @@ -99,6 +101,10 @@ uint32_tmesh_airtime_calc(struct ieee80 */ static SYSCTL_NODE(_net_wlan, OID_AUTO, mesh, CTLFLAG_RD, 0, "IEEE 802.11s parameters"); +static int ieee80211_mesh_gateint = -1; +SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, gateint, CTLTYPE_INT | CTLFLAG_RW, +&ieee80211_mesh_gateint, 0, ieee80211_sysctl_msecs_ticks, "I", +"mesh gate interval (ms)"); static int ieee80211_mesh_retrytimeout = -1; SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, retrytimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_retrytimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -133,11 +139,13 @@ staticieee80211_recv_action_func mesh_r static ieee80211_recv_action_func mesh_recv_action_meshpeering_confirm; static ieee80211_recv_action_func mesh_recv_action_meshpeering_close; static ieee80211_recv_action_func mesh_recv_action_meshlmetric; +static ieee80211_recv_action_func mesh_recv_action_meshgate; static ieee80211_send_action_func mesh_send_action_meshpeering_open; static ieee80211_send_action_func mesh_send_action_meshpeering_confirm; static ieee80211_send_action_func mesh_send_action_meshpeering_close; static ieee80211_send_action_func mesh_send_action_meshlmetric; +static ieee80211_send_action_func mesh_send_action_meshgate; static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { .mpm_descr = "AIRTIME", @@ -498,6 +506,48 @@ mesh_select_proto_metric(struct ieee8021 #undef N static
svn commit: r246508 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:24:20 2013 New Revision: 246508 URL: http://svnweb.freebsd.org/changeset/base/246508 Log: Propagate GANN frames, and store know gate info. * Modified mesh_recv_action_meshgate to do following: + if mesh STA already knows the mesh gate of the recevied GANN frame + if mesh gate is know, check seq number according to 802.11 standard + if mesh gate is not know, add it to the list of known mesh gates + if forwarding is enabled and ttl >= 1 then propagate the GANN frame; * Declare a new malloc type M_80211_MESH_GT_RT; * Declare a struct to store GANN information, ieee80211_mesh_gate_route. And add it as a TAILQ list to ieee80211_mesh_state; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:10 2013 (r246507) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:20 2013 (r246508) @@ -171,7 +171,8 @@ MALLOC_DEFINE(M_80211_MESH_PERR, "80211p /* The longer one of the lifetime should be stored as new lifetime */ #define MESH_ROUTE_LIFETIME_MAX(a, b) (a > b ? a : b) -MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh", "802.11s routing table"); +MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh_rt", "802.11s routing table"); +MALLOC_DEFINE(M_80211_MESH_GT_RT, "80211mesh_gt", "802.11s known gates table"); /* * Helper functions to manipulate the Mesh routing table. @@ -670,6 +671,7 @@ mesh_vattach(struct ieee80211vap *vap) ms->ms_seq = 0; ms->ms_flags = (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_FWD); ms->ms_ttl = IEEE80211_MESH_DEFAULT_TTL; + TAILQ_INIT(&ms->ms_known_gates); TAILQ_INIT(&ms->ms_routes); mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF); callout_init(&ms->ms_cleantimer, CALLOUT_MPSAFE); @@ -2370,18 +2372,78 @@ mesh_recv_action_meshgate(struct ieee802 const uint8_t *frm, const uint8_t *efrm) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_gate_route *gr, *next; struct ieee80211_mesh_route *rt_gate; + struct ieee80211_meshgann_ie pgann; + int found = 0; const struct ieee80211_meshgann_ie *ie = (const struct ieee80211_meshgann_ie *) (frm+2); /* action + code */ - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, - "%s", "received GANN from meshgate"); + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr)) + return 0; + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, + "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":", + ie->gann_seq); + + if (ms == NULL) + return (0); + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { + if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr)) + continue; + if (ie->gann_seq <= gr->gr_lastseq) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, + "GANN old seqno %u <= %u", + ie->gann_seq, gr->gr_lastseq); + MESH_RT_UNLOCK(ms); + return (0); + } + /* corresponding mesh gate found & GANN accepted */ + found = 1; + break; + + } + if (found == 0) { + /* this GANN is from a new mesh Gate add it to known table. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, + "stored new GANN information, seq %u.", ie->gann_seq); + gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + IEEE80211_ADDR_COPY(gr->gr_addr, ie->gann_addr); + TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); + } + gr->gr_lastseq = ie->gann_seq; - rt_gate = ieee80211_mesh_rt_find(vap, ie->gann_addr); + /* check if we have a path to this gate */ + rt_gate = mesh_rt_find_locked(ms, gr->gr_addr); if (rt_gate != NULL && - rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) + rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) { + gr->gr_route = rt_gate; rt_gate->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + } + + MESH_RT_UNLOCK(ms); + + /* popagate only if decremented ttl >= 1 && forwarding is enabled */ + if ((ie->gann_ttl - 1) < 1 && + !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) + return 0; + pgann.gann_flags = ie->gann_flags; /* Re
svn commit: r246509 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:24:52 2013 New Revision: 246509 URL: http://svnweb.freebsd.org/changeset/base/246509 Log: Mark root mesh as gate when mesh gate flag set. * Add function ieee80211_mesh_mark_gate in ieee80211_mesh.h; * When received a proactive PREQ or RANN with corresponding mesh gate flag set, create a new entry in the known mesh gate list; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:52 2013 (r246509) @@ -1092,6 +1092,16 @@ hwmp_recv_preq(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "root mesh station @ %6D", preq->preq_origaddr, ":"); + /* Check if root is a mesh gate, mark it */ + if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_GATE) { + struct ieee80211_mesh_gate_route *gr; + + rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + gr = ieee80211_mesh_mark_gate(vap, preq->preq_origaddr, + rtorig); + gr->gr_lastseq = 0; /* NOT GANN */ + } + /* * Reply with a PREP if we don't have a path to the root * or if the root sent us a proactive PREQ. @@ -1745,6 +1755,15 @@ hwmp_recv_rann(struct ieee80211vap *vap, } } hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + /* Check if root is a mesh gate, mark it */ + if (rann->rann_flags & IEEE80211_MESHRANN_FLAGS_GATE) { + struct ieee80211_mesh_gate_route *gr; + + rt->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + gr = ieee80211_mesh_mark_gate(vap, rann->rann_addr, + rt); + gr->gr_lastseq = 0; /* NOT GANN */ + } /* discovery timeout */ ieee80211_mesh_rt_update(rt, ticks_to_msecs(ieee80211_hwmp_roottimeout)); Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:52 2013 (r246509) @@ -854,6 +854,43 @@ mesh_rt_cleanup_cb(void *arg) mesh_rt_cleanup_cb, vap); } +/* + * Mark a mesh STA as gate and return a pointer to it. + * If this is first time, we create a new gate route. + * Always update the path route to this mesh gate. + */ +struct ieee80211_mesh_gate_route * +ieee80211_mesh_mark_gate(struct ieee80211vap *vap, const uint8_t *addr, +struct ieee80211_mesh_route *rt) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_gate_route *gr = NULL, *next; + int found = 0; + + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { + if (IEEE80211_ADDR_EQ(gr->gr_addr, addr)) { + found = 1; + break; + } + } + + if (!found) { + /* New mesh gate add it to known table. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, addr, + "%s", "stored new gate information from pro-PREQ."); + gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + IEEE80211_ADDR_COPY(gr->gr_addr, addr); + TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); + } + gr->gr_route = rt; + /* TODO: link from path route to gate route */ + MESH_RT_UNLOCK(ms); + + return gr; +} + /* * Helper function to note the Mesh Peer Link FSM change. Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:52 2013 (r246509) @@ -566,6 +566,9 @@ voidieee80211_mesh_init_neighbor(struc const struct ieee80211_scanparams *); void ieee80211_mesh_update_beacon(struct ieee80211vap *, struct ieee80211_beacon_offsets *); +struct ieee80211_mesh_gate_route * + ieee80211_mesh_mark_gate(struct ieee80211vap *, + const uint8_t *, struct ieee80211_mesh_route *); /* * Return non-zero if proxy operation is enabled. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.o
svn commit: r246510 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:25:32 2013 New Revision: 246510 URL: http://svnweb.freebsd.org/changeset/base/246510 Log: Send frames to mesh gate if 11s discovery fails. * Send frames that have no path to a known valid Mesh Gate; * Added the function ieee80211_mesh_forward_to_gates that sends the frame to the first found Mesh Gate in the forwarding information; * If we try to discover again while we are discovering queue frame, the discovery callout will send the frames either to mesh gates or discards them silently; * Queue frame also if we try to discover to frequently; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:52 2013 (r246509) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:25:32 2013 (r246510) @@ -1839,12 +1839,11 @@ hwmp_rediscover_cb(void *arg) hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if (hr->hr_preqretries >= ieee80211_hwmp_maxpreq_retries) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - rt->rt_dest, NULL, "%s", - "no valid path , max number of discovery, send GATE"); - /* TODO: send to known gates */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, + rt->rt_dest, "%s", + "max number of discovery, send queued frames to GATE"); + ieee80211_mesh_forward_to_gates(vap, rt); vap->iv_stats.is_mesh_fwd_nopath++; - rt->rt_flags = 0; /* Mark invalid */ return ; /* XXX: flush queue? */ } @@ -1914,6 +1913,12 @@ hwmp_discover(struct ieee80211vap *vap, } hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest, + "%s", "already discovering queue frame until path found"); + sendpreq = 1; + goto done; + } if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { if (hr->hr_lastdiscovery != 0 && (ticks - hr->hr_lastdiscovery < @@ -1921,7 +1926,7 @@ hwmp_discover(struct ieee80211vap *vap, IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, dest, NULL, "%s", "too frequent discovery requeust"); - /* XXX: stats? */ + sendpreq = 1; goto done; } hr->hr_lastdiscovery = ticks; Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:52 2013 (r246509) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:25:32 2013 (r246510) @@ -1022,6 +1022,71 @@ mesh_find_txnode(struct ieee80211vap *va } /* + * Forward the queued frames to known valid mesh gates. + * Assume destination to be outside the MBSS (i.e. proxy entry), + * If no valid mesh gates are known silently discard queued frames. + * If there is no 802.2 path route will be timedout. + */ +void +ieee80211_mesh_forward_to_gates(struct ieee80211vap *vap, +struct ieee80211_mesh_route *rt_dest) +{ + struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ifnet *ifp = vap->iv_ifp; + struct ieee80211_mesh_route *rt_gate; + struct ieee80211_mesh_gate_route *gr = NULL, *gr_next; + struct mbuf *m, *next; + int gates_found = 0; + + KASSERT( rt_dest->rt_flags == IEEE80211_MESHRT_FLAGS_DISCOVER, + ("Route is not marked with IEEE80211_MESHRT_FLAGS_DISCOVER")); + + /* XXX: send to more than one valid mash gate */ + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, gr_next) { + rt_gate = gr->gr_route; + if (rt_gate == NULL) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, + rt_dest->rt_dest, + "mesh gate with no path %6D", + gr->gr_addr, ":"); + continue; + } + gates_found = 1; + /* convert route to a proxy route */ + rt_dest->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | + IEEE80211_MESHRT_FLAG
svn commit: r246511 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:26:06 2013 New Revision: 246511 URL: http://svnweb.freebsd.org/changeset/base/246511 Log: Mesh gate code to transmit to all mesh gates. * Modified mesh_find_txnode to be able to handle proxy marked entries by recursively calling itself to find the txnode towards the active mesh gate; * Mesh Gate: Added a new function that transmits data frames similar to ieee80211_start; * Modified ieee80211_mesh_forward_to_gates so that: + Frames are duplicated and sent to each valid Mesh Gate; + Route is marked invalid before return of function, this is because we dont know yet which Mesh Gate is we will use; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:25:32 2013 (r246510) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:26:06 2013 (r246511) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -79,6 +80,8 @@ static intmesh_checkpseq(struct ieee802 static struct ieee80211_node * mesh_find_txnode(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); +static voidmesh_transmit_to_gate(struct ieee80211vap *, struct mbuf *, + struct ieee80211_mesh_route *); static voidmesh_forward(struct ieee80211vap *, struct mbuf *, const struct ieee80211_meshcntl *); static int mesh_input(struct ieee80211_node *, struct mbuf *, int, int); @@ -1011,21 +1014,151 @@ mesh_find_txnode(struct ieee80211vap *va rt = ieee80211_mesh_rt_find(vap, dest); if (rt == NULL) return NULL; - if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || - (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) { + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest, - "%s: !valid or proxy, flags 0x%x", __func__, rt->rt_flags); + "%s: !valid, flags 0x%x", __func__, rt->rt_flags); /* XXX stat */ return NULL; } + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { + rt = ieee80211_mesh_rt_find(vap, rt->rt_mesh_gate); + if (rt == NULL) return NULL; + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest, + "%s: meshgate !valid, flags 0x%x", __func__, + rt->rt_flags); + /* XXX stat */ + return NULL; + } + } return ieee80211_find_txnode(vap, rt->rt_nexthop); } +static void +mesh_transmit_to_gate(struct ieee80211vap *vap, struct mbuf *m, +struct ieee80211_mesh_route *rt_gate) +{ + struct ifnet *ifp = vap->iv_ifp; + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *parent = ic->ic_ifp; + struct ieee80211_node *ni; + struct ether_header *eh; + int error; + + eh = mtod(m, struct ether_header *); + ni = mesh_find_txnode(vap, rt_gate->rt_dest); + if (ni == NULL) { + ifp->if_oerrors++; + m_freem(m); + return; + } + + if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && + (m->m_flags & M_PWR_SAV) == 0) { + /* +* Station in power save mode; pass the frame +* to the 802.11 layer and continue. We'll get +* the frame back when the time is right. +* XXX lose WDS vap linkage? +*/ + (void) ieee80211_pwrsave(ni, m); + ieee80211_free_node(ni); + return; + } + + /* calculate priority so drivers can find the tx queue */ + if (ieee80211_classify(ni, m)) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, + eh->ether_dhost, NULL, + "%s", "classification failure"); + vap->iv_stats.is_tx_classify++; + ifp->if_oerrors++; + m_freem(m); + ieee80211_free_node(ni); + return; + } + /* +* Stash the node pointer. Note that we do this after +* any call to ieee80211_dwds_mcast because that code +* uses any existing value for rcvif to identify the +* interface it (might have been) received on. +*/ + m->m_pkthdr.rcvif = (void *)ni; + + BPF_MTAP(ifp, m); /* 802.3 tx */ + + /* +* Check if A-MPDU tx aggregation is setup or if we +* should try to enable it. The sta must be associated +* with HT and A-
svn commit: r246512 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:26:40 2013 New Revision: 246512 URL: http://svnweb.freebsd.org/changeset/base/246512 Log: HWMP: ic->raw_xmit didn't always point to correct ni. This is a code re-write. ic->raw_xmit need a pointer to ieee80211_node for the destination node (da). I have reorganized the code so that a pointer to the da node is searched for in the end & in one place. * Make mesh_find_txnode public to be used by HWMP, renamed to ieee80211_mesh_finx_txnode; * changed the argument from ieee80211_node to ieee80211vap for all hwmp_send_* functions; * removed the 'sa' argument from hwmp_send_* functions as all HWMP frames have the source address equal to vap->iv_myaddr; * Modified hwmp_send_action so that if da is MULTCAST ni=vap->iv_bss otherwise we called ieee80211_mesh_find_txnode. Also no need to hold a reference in this functions if da is not MULTICAST as by finding the node it became referenced in ieee80211_find_txnode; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:06 2013 (r246511) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:40 2013 (r246512) @@ -68,8 +68,7 @@ static void hwmp_vattach(struct ieee8021 static voidhwmp_vdetach(struct ieee80211vap *); static int hwmp_newstate(struct ieee80211vap *, enum ieee80211_state, int); -static int hwmp_send_action(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_action(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], uint8_t *, size_t); static uint8_t * hwmp_add_meshpreq(uint8_t *, @@ -86,23 +85,20 @@ static void hwmp_rootmode_rann_cb(void * static voidhwmp_recv_preq(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshpreq_ie *); -static int hwmp_send_preq(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_preq(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshpreq_ie *, struct timeval *, struct timeval *); static voidhwmp_recv_prep(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshprep_ie *); -static int hwmp_send_prep(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_prep(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshprep_ie *); static voidhwmp_recv_perr(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshperr_ie *); -static int hwmp_send_perr(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_perr(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *); static voidhwmp_senderror(struct ieee80211vap *, @@ -111,8 +107,7 @@ static void hwmp_senderror(struct ieee80 static voidhwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshrann_ie *); -static int hwmp_send_rann(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_rann(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshrann_ie *); static struct ieee80211_node * @@ -588,17 +583,30 @@ hwmp_recv_action_meshpath(struct ieee802 } static int -hwmp_send_action(struct ieee80211_node *ni, -const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_action(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], uint8_t *ie, size_t len) { - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *ni; + struct ieee80211com *ic; struct ieee80211_bpf_params params; struct mbuf *m; uint8_t *frm; + if (IEEE80211_IS_MULTICAST(da)) { + ni = ieee80211_ref_node(vap->iv_bss); +#ifdef IEEE80211_DEBUG_REFCNT + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), + ieee8021
svn commit: r246513 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:27:40 2013 New Revision: 246513 URL: http://svnweb.freebsd.org/changeset/base/246513 Log: Mesh HWMP PREQ update: proxy reply only if mesh STA is a meshgate. * Original PREP frame is transmitted only by the target mesh STA or the mesh STA that is the proxy target; * Fixed so that metric value is not over written incorrectly in hwmp_recv_preq for when replying back with a PREP; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:40 2013 (r246512) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:27:40 2013 (r246513) @@ -1017,10 +1017,12 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * Check if the PREQ is addressed to us. -* or a Proxy currently supplied by us. +* or a Proxy currently gated by us. */ if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || - (rttarg != NULL && + (ms->ms_flags & IEEE80211_MESHFLAGS_GATE && + rttarg != NULL && + IEEE80211_ADDR_EQ(vap->iv_myaddr, rttarg->rt_mesh_gate) && rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { /* @@ -1031,6 +1033,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, prep.prep_flags = 0; prep.prep_hopcount = 0; + prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); if (rttarg != NULL && /* if NULL it means we are the target */ rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { @@ -1042,6 +1045,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* update proxy seqno to HWMP seqno */ rttarg->rt_ext_seq = hs->hs_seq; prep.prep_hopcount = rttarg->rt_nhops; + prep.prep_metric = rttarg->rt_metric; IEEE80211_ADDR_COPY(prep.prep_targetaddr, rttarg->rt_mesh_gate); } /* @@ -1050,7 +1054,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, prep.prep_ttl = ms->ms_ttl; prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; - prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246514 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:28:25 2013 New Revision: 246514 URL: http://svnweb.freebsd.org/changeset/base/246514 Log: Mesh HWMP: don't send an intermediate PREP for proxy entries. * The standard is unclear about what should happen in case a mesh STA (not marked as a mesh gate) recevies a PREQ for a destination that is marked as proxy. Solution for now is not to do intermediate reply at all, and let the PREQ reach the mesh gate; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:27:40 2013 (r246513) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:28:25 2013 (r246514) @@ -1133,9 +1133,11 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * We have a valid route to this node. +* NB: if target is proxy dont reply. */ if (rttarg != NULL && - (rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID && + !(rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) { /* * Check if we can send an intermediate Path Reply, * i.e., Target Only bit is not set and target is not ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246515 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:29:14 2013 New Revision: 246515 URL: http://svnweb.freebsd.org/changeset/base/246515 Log: Mesh HWMP PREQ: fixed conditions for discarding elements. Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:28:25 2013 (r246514) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:29:14 2013 (r246515) @@ -997,10 +997,10 @@ hwmp_recv_preq(struct ieee80211vap *vap, * it will be marked below. */ rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; - }else if ((hrtarg != NULL && - HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && - ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || - preqid >= preq->preq_id) { + } else if ((hrtarg != NULL && + !HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0))) || + (rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID && + preqid >= preq->preq_id)) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "discard PREQ from %6D, old seqno %u <= %u," " or old preqid %u < %u", ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246516 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:29:48 2013 New Revision: 246516 URL: http://svnweb.freebsd.org/changeset/base/246516 Log: Update ddb to print mesh routing table. * Modified _db_show_vap and _db_show_com to print mesh routing table if the 'm' modifier is specified; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_ddb.c Modified: head/sys/net80211/ieee80211_ddb.c == --- head/sys/net80211/ieee80211_ddb.c Thu Feb 7 21:29:14 2013 (r246515) +++ head/sys/net80211/ieee80211_ddb.c Thu Feb 7 21:29:48 2013 (r246516) @@ -63,9 +63,9 @@ __FBSDID("$FreeBSD$"); } while (0) static void _db_show_sta(const struct ieee80211_node *); -static void _db_show_vap(const struct ieee80211vap *, int); +static void _db_show_vap(const struct ieee80211vap *, int, int); static void _db_show_com(const struct ieee80211com *, - int showvaps, int showsta, int showprocs); + int showvaps, int showsta, int showmesh, int showprocs); static void _db_show_node_table(const char *tag, const struct ieee80211_node_table *); @@ -103,7 +103,7 @@ DB_SHOW_COMMAND(statab, db_show_statab) DB_SHOW_COMMAND(vap, db_show_vap) { - int i, showprocs = 0; + int i, showmesh = 0, showprocs = 0; if (!have_addr) { db_printf("usage: show vap \n"); @@ -113,18 +113,22 @@ DB_SHOW_COMMAND(vap, db_show_vap) switch (modif[i]) { case 'a': showprocs = 1; + showmesh = 1; + break; + case 'm': + showmesh = 1; break; case 'p': showprocs = 1; break; } - _db_show_vap((const struct ieee80211vap *) addr, showprocs); + _db_show_vap((const struct ieee80211vap *) addr, showmesh, showprocs); } DB_SHOW_COMMAND(com, db_show_com) { const struct ieee80211com *ic; - int i, showprocs = 0, showvaps = 0, showsta = 0; + int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0; if (!have_addr) { db_printf("usage: show com \n"); @@ -133,11 +137,14 @@ DB_SHOW_COMMAND(com, db_show_com) for (i = 0; modif[i] != '\0'; i++) switch (modif[i]) { case 'a': - showsta = showvaps = showprocs = 1; + showsta = showmesh = showvaps = showprocs = 1; break; case 's': showsta = 1; break; + case 'm': + showmesh = 1; + break; case 'v': showvaps = 1; break; @@ -147,7 +154,7 @@ DB_SHOW_COMMAND(com, db_show_com) } ic = (const struct ieee80211com *) addr; - _db_show_com(ic, showvaps, showsta, showprocs); + _db_show_com(ic, showvaps, showsta, showmesh, showprocs); } DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps) @@ -178,7 +185,7 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va vap->iv_ifp->if_xname, vap); db_printf("\n"); } else - _db_show_com(ic, 1, 1, 1); + _db_show_com(ic, 1, 1, 1, 1); } } } @@ -330,7 +337,7 @@ _db_show_tdma(const char *sep, const str #endif /* IEEE80211_SUPPORT_TDMA */ static void -_db_show_vap(const struct ieee80211vap *vap, int showprocs) +_db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) { const struct ieee80211com *ic = vap->iv_ic; int i; @@ -341,6 +348,10 @@ _db_show_vap(const struct ieee80211vap * db_printf("\n"); db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]); +#ifdef IEEE80211_SUPPORT_MESH + if (vap->iv_opmode == IEEE80211_M_MBSS) + db_printf("(%p)", vap->iv_mesh); +#endif db_printf(" state %s", ieee80211_state_name[vap->iv_state]); db_printf(" ifp %p(%s)", vap->iv_ifp, vap->iv_ifp->if_xname); db_printf("\n"); @@ -472,6 +483,10 @@ _db_show_vap(const struct ieee80211vap * db_printf(" acl %p", vap->iv_acl); db_printf(" as %p", vap->iv_as); db_printf("\n"); +#ifdef IEEE80211_SUPPORT_MESH + if (showmesh && vap->iv_mesh != NULL) + _db_show_mesh(vap->iv_mesh); +#endif #ifdef IEEE80211_SUPPORT_TDMA if (vap->iv_tdma != NULL) _db_show_tdma("\t", vap->iv_tdma, showprocs); @@ -495,7 +510,8 @@ _db_show_vap(const struct ieee80211vap * } static void -_db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, int showprocs) +_db_show_com(const s
svn commit: r246517 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:30:29 2013 New Revision: 246517 URL: http://svnweb.freebsd.org/changeset/base/246517 Log: Mesh bug: debug infomartion showing swapped SA and DA address. * Fix bug for "forward frame from SA(%6D), DA(%6D)" where addresses where swapped between SA and DA; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cThu Feb 7 21:29:48 2013 (r246516) +++ head/sys/net80211/ieee80211_output.cThu Feb 7 21:30:29 2013 (r246517) @@ -264,8 +264,8 @@ ieee80211_start(struct ifnet *ifp) } IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, "forward frame from DS SA(%6D), DA(%6D)\n", - eh->ether_dhost, ":", - eh->ether_shost, ":"); + eh->ether_shost, ":", + eh->ether_dhost, ":"); ieee80211_mesh_proxy_check(vap, eh->ether_shost); } ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246518 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:30:58 2013 New Revision: 246518 URL: http://svnweb.freebsd.org/changeset/base/246518 Log: Mesh HWMP PERR bug fixes. * When calling ieee80211_mesh_rt_flush_peer, the rt->rt_dest argument should not be passed because it can get freed before invalidating the other routes that depends on it to compare with next_hop. Use PERR_DADDR(i) instead; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:29 2013 (r246517) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:58 2013 (r246518) @@ -1570,7 +1570,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, "PERR, unknown reason code %u\n", PERR_DFLAGS(i)); goto done; /* XXX: stats?? */ } - ieee80211_mesh_rt_flush_peer(vap, rt->rt_dest); + ieee80211_mesh_rt_flush_peer(vap, PERR_DADDR(i)); KASSERT(j < 32, ("PERR, error ndest >= 32 (%u)", j)); } if (j == 0) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246519 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:31:37 2013 New Revision: 246519 URL: http://svnweb.freebsd.org/changeset/base/246519 Log: Mesh HWMP forwarding information: updating FI for transmitter. * Added hwmp_update_transmitter function that checks if the metric to the transmitter have improved. If old FI is invalid or metric is larger the FI to the transmitter is updated occurdingly. This is a recommendation from the 802.11 2012 standard, table 13-9; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:58 2013 (r246518) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:31:37 2013 (r246519) @@ -896,6 +896,45 @@ hwmp_rootmode_rann_cb(void *arg) hwmp_rootmode_setup(vap); } +/* + * Update forwarding information to TA if metric improves. + */ +static void +hwmp_update_transmitter(struct ieee80211vap *vap, struct ieee80211_node *ni, +const char *hwmp_frame) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_route *rttran = NULL; /* Transmitter */ + int metric = 0; + + rttran = ieee80211_mesh_rt_find(vap, ni->ni_macaddr); + if (rttran == NULL) { + rttran = ieee80211_mesh_rt_add(vap, ni->ni_macaddr); + if (rttran == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add path to transmitter %6D of %s", + ni->ni_macaddr, ":", hwmp_frame); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } + } + metric = ms->ms_pmetric->mpm_metric(ni); + if (!(rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) || + rttran->rt_metric > metric) + { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "%s path to transmiter %6D of %s, metric %d:%d", + rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? + "prefer" : "update", ni->ni_macaddr, ":", hwmp_frame, + rttran->rt_metric, metric); + IEEE80211_ADDR_COPY(rttran->rt_nexthop, ni->ni_macaddr); + rttran->rt_metric = metric; + rttran->rt_nhops = 1; + ieee80211_mesh_rt_update(rttran, ms->ms_ppath->mpp_inact); + rttran->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; + } +} + #definePREQ_TFLAGS(n) preq->preq_targets[n].target_flags #definePREQ_TADDR(n) preq->preq_targets[n].target_addr #definePREQ_TSEQ(n)preq->preq_targets[n].target_seq @@ -1010,10 +1049,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, return; } - /* -* Forwarding information for transmitter mesh STA -* [OPTIONAL: if metric improved] -*/ + /* Update forwarding information to TA if metric improves. */ + hwmp_update_transmitter(vap, ni, "PREQ"); /* * Check if the PREQ is addressed to us. @@ -1268,7 +1305,6 @@ hwmp_recv_prep(struct ieee80211vap *vap, * rules defined in 13.10.8.4). If the conditions for creating or * updating the forwarding information have not been met in those * rules, no further steps are applied to the PREP. -* [OPTIONAL]: update forwarding information to TA if metric improves. */ rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr); if (rt == NULL) { @@ -1323,6 +1359,9 @@ hwmp_recv_prep(struct ieee80211vap *vap, } rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + /* Update forwarding information to TA if metric improves */ + hwmp_update_transmitter(vap, ni, "PREP"); + /* * If it's NOT for us, propagate the PREP */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246520 - head/sys/net80211
Author: monthadar Date: Thu Feb 7 21:32:09 2013 New Revision: 246520 URL: http://svnweb.freebsd.org/changeset/base/246520 Log: Mesh: recevied GANN frames where not parsed correctly. * Added mesh_parse_meshgate_action that parse all values to host endian; * Add more detailed debug output; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:31:37 2013 (r246519) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:32:09 2013 (r246520) @@ -533,9 +533,6 @@ mesh_gatemode_cb(void *arg) struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_meshgann_ie gann; - IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss, - "%s", "send broadcast GANN"); - gann.gann_flags = 0; /* Reserved */ gann.gann_hopcount = 0; gann.gann_ttl = ms->ms_ttl; @@ -543,6 +540,9 @@ mesh_gatemode_cb(void *arg) gann.gann_seq = ms->ms_gateseq++; gann.gann_interval = ieee80211_mesh_gateint; + IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss, + "send broadcast GANN (seq %u)", gann.gann_seq); + ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH, IEEE80211_ACTION_MESH_GANN, &gann); mesh_gatemode_setup(vap); @@ -2605,6 +2605,40 @@ mesh_recv_action_meshlmetric(struct ieee } /* + * Parse meshgate action ie's for GANN frames. + * Returns -1 if parsing fails, otherwise 0. + */ +static int +mesh_parse_meshgate_action(struct ieee80211_node *ni, +const struct ieee80211_frame *wh, /* XXX for VERIFY_LENGTH */ +struct ieee80211_meshgann_ie *ie, const uint8_t *frm, const uint8_t *efrm) +{ + struct ieee80211vap *vap = ni->ni_vap; + const struct ieee80211_meshgann_ie *gannie; + + while (efrm - frm > 1) { + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return -1); + switch (*frm) { + case IEEE80211_ELEMID_MESHGANN: + gannie = (const struct ieee80211_meshgann_ie *) frm; + memset(ie, 0, sizeof(ie)); + ie->gann_ie = gannie->gann_ie; + ie->gann_len = gannie->gann_len; + ie->gann_flags = gannie->gann_flags; + ie->gann_hopcount = gannie->gann_hopcount; + ie->gann_ttl = gannie->gann_ttl; + IEEE80211_ADDR_COPY(ie->gann_addr, gannie->gann_addr); + ie->gann_seq = LE_READ_4(&gannie->gann_seq); + ie->gann_interval = LE_READ_2(&gannie->gann_interval); + break; + } + frm += frm[1] + 2; + } + + return 0; +} + +/* * Mesh Gate Announcement handling. */ static int @@ -2617,29 +2651,36 @@ mesh_recv_action_meshgate(struct ieee802 struct ieee80211_mesh_gate_route *gr, *next; struct ieee80211_mesh_route *rt_gate; struct ieee80211_meshgann_ie pgann; + struct ieee80211_meshgann_ie ie; int found = 0; - const struct ieee80211_meshgann_ie *ie = - (const struct ieee80211_meshgann_ie *) - (frm+2); /* action + code */ - if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr)) + /* +2 for action + code */ + if (mesh_parse_meshgate_action(ni, wh, &ie, frm+2, efrm) != 0) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, "%s", + "GANN parsing failed"); + vap->iv_stats.is_rx_mgtdiscard++; + return (0); + } + + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie.gann_addr)) return 0; IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, - "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":", - ie->gann_seq); + "received GANN, meshgate: %6D (seq %u)", ie.gann_addr, ":", + ie.gann_seq); if (ms == NULL) return (0); MESH_RT_LOCK(ms); TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { - if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr)) + if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie.gann_addr)) continue; - if (ie->gann_seq <= gr->gr_lastseq) { + if (ie.gann_seq <= gr->gr_lastseq) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, NULL, "GANN old seqno %u <= %u", - ie->gann_seq, gr->gr_lastseq); + ie.gann_seq, gr->gr_lastseq); MESH_RT_UNLOCK(ms); return (0); } @@ -2650,14 +2691,14 @@ mesh_
svn commit: r237561 - head/sys/net80211
Author: monthadar Date: Mon Jun 25 11:52:26 2012 New Revision: 237561 URL: http://svn.freebsd.org/changeset/base/237561 Log: Mesh mode, potential garbage in QoS subfield. * qos[1] subfield is never assigned a value before this statement. qos[1] can potentially be OR:ed with garbage. Make it an assignment instead; * Remove brackets around if statement; Approved by: adrian Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cMon Jun 25 09:46:06 2012 (r237560) +++ head/sys/net80211/ieee80211_output.cMon Jun 25 11:52:26 2012 (r237561) @@ -1313,9 +1313,9 @@ ieee80211_encap(struct ieee80211vap *vap if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy) qos[0] |= IEEE80211_QOS_ACKPOLICY_NOACK; #ifdef IEEE80211_SUPPORT_MESH - if (vap->iv_opmode == IEEE80211_M_MBSS) { - qos[1] |= IEEE80211_QOS_MC; - } else + if (vap->iv_opmode == IEEE80211_M_MBSS) + qos[1] = IEEE80211_QOS_MC; + else #endif qos[1] = 0; wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_QOS; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238938 - head/sys/dev/wtap
Author: monthadar Date: Tue Jul 31 07:22:50 2012 New Revision: 238938 URL: http://svn.freebsd.org/changeset/base/238938 Log: Fix wtap to not panic in wtap_beacon_intrp. * Changed KASSERT to be debug printf (DWTAP_PRINTF). If state is not IEEE80211_S_RUN we return without scheduling a new callout; * When net80211 stack changes state to IEEE802_11_INIT we stop the beacon callout task; Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c == --- head/sys/dev/wtap/if_wtap.c Tue Jul 31 05:51:48 2012(r238937) +++ head/sys/dev/wtap/if_wtap.c Tue Jul 31 07:22:50 2012(r238938) @@ -230,8 +230,10 @@ wtap_beacon_intrp(void *arg) struct ieee80211vap *vap = arg; struct mbuf *m; - KASSERT(vap->iv_state >= IEEE80211_S_RUN, - ("not running, state %d", vap->iv_state)); + if (vap->iv_state < IEEE80211_S_RUN) { + DWTAP_PRINTF("Skip beacon, not running, state %d", vap->iv_state); + return ; + } DWTAP_PRINTF("[%d] beacon intrp\n", avp->id); //burst mode /* * Update dynamic beacon contents. If this returns @@ -289,6 +291,8 @@ wtap_newstate(struct ieee80211vap *vap, default: goto bad; } + } else if (nstate == IEEE80211_S_INIT) { + callout_stop(&avp->av_swba); } return 0; bad: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238939 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 07:31:47 2012 New Revision: 238939 URL: http://svn.freebsd.org/changeset/base/238939 Log: Fix bugs in net80211s found with wtap simulator. For description of the test scripts refer to projects/net80211_testsuite/wtap. * Test 007 showed a bug in intermediate PREP for a proxy entry. Resolved; * Test 002 showed a bug in the Addressing Mode flag for a PREQ. Resolved; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:22:50 2012 (r238938) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) @@ -840,7 +840,7 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_GATE; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) @@ -951,7 +951,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, hrtarg = IEEE80211_MESH_ROUTE_PRIV(rttarg, struct ieee80211_hwmp_route); /* Address mode: ucast */ - if((preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM) == 0 && + if(preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM && rttarg == NULL && !IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_HWMP, @@ -1029,6 +1029,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, hs->hs_seq = HWMP_SEQ_MAX(hs->hs_seq, PREQ_TSEQ(0)) + 1; prep.prep_flags = 0; + prep.prep_hopcount = 0; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); if (rttarg != NULL && /* if NULL it means we are the target */ rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1038,13 +1040,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, rttarg->rt_dest); /* update proxy seqno to HWMP seqno */ rttarg->rt_ext_seq = hs->hs_seq; + prep.prep_hopcount = rttarg->rt_nhops; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, rttarg->rt_mesh_gate); } /* * Build and send a PREP frame. */ - prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238940 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 07:36:27 2012 New Revision: 238940 URL: http://svn.freebsd.org/changeset/base/238940 Log: Fix a PREQ comparison error in 11s HWMP. * Earlier we compared two not equal metrics, one was what we recevied in the 'new PREQ' while the other was what we already have saved which was 'old PREQ' + link metric for the last hop; * Fixed by adding 'new PREQ' + link metric for the last hop in a temporary variable; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:36:27 2012 (r238940) @@ -912,6 +912,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -985,13 +986,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ + metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && - preq->preq_metric < rtorig->rt_metric)) { + metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; IEEE80211_ADDR_COPY(rtorig->rt_nexthop, wh->i_addr2); - rtorig->rt_metric = preq->preq_metric + - ms->ms_pmetric->mpm_metric(ni); + rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r238942 - head/sys/net80211
Author: monthadar Date: Tue Jul 31 08:05:40 2012 New Revision: 238942 URL: http://svn.freebsd.org/changeset/base/238942 Log: Fixed some debug output in hwmp_recv_prep. Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:04:49 2012 (r238941) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:05:40 2012 (r238942) @@ -1289,7 +1289,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "discard PREP from %6D, new metric %u > %u", prep->prep_targetaddr, ":", - prep->prep_metric, rt->rt_metric); + metric, rt->rt_metric); return; } } @@ -1299,7 +1299,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_targetaddr, ":", - rt->rt_nhops, prep->prep_hopcount, + rt->rt_nhops, prep->prep_hopcount + 1, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; @@ -1371,7 +1371,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rtext->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_target_ext_addr, ":", - rtext->rt_nhops, prep->prep_hopcount, + rtext->rt_nhops, prep->prep_hopcount + 1, rtext->rt_metric, metric); rtext->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r246807 - head/sys/net80211
Author: monthadar Date: Thu Feb 14 20:00:38 2013 New Revision: 246807 URL: http://svnweb.freebsd.org/changeset/base/246807 Log: Mesh: QoS Control field bit flags fix. * The following bit flags where incroccetly defined: o Mesh Control Present o Mesh Power Save Level o RSPI This is now corrected according to Table 8.4 as per IEEE 802.11 2012; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Thu Feb 14 19:46:41 2013 (r246806) +++ head/sys/net80211/ieee80211.h Thu Feb 14 20:00:38 2013 (r246807) @@ -200,11 +200,11 @@ struct ieee80211_qosframe_addr4 { #defineIEEE80211_QOS_EOSP_S4 #defineIEEE80211_QOS_TID 0x0f /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */ -#define IEEE80211_QOS_MC 0x10/* Mesh control */ +#define IEEE80211_QOS_MC 0x01/* Mesh control */ /* Mesh power save level*/ -#define IEEE80211_QOS_MESH_PSL 0x20 +#define IEEE80211_QOS_MESH_PSL 0x02 /* Mesh Receiver Service Period Initiated */ -#define IEEE80211_QOS_RSPI 0x40 +#define IEEE80211_QOS_RSPI 0x04 /* bits 11 to 15 reserved */ /* does frame have QoS sequence control data */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"