diff options
author | adrian <adrian@FreeBSD.org> | 2012-10-26 19:06:24 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-10-26 19:06:24 +0000 |
commit | fd573bf186b8d0a2f44a2904c0706b50af1ec76e (patch) | |
tree | 88885eb6f15c6f5787e4f038204fd58ec528c2c7 /sys/net80211/ieee80211_freebsd.c | |
parent | 1bc1b805d784dfea246cfb0aef335c02088d50e8 (diff) | |
download | FreeBSD-src-fd573bf186b8d0a2f44a2904c0706b50af1ec76e.zip FreeBSD-src-fd573bf186b8d0a2f44a2904c0706b50af1ec76e.tar.gz |
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.
Diffstat (limited to 'sys/net80211/ieee80211_freebsd.c')
-rw-r--r-- | sys/net80211/ieee80211_freebsd.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index e307e9d..0ba2ebf 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -65,9 +65,10 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ieee80211_debug, 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, int unit, caddr_t params) 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, void *unused) 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, void *unused) } static moduledata_t wlan_mod = { +#if __FreeBSD_version >= 1000020 wlanname, +#else + "wlan", +#endif wlan_modevent, 0 }; |