From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 23:40:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6865B106566C; Sat, 25 Oct 2008 23:40:29 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57CBB8FC12; Sat, 25 Oct 2008 23:40:29 +0000 (UTC) (envelope-from sam@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 m9PNeTZm060606; Sat, 25 Oct 2008 23:40:29 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9PNeTNd060605; Sat, 25 Oct 2008 23:40:29 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200810252340.m9PNeTNd060605@svn.freebsd.org> From: Sam Leffler Date: Sat, 25 Oct 2008 23:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184276 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 23:40:29 -0000 Author: sam Date: Sat Oct 25 23:40:29 2008 New Revision: 184276 URL: http://svn.freebsd.org/changeset/base/184276 Log: use a private mgt frame recv handler for ahdemo mode instead of an inline test in the adhoc mode rx path so classes derived from ahdemo mode can override the default behaviour Modified: head/sys/net80211/ieee80211_adhoc.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sat Oct 25 23:39:18 2008 (r184275) +++ head/sys/net80211/ieee80211_adhoc.c Sat Oct 25 23:40:29 2008 (r184276) @@ -66,6 +66,8 @@ static int adhoc_input(struct ieee80211_ int rssi, int noise, uint32_t rstamp); static void adhoc_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int noise, uint32_t rstamp); +static void ahdemo_recv_mgmt(struct ieee80211_node *, struct mbuf *, + int subtype, int rssi, int noise, uint32_t rstamp); void ieee80211_adhoc_attach(struct ieee80211com *ic) @@ -89,7 +91,10 @@ adhoc_vattach(struct ieee80211vap *vap) { vap->iv_newstate = adhoc_newstate; vap->iv_input = adhoc_input; - vap->iv_recv_mgmt = adhoc_recv_mgmt; + if (vap->iv_opmode == IEEE80211_M_IBSS) + vap->iv_recv_mgmt = adhoc_recv_mgmt; + else + vap->iv_recv_mgmt = ahdemo_recv_mgmt; vap->iv_opdetach = adhoc_vdetach; } @@ -609,9 +614,7 @@ adhoc_input(struct ieee80211_node *ni, s } if (bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); - /* NB: only IBSS mode gets mgt frames */ - if (vap->iv_opmode == IEEE80211_M_IBSS) - vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); + vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); m_freem(m); return IEEE80211_FC0_TYPE_MGT; @@ -879,3 +882,20 @@ adhoc_recv_mgmt(struct ieee80211_node *n } #undef IEEE80211_VERIFY_LENGTH #undef IEEE80211_VERIFY_ELEMENT + +static void +ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, + int subtype, int rssi, int noise, uint32_t rstamp) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + + /* + * Process management frames when scanning; useful for doing + * a site-survey. + */ + if (ic->ic_flags & IEEE80211_F_SCAN) + adhoc_recv_mgmt(ni, m0, subtype, rssi, noise, rstamp); + else + vap->iv_stats.is_rx_mgtdiscard++; +}