From owner-svn-src-all@FreeBSD.ORG Fri Oct 26 19:06:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9654913; Fri, 26 Oct 2012 19:06:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78C278FC0A; Fri, 26 Oct 2012 19:06:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9QJ6Pdp072189; Fri, 26 Oct 2012 19:06:25 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9QJ6PpV072187; Fri, 26 Oct 2012 19:06:25 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201210261906.q9QJ6PpV072187@svn.freebsd.org> From: Adrian Chadd Date: Fri, 26 Oct 2012 19:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242154 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 26 Oct 2012 19:06:25 -0000 Author: adrian Date: Fri Oct 26 19:06:24 2012 New Revision: 242154 URL: http://svn.freebsd.org/changeset/base/242154 Log: Allow net80211 to be built on -9 and -8. There are some people who use the -HEAD net80211 and wireless drivers on earlier FreeBSD versions in order to get the updated 802.11n support. The previous if_clone API changes broke this. Modified: head/sys/net80211/ieee80211_freebsd.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Fri Oct 26 18:06:49 2012 (r242153) +++ head/sys/net80211/ieee80211_freebsd.c Fri Oct 26 19:06:24 2012 (r242154) @@ -65,9 +65,10 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, C static MALLOC_DEFINE(M_80211_COM, "80211com", "802.11 com state"); +#if __FreeBSD_version >= 1000020 static const char wlanname[] = "wlan"; - static struct if_clone *wlan_cloner; +#endif /* * Allocate/free com structure in conjunction with ifnet; @@ -133,10 +134,19 @@ wlan_clone_create(struct if_clone *ifc, if_printf(ifp, "TDMA not supported\n"); return EOPNOTSUPP; } +#if __FreeBSD_version >= 1000020 vap = ic->ic_vap_create(ic, wlanname, unit, cp.icp_opmode, cp.icp_flags, cp.icp_bssid, cp.icp_flags & IEEE80211_CLONE_MACADDR ? cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp)); +#else + vap = ic->ic_vap_create(ic, ifc->ifc_name, unit, + cp.icp_opmode, cp.icp_flags, cp.icp_bssid, + cp.icp_flags & IEEE80211_CLONE_MACADDR ? + cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp)); + +#endif + return (vap == NULL ? EIO : 0); } @@ -149,11 +159,17 @@ wlan_clone_destroy(struct ifnet *ifp) ic->ic_vap_delete(vap); } +IFC_SIMPLE_DECLARE(wlan, 0); + void ieee80211_vap_destroy(struct ieee80211vap *vap) { CURVNET_SET(vap->iv_ifp->if_vnet); +#if __FreeBSD_version >= 1000020 if_clone_destroyif(wlan_cloner, vap->iv_ifp); +#else + if_clone_destroyif(&wlan_cloner, vap->iv_ifp); +#endif CURVNET_RESTORE(); } @@ -811,13 +827,21 @@ wlan_modevent(module_t mod, int type, vo EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent); return ENOMEM; } +#if __FreeBSD_version >= 1000020 wlan_cloner = if_clone_simple(wlanname, wlan_clone_create, wlan_clone_destroy, 0); +#else + if_clone_attach(&wlan_cloner); +#endif if_register_com_alloc(IFT_IEEE80211, wlan_alloc, wlan_free); return 0; case MOD_UNLOAD: if_deregister_com_alloc(IFT_IEEE80211); +#if __FreeBSD_version >= 1000020 if_clone_detach(wlan_cloner); +#else + if_clone_detach(&wlan_cloner); +#endif EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent); EVENTHANDLER_DEREGISTER(iflladdr_event, wlan_ifllevent); return 0; @@ -826,7 +850,11 @@ wlan_modevent(module_t mod, int type, vo } static moduledata_t wlan_mod = { +#if __FreeBSD_version >= 1000020 wlanname, +#else + "wlan", +#endif wlan_modevent, 0 };