From owner-p4-projects@FreeBSD.ORG Fri Mar 28 19:25:31 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 76D3A1065675; Fri, 28 Mar 2008 19:25:31 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35D88106564A for ; Fri, 28 Mar 2008 19:25:31 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D93628FC16 for ; Fri, 28 Mar 2008 19:25:30 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m2SJPUts012213 for ; Fri, 28 Mar 2008 19:25:30 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2SJPUEi012211 for perforce@freebsd.org; Fri, 28 Mar 2008 19:25:30 GMT (envelope-from sam@freebsd.org) Date: Fri, 28 Mar 2008 19:25:30 GMT Message-Id: <200803281925.m2SJPUEi012211@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 138850 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Mar 2008 19:25:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=138850 Change 138850 by sam@sam_ebb on 2008/03/28 19:25:21 o add promisc mode driver callback o when calculating the rx filter honor IFF_PROMISC directly as net80211 now filters out settings for ap mode vaps o automatically enable promiscuous mode when operating in monitor mode (otherwise we won't see many frames as the device will drop most frames for mismatched bssid) Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#52 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#52 (text+ko) ==== @@ -143,6 +143,7 @@ static void ath_key_update_begin(struct ieee80211vap *); static void ath_key_update_end(struct ieee80211vap *); static void ath_update_mcast(struct ifnet *); +static void ath_update_promisc(struct ifnet *); static void ath_mode_init(struct ath_softc *); static void ath_setslottime(struct ath_softc *); static void ath_updateslot(struct ifnet *); @@ -627,6 +628,7 @@ ic->ic_vap_delete = ath_vap_delete; ic->ic_raw_xmit = ath_raw_xmit; ic->ic_update_mcast = ath_update_mcast; + ic->ic_update_promisc = ath_update_promisc; ic->ic_node_alloc = ath_node_alloc; sc->sc_node_free = ic->ic_node_free; ic->ic_node_free = ath_node_free; @@ -2455,7 +2457,9 @@ * of sight and we need to blindly preserve them * o probe request frames are accepted only when operating in * hostap, adhoc, or monitor modes - * o enable promiscuous mode according to the interface state + * o enable promiscuous mode + * - when in monitor mode + * - if interface marked PROMISC (assumes bridge setting is filtered) * o accept beacons: * - when operating in station mode for collecting rssi data when * the station is otherwise quiet, or @@ -2463,7 +2467,7 @@ * node table entries for peers, * - when scanning * - when doing s/w beacon miss (e.g. for ap+sta) - * - when operatin in ap mode in 11g to detect overlapping bss that + * - when operating in ap mode in 11g to detect overlapping bss that * require protection * o accept control frames: * - when in monitor mode @@ -2489,11 +2493,8 @@ #endif if (ic->ic_opmode != IEEE80211_M_STA) rfilt |= HAL_RX_FILTER_PROBEREQ; - if (ic->ic_opmode != IEEE80211_M_HOSTAP && - (ifp->if_flags & IFF_PROMISC)) + if (ic->ic_opmode == IEEE80211_M_MONITOR || (ifp->if_flags & IFF_PROMISC)) rfilt |= HAL_RX_FILTER_PROM; - if (ifp->if_flags & IFF_PPROMISC) - rfilt |= HAL_RX_FILTER_PROM; if (ic->ic_opmode == IEEE80211_M_STA || sc->sc_opmode == HAL_M_IBSS || sc->sc_swbmiss || sc->sc_scanning) @@ -2508,10 +2509,25 @@ rfilt |= HAL_RX_FILTER_BEACON; if (ic->ic_opmode == IEEE80211_M_MONITOR) rfilt |= HAL_RX_FILTER_CONTROL; + DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, %s if_flags 0x%x\n", + __func__, rfilt, ieee80211_opmode_name[ic->ic_opmode], ifp->if_flags); return rfilt; } static void +ath_update_promisc(struct ifnet *ifp) +{ + struct ath_softc *sc = ifp->if_softc; + u_int32_t rfilt; + + /* configure rx filter */ + rfilt = ath_calcrxfilter(sc); + ath_hal_setrxfilter(sc->sc_ah, rfilt); + + DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); +} + +static void ath_update_mcast(struct ifnet *ifp) { struct ath_softc *sc = ifp->if_softc; @@ -2558,7 +2574,6 @@ /* configure rx filter */ rfilt = ath_calcrxfilter(sc); ath_hal_setrxfilter(ah, rfilt); - DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); /* configure operational mode */ ath_hal_setopmode(ah);