Date: Wed, 1 Jul 2009 14:43:07 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r195240 - projects/mesh11s/sys/net80211 Message-ID: <200907011443.n61Eh7Hv015602@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Wed Jul 1 14:43:06 2009 New Revision: 195240 URL: http://svn.freebsd.org/changeset/base/195240 Log: Complete prep processing by checking path metric, seq no and hopcount. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c projects/mesh11s/sys/net80211/ieee80211_ioctl.h Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jul 1 13:30:01 2009 (r195239) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jul 1 14:43:06 2009 (r195240) @@ -800,16 +800,32 @@ hwmp_recv_prep(struct ieee80211vap *vap, } rt = hwmp_rt_find(vap, prep->prep_origaddr); - if (rt != NULL) { + if (rt == NULL) + return; + if (prep->prep_targetseq == rt->rt_seq) { + int useprep = 0; /* - * Build the rest of the entry. - * XXX check for SEQ and PREQ ID. + * Check if we already have a path to this node. + * If we do, check if this path reply contains a + * better route. */ - IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); - rt->rt_nhops = prep->prep_hopcount; - rt->rt_lifetime = prep->prep_lifetime; - rt->rt_metric = prep->prep_metric; - } + if (IEEE80211_ADDR_EQ(rt->rt_nexthop, invalidaddr)) + useprep = 1; + else if (prep->prep_hopcount < rt->rt_nhops || + prep->prep_metric < rt->rt_metric) + useprep = 1; + if (useprep) { + IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); + rt->rt_nhops = prep->prep_hopcount; + rt->rt_lifetime = prep->prep_lifetime; + rt->rt_metric = prep->prep_metric; + } + } else { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "discard PREP from %s, wrong seqno %u", + ether_sprintf(prep->prep_origaddr), prep->prep_targetseq); + vap->iv_stats.is_hwmp_wrongseq++; + } /* * XXX: If it's for us and the AE bit is set, update the Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jul 1 13:30:01 2009 (r195239) +++ projects/mesh11s/sys/net80211/ieee80211_ioctl.h Wed Jul 1 14:43:06 2009 (r195240) @@ -229,7 +229,10 @@ struct ieee80211_stats { uint32_t is_mesh_fwd_tooshort; /* mesh not fwd'd 'cuz no hdr */ uint32_t is_mesh_fwd_disabled; /* mesh not fwd'd 'cuz disabled */ uint32_t is_mesh_fwd_nopath; /* mesh not fwd'd 'cuz path unknown */ - uint32_t is_spare[11]; + + uint32_t is_hwmp_wrongseq; /* wrong hwmp seq no. */ + + uint32_t is_spare[10]; }; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907011443.n61Eh7Hv015602>