ieee80211_freebsd.c (298433) | ieee80211_freebsd.c (299171) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 298433 2016-04-21 19:57:40Z pfg $"); | 27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 299171 2016-05-06 11:41:49Z avos $"); |
28 29/* 30 * IEEE 802.11 support (FreeBSD-specific code) 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 810 unchanged lines hidden (view full) --- 846#ifdef notyet 847 (void)kern_kldload(curthread, modname, NULL); 848#else 849 printf("%s: load the %s module by hand for now.\n", __func__, modname); 850#endif 851} 852 853static eventhandler_tag wlan_bpfevent; | 28 29/* 30 * IEEE 802.11 support (FreeBSD-specific code) 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 810 unchanged lines hidden (view full) --- 846#ifdef notyet 847 (void)kern_kldload(curthread, modname, NULL); 848#else 849 printf("%s: load the %s module by hand for now.\n", __func__, modname); 850#endif 851} 852 853static eventhandler_tag wlan_bpfevent; |
854static eventhandler_tag wlan_ifllevent; |
|
854 855static void 856bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach) 857{ 858 /* NB: identify vap's by if_init */ 859 if (dlt == DLT_IEEE802_11_RADIO && 860 ifp->if_init == ieee80211_init) { 861 struct ieee80211vap *vap = ifp->if_softc; --- 12 unchanged lines hidden (view full) --- 874 ieee80211_syncflag_ext(vap, -IEEE80211_FEXT_BPF); 875 if (vap->iv_opmode == IEEE80211_M_MONITOR) 876 atomic_subtract_int(&vap->iv_ic->ic_montaps, 1); 877 } 878 } 879} 880 881/* | 855 856static void 857bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach) 858{ 859 /* NB: identify vap's by if_init */ 860 if (dlt == DLT_IEEE802_11_RADIO && 861 ifp->if_init == ieee80211_init) { 862 struct ieee80211vap *vap = ifp->if_softc; --- 12 unchanged lines hidden (view full) --- 875 ieee80211_syncflag_ext(vap, -IEEE80211_FEXT_BPF); 876 if (vap->iv_opmode == IEEE80211_M_MONITOR) 877 atomic_subtract_int(&vap->iv_ic->ic_montaps, 1); 878 } 879 } 880} 881 882/* |
883 * Change MAC address on the vap (if was not started). 884 */ 885static void 886wlan_iflladdr(void *arg __unused, struct ifnet *ifp) 887{ 888 /* NB: identify vap's by if_init */ 889 if (ifp->if_init == ieee80211_init && 890 (ifp->if_flags & IFF_UP) == 0) { 891 struct ieee80211vap *vap = ifp->if_softc; 892 893 IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); 894 } 895} 896 897/* |
|
882 * Module glue. 883 * 884 * NB: the module name is "wlan" for compatibility with NetBSD. 885 */ 886static int 887wlan_modevent(module_t mod, int type, void *unused) 888{ 889 switch (type) { 890 case MOD_LOAD: 891 if (bootverbose) 892 printf("wlan: <802.11 Link Layer>\n"); 893 wlan_bpfevent = EVENTHANDLER_REGISTER(bpf_track, 894 bpf_track, 0, EVENTHANDLER_PRI_ANY); | 898 * Module glue. 899 * 900 * NB: the module name is "wlan" for compatibility with NetBSD. 901 */ 902static int 903wlan_modevent(module_t mod, int type, void *unused) 904{ 905 switch (type) { 906 case MOD_LOAD: 907 if (bootverbose) 908 printf("wlan: <802.11 Link Layer>\n"); 909 wlan_bpfevent = EVENTHANDLER_REGISTER(bpf_track, 910 bpf_track, 0, EVENTHANDLER_PRI_ANY); |
911 wlan_ifllevent = EVENTHANDLER_REGISTER(iflladdr_event, 912 wlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); |
|
895 wlan_cloner = if_clone_simple(wlanname, wlan_clone_create, 896 wlan_clone_destroy, 0); 897 return 0; 898 case MOD_UNLOAD: 899 if_clone_detach(wlan_cloner); 900 EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent); | 913 wlan_cloner = if_clone_simple(wlanname, wlan_clone_create, 914 wlan_clone_destroy, 0); 915 return 0; 916 case MOD_UNLOAD: 917 if_clone_detach(wlan_cloner); 918 EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent); |
919 EVENTHANDLER_DEREGISTER(iflladdr_event, wlan_ifllevent); |
|
901 return 0; 902 } 903 return EINVAL; 904} 905 906static moduledata_t wlan_mod = { 907 wlanname, 908 wlan_modevent, 909 0 910}; 911DECLARE_MODULE(wlan, wlan_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); 912MODULE_VERSION(wlan, 1); 913MODULE_DEPEND(wlan, ether, 1, 1, 1); 914#ifdef IEEE80211_ALQ 915MODULE_DEPEND(wlan, alq, 1, 1, 1); 916#endif /* IEEE80211_ALQ */ 917 | 920 return 0; 921 } 922 return EINVAL; 923} 924 925static moduledata_t wlan_mod = { 926 wlanname, 927 wlan_modevent, 928 0 929}; 930DECLARE_MODULE(wlan, wlan_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); 931MODULE_VERSION(wlan, 1); 932MODULE_DEPEND(wlan, ether, 1, 1, 1); 933#ifdef IEEE80211_ALQ 934MODULE_DEPEND(wlan, alq, 1, 1, 1); 935#endif /* IEEE80211_ALQ */ 936 |