Date: Tue, 30 Jun 2009 18:52:36 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r195201 - projects/mesh11s/sys/net80211 Message-ID: <200906301852.n5UIqaV4089232@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Tue Jun 30 18:52:36 2009 New Revision: 195201 URL: http://svn.freebsd.org/changeset/base/195201 Log: Try to avoid duplicates by using the HWMP table. XXX will be redone in the near future. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c projects/mesh11s/sys/net80211/ieee80211_mesh.c Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Tue Jun 30 18:51:22 2009 (r195200) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Tue Jun 30 18:52:36 2009 (r195201) @@ -173,7 +173,6 @@ hwmp_rt_add(struct ieee80211vap *vap, co rt = malloc(sizeof(struct ieee80211_hwmp_route), M_80211_HWMP, M_NOWAIT | M_ZERO); - memset(rt, 0, sizeof(*rt)); IEEE80211_ADDR_COPY(rt->rt_dest, dest); HWMP_LOCK(hs); TAILQ_INSERT_TAIL(&hs->hs_routes, rt, rt_next); @@ -691,11 +690,10 @@ hwmp_recv_preq(struct ieee80211vap *vap, * propagate the PREQ based on TTL. */ } else if (preq->preq_ttl > 1) { - if (rt == NULL) { + if (rt == NULL) rt = hwmp_rt_add(vap, PREQ_TADDR(0)); - rt->rt_metric = preq->preq_metric; - rt->rt_lifetime = preq->preq_lifetime; - } + rt->rt_metric = preq->preq_metric; + rt->rt_lifetime = preq->preq_lifetime; rt->rt_seq = preq->preq_origseq; rt->rt_preqid = preq->preq_id; @@ -1074,14 +1072,13 @@ ieee80211_hwmp_discover(struct ieee80211 /* XXX stat+msg */ goto done; } + } + if (IEEE80211_ADDR_EQ(rt->rt_nexthop, invalidaddr)) { rt->rt_seq = ++hs->hs_seq; rt->rt_preqid = ++hs->hs_preqid; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; rt->rt_lifetime = timeval2msecs(ieee80211_hwmp_pathtimeout); - sendpreq = 1; - unknowndst = 1; - } else if (IEEE80211_ADDR_EQ(rt->rt_nexthop, invalidaddr)) { /* XXX check preq retries */ sendpreq = 1; unknowndst = 1; @@ -1177,9 +1174,12 @@ ieee80211_hwmp_checkpseq(struct ieee8021 rt->rt_lastpseq = seq; return 0; } - if (rt->rt_lastpseq >= seq) + if (rt->rt_lastpseq >= seq) { + IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, + vap->iv_bss, "seqno %u <= seqno %u", seq, + rt->rt_lastpseq); return 1; - else { + } else { rt->rt_lastpseq = seq; return 0; } Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_mesh.c Tue Jun 30 18:51:22 2009 (r195200) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Tue Jun 30 18:52:36 2009 (r195201) @@ -413,6 +413,8 @@ mesh_input(struct ieee80211_node *ni, st const struct ieee80211_meshcntl *mc; int hdrspace, need_tap; uint8_t dir, type, subtype, qos; + uint32_t seq; + uint8_t *addr; KASSERT(ni != NULL, ("null node")); ni->ni_inact = ni->ni_inact_reload; @@ -514,10 +516,24 @@ mesh_input(struct ieee80211_node *ni, st ((struct ieee80211_qosframe *)wh)->i_qos[0]; } else qos = 0; + + /* + * BIG FAT XXX + * ugly + */ + seq = LE_READ_4(mc->mc_seq); + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + addr = wh->i_addr3; + else + addr = ((struct ieee80211_qosframe_addr4 *)wh)->i_addr4; + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, addr)) + goto out; + if (ieee80211_hwmp_checkpseq(vap, addr, seq)) + goto out; /* * Check if we can forward the packet. */ - if (mc->mc_ttl <= 0 || + if (mc->mc_ttl == 0 || !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) goto deliver; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906301852.n5UIqaV4089232>