diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2005-09-07 05:40:12 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2005-09-07 05:40:12 +0000 |
commit | e26760b3c607491083d6b68a5b51b718e8861133 (patch) | |
tree | 3d5c9a29e96610863c50f2e7afb57dd7a48e34e0 /sys/net80211 | |
parent | 0cd5ad7118f3137fc7909921081bfabad513eb2c (diff) |
Remove FreeBSD/NetBSD ifdef mess. We are not likely to be
doing a wholesale merge with them in future.
very enthusiastic ok from reyk@
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211.c | 370 | ||||
-rw-r--r-- | sys/net80211/ieee80211_compat.c | 8 | ||||
-rw-r--r-- | sys/net80211/ieee80211_compat.h | 19 | ||||
-rw-r--r-- | sys/net80211/ieee80211_crypto.c | 42 | ||||
-rw-r--r-- | sys/net80211/ieee80211_input.c | 59 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.c | 33 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.h | 27 | ||||
-rw-r--r-- | sys/net80211/ieee80211_output.c | 37 | ||||
-rw-r--r-- | sys/net80211/ieee80211_proto.c | 45 | ||||
-rw-r--r-- | sys/net80211/ieee80211_rssadapt.c | 132 | ||||
-rw-r--r-- | sys/net80211/ieee80211_var.h | 14 |
11 files changed, 11 insertions, 775 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index d255216f29c..0639908ee76 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.8 2005/05/28 12:01:53 reyk Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.9 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -34,20 +34,11 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.11 2004/04/02 20:19:20 sam Exp $"); -#elif defined (__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $"); -#endif /* * IEEE 802.11 generic handler */ -#ifdef __NetBSD__ -#include "opt_inet.h" -#endif - #include "bpfilter.h" #include <sys/param.h> @@ -58,25 +49,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $" #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined( __FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -85,11 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $" #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> @@ -97,37 +72,15 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $" #ifdef IEEE80211_DEBUG int ieee80211_debug = 0; -#ifdef __NetBSD__ -static int ieee80211_debug_nodenum; -#endif /* __NetBSD__ */ - -#ifdef __FreeBSD__ -SYSCTL_INT(_debug, OID_AUTO, ieee80211, CTLFLAG_RW, &ieee80211_debug, - 0, "IEEE 802.11 media debugging printfs"); -#endif #endif int ieee80211_cache_size = IEEE80211_CACHE_SIZE; -#ifdef __NetBSD__ -static int ieee80211_cache_size_nodenum; -#endif struct ieee80211com_head ieee80211com_head = LIST_HEAD_INITIALIZER(ieee80211com_head); static void ieee80211_setbasicrates(struct ieee80211com *); -#ifdef __NetBSD__ -static void sysctl_ieee80211_fill_node(struct ieee80211_node *, - struct ieee80211_node_sysctl *, int, struct ieee80211_channel *, int); -static struct ieee80211_node *ieee80211_node_walknext( - struct ieee80211_node_walk *); -static struct ieee80211_node *ieee80211_node_walkfirst( - struct ieee80211_node_walk *, u_short); -static int sysctl_ieee80211_verify(SYSCTLFN_ARGS); -static int sysctl_ieee80211_node(SYSCTLFN_ARGS); -#endif /* __NetBSD__ */ - #define LOGICALLY_EQUAL(x, y) (!(x) == !(y)) #if 0 @@ -148,13 +101,9 @@ ieee80211_ifattach(struct ifnet *ifp) struct ieee80211_channel *c; int i; -#if defined(__OpenBSD__) memcpy(((struct arpcom *)ifp)->ac_enaddr, ic->ic_myaddr, ETHER_ADDR_LEN); ether_ifattach(ifp); -#else - ether_ifattach(ifp, ic->ic_myaddr); -#endif ifp->if_output = ieee80211_output; @@ -230,11 +179,7 @@ ieee80211_ifdetach(struct ifnet *ifp) ieee80211_crypto_detach(ifp); ieee80211_node_detach(ifp); LIST_REMOVE(ic, ic_list); -#ifdef __FreeBSD__ - ifmedia_removeall(&ic->ic_media); -#else ifmedia_delete_instance(&ic->ic_media, IFM_INST_ANY); -#endif #if NBPFILTER > 0 BPF_DETACH(ifp); #endif @@ -979,316 +924,3 @@ ieee80211_media2rate(int mword) return 0; #undef N } - -#ifdef __NetBSD__ -static void -ieee80211_clean_all_nodes(int cache_size) -{ - struct ieee80211com *ic; - LIST_FOREACH(ic, &ieee80211com_head, ic_list) { - ic->ic_max_nnodes = cache_size; - ieee80211_clean_nodes(ic); - } -} - -/* TBD factor with sysctl_ath_verify. */ -static int -sysctl_ieee80211_verify(SYSCTLFN_ARGS) -{ - int error, t; - struct sysctlnode node; - - node = *rnode; - t = *(int*)rnode->sysctl_data; - node.sysctl_data = &t; - error = sysctl_lookup(SYSCTLFN_CALL(&node)); - if (error || newp == NULL) - return (error); - - if (node.sysctl_num == ieee80211_cache_size_nodenum) { - if (t < 0) - return (EINVAL); -#ifdef IEEE80211_DEBUG - } else if (node.sysctl_num != ieee80211_debug_nodenum) -#else /* IEEE80211_DEBUG */ - } else -#endif /* IEEE80211_DEBUG */ - return (EINVAL); - - *(int*)rnode->sysctl_data = t; - - return (0); -} - -/* - * Pointers for testing: - * - * If there are no interfaces, or else no 802.11 interfaces, - * ieee80211_node_walkfirst must return NULL. - * - * If there is any single 802.11 interface, ieee80211_node_walkfirst - * must not return NULL. - */ -static struct ieee80211_node * -ieee80211_node_walkfirst(struct ieee80211_node_walk *nw, - u_short if_index) -{ - struct ieee80211com *ic; - (void)memset(nw, 0, sizeof(*nw)); - - nw->nw_ifindex = if_index; - - LIST_FOREACH(ic, &ieee80211com_head, ic_list) { - if (if_index != 0 && ic->ic_if.if_index != if_index) - continue; - nw->nw_ic = ic; - nw->nw_ni = ic->ic_bss; - break; - } - - KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL)); - - return nw->nw_ni; -} - -static struct ieee80211_node * -ieee80211_node_walknext(struct ieee80211_node_walk *nw) -{ - KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL)); - - if (nw->nw_ic == NULL && nw->nw_ni == NULL) - return NULL; - - if (nw->nw_ni == nw->nw_ic->ic_bss) - nw->nw_ni = TAILQ_FIRST(&nw->nw_ic->ic_node); - else - nw->nw_ni = TAILQ_NEXT(nw->nw_ni, ni_list); - - if (nw->nw_ni == NULL) { - if (nw->nw_ifindex != 0) - return NULL; - - nw->nw_ic = LIST_NEXT(nw->nw_ic, ic_list); - if (nw->nw_ic == NULL) - return NULL; - - nw->nw_ni = nw->nw_ic->ic_bss; - } - - KASSERT(LOGICALLY_EQUAL(nw->nw_ni == NULL, nw->nw_ic == NULL)); - - return nw->nw_ni; -} - -static void -sysctl_ieee80211_fill_node(struct ieee80211_node *ni, - struct ieee80211_node_sysctl *ns, int ifindex, - struct ieee80211_channel *chan0, int is_bss) -{ - ns->ns_ifindex = ifindex; - ns->ns_capinfo = ni->ni_capinfo; - ns->ns_flags = (is_bss) ? IEEE80211_NODE_SYSCTL_F_BSS : 0; - (void)memcpy(ns->ns_macaddr, ni->ni_macaddr, sizeof(ns->ns_macaddr)); - (void)memcpy(ns->ns_bssid, ni->ni_bssid, sizeof(ns->ns_bssid)); - if (ni->ni_chan != IEEE80211_CHAN_ANYC) { - ns->ns_freq = ni->ni_chan->ic_freq; - ns->ns_chanflags = ni->ni_chan->ic_flags; - ns->ns_chanidx = ni->ni_chan - chan0; - } else { - ns->ns_freq = ns->ns_chanflags = 0; - ns->ns_chanidx = 0; - } - ns->ns_rssi = ni->ni_rssi; - ns->ns_esslen = ni->ni_esslen; - (void)memcpy(ns->ns_essid, ni->ni_essid, sizeof(ns->ns_essid)); - ns->ns_pwrsave = ni->ni_pwrsave; - ns->ns_erp = ni->ni_erp; - ns->ns_associd = ni->ni_associd; - ns->ns_inact = ni->ni_inact * IEEE80211_INACT_WAIT; - ns->ns_rstamp = ni->ni_rstamp; - ns->ns_rates = ni->ni_rates; - ns->ns_txrate = ni->ni_txrate; - ns->ns_intval = ni->ni_intval; - (void)memcpy(ns->ns_tstamp, ni->ni_tstamp, sizeof(ns->ns_tstamp)); - ns->ns_txseq = ni->ni_txseq; - ns->ns_rxseq = ni->ni_rxseq; - ns->ns_fhdwell = ni->ni_fhdwell; - ns->ns_fhindex = ni->ni_fhindex; - ns->ns_fails = ni->ni_fails; -} - -/* Between two examinations of the sysctl tree, I expect each - * interface to add no more than 5 nodes. - */ -#define IEEE80211_SYSCTL_NODE_GROWTH 5 - -static int -sysctl_ieee80211_node(SYSCTLFN_ARGS) -{ - struct ieee80211_node_walk nw; - struct ieee80211_node *ni; - struct ieee80211_node_sysctl ns; - char *dp; - u_int cur_ifindex, ifcount, ifindex, last_ifindex, op, arg, hdr_type; - size_t len, needed, eltsize, out_size; - int error, s, nelt; - - if (namelen == 1 && name[0] == CTL_QUERY) - return (sysctl_query(SYSCTLFN_CALL(rnode))); - - if (namelen != IEEE80211_SYSCTL_NODENAMELEN) - return (EINVAL); - - /* ifindex.op.arg.header-type.eltsize.nelt */ - dp = oldp; - len = (oldp != NULL) ? *oldlenp : 0; - ifindex = name[IEEE80211_SYSCTL_NODENAME_IF]; - op = name[IEEE80211_SYSCTL_NODENAME_OP]; - arg = name[IEEE80211_SYSCTL_NODENAME_ARG]; - hdr_type = name[IEEE80211_SYSCTL_NODENAME_TYPE]; - eltsize = name[IEEE80211_SYSCTL_NODENAME_ELTSIZE]; - nelt = name[IEEE80211_SYSCTL_NODENAME_ELTCOUNT]; - out_size = MIN(sizeof(ns), eltsize); - - if (op != IEEE80211_SYSCTL_OP_ALL || arg != 0 || - hdr_type != IEEE80211_SYSCTL_T_NODE || eltsize < 1 || nelt < 0) - return (EINVAL); - - error = 0; - needed = 0; - ifcount = 0; - last_ifindex = 0; - - s = splnet(); - - for (ni = ieee80211_node_walkfirst(&nw, ifindex); ni != NULL; - ni = ieee80211_node_walknext(&nw)) { - struct ieee80211com *ic; - - ic = nw.nw_ic; - cur_ifindex = ic->ic_if.if_index; - - if (cur_ifindex != last_ifindex) { - ifcount++; - last_ifindex = cur_ifindex; - } - - if (nelt <= 0) - continue; - - if (len >= eltsize) { - sysctl_ieee80211_fill_node(ni, &ns, cur_ifindex, - &ic->ic_channels[0], ni == ic->ic_bss); - error = copyout(&ns, dp, out_size); - if (error) - goto cleanup; - dp += eltsize; - len -= eltsize; - } - needed += eltsize; - if (nelt != INT_MAX) - nelt--; - } -cleanup: - splx(s); - - *oldlenp = needed; - if (oldp == NULL) - *oldlenp += ifcount * IEEE80211_SYSCTL_NODE_GROWTH * eltsize; - - return (error); -} - -/* - * Setup sysctl(3) MIB, net.ieee80211.* - * - * TBD condition CTLFLAG_PERMANENT on being an LKM or not - */ -SYSCTL_SETUP(sysctl_ieee80211, "sysctl ieee80211 subtree setup") -{ - int rc; - struct sysctlnode *cnode, *rnode; - - if ((rc = sysctl_createv(clog, 0, NULL, &rnode, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL, - NULL, 0, NULL, 0, CTL_NET, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &rnode, &rnode, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "link", - "link-layer statistics and controls", - NULL, 0, NULL, 0, PF_LINK, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &rnode, &rnode, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "ieee80211", - "IEEE 802.11 WLAN statistics and controls", - NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &rnode, NULL, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "nodes", "client/peer stations", - sysctl_ieee80211_node, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0) - goto err; - -#ifdef IEEE80211_DEBUG - - /* control debugging printfs */ - if ((rc = sysctl_createv(clog, 0, &rnode, &cnode, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, - "debug", SYSCTL_DESCR("Enable IEEE 802.11 debugging output"), - sysctl_ieee80211_verify, 0, &ieee80211_debug, 0, - CTL_CREATE, CTL_EOL)) != 0) - goto err; - - ieee80211_debug_nodenum = cnode->sysctl_num; - -#endif /* IEEE80211_DEBUG */ - - /* control LRU cache size */ - if ((rc = sysctl_createv(clog, 0, &rnode, &cnode, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, - "maxnodecache", SYSCTL_DESCR("Maximum station cache size"), - sysctl_ieee80211_verify, 0, &ieee80211_cache_size, - 0, CTL_CREATE, CTL_EOL)) != 0) - goto err; - - ieee80211_cache_size_nodenum = cnode->sysctl_num; - - return; -err: - printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc); -} -#endif /* __NetBSD__ */ - -#ifdef __FreeBSD__ -/* - * Module glue. - * - * NB: the module name is "wlan" for compatibility with NetBSD. - */ - -static int -ieee80211_modevent(module_t mod, int type, void *unused) -{ - switch (type) { - case MOD_LOAD: - if (bootverbose) - printf("wlan: <802.11 Link Layer>\n"); - return 0; - case MOD_UNLOAD: - return 0; - } - return EINVAL; -} - -static moduledata_t ieee80211_mod = { - "wlan", - ieee80211_modevent, - 0 -}; -DECLARE_MODULE(wlan, ieee80211_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); -MODULE_VERSION(wlan, 1); -MODULE_DEPEND(wlan, rc4, 1, 1, 1); -MODULE_DEPEND(wlan, ether, 1, 1, 1); -#endif diff --git a/sys/net80211/ieee80211_compat.c b/sys/net80211/ieee80211_compat.c index 4962111e1fa..3a790e1776b 100644 --- a/sys/net80211/ieee80211_compat.c +++ b/sys/net80211/ieee80211_compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_compat.c,v 1.3 2004/10/04 16:01:46 mickey Exp $ */ +/* $OpenBSD: ieee80211_compat.c,v 1.4 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_compat.c,v 1.3 2003/09/23 15:57:25 dyoung Exp $ */ /*- @@ -34,11 +34,6 @@ #include <net/if.h> #include <net80211/ieee80211_compat.h> -#ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_compat.c,v 1.3 2003/09/23 15:57:25 dyoung Exp $"); -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) void if_printf(struct ifnet *ifp, const char *fmt, ...) { @@ -51,4 +46,3 @@ if_printf(struct ifnet *ifp, const char *fmt, ...) va_end(ap); return; } -#endif diff --git a/sys/net80211/ieee80211_compat.h b/sys/net80211/ieee80211_compat.h index b217c261ceb..862b3e18b2a 100644 --- a/sys/net80211/ieee80211_compat.h +++ b/sys/net80211/ieee80211_compat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_compat.h,v 1.1 2004/06/22 22:53:52 millert Exp $ */ +/* $OpenBSD: ieee80211_compat.h,v 1.2 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_compat.h,v 1.5 2004/01/13 23:37:30 dyoung Exp $ */ /*- @@ -30,34 +30,17 @@ #ifndef _NET80211_IEEE80211_COMPAT_H_ #define _NET80211_IEEE80211_COMPAT_H_ -#if defined(__NetBSD__) || defined(__OpenBSD__) #define IASSERT(cond, complaint) if (!(cond)) panic complaint -#else -#define IASSERT(cond, complaint) KASSERT(cond, complaint) -#endif -#if defined(__NetBSD__) || defined(__OpenBSD__) void if_printf(struct ifnet *, const char *, ...) __attribute__((__format__(__printf__,2,3))); -#endif -#if defined(__NetBSD__) || defined(__OpenBSD__) #define ieee80211_node_critsec_decl(v) int v #define ieee80211_node_critsec_begin(ic, v) do { v = splnet(); } while (0) #define ieee80211_node_critsec_end(ic, v) splx(v) -#else -#define ieee80211_node_critsec_decl(v) /* empty */ -#define ieee80211_node_critsec_begin(ic, v) mtx_lock(&(ic)->ic_nodelock) -#define ieee80211_node_critsec_end(ic, v) mtx_unlock(&ic->ic_nodelock) -#endif -#if defined(__OpenBSD__) #define BPF_ATTACH(ifp_x,dlt_x,dlf_x,bpf_x) \ bpfattach(bpf_x,ifp_x,dlt_x,dlf_x) -#else -#define BPF_ATTACH(ifp_x,dlt_x,dlf_x,bpf_x) \ - bpfattach2(ifp_x,dlt_x,dlf_x,bpf_x) -#endif #define BPF_DETACH(ifp_x) bpfdetach(ifp_x) #define BPF_MTAP(bpf_x,mbf_x) bpf_mtap(bpf_x,mbf_x) diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c index 5c217985662..70a42d5d2ee 100644 --- a/sys/net80211/ieee80211_crypto.c +++ b/sys/net80211/ieee80211_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_crypto.c,v 1.3 2004/06/28 19:29:40 millert Exp $ */ +/* $OpenBSD: ieee80211_crypto.c,v 1.4 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung Exp $ */ /*- @@ -34,15 +34,6 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.3 2003/10/17 23:15:30 sam Exp $"); -#elif defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung Exp $"); -#endif - -#if defined(__NetBSD__) -#include "opt_inet.h" -#endif #include "bpfilter.h" @@ -55,25 +46,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined(__FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -82,30 +61,17 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_compat.h> -#if defined(__FreeBSD__) -#include <crypto/rc4/rc4.h> -#define arc4_ctxlen() sizeof (struct rc4_state) -#define arc4_setkey(_c,_k,_l) rc4_init(_c,_k,_l) -#define arc4_encrypt(_c,_d,_s,_l) rc4_crypt(_c,_s,_d,_l) -#elif defined(__OpenBSD__) #include <dev/rndvar.h> #include <crypto/arc4.h> #define arc4_ctxlen() sizeof (struct rc4_ctx) #define arc4_setkey(_c,_k,_l) rc4_keysetup(_c,_k,_l) #define arc4_encrypt(_c,_d,_s,_l) rc4_crypt(_c,_s,_d,_l) -#else -#include <crypto/arc4/arc4.h> -#endif static void ieee80211_crc_init(void); static u_int32_t ieee80211_crc_update(u_int32_t crc, u_int8_t *buf, int len); @@ -166,13 +132,7 @@ ieee80211_wep_crypt(struct ifnet *ifp, struct mbuf *m0, int txflag) ic->ic_stats.is_rx_nombuf++; goto fail; } -#if defined(__FreeBSD__) - M_MOVE_PKTHDR(n, m); -#elif defined(__OpenBSD__) M_DUP_PKTHDR(n, m); -#else - M_COPY_PKTHDR(n, m); -#endif len = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN; if (txflag) { n->m_pkthdr.len += len; diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index dc6a2ffa60c..2bf748f2958 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.6 2005/05/07 02:50:47 jsg Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.7 2005/09/07 05:40:11 jsg Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -34,15 +34,6 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.20 2004/04/02 23:35:24 sam Exp $"); -#elif defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $"); -#endif - -#if defined(__NetBSD__) -#include "opt_inet.h" -#endif #include "bpfilter.h" @@ -55,26 +46,14 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> #include <sys/endian.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined(__FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -83,19 +62,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_compat.h> -#ifdef __OpenBSD__ #include <dev/rndvar.h> -#endif const struct timeval ieee80211_merge_print_intvl = { .tv_sec = 1, @@ -127,9 +100,6 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, int error, len; u_int8_t dir, type, subtype; u_int16_t rxseq; -#if !defined(__OpenBSD__) - ALTQ_DECL(struct altq_pktattr pktattr;) -#endif IASSERT(ni != NULL, ("null node")); @@ -260,13 +230,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, if (ic->ic_state != IEEE80211_S_SCAN && !IEEE80211_ADDR_EQ(wh->i_addr3, ic->ic_bss->ni_bssid) && -#ifdef __OpenBSD__ !IEEE80211_ADDR_EQ(wh->i_addr3, etherbroadcastaddr)) { -#else - !IEEE80211_ADDR_EQ(wh->i_addr3, - ifp->if_broadcastaddr)) { -#endif /* Destination is not our BSS or broadcast. */ IEEE80211_DPRINTF2( ("%s: discard data frame to DA %s\n", @@ -283,13 +248,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, if (ic->ic_state != IEEE80211_S_SCAN && !IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_bss->ni_bssid) && -#ifdef __OpenBSD__ !IEEE80211_ADDR_EQ(wh->i_addr1, etherbroadcastaddr)) { -#else - !IEEE80211_ADDR_EQ(wh->i_addr1, - ifp->if_broadcastaddr)) { -#endif /* BSS is not us or broadcast. */ IEEE80211_DPRINTF2( ("%s: discard data frame to BSS %s\n", @@ -374,13 +334,6 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, } } if (m1 != NULL) { -#if !defined(__OpenBSD__) -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - altq_etherclassify(&ifp->if_snd, m1, - &pktattr); -#endif -#endif len = m1->m_pkthdr.len; IFQ_ENQUEUE(&ifp->if_snd, m1, NULL, error); if (error) @@ -401,11 +354,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, if (ifp->if_bpf && m1 == NULL) BPF_MTAP(ifp->if_bpf, m); #endif -#if defined(__OpenBSD__) ether_input_mbuf(ifp, m); -#else - (*ifp->if_input)(ifp, m); -#endif } return; @@ -555,13 +504,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m) m_freem(m); return NULL; } -#if defined(__FreeBSD__) - M_MOVE_PKTHDR(n, m); -#elif defined(__OpenBSD__) M_DUP_PKTHDR(n, m); -#else - M_COPY_PKTHDR(n, m); -#endif n->m_len = MHLEN; } else { MGET(n, M_DONTWAIT, MT_DATA); diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 084cb68a816..44a1923898a 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.5 2005/05/25 07:40:49 reyk Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.6 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -34,15 +34,6 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.22 2004/04/05 04:15:55 sam Exp $"); -#elif defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $"); -#endif - -#if defined(__NetBSD__) -#include "opt_inet.h" -#endif #include "bpfilter.h" @@ -55,25 +46,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung E #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined(__FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -82,19 +61,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung E #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_compat.h> -#ifdef __OpenBSD__ #include <dev/rndvar.h> -#endif static struct ieee80211_node *ieee80211_node_alloc(struct ieee80211com *); static void ieee80211_node_free(struct ieee80211com *, struct ieee80211_node *); @@ -111,11 +84,7 @@ static struct ieee80211_node *ieee80211_alloc_node_helper(struct ieee80211com *) static void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *); -#ifdef __NetBSD__ -MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state"); -#else #define M_80211_NODE M_DEVBUF -#endif void ieee80211_node_attach(struct ifnet *ifp) diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index fdc2f4d489e..c4e4658214e 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.4 2005/05/25 07:40:49 reyk Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.5 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -129,7 +129,6 @@ struct ieee80211_node { u_int32_t *ni_challenge; /* shared-key challenge */ }; -#if defined(__NetBSD__) || defined(__OpenBSD__) #define ieee80211_node_incref(ni) \ do { \ int _s = splnet(); \ @@ -147,19 +146,6 @@ ieee80211_node_decref(struct ieee80211_node *ni) return refcnt; } -#else -#define ieee80211_node_incref(ni) atomic_add_int(&(ni)->ni_refcnt, 1) -static __inline int -ieee80211_node_decref(struct ieee80211_node *ni) -{ - int orefcnt; - do { - orefcnt = ni->ni_refcnt; - } while (atomic_cmpset_int(&ni->ni_refcnt, orefcnt, orefcnt - 1) == 0); - return orefcnt - 1; -} -#endif - static __inline struct ieee80211_node * ieee80211_ref_node(struct ieee80211_node *ni) { @@ -174,23 +160,12 @@ ieee80211_unref_node(struct ieee80211_node **ni) *ni = NULL; /* guard against use */ } -#ifdef __FreeBSD__ -typedef struct mtx ieee80211_node_lock_t; -#define IEEE80211_NODE_LOCK_INIT(_ic, _name) \ - mtx_init(&(_ic)->ic_nodelock, _name, "802.11 node table", MTX_DEF) -#define IEEE80211_NODE_LOCK_DESTROY(_ic) mtx_destroy(&(_ic)->ic_nodelock) -#define IEEE80211_NODE_LOCK(_ic) mtx_lock(&(_ic)->ic_nodelock) -#define IEEE80211_NODE_UNLOCK(_ic) mtx_unlock(&(_ic)->ic_nodelock) -#define IEEE80211_NODE_LOCK_ASSERT(_ic) \ - mtx_assert(&(_ic)->ic_nodelock, MA_OWNED) -#else typedef int ieee80211_node_lock_t; #define IEEE80211_NODE_LOCK_INIT(_ic, _name) #define IEEE80211_NODE_LOCK_DESTROY(_ic) #define IEEE80211_NODE_LOCK(_ic) (_ic)->ic_nodelock = splnet() #define IEEE80211_NODE_UNLOCK(_ic) splx((_ic)->ic_nodelock) #define IEEE80211_NODE_LOCK_ASSERT(_ic) -#endif #define IEEE80211_NODE_LOCK_BH IEEE80211_NODE_LOCK #define IEEE80211_NODE_UNLOCK_BH IEEE80211_NODE_UNLOCK diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index c104fe472b0..400cdc4472a 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_output.c,v 1.9 2005/04/20 19:52:43 reyk Exp $ */ +/* $OpenBSD: ieee80211_output.c,v 1.10 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */ /*- @@ -34,15 +34,6 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.10 2004/04/02 23:25:39 sam Exp $"); -#elif defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $"); -#endif - -#ifdef __NetBSD__ -#include "opt_inet.h" -#endif #include "bpfilter.h" @@ -54,25 +45,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined(__FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -81,11 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> @@ -184,9 +159,6 @@ ieee80211_mgmt_output(struct ifnet *ifp, struct ieee80211_node *ni, M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m == NULL) return ENOMEM; -#ifdef __FreeBSD__ - KASSERT(m->m_pkthdr.rcvif == NULL, ("rcvif not null")); -#endif m->m_pkthdr.rcvif = (void *)ni; wh = mtod(m, struct ieee80211_frame *); @@ -587,16 +559,9 @@ ieee80211_getmbuf(int flags, int type, u_int pktlen) struct mbuf *m; IASSERT(pktlen <= MCLBYTES, ("802.11 packet too large: %u", pktlen)); -#ifdef __FreeBSD__ - if (pktlen <= MHLEN) - MGETHDR(m, flags, type); - else - m = m_getcl(flags, type, M_PKTHDR); -#else MGETHDR(m, flags, type); if (m != NULL && pktlen > MHLEN) MCLGET(m, flags); -#endif return m; } diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 44e7e6098c8..f32a054f1bc 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.c,v 1.4 2005/03/13 13:48:45 reyk Exp $ */ +/* $OpenBSD: ieee80211_proto.c,v 1.5 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */ /*- @@ -34,20 +34,11 @@ */ #include <sys/cdefs.h> -#if defined(__FreeBSD__) -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.8 2004/04/02 20:22:25 sam Exp $"); -#elif defined(__NetBSD__) -__KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $"); -#endif /* * IEEE 802.11 protocol support. */ -#if defined(__NetBSD__) -#include "opt_inet.h" -#endif - #include "bpfilter.h" #include <sys/param.h> @@ -58,25 +49,13 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung E #include <sys/sockio.h> #include <sys/endian.h> #include <sys/errno.h> -#ifdef __FreeBSD__ -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/sysctl.h> -#ifdef __FreeBSD__ -#include <machine/atomic.h> -#endif - #include <net/if.h> #include <net/if_dl.h> #include <net/if_media.h> #include <net/if_arp.h> -#if defined(__FreeBSD__) -#include <net/ethernet.h> -#elif defined(__NetBSD__) -#include <net/if_ether.h> -#endif #include <net/if_llc.h> #if NBPFILTER > 0 @@ -85,11 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung E #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> @@ -129,10 +104,6 @@ ieee80211_proto_attach(struct ifnet *ifp) ic->ic_fixed_rate = -1; /* no fixed rate */ ic->ic_protmode = IEEE80211_PROT_CTSONLY; -#ifdef __FreeBSD__ - mtx_init(&ic->ic_mgtq.ifq_mtx, ifp->if_xname, "mgmt send q", MTX_DEF); -#endif - /* protocol state change handler */ ic->ic_newstate = ieee80211_newstate; @@ -146,13 +117,8 @@ ieee80211_proto_detach(struct ifnet *ifp) { struct ieee80211com *ic = (void *)ifp; -#ifdef __FreeBSD__ - IF_DRAIN(&ic->ic_mgtq); - mtx_destroy(&ic->ic_mgtq.ifq_mtx); -#else IF_PURGE(&ic->ic_mgtq); IF_PURGE(&ic->ic_pwrsaveq); -#endif } void @@ -401,12 +367,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int mgt case IEEE80211_S_AUTH: case IEEE80211_S_SCAN: ic->ic_mgt_timer = 0; -#ifdef __FreeBSD__ - IF_DRAIN(&ic->ic_mgtq); -#else IF_PURGE(&ic->ic_mgtq); IF_PURGE(&ic->ic_pwrsaveq); -#endif if (ic->ic_wep_ctx != NULL) { free(ic->ic_wep_ctx, M_DEVBUF); ic->ic_wep_ctx = NULL; @@ -418,13 +380,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int mgt case IEEE80211_S_SCAN: ic->ic_flags &= ~IEEE80211_F_SIBSS; /* initialize bss for probe request */ -#if defined(__OpenBSD__) IEEE80211_ADDR_COPY(ni->ni_macaddr, etherbroadcastaddr); IEEE80211_ADDR_COPY(ni->ni_bssid, etherbroadcastaddr); -#else - IEEE80211_ADDR_COPY(ni->ni_macaddr, ifp->if_broadcastaddr); - IEEE80211_ADDR_COPY(ni->ni_bssid, ifp->if_broadcastaddr); -#endif ni->ni_rates = ic->ic_sup_rates[ ieee80211_chan2mode(ic, ni->ni_chan)]; ni->ni_associd = 0; diff --git a/sys/net80211/ieee80211_rssadapt.c b/sys/net80211/ieee80211_rssadapt.c index 6d99cc28fd2..70d10b8440b 100644 --- a/sys/net80211/ieee80211_rssadapt.c +++ b/sys/net80211/ieee80211_rssadapt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_rssadapt.c,v 1.1 2004/06/22 22:53:52 millert Exp $ */ +/* $OpenBSD: ieee80211_rssadapt.c,v 1.2 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_rssadapt.c,v 1.7 2004/05/25 04:33:59 dyoung Exp $ */ /*- @@ -38,17 +38,10 @@ #include <net/if.h> #include <net/if_media.h> -#ifdef __FreeBSD__ -#include <net/ethernet.h> -#endif #ifdef INET #include <netinet/in.h> -#if defined(__FreeBSD__) || defined(__OpenBSD__) #include <netinet/if_ether.h> -#else -#include <net/if_ether.h> -#endif #endif #include <net80211/ieee80211_var.h> @@ -91,129 +84,6 @@ static struct ieee80211_rssadapt_expavgctl master_expavgctl = { rc_avgrssi_old : 4 }; -#ifdef __NetBSD__ -#ifdef IEEE80211_DEBUG -/* TBD factor with sysctl_ath_verify, sysctl_ieee80211_verify. */ -static int -sysctl_ieee80211_rssadapt_debug(SYSCTLFN_ARGS) -{ - int error, t; - struct sysctlnode node; - - node = *rnode; - t = *(int*)rnode->sysctl_data; - node.sysctl_data = &t; - error = sysctl_lookup(SYSCTLFN_CALL(&node)); - if (error || newp == NULL) - return (error); - - IEEE80211_DPRINTF(("%s: t = %d, nodenum = %d, rnodenum = %d\n", - __func__, t, node.sysctl_num, rnode->sysctl_num)); - - if (t < 0 || t > 2) - return (EINVAL); - *(int*)rnode->sysctl_data = t; - - return (0); -} -#endif /* IEEE80211_DEBUG */ - -/* TBD factor with sysctl_ath_verify, sysctl_ieee80211_verify. */ -static int -sysctl_ieee80211_rssadapt_expavgctl(SYSCTLFN_ARGS) -{ - struct ieee80211_rssadapt_expavgctl rc; - int error; - struct sysctlnode node; - - node = *rnode; - rc = *(struct ieee80211_rssadapt_expavgctl *)rnode->sysctl_data; - node.sysctl_data = &rc; - error = sysctl_lookup(SYSCTLFN_CALL(&node)); - if (error || newp == NULL) - return (error); - - IEEE80211_DPRINTF(("%s: decay = %d/%d, thresh = %d/%d, " - "avgrssi = %d/%d, nodenum = %d, rnodenum = %d\n", - __func__, rc.rc_decay_old, rc.rc_decay_denom, - rc.rc_thresh_old, rc.rc_thresh_denom, - rc.rc_avgrssi_old, rc.rc_avgrssi_denom, - node.sysctl_num, rnode->sysctl_num)); - - if (rc.rc_decay_old < 0 || - rc.rc_decay_denom < rc.rc_decay_old) - return (EINVAL); - - if (rc.rc_thresh_old < 0 || - rc.rc_thresh_denom < rc.rc_thresh_old) - return (EINVAL); - - if (rc.rc_avgrssi_old < 0 || - rc.rc_avgrssi_denom < rc.rc_avgrssi_old) - return (EINVAL); - - *(struct ieee80211_rssadapt_expavgctl *)rnode->sysctl_data = rc; - - return (0); -} - -/* - * Setup sysctl(3) MIB, net.ieee80211.* - * - * TBD condition CTLFLAG_PERMANENT on being an LKM or not - */ -SYSCTL_SETUP(sysctl_ieee80211_rssadapt, - "sysctl ieee80211 rssadapt subtree setup") -{ - int rc; - struct sysctlnode *node; - - if ((rc = sysctl_createv(clog, 0, NULL, &node, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL, - NULL, 0, NULL, 0, CTL_NET, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &node, &node, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "link", NULL, - NULL, 0, NULL, 0, PF_LINK, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &node, &node, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "ieee80211", NULL, - NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0) - goto err; - - if ((rc = sysctl_createv(clog, 0, &node, &node, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "rssadapt", - SYSCTL_DESCR("Received Signal Strength adaptation controls"), - NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0) - goto err; - -#ifdef IEEE80211_DEBUG - /* control debugging printfs */ - if ((rc = sysctl_createv(clog, 0, &node, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, "debug", - SYSCTL_DESCR("Enable RSS adaptation debugging output"), - sysctl_ieee80211_rssadapt_debug, 0, &ieee80211_rssadapt_debug, 0, - CTL_CREATE, CTL_EOL)) != 0) - goto err; -#endif /* IEEE80211_DEBUG */ - - /* control rate of decay for exponential averages */ - if ((rc = sysctl_createv(clog, 0, &node, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_STRUCT, - "expavgctl", SYSCTL_DESCR("RSS exponential averaging control"), - sysctl_ieee80211_rssadapt_expavgctl, 0, - &master_expavgctl, sizeof(master_expavgctl), CTL_CREATE, - CTL_EOL)) != 0) - goto err; - - return; -err: - printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc); -} -#endif /* __NetBSD__ */ - int ieee80211_rssadapt_choose(struct ieee80211_rssadapt *ra, struct ieee80211_rateset *rs, struct ieee80211_frame *wh, u_int len, diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index d153907c4af..b86198bb7af 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.9 2005/05/25 07:40:49 reyk Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.10 2005/09/07 05:40:11 jsg Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -144,11 +144,7 @@ struct ieee80211_channel { #define IEEE80211_SCAN_RESUME 0x4 struct ieee80211com { -#ifdef __NetBSD__ - struct ethercom ic_ec; -#else struct arpcom ic_ac; -#endif LIST_ENTRY(ieee80211com) ic_list; /* chain of all ieee80211com */ void (*ic_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, @@ -181,11 +177,7 @@ struct ieee80211com { u_int16_t ic_max_aid; enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */ struct ifmedia ic_media; /* interface media config */ -#ifdef __FreeBSD__ - struct bpf_if *ic_rawbpf; /* packet filter structure */ -#else caddr_t ic_rawbpf; /* packet filter structure */ -#endif struct ieee80211_node *ic_bss; /* information for this node */ struct ieee80211_channel *ic_ibss_chan; int ic_fixed_rate; /* index to ic_sup_rates[] */ @@ -229,11 +221,7 @@ struct ieee80211com { * IBSS merge print-outs */ }; -#ifdef __NetBSD__ -#define ic_if ic_ec.ec_if -#else #define ic_if ic_ac.ac_if -#endif #define ic_softc ic_if.if_softc LIST_HEAD(ieee80211com_head, ieee80211com); |