From owner-svn-src-projects@FreeBSD.ORG Wed Jul 1 14:43:07 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 688221065689; Wed, 1 Jul 2009 14:43:07 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CED08FC34; Wed, 1 Jul 2009 14:43:07 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n61Eh7IL015605; Wed, 1 Jul 2009 14:43:07 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n61Eh7Hv015602; Wed, 1 Jul 2009 14:43:07 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200907011443.n61Eh7Hv015602@svn.freebsd.org> From: Rui Paulo Date: Wed, 1 Jul 2009 14:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195240 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 14:43:07 -0000 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]; }; /*