CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 15:18:37 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: More overflows... To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:37:24 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix overflow. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:37:24 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix overflow. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.95 src/sys/net80211/ieee80211_input.c:1.96 --- src/sys/net80211/ieee80211_input.c:1.95 Tue Jan 16 14:01:13 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 14:37:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.96 2018/01/16 14:37:24 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -2003,8 +2003,7 @@ ieee80211_update_adhoc_node(struct ieee8 void ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, - struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp) +struct ieee80211_node *ni, int subtype, int rssi, u_int32_t rstamp) { #define ISPROBE(_st) ((_st) == IEEE80211_FC0_SUBTYPE_PROBE_RESP) #define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) @@ -2016,8 +2015,9 @@ ieee80211_recv_mgmt(struct ieee80211com IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); wh = mtod(m0, struct ieee80211_frame *); - frm = (u_int8_t *)[1]; + frm = (u_int8_t *)(wh + 1); efrm = mtod(m0, u_int8_t *) + m0->m_len; + switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: case IEEE80211_FC0_SUBTYPE_BEACON: { @@ -2037,6 +2037,7 @@ ieee80211_recv_mgmt(struct ieee80211com ic->ic_stats.is_rx_mgtdiscard++; return; } + /* * beacon/probe response frame format * [8] time stamp @@ -2059,7 +2060,9 @@ ieee80211_recv_mgmt(struct ieee80211com scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan); scan.chan = scan.bchan; - while (frm < efrm) { + while (frm + 1 < efrm) { + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2); + switch (*frm) { case IEEE80211_ELEMID_SSID: scan.ssid = frm; @@ -2122,10 +2125,13 @@ ieee80211_recv_mgmt(struct ieee80211com ic->ic_stats.is_rx_elem_unknown++; break; } + frm += frm[1] + 2; } + IEEE80211_VERIFY_ELEMENT(scan.rates, IEEE80211_RATE_MAXSIZE); IEEE80211_VERIFY_ELEMENT(scan.ssid, IEEE80211_NWID_LEN); + if ( #if IEEE80211_CHAN_MAX < 255 scan.chan > IEEE80211_CHAN_MAX || @@ -2172,7 +2178,7 @@ ieee80211_recv_mgmt(struct ieee80211com if (ni != ic->ic_bss) { ni = ieee80211_refine_node_for_beacon(ic, ni, - >ic_channels[scan.chan], scan.ssid); + >ic_channels[scan.chan], scan.ssid); } /* * Count frame now that we know it's to be processed.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:01:13 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix memory leak. If m1 == m, m = NULL, so it's safe to just call m_freem. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 14:01:13 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix memory leak. If m1 == m, m = NULL, so it's safe to just call m_freem. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.94 src/sys/net80211/ieee80211_input.c:1.95 --- src/sys/net80211/ieee80211_input.c:1.94 Tue Jan 16 09:42:11 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 14:01:13 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -891,6 +891,7 @@ ieee80211_deliver_data(struct ieee80211c ieee80211_free_node(sta); } } + if (m1 != NULL) { int len; #ifdef ALTQ @@ -902,13 +903,14 @@ ieee80211_deliver_data(struct ieee80211c IFQ_ENQUEUE(>if_snd, m1, error); if (error) { ifp->if_oerrors++; +m_freem(m); m = NULL; } ifp->if_obytes += len; } } - if (m != NULL) { + if (m != NULL) { if (ni->ni_vlan != 0) vlan_set_tag(m, ni->ni_vlan); @@ -919,6 +921,7 @@ ieee80211_deliver_data(struct ieee80211c KASSERT(ifp->if_percpuq); if_percpuq_enqueue(ifp->if_percpuq, m); } + return; }
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:42:11 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Style, remove pointless XXXs, and add a comment about LLC. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.93 src/sys/net80211/ieee80211_input.c:1.94 --- src/sys/net80211/ieee80211_input.c:1.93 Tue Jan 16 08:39:29 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 09:42:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -177,7 +177,7 @@ ieee80211_input_data(struct ieee80211com ni->ni_macaddr, NULL, "data too short: expecting %u", hdrspace); ic->ic_stats.is_rx_tooshort++; - goto out; /* XXX */ + goto out; } wh = mtod(m, struct ieee80211_frame *); @@ -300,10 +300,9 @@ ieee80211_input_data(struct ieee80211com goto out; } } - wh = NULL; /* no longer valid, catch any uses */ /* - * Next strip any MSDU crypto bits. + * Next, strip any MSDU crypto bits. */ if (key != NULL && !ieee80211_crypto_demic(ic, key, m, 0)) { IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, @@ -763,7 +762,7 @@ ieee80211_defrag(struct ieee80211com *ic struct ieee80211_frame *lwh; u_int16_t rxseq; u_int8_t fragno; - u_int8_t more_frag = wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG; + const u_int8_t more_frag = wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG; struct mbuf *mfrag; IASSERT(!IEEE80211_IS_MULTICAST(wh->i_addr1), ("multicast fragm?")); @@ -818,27 +817,33 @@ ieee80211_defrag(struct ieee80211com *ic } } - if (mfrag == NULL) { + if (mfrag == NULL) { if (fragno != 0) { /* !first fragment, discard */ IEEE80211_NODE_STAT(ni, rx_defrag); m_freem(m); return NULL; } mfrag = m; - } else {/* concatenate */ - m_adj(m, hdrspace); /* strip header */ + } else { + /* Strip header and concatenate */ + m_adj(m, hdrspace); m_cat(mfrag, m); + /* NB: m_cat doesn't update the packet header */ mfrag->m_pkthdr.len += m->m_pkthdr.len; + /* track last seqnum and fragno */ lwh = mtod(mfrag, struct ieee80211_frame *); - *(u_int16_t *) lwh->i_seq = *(u_int16_t *) wh->i_seq; + *(u_int16_t *)lwh->i_seq = *(u_int16_t *)wh->i_seq; } - if (more_frag) { /* more to come, save */ + + if (more_frag) { + /* more to come, save */ ni->ni_rxfragstamp = ticks; ni->ni_rxfrag[0] = mfrag; mfrag = NULL; } + return mfrag; } @@ -920,26 +925,33 @@ ieee80211_deliver_data(struct ieee80211c static struct mbuf * ieee80211_decap(struct ieee80211com *ic, struct mbuf *m, int hdrlen) { - struct ieee80211_qosframe_addr4 wh; /* Max size address frames */ + struct ieee80211_qosframe_addr4 wh; /* Max size address frames */ struct ether_header *eh; struct llc *llc; if (m->m_len < hdrlen + sizeof(*llc) && (m = m_pullup(m, hdrlen + sizeof(*llc))) == NULL) { - /* XXX stat, msg */ return NULL; } + memcpy(, mtod(m, void *), hdrlen); + llc = (struct llc *)(mtod(m, char *) + hdrlen); - if (llc->llc_dsap == LLC_SNAP_LSAP && llc->llc_ssap == LLC_SNAP_LSAP && - llc->llc_control == LLC_UI && llc->llc_snap.org_code[0] == 0 && - llc->llc_snap.org_code[1] == 0 && llc->llc_snap.org_code[2] == 0) { + if (llc->llc_dsap == LLC_SNAP_LSAP && + llc->llc_ssap == LLC_SNAP_LSAP && + llc->llc_control == LLC_UI && + llc->llc_snap.org_code[0] == 0 && + llc->llc_snap.org_code[1] == 0 && + llc->llc_snap.org_code[2] == 0) { m_adj(m, hdrlen + sizeof(struct llc) - sizeof(*eh)); llc = NULL; } else { + /* Keep the LLC after the Ethernet header. */ m_adj(m, hdrlen - sizeof(*eh)); } + eh = mtod(m, struct ether_header *); + switch (wh.i_fc[1] & IEEE80211_FC1_DIR_MASK) { case IEEE80211_FC1_DIR_NODS: IEEE80211_ADDR_COPY(eh->ether_dhost, wh.i_addr1); @@ -958,6 +970,7 @@ ieee80211_decap(struct ieee80211com *ic, IEEE80211_ADDR_COPY(eh->ether_shost, wh.i_addr4); break; } + #ifdef ALIGNED_POINTER if (!ALIGNED_POINTER(mtod(m, char *) + sizeof(*eh), u_int32_t)) { struct mbuf *n, *n0, **np; @@ -1009,10 +1022,12 @@ ieee80211_decap(struct ieee80211com *ic, m = n0; } #endif /* ALIGNED_POINTER */ + if (llc != NULL) { eh = mtod(m, struct ether_header *); eh->ether_type = htons(m->m_pkthdr.len -
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:42:11 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Style, remove pointless XXXs, and add a comment about LLC. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:04:30 UTC 2018 Modified Files: src/sys/net80211: ieee80211_crypto.c Log Message: Update the mbuf pointer when m_pullup succeeds, I forgot this in my last revision (I only fixed the UAF in one branch). Meanwhile, style. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 09:04:30 UTC 2018 Modified Files: src/sys/net80211: ieee80211_crypto.c Log Message: Update the mbuf pointer when m_pullup succeeds, I forgot this in my last revision (I only fixed the UAF in one branch). Meanwhile, style. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto.c diff -u src/sys/net80211/ieee80211_crypto.c:1.18 src/sys/net80211/ieee80211_crypto.c:1.19 --- src/sys/net80211/ieee80211_crypto.c:1.18 Sun Dec 10 08:56:23 2017 +++ src/sys/net80211/ieee80211_crypto.c Tue Jan 16 09:04:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $ */ +/* $NetBSD: ieee80211_crypto.c,v 1.19 2018/01/16 09:04:30 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.12 2005/08/08 18:46:35 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.19 2018/01/16 09:04:30 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -559,6 +559,11 @@ ieee80211_crypto_encap(struct ieee80211c return (cip->ic_encap(k, m, keyid<<6) ? k : NULL); } +#define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) +#define IEEE80211_WEP_MINLEN \ + (sizeof(struct ieee80211_frame) + \ + IEEE80211_WEP_HDRLEN + IEEE80211_WEP_CRCLEN) + /* * Validate and strip privacy headers (and trailer) for a * received frame that has the WEP/Privacy bit set. @@ -567,13 +572,9 @@ struct ieee80211_key * ieee80211_crypto_decap(struct ieee80211com *ic, struct ieee80211_node *ni, struct mbuf **mp, int hdrlen) { -#define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) -#define IEEE80211_WEP_MINLEN \ - (sizeof(struct ieee80211_frame) + \ - IEEE80211_WEP_HDRLEN + IEEE80211_WEP_CRCLEN) + const struct ieee80211_cipher *cip; struct ieee80211_key *k; struct ieee80211_frame *wh; - const struct ieee80211_cipher *cip; struct mbuf *m = *mp; u_int8_t keyid; @@ -582,7 +583,7 @@ ieee80211_crypto_decap(struct ieee80211c IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY, "%s: WEP data frame too short, len %u\n", __func__, m->m_pkthdr.len); - ic->ic_stats.is_rx_tooshort++; /* XXX need unique stat? */ + ic->ic_stats.is_rx_tooshort++; return NULL; } @@ -595,18 +596,22 @@ ieee80211_crypto_decap(struct ieee80211c wh = mtod(m, struct ieee80211_frame *); m_copydata(m, hdrlen + IEEE80211_WEP_IVLEN, sizeof(keyid), ); if (IEEE80211_IS_MULTICAST(wh->i_addr1) || - ni->ni_ucastkey.wk_cipher == _cipher_none) + ni->ni_ucastkey.wk_cipher == _cipher_none) { k = >ic_nw_keys[keyid >> 6]; - else + } else { k = >ni_ucastkey; + } /* * Insure crypto header is contiguous for all decap work. */ cip = k->wk_cipher; - if (m->m_len < hdrlen + cip->ic_header && - (m = m_pullup(m, hdrlen + cip->ic_header)) == NULL) { - *mp = NULL; + if (m->m_len < hdrlen + cip->ic_header) { + m = m_pullup(m, hdrlen + cip->ic_header); + *mp = m; + } + + if (m == NULL) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_CRYPTO, "[%s] unable to pullup %s header\n", ether_sprintf(wh->i_addr2), cip->ic_name); @@ -615,6 +620,4 @@ ieee80211_crypto_decap(struct ieee80211c } return (cip->ic_decap(k, m, hdrlen) ? k : NULL); -#undef IEEE80211_WEP_MINLEN -#undef IEEE80211_WEP_HDRLEN }
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 08:39:29 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Split ieee80211_input into three sub-functions, that parse received packets depending on their type: DATA -> ieee80211_input_data MANAGEMENT -> ieee80211_input_management CONTROL-> ieee80211_input_control No real functional change, but makes the code much clearer. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 08:39:29 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Split ieee80211_input into three sub-functions, that parse received packets depending on their type: DATA -> ieee80211_input_data MANAGEMENT -> ieee80211_input_management CONTROL-> ieee80211_input_control No real functional change, but makes the code much clearer. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.92 src/sys/net80211/ieee80211_input.c:1.93 --- src/sys/net80211/ieee80211_input.c:1.92 Tue Jan 16 07:53:02 2018 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 08:39:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.93 2018/01/16 08:39:29 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -148,6 +148,359 @@ static void ieee80211_update_adhoc_node( struct ieee80211_node *, struct ieee80211_frame *, struct ieee80211_scanparams *, int, u_int32_t); +/* -- */ + +/* + * Input code for a DATA frame. + */ +static int +ieee80211_input_data(struct ieee80211com *ic, struct mbuf **mp, +struct ieee80211_node *ni) +{ + struct ifnet *ifp = ic->ic_ifp; + struct ieee80211_key *key; + struct ieee80211_frame *wh; + u_int8_t dir, subtype; + struct ether_header *eh; + struct mbuf *m = *mp; + int hdrspace; + + wh = mtod(m, struct ieee80211_frame *); + dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; + subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; + + hdrspace = ieee80211_hdrspace(ic, wh); + + if (m->m_len < hdrspace && + (m = m_pullup(m, hdrspace)) == NULL) { + IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_ANY, + ni->ni_macaddr, NULL, + "data too short: expecting %u", hdrspace); + ic->ic_stats.is_rx_tooshort++; + goto out; /* XXX */ + } + wh = mtod(m, struct ieee80211_frame *); + + switch (ic->ic_opmode) { + case IEEE80211_M_STA: + if (dir != IEEE80211_FC1_DIR_FROMDS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + if ((ifp->if_flags & IFF_SIMPLEX) && + IEEE80211_IS_MULTICAST(wh->i_addr1) && + IEEE80211_ADDR_EQ(wh->i_addr3, ic->ic_myaddr)) { + /* + * In IEEE802.11 network, multicast packet + * sent from me is broadcast from AP. + * It should be silently discarded for + * SIMPLEX interface. + */ + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, NULL, "%s", "multicast echo"); + ic->ic_stats.is_rx_mcastecho++; + goto out; + } + break; + + case IEEE80211_M_IBSS: + case IEEE80211_M_AHDEMO: + if (dir != IEEE80211_FC1_DIR_NODS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + /* XXX no power-save support */ + break; + + case IEEE80211_M_HOSTAP: +#ifndef IEEE80211_NO_HOSTAP + if (dir != IEEE80211_FC1_DIR_TODS) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown dir 0x%x", dir); + ic->ic_stats.is_rx_wrongdir++; + goto out; + } + /* check if source STA is associated */ + if (ni == ic->ic_bss) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unknown src"); + ieee80211_send_error(ic, ni, wh->i_addr2, + IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_NOT_AUTHED); + ic->ic_stats.is_rx_notassoc++; + goto err; + } + if (ni->ni_associd == 0) { + IEEE80211_DISCARD(ic, IEEE80211_MSG_INPUT, + wh, "data", "%s", "unassoc src"); + IEEE80211_SEND_MGMT(ic, ni, + IEEE80211_FC0_SUBTYPE_DISASSOC, + IEEE80211_REASON_NOT_ASSOCED); + ic->ic_stats.is_rx_notassoc++; + goto err; + } + + /* + * Check for power save state change. + */ + if (((wh->i_fc[1] & IEEE80211_FC1_PWR_MGT) ^ + (ni->ni_flags & IEEE80211_NODE_PWR_MGT))) + ieee80211_node_pwrsave(ni, +wh->i_fc[1] & IEEE80211_FC1_PWR_MGT); +#endif /* !IEEE80211_NO_HOSTAP */ + break; + + default: + /* XXX here to keep compiler happy */ + goto out; + } + + /* + * Handle privacy requirements. Note that we + * must not be preempted from here until after + * we (potentially) call ieee80211_crypto_demic; + * otherwise we may
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 07:53:02 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_var.h Log Message: Start cleaning up this mess. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.31 -r1.32 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Tue Jan 16 07:53:02 UTC 2018 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_var.h Log Message: Start cleaning up this mess. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.31 -r1.32 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.91 src/sys/net80211/ieee80211_input.c:1.92 --- src/sys/net80211/ieee80211_input.c:1.91 Sun Dec 10 08:56:23 2017 +++ src/sys/net80211/ieee80211_input.c Tue Jan 16 07:53:02 2018 @@ -1,5 +1,6 @@ -/* $NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $ */ -/*- +/* $NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $ */ + +/* * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * All rights reserved. @@ -36,16 +37,13 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $"); #endif #ifdef _KERNEL_OPT #include "opt_inet.h" #endif -#ifdef __NetBSD__ -#endif /* __NetBSD__ */ - #include #include #include @@ -138,7 +136,7 @@ static struct mbuf *ieee80211_defrag(str struct ieee80211_node *, struct mbuf *, int); static struct mbuf *ieee80211_decap(struct ieee80211com *, struct mbuf *, int); static void ieee80211_send_error(struct ieee80211com *, struct ieee80211_node *, - const u_int8_t *mac, int subtype, int arg); + const u_int8_t *mac, int subtype, int arg); static void ieee80211_deliver_data(struct ieee80211com *, struct ieee80211_node *, struct mbuf *); #ifndef IEEE80211_NO_HOSTAP @@ -172,7 +170,6 @@ ieee80211_input(struct ieee80211com *ic, struct ether_header *eh; int hdrspace; u_int8_t dir, type, subtype; - u_int8_t *bssid; u_int16_t rxseq; IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); @@ -187,6 +184,7 @@ ieee80211_input(struct ieee80211com *ic, m->m_flags &= ~M_HASFCS; } type = -1; /* undefined */ + /* * In monitor mode, send everything directly to bpf. * XXX may want to include the CRC @@ -201,6 +199,7 @@ ieee80211_input(struct ieee80211com *ic, ic->ic_stats.is_rx_tooshort++; goto out; } + /* * Bit of a cheat here, we use a pointer for a 3-address * frame format but don't reference fields past outside @@ -220,7 +219,10 @@ ieee80211_input(struct ieee80211com *ic, dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; + if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { + u_int8_t *bssid; + switch (ic->ic_opmode) { case IEEE80211_M_STA: bssid = wh->i_addr2; @@ -234,11 +236,12 @@ ieee80211_input(struct ieee80211com *ic, goto out; } - /* Filter out packets not directed to us in case the - * device is in promiscous mode + /* + * Filter out packets not directed to us in case the + * device is in promiscuous mode */ - if ((! IEEE80211_IS_MULTICAST(wh->i_addr1)) - && (! IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr))) { + if (!IEEE80211_IS_MULTICAST(wh->i_addr1) && + !IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D", ic->ic_myaddr, ":", wh->i_addr1, ":"); @@ -246,6 +249,7 @@ ieee80211_input(struct ieee80211com *ic, goto out; } break; + case IEEE80211_M_IBSS: case IEEE80211_M_AHDEMO: case IEEE80211_M_HOSTAP: @@ -266,6 +270,7 @@ ieee80211_input(struct ieee80211com *ic, } if (type != IEEE80211_FC0_TYPE_DATA) break; + /* * Data frame, validate the bssid. */ @@ -283,9 +288,11 @@ ieee80211_input(struct ieee80211com *ic, ic->ic_stats.is_rx_wrongbss++; goto out; } + /* * For adhoc mode we cons up a node when it doesn't - * exist. This should probably done after an ACL check. + * exist. This should probably be done after an ACL + * check. */ if (ni == ic->ic_bss && ic->ic_opmode != IEEE80211_M_HOSTAP && @@ -295,35 +302,45 @@ ieee80211_input(struct ieee80211com *ic, * discovered member of the IBSS. */ ni = ieee80211_fakeup_adhoc_node(>ic_sta, - wh->i_addr2); +wh->i_addr2); if (ni == NULL) { /* NB: stat kept for alloc failure */ goto err; } } break; + default: goto out; } + ni->ni_rssi = rssi; ni->ni_rstamp = rstamp; + if (HAS_SEQ(type) && (ic->ic_opmode != IEEE80211_M_STA || !IEEE80211_IS_MULTICAST(wh->i_addr1))) { u_int8_t tid,
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Sun Dec 10 08:56:24 UTC 2017 Modified Files: src/sys/net80211: ieee80211_crypto.c ieee80211_crypto.h ieee80211_input.c Log Message: Fix use-after-free: ieee80211_crypto_decap does a pullup on the mbuf but the updated pointer is not passed back. Looks like it is triggerable remotely. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_crypto.c cvs rdiff -u -r1.11 -r1.12 src/sys/net80211/ieee80211_crypto.h cvs rdiff -u -r1.90 -r1.91 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Sun Dec 10 08:56:24 UTC 2017 Modified Files: src/sys/net80211: ieee80211_crypto.c ieee80211_crypto.h ieee80211_input.c Log Message: Fix use-after-free: ieee80211_crypto_decap does a pullup on the mbuf but the updated pointer is not passed back. Looks like it is triggerable remotely. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_crypto.c cvs rdiff -u -r1.11 -r1.12 src/sys/net80211/ieee80211_crypto.h cvs rdiff -u -r1.90 -r1.91 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto.c diff -u src/sys/net80211/ieee80211_crypto.c:1.17 src/sys/net80211/ieee80211_crypto.c:1.18 --- src/sys/net80211/ieee80211_crypto.c:1.17 Mon Aug 24 22:21:26 2015 +++ src/sys/net80211/ieee80211_crypto.c Sun Dec 10 08:56:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_crypto.c,v 1.17 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.12 2005/08/08 18:46:35 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.17 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -565,7 +565,7 @@ ieee80211_crypto_encap(struct ieee80211c */ struct ieee80211_key * ieee80211_crypto_decap(struct ieee80211com *ic, - struct ieee80211_node *ni, struct mbuf *m, int hdrlen) + struct ieee80211_node *ni, struct mbuf **mp, int hdrlen) { #define IEEE80211_WEP_HDRLEN (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) #define IEEE80211_WEP_MINLEN \ @@ -574,6 +574,7 @@ ieee80211_crypto_decap(struct ieee80211c struct ieee80211_key *k; struct ieee80211_frame *wh; const struct ieee80211_cipher *cip; + struct mbuf *m = *mp; u_int8_t keyid; /* NB: this minimum size data frame could be bigger */ @@ -605,6 +606,7 @@ ieee80211_crypto_decap(struct ieee80211c cip = k->wk_cipher; if (m->m_len < hdrlen + cip->ic_header && (m = m_pullup(m, hdrlen + cip->ic_header)) == NULL) { + *mp = NULL; IEEE80211_DPRINTF(ic, IEEE80211_MSG_CRYPTO, "[%s] unable to pullup %s header\n", ether_sprintf(wh->i_addr2), cip->ic_name); Index: src/sys/net80211/ieee80211_crypto.h diff -u src/sys/net80211/ieee80211_crypto.h:1.11 src/sys/net80211/ieee80211_crypto.h:1.12 --- src/sys/net80211/ieee80211_crypto.h:1.11 Sat Jan 3 03:43:23 2009 +++ src/sys/net80211/ieee80211_crypto.h Sun Dec 10 08:56:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_crypto.h,v 1.11 2009/01/03 03:43:23 yamt Exp $ */ +/* $NetBSD: ieee80211_crypto.h,v 1.12 2017/12/10 08:56:23 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -181,7 +181,7 @@ int ieee80211_crypto_available(u_int cip struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211com *, struct ieee80211_node *, struct mbuf *); struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211com *, - struct ieee80211_node *, struct mbuf *, int); + struct ieee80211_node *, struct mbuf **, int); /* * Check and remove any MIC. Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.90 src/sys/net80211/ieee80211_input.c:1.91 --- src/sys/net80211/ieee80211_input.c:1.90 Sun Dec 10 08:48:15 2017 +++ src/sys/net80211/ieee80211_input.c Sun Dec 10 08:56:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -454,7 +454,7 @@ ieee80211_input(struct ieee80211com *ic, IEEE80211_NODE_STAT(ni, rx_noprivacy); goto out; } - key = ieee80211_crypto_decap(ic, ni, m, hdrspace); + key = ieee80211_crypto_decap(ic, ni, , hdrspace); if (key == NULL) { /* NB: stats+msgs handled in crypto_decap */ IEEE80211_NODE_STAT(ni, rx_wepfail); @@ -595,7 +595,7 @@ ieee80211_input(struct ieee80211com *ic, goto out; } hdrspace = ieee80211_hdrspace(ic, wh); - key = ieee80211_crypto_decap(ic, ni, m, hdrspace); + key = ieee80211_crypto_decap(ic, ni, , hdrspace); if (key == NULL) { /* NB: stats+msgs handled in crypto_decap */
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Sun Dec 10 08:48:15 UTC 2017 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Update the pointer after m_pullup, otherwise possible use-after-free. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.89 src/sys/net80211/ieee80211_input.c:1.90 --- src/sys/net80211/ieee80211_input.c:1.89 Tue Sep 26 07:42:06 2017 +++ src/sys/net80211/ieee80211_input.c Sun Dec 10 08:48:15 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.89 2017/09/26 07:42:06 knakahara Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.89 2017/09/26 07:42:06 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $"); #endif #ifdef _KERNEL_OPT @@ -358,6 +358,8 @@ ieee80211_input(struct ieee80211com *ic, ic->ic_stats.is_rx_tooshort++; goto out; /* XXX */ } + wh = mtod(m, struct ieee80211_frame *); + switch (ic->ic_opmode) { case IEEE80211_M_STA: if (dir != IEEE80211_FC1_DIR_FROMDS) {
CVS commit: src/sys/net80211
Module Name:src Committed By: maxv Date: Sun Dec 10 08:48:15 UTC 2017 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Update the pointer after m_pullup, otherwise possible use-after-free. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: ozaki-r Date: Mon Mar 6 08:36:20 UTC 2017 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix incrementing wrong counter To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: ozaki-r Date: Mon Mar 6 08:36:20 UTC 2017 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix incrementing wrong counter To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.87 src/sys/net80211/ieee80211_input.c:1.88 --- src/sys/net80211/ieee80211_input.c:1.87 Thu Feb 2 10:05:35 2017 +++ src/sys/net80211/ieee80211_input.c Mon Mar 6 08:36:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.87 2017/02/02 10:05:35 nonaka Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.88 2017/03/06 08:36:20 ozaki-r Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.87 2017/02/02 10:05:35 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.88 2017/03/06 08:36:20 ozaki-r Exp $"); #endif #ifdef _KERNEL_OPT @@ -780,7 +780,7 @@ ieee80211_deliver_data(struct ieee80211c len = m1->m_pkthdr.len; IFQ_ENQUEUE(>if_snd, m1, error); if (error) { -ifp->if_omcasts++; +ifp->if_oerrors++; m = NULL; } ifp->if_obytes += len;
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sun Oct 9 14:50:20 UTC 2016 Modified Files: src/sys/net80211: ieee80211_crypto_wep.c Log Message: PR/51540: Henning Petersen: replace , with ; To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_crypto_wep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sun Oct 9 14:50:20 UTC 2016 Modified Files: src/sys/net80211: ieee80211_crypto_wep.c Log Message: PR/51540: Henning Petersen: replace , with ; To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_crypto_wep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto_wep.c diff -u src/sys/net80211/ieee80211_crypto_wep.c:1.8 src/sys/net80211/ieee80211_crypto_wep.c:1.9 --- src/sys/net80211/ieee80211_crypto_wep.c:1.8 Wed Dec 17 15:51:37 2008 +++ src/sys/net80211/ieee80211_crypto_wep.c Sun Oct 9 10:50:20 2016 @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_wep.c,v 1.7 2005/06/10 16:11:24 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.8 2008/12/17 20:51:37 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.9 2016/10/09 14:50:20 christos Exp $"); #endif /* @@ -421,7 +421,7 @@ wep_decrypt(struct ieee80211_key *key, s } off = hdrlen + wep.ic_header; - data_len = m->m_pkthdr.len - (off + wep.ic_trailer), + data_len = m->m_pkthdr.len - (off + wep.ic_trailer); /* Compute CRC32 over unencrypted data and apply RC4 to data */ crc = ~0;
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Tue Sep 27 20:20:06 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_netbsd.c ieee80211_node.c ieee80211_rssadapt.c ieee80211_var.h Log Message: - use ether_snprintf() so that we don't overwrite our buffer for printing ethernet-like addresses - make this compile againw without IEEE80211_DEBUG. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.27 -r1.28 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.71 -r1.72 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211_rssadapt.c cvs rdiff -u -r1.30 -r1.31 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Tue Sep 27 20:20:06 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_netbsd.c ieee80211_node.c ieee80211_rssadapt.c ieee80211_var.h Log Message: - use ether_snprintf() so that we don't overwrite our buffer for printing ethernet-like addresses - make this compile againw without IEEE80211_DEBUG. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.27 -r1.28 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.71 -r1.72 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211_rssadapt.c cvs rdiff -u -r1.30 -r1.31 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.84 src/sys/net80211/ieee80211_input.c:1.85 --- src/sys/net80211/ieee80211_input.c:1.84 Sat May 14 09:35:40 2016 +++ src/sys/net80211/ieee80211_input.c Tue Sep 27 16:20:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.85 2016/09/27 20:20:06 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.85 2016/09/27 20:20:06 christos Exp $"); #endif #ifdef _KERNEL_OPT @@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_in #include #include -#include +#include #include #include #include @@ -66,7 +66,6 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_in #include #include -#include #include #include @@ -116,6 +115,7 @@ doprint(struct ieee80211com *ic, int sub if ((_ic)->ic_debug & (_m)) \ ieee80211_discard_mac(_ic, _mac, _type, _fmt, __VA_ARGS__);\ } while (0) +#define IEEE80211_DEBUGVAR(a) a static const u_int8_t *ieee80211_getbssid(struct ieee80211com *, const struct ieee80211_frame *); @@ -130,6 +130,7 @@ static void ieee80211_discard_mac(struct #define IEEE80211_DISCARD(_ic, _m, _wh, _type, _fmt, ...) #define IEEE80211_DISCARD_IE(_ic, _m, _wh, _type, _fmt, ...) #define IEEE80211_DISCARD_MAC(_ic, _m, _mac, _type, _fmt, ...) +#define IEEE80211_DEBUGVAR(a) #endif /* IEEE80211_DEBUG */ static struct mbuf *ieee80211_defrag(struct ieee80211com *, @@ -172,6 +173,7 @@ ieee80211_input(struct ieee80211com *ic, u_int8_t dir, type, subtype; u_int8_t *bssid; u_int16_t rxseq; + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); IASSERT(ni != NULL, ("null node")); ni->ni_inact = ni->ni_inact_reload; @@ -222,7 +224,9 @@ ieee80211_input(struct ieee80211com *ic, if (!IEEE80211_ADDR_EQ(bssid, ni->ni_bssid)) { /* not interested in */ IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, -bssid, NULL, "%s", "not to bss"); +bssid, NULL, "node %s, %s", +ether_snprintf(ebuf, sizeof(ebuf), +ni->ni_bssid), "not to bss"); ic->ic_stats.is_rx_wrongbss++; goto out; } @@ -265,8 +269,14 @@ ieee80211_input(struct ieee80211com *ic, if (!IEEE80211_ADDR_EQ(bssid, ic->ic_bss->ni_bssid) && !IEEE80211_ADDR_EQ(bssid, ifp->if_broadcastaddr)) { /* not interested in */ +IEEE80211_DEBUGVAR( +char bbuf[3 * ETHER_ADDR_LEN]); IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, -bssid, NULL, "%s", "not to bss"); +bssid, NULL, "bss %s, broadcast %s, %s", +ether_snprintf(ebuf, sizeof(ebuf), +ic->ic_bss->ni_bssid), +ether_snprintf(bbuf, sizeof(bbuf), +ifp->if_broadcastaddr), "not to bss"); ic->ic_stats.is_rx_wrongbss++; goto out; } @@ -553,7 +563,8 @@ ieee80211_input(struct ieee80211com *ic, if_printf(ic->ic_ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - ether_sprintf(wh->i_addr2), rssi); + ether_snprintf(ebuf, sizeof(ebuf), wh->i_addr2), + rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { @@ -919,11 +930,13 @@ ieee80211_setup_rates(struct ieee80211_n */ nxrates = xrates[1]; if (rs->rs_nrates + nxrates > IEEE80211_RATE_MAXSIZE) { + IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]); nxrates = IEEE80211_RATE_MAXSIZE - rs->rs_nrates; IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE, "[%s] extended rate set too large;" " only using %u of %u rates\n", - ether_sprintf(ni->ni_macaddr), nxrates, xrates[1]); + ether_snprintf(ebuf, sizeof(ebuf), ni->ni_macaddr), + nxrates, xrates[1]); ic->ic_stats.is_rx_rstoobig++; }
CVS commit: src/sys/net80211
Module Name:src Committed By: ozaki-r Date: Mon Jun 20 08:57:18 UTC 2016 Modified Files: src/sys/net80211: ieee80211_output.c Log Message: Get rid of invalid KASSERT The mbuf being checked is allocated in ieee80211_getmgtframe just above, so checking NULL of its CTX is meaningless. Pointed out by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/net80211/ieee80211_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: ozaki-r Date: Mon Jun 20 08:57:18 UTC 2016 Modified Files: src/sys/net80211: ieee80211_output.c Log Message: Get rid of invalid KASSERT The mbuf being checked is allocated in ieee80211_getmgtframe just above, so checking NULL of its CTX is meaningless. Pointed out by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/net80211/ieee80211_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_output.c diff -u src/sys/net80211/ieee80211_output.c:1.55 src/sys/net80211/ieee80211_output.c:1.56 --- src/sys/net80211/ieee80211_output.c:1.55 Mon Jun 20 08:30:59 2016 +++ src/sys/net80211/ieee80211_output.c Mon Jun 20 08:57:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_output.c,v 1.55 2016/06/20 08:30:59 knakahara Exp $ */ +/* $NetBSD: ieee80211_output.c,v 1.56 2016/06/20 08:57:18 ozaki-r Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.55 2016/06/20 08:30:59 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.56 2016/06/20 08:57:18 ozaki-r Exp $"); #endif #ifdef _KERNEL_OPT @@ -184,9 +184,6 @@ ieee80211_mgmt_output(struct ieee80211co M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m == NULL) return ENOMEM; -#ifdef __FreeBSD__ - KASSERT(M_GETCTX(m, struct ieee80211_node *) == NULL); -#endif M_SETCTX(m, ni); wh = mtod(m, struct ieee80211_frame *); @@ -1344,7 +1341,6 @@ ieee80211_send_probereq(struct ieee80211 M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m == NULL) return ENOMEM; - KASSERT(M_GETCTX(m, struct ieee80211_node *) == NULL); M_SETCTX(m, ni); wh = mtod(m, struct ieee80211_frame *);
CVS commit: src/sys/net80211
Module Name:src Committed By: mlelstv Date: Sat May 14 13:35:40 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: In station mode filter packets that or not for us in case the interface is in promiscous mode or doesn't filter packets itself. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.83 src/sys/net80211/ieee80211_input.c:1.84 --- src/sys/net80211/ieee80211_input.c:1.83 Sat May 7 12:36:50 2016 +++ src/sys/net80211/ieee80211_input.c Sat May 14 13:35:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $"); #endif #ifdef _KERNEL_OPT @@ -226,6 +226,18 @@ ieee80211_input(struct ieee80211com *ic, ic->ic_stats.is_rx_wrongbss++; goto out; } + + /* Filter out packets not directed to us in case the + * device is in promiscous mode + */ + if ((! IEEE80211_IS_MULTICAST(wh->i_addr1)) + && (! IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr))) { +IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, +bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D", +ic->ic_myaddr, ":", wh->i_addr1, ":"); +ic->ic_stats.is_rx_wrongbss++; +goto out; + } break; case IEEE80211_M_IBSS: case IEEE80211_M_AHDEMO:
CVS commit: src/sys/net80211
Module Name:src Committed By: mlelstv Date: Sat May 14 13:35:40 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: In station mode filter packets that or not for us in case the interface is in promiscous mode or doesn't filter packets itself. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: mlelstv Date: Sat May 7 12:36:50 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Don't check sequence number on multicast packets in station mode. Handle overflow of 12bit sequence number. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.82 src/sys/net80211/ieee80211_input.c:1.83 --- src/sys/net80211/ieee80211_input.c:1.82 Wed Apr 20 09:01:04 2016 +++ src/sys/net80211/ieee80211_input.c Sat May 7 12:36:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.82 2016/04/20 09:01:04 knakahara Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.82 2016/04/20 09:01:04 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $"); #endif #ifdef _KERNEL_OPT @@ -282,8 +282,11 @@ ieee80211_input(struct ieee80211com *ic, } ni->ni_rssi = rssi; ni->ni_rstamp = rstamp; - if (HAS_SEQ(type)) { - u_int8_t tid; + if (HAS_SEQ(type) && (ic->ic_opmode != IEEE80211_M_STA || + !IEEE80211_IS_MULTICAST(wh->i_addr1))) { + u_int8_t tid, retry; + u_int16_t rxno, orxno; + if (ieee80211_has_qos(wh)) { tid = ((struct ieee80211_qosframe *)wh)-> i_qos[0] & IEEE80211_QOS_TID; @@ -293,15 +296,20 @@ ieee80211_input(struct ieee80211com *ic, } else tid = 0; rxseq = le16toh(*(u_int16_t *)wh->i_seq); - if ((wh->i_fc[1] & IEEE80211_FC1_RETRY) && - SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) { + retry = wh->i_fc[1] & IEEE80211_FC1_RETRY; + rxno = rxseq >> IEEE80211_SEQ_SEQ_SHIFT; + orxno = ni->ni_rxseqs[tid] >> IEEE80211_SEQ_SEQ_SHIFT; + if (retry && ( + (orxno == 4095 && rxno == orxno) || + (orxno != 4095 && + SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) + )) { /* duplicate, discard */ IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, bssid, "duplicate", "seqno <%u,%u> fragno <%u,%u> tid %u", -rxseq >> IEEE80211_SEQ_SEQ_SHIFT, -ni->ni_rxseqs[tid] >> - IEEE80211_SEQ_SEQ_SHIFT, +rxno, +orxno, rxseq & IEEE80211_SEQ_FRAG_MASK, ni->ni_rxseqs[tid] & IEEE80211_SEQ_FRAG_MASK,
CVS commit: src/sys/net80211
Module Name:src Committed By: mlelstv Date: Sat May 7 12:36:50 UTC 2016 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Don't check sequence number on multicast packets in station mode. Handle overflow of 12bit sequence number. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Wed Apr 27 20:17:00 UTC 2016 Modified Files: src/sys/net80211: ieee80211.h Log Message: Add 80211n ht frame. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Wed Apr 27 20:17:00 UTC 2016 Modified Files: src/sys/net80211: ieee80211.h Log Message: Add 80211n ht frame. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.26 src/sys/net80211/ieee80211.h:1.27 --- src/sys/net80211/ieee80211.h:1.26 Sat Mar 30 10:14:31 2013 +++ src/sys/net80211/ieee80211.h Wed Apr 27 16:17:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.26 2013/03/30 14:14:31 christos Exp $ */ +/* $NetBSD: ieee80211.h,v 1.27 2016/04/27 20:17:00 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -81,6 +81,17 @@ struct ieee80211_qosframe { /* see below */ } __packed; +struct ieee80211_htframe { /* 11n */ + u_int8_t i_fc[2]; + u_int8_t i_dur[2]; + u_int8_t i_addr1[IEEE80211_ADDR_LEN]; + u_int8_t i_addr2[IEEE80211_ADDR_LEN]; + u_int8_t i_addr3[IEEE80211_ADDR_LEN]; + u_int8_t i_seq[2]; + u_int8_t i_qos[2]; + u_int8_t i_ht[4]; +} __packed; + struct ieee80211_qoscntl { u_int8_t i_qos[2]; };
Re: CVS commit: src/sys/net80211
On 06/04/2016 17:31, David Young wrote: > On Wed, Apr 06, 2016 at 02:42:16PM +, Roy Marples wrote: >> Module Name: src >> Committed By:roy >> Date:Wed Apr 6 14:42:16 UTC 2016 >> >> Modified Files: >> src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h >> ieee80211_rssadapt.h ieee80211_var.h >> >> Log Message: >> ieee80211 users in Other OS export rssi and noise as int8_t. >> We should not be the odd one out for no good reason and the majority >> of the ieee80211 drivers treat rssi as int8_t. > > This may be a more difficult change to make properly than you > anticipated. Drivers like rtw(4) assume 0 <= RSSI <= UINT8_MAX. If you > put those RSSI into an int8_t, then for high signal strengths the number > may change sign instead of increase in magnitude. You're correct, sorry about that. Still, in the hope that one day I can display my pretty bars we need some way of telling userland something about the units of RSSI as known to the driver - maybe we can expose some driver capabilities and do it there? struct ieee80211_drivercaps_req { uint32_tdc_drivercaps; uint32_tdc_cryptocaps; uint8_t dc_rssi_min; uint8_t dc_rssi_max; } #define IEEE80211_C_RSSI_DBM So userland can know the minimum and maximum values for RSSI and optionally what they mean - in this case I want to know that my iwi(4) and iwn(4) report values in dBm. Ideally I want to extend ieee80211_input to accept noise (if known) as well. FreeBSD simply dropped rstamp in the function whereas OpenBSD converted the last field to a struct which has rssi and rstamp, but obviously nosie could be added there as well. Thoughts on this are welcome. Roy
CVS commit: src/sys/net80211
Module Name:src Committed By: roy Date: Fri Apr 8 14:30:47 UTC 2016 Modified Files: src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h ieee80211_rssadapt.h ieee80211_var.h Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_ioctl.h cvs rdiff -u -r1.70 -r1.71 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.26 -r1.27 src/sys/net80211/ieee80211_node.h cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_rssadapt.h cvs rdiff -u -r1.29 -r1.30 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_ioctl.h diff -u src/sys/net80211/ieee80211_ioctl.h:1.22 src/sys/net80211/ieee80211_ioctl.h:1.23 --- src/sys/net80211/ieee80211_ioctl.h:1.22 Wed Apr 6 14:42:16 2016 +++ src/sys/net80211/ieee80211_ioctl.h Fri Apr 8 14:30:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.h,v 1.22 2016/04/06 14:42:16 roy Exp $ */ +/* $NetBSD: ieee80211_ioctl.h,v 1.23 2016/04/08 14:30:47 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -356,7 +356,7 @@ struct ieee80211req_sta_info { u_int16_t isi_flags; /* channel flags */ u_int16_t isi_state; /* state flags */ u_int8_t isi_authmode; /* authentication algorithm */ - int8_t isi_rssi; + u_int8_t isi_rssi; u_int8_t isi_capinfo; /* capabilities */ u_int8_t isi_erp; /* ERP element */ u_int8_t isi_macaddr[IEEE80211_ADDR_LEN]; @@ -524,8 +524,8 @@ struct ieee80211req_scan_result { u_int16_t isr_len; /* length (mult of 4) */ u_int16_t isr_freq; /* MHz */ u_int16_t isr_flags; /* channel flags */ - int8_t isr_noise; - int8_t isr_rssi; + u_int8_t isr_noise; + u_int8_t isr_rssi; u_int8_t isr_intval; /* beacon interval */ u_int8_t isr_capinfo; /* capabilities */ u_int8_t isr_erp; /* ERP element */ Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.70 src/sys/net80211/ieee80211_node.c:1.71 --- src/sys/net80211/ieee80211_node.c:1.70 Wed Apr 6 14:42:16 2016 +++ src/sys/net80211/ieee80211_node.c Fri Apr 8 14:30:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.70 2016/04/06 14:42:16 roy Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.71 2016/04/08 14:30:47 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.70 2016/04/06 14:42:16 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.71 2016/04/08 14:30:47 roy Exp $"); #endif #ifdef _KERNEL_OPT @@ -85,7 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_no static struct ieee80211_node *node_alloc(struct ieee80211_node_table *); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); -static int8_t node_getrssi(const struct ieee80211_node *); +static u_int8_t node_getrssi(const struct ieee80211_node *); static void ieee80211_setup_node(struct ieee80211_node_table *, struct ieee80211_node *, const u_int8_t *); @@ -589,7 +589,7 @@ ieee80211_node_compare(struct ieee80211c const struct ieee80211_node *b) { u_int8_t maxa, maxb; - int8_t rssia, rssib; + u_int8_t rssia, rssib; int weight; /* privacy support preferred */ @@ -1001,7 +1001,7 @@ node_free(struct ieee80211_node *ni) free(ni, M_80211_NODE); } -static int8_t +static u_int8_t node_getrssi(const struct ieee80211_node *ni) { return ni->ni_rssi; @@ -2347,12 +2347,12 @@ done: ieee80211_free_node(ni); } -int8_t +u_int8_t ieee80211_getrssi(struct ieee80211com *ic) { #define NZ(x) ((x) == 0 ? 1 : (x)) struct ieee80211_node_table *nt = >ic_sta; - int32_t rssi_samples, rssi_total; + u_int32_t rssi_samples, rssi_total; struct ieee80211_node *ni; rssi_total = 0; Index: src/sys/net80211/ieee80211_node.h diff -u src/sys/net80211/ieee80211_node.h:1.26 src/sys/net80211/ieee80211_node.h:1.27 --- src/sys/net80211/ieee80211_node.h:1.26 Wed Apr 6 14:42:16 2016 +++ src/sys/net80211/ieee80211_node.h Fri Apr 8 14:30:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.h,v 1.26 2016/04/06 14:42:16 roy Exp $ */ +/* $NetBSD: ieee80211_node.h,v 1.27 2016/04/08 14:30:47 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -120,7 +120,7 @@ struct ieee80211_node { /* hardware */ u_int32_t ni_rstamp; /* recv timestamp */ - int8_t ni_rssi; /* recv ssi */ + u_int8_t ni_rssi; /* recv ssi */ /* header */ u_int8_t ni_macaddr[IEEE80211_ADDR_LEN]; @@ -286,7 +286,7 @@ struct ieee80211_node *ieee80211_fakeup_ struct ieee80211_node_table *, const u_int8_t macaddr[]); void ieee80211_node_join(struct
CVS commit: src/sys/net80211
Module Name:src Committed By: roy Date: Fri Apr 8 14:30:47 UTC 2016 Modified Files: src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h ieee80211_rssadapt.h ieee80211_var.h Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_ioctl.h cvs rdiff -u -r1.70 -r1.71 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.26 -r1.27 src/sys/net80211/ieee80211_node.h cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_rssadapt.h cvs rdiff -u -r1.29 -r1.30 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/net80211
On 06/04/2016 17:31, David Young wrote: > On Wed, Apr 06, 2016 at 02:42:16PM +, Roy Marples wrote: >> Module Name: src >> Committed By:roy >> Date:Wed Apr 6 14:42:16 UTC 2016 >> >> Modified Files: >> src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h >> ieee80211_rssadapt.h ieee80211_var.h >> >> Log Message: >> ieee80211 users in Other OS export rssi and noise as int8_t. >> We should not be the odd one out for no good reason and the majority >> of the ieee80211 drivers treat rssi as int8_t. > > This may be a more difficult change to make properly than you > anticipated. Drivers like rtw(4) assume 0 <= RSSI <= UINT8_MAX. If you > put those RSSI into an int8_t, then for high signal strengths the number > may change sign instead of increase in magnitude. A fair point. But would this not also be true for drivers like iwn(4) who assume rssi can be negative? Roy
Re: CVS commit: src/sys/net80211
On Wed, Apr 06, 2016 at 02:42:16PM +, Roy Marples wrote: > Module Name: src > Committed By: roy > Date: Wed Apr 6 14:42:16 UTC 2016 > > Modified Files: > src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h > ieee80211_rssadapt.h ieee80211_var.h > > Log Message: > ieee80211 users in Other OS export rssi and noise as int8_t. > We should not be the odd one out for no good reason and the majority > of the ieee80211 drivers treat rssi as int8_t. This may be a more difficult change to make properly than you anticipated. Drivers like rtw(4) assume 0 <= RSSI <= UINT8_MAX. If you put those RSSI into an int8_t, then for high signal strengths the number may change sign instead of increase in magnitude. Dave -- David Young dyo...@pobox.comUrbana, IL(217) 721-9981
CVS commit: src/sys/net80211
Module Name:src Committed By: roy Date: Wed Apr 6 14:42:16 UTC 2016 Modified Files: src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h ieee80211_rssadapt.h ieee80211_var.h Log Message: ieee80211 users in Other OS export rssi and noise as int8_t. We should not be the odd one out for no good reason and the majority of the ieee80211 drivers treat rssi as int8_t. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_ioctl.h cvs rdiff -u -r1.69 -r1.70 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.25 -r1.26 src/sys/net80211/ieee80211_node.h cvs rdiff -u -r1.7 -r1.8 src/sys/net80211/ieee80211_rssadapt.h cvs rdiff -u -r1.28 -r1.29 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: roy Date: Wed Apr 6 14:42:16 UTC 2016 Modified Files: src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h ieee80211_rssadapt.h ieee80211_var.h Log Message: ieee80211 users in Other OS export rssi and noise as int8_t. We should not be the odd one out for no good reason and the majority of the ieee80211 drivers treat rssi as int8_t. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_ioctl.h cvs rdiff -u -r1.69 -r1.70 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.25 -r1.26 src/sys/net80211/ieee80211_node.h cvs rdiff -u -r1.7 -r1.8 src/sys/net80211/ieee80211_rssadapt.h cvs rdiff -u -r1.28 -r1.29 src/sys/net80211/ieee80211_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_ioctl.h diff -u src/sys/net80211/ieee80211_ioctl.h:1.21 src/sys/net80211/ieee80211_ioctl.h:1.22 --- src/sys/net80211/ieee80211_ioctl.h:1.21 Sun Sep 6 06:01:01 2015 +++ src/sys/net80211/ieee80211_ioctl.h Wed Apr 6 14:42:16 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.h,v 1.21 2015/09/06 06:01:01 dholland Exp $ */ +/* $NetBSD: ieee80211_ioctl.h,v 1.22 2016/04/06 14:42:16 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -356,7 +356,7 @@ struct ieee80211req_sta_info { u_int16_t isi_flags; /* channel flags */ u_int16_t isi_state; /* state flags */ u_int8_t isi_authmode; /* authentication algorithm */ - u_int8_t isi_rssi; + int8_t isi_rssi; u_int8_t isi_capinfo; /* capabilities */ u_int8_t isi_erp; /* ERP element */ u_int8_t isi_macaddr[IEEE80211_ADDR_LEN]; @@ -524,8 +524,8 @@ struct ieee80211req_scan_result { u_int16_t isr_len; /* length (mult of 4) */ u_int16_t isr_freq; /* MHz */ u_int16_t isr_flags; /* channel flags */ - u_int8_t isr_noise; - u_int8_t isr_rssi; + int8_t isr_noise; + int8_t isr_rssi; u_int8_t isr_intval; /* beacon interval */ u_int8_t isr_capinfo; /* capabilities */ u_int8_t isr_erp; /* ERP element */ Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.69 src/sys/net80211/ieee80211_node.c:1.70 --- src/sys/net80211/ieee80211_node.c:1.69 Mon Aug 24 22:21:26 2015 +++ src/sys/net80211/ieee80211_node.c Wed Apr 6 14:42:16 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.69 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.70 2016/04/06 14:42:16 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.69 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.70 2016/04/06 14:42:16 roy Exp $"); #endif #ifdef _KERNEL_OPT @@ -85,7 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_no static struct ieee80211_node *node_alloc(struct ieee80211_node_table *); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); -static u_int8_t node_getrssi(const struct ieee80211_node *); +static int8_t node_getrssi(const struct ieee80211_node *); static void ieee80211_setup_node(struct ieee80211_node_table *, struct ieee80211_node *, const u_int8_t *); @@ -589,7 +589,7 @@ ieee80211_node_compare(struct ieee80211c const struct ieee80211_node *b) { u_int8_t maxa, maxb; - u_int8_t rssia, rssib; + int8_t rssia, rssib; int weight; /* privacy support preferred */ @@ -1001,7 +1001,7 @@ node_free(struct ieee80211_node *ni) free(ni, M_80211_NODE); } -static u_int8_t +static int8_t node_getrssi(const struct ieee80211_node *ni) { return ni->ni_rssi; @@ -2347,12 +2347,12 @@ done: ieee80211_free_node(ni); } -u_int8_t +int8_t ieee80211_getrssi(struct ieee80211com *ic) { #define NZ(x) ((x) == 0 ? 1 : (x)) struct ieee80211_node_table *nt = >ic_sta; - u_int32_t rssi_samples, rssi_total; + int32_t rssi_samples, rssi_total; struct ieee80211_node *ni; rssi_total = 0; Index: src/sys/net80211/ieee80211_node.h diff -u src/sys/net80211/ieee80211_node.h:1.25 src/sys/net80211/ieee80211_node.h:1.26 --- src/sys/net80211/ieee80211_node.h:1.25 Sat Oct 18 08:33:29 2014 +++ src/sys/net80211/ieee80211_node.h Wed Apr 6 14:42:16 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.h,v 1.25 2014/10/18 08:33:29 snj Exp $ */ +/* $NetBSD: ieee80211_node.h,v 1.26 2016/04/06 14:42:16 roy Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -120,7 +120,7 @@ struct ieee80211_node { /* hardware */ u_int32_t ni_rstamp; /* recv timestamp */ - u_int8_t ni_rssi; /* recv ssi */ + int8_t ni_rssi; /* recv ssi */ /* header */ u_int8_t
CVS commit: src/sys/net80211
Module Name:src Committed By: pooka Date: Mon Aug 24 20:58:47 UTC 2015 Modified Files: src/sys/net80211: ieee80211_amrr.c Log Message: + include opt_inet.h for INET (or lack thereof) + include net/in_ether.h, not netinet/in_ether.h (did not cause a meltdown only because opt_inet.h was missing) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/net80211/ieee80211_amrr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_amrr.c diff -u src/sys/net80211/ieee80211_amrr.c:1.2 src/sys/net80211/ieee80211_amrr.c:1.3 --- src/sys/net80211/ieee80211_amrr.c:1.2 Tue Dec 11 12:40:10 2007 +++ src/sys/net80211/ieee80211_amrr.c Mon Aug 24 20:58:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_amrr.c,v 1.2 2007/12/11 12:40:10 lukem Exp $ */ +/* $NetBSD: ieee80211_amrr.c,v 1.3 2015/08/24 20:58:47 pooka Exp $ */ /* $OpenBSD: ieee80211_amrr.c,v 1.1 2006/06/17 19:07:19 damien Exp $ */ /*- @@ -19,7 +19,11 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ieee80211_amrr.c,v 1.2 2007/12/11 12:40:10 lukem Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_amrr.c,v 1.3 2015/08/24 20:58:47 pooka Exp $); + +#ifdef _KERNEL_OPT +#include opt_inet.h +#endif #include sys/param.h #include sys/kernel.h @@ -27,11 +31,11 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211_am #include sys/sysctl.h #include net/if.h +#include net/if_ether.h #include net/if_media.h #ifdef INET #include netinet/in.h -#include netinet/if_ether.h #endif #include net80211/ieee80211.h
CVS commit: src/sys/net80211
Module Name:src Committed By: pooka Date: Mon Aug 24 20:58:47 UTC 2015 Modified Files: src/sys/net80211: ieee80211_amrr.c Log Message: + include opt_inet.h for INET (or lack thereof) + include net/in_ether.h, not netinet/in_ether.h (did not cause a meltdown only because opt_inet.h was missing) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/net80211/ieee80211_amrr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: pooka Date: Mon Apr 7 00:07:40 UTC 2014 Modified Files: src/sys/net80211: ieee80211_netbsd.c ieee80211_netbsd.h ieee80211_rssadapt.c Log Message: Use module-compatible sysctl init instead of link sets. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_netbsd.h \ src/sys/net80211/ieee80211_rssadapt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_netbsd.c diff -u src/sys/net80211/ieee80211_netbsd.c:1.25 src/sys/net80211/ieee80211_netbsd.c:1.26 --- src/sys/net80211/ieee80211_netbsd.c:1.25 Tue Feb 25 18:30:12 2014 +++ src/sys/net80211/ieee80211_netbsd.c Mon Apr 7 00:07:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_netbsd.c,v 1.25 2014/02/25 18:30:12 pooka Exp $ */ +/* $NetBSD: ieee80211_netbsd.c,v 1.26 2014/04/07 00:07:40 pooka Exp $ */ /*- * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * All rights reserved. @@ -30,7 +30,7 @@ #ifdef __FreeBSD__ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $); #else -__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.25 2014/02/25 18:30:12 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.26 2014/04/07 00:07:40 pooka Exp $); #endif /* @@ -68,6 +68,8 @@ static struct ieee80211_node *ieee80211_ struct ieee80211_node_walk *, u_short); static int ieee80211_sysctl_node(SYSCTLFN_ARGS); +static void ieee80211_sysctl_setup(void); + #ifdef IEEE80211_DEBUG int ieee80211_debug = 0; #endif @@ -81,6 +83,8 @@ ieee80211_init0(void) { ieee80211_setup_func * const *ieee80211_setup, f; + ieee80211_sysctl_setup(); + if (max_linkhdr ALIGN(sizeof(struct ieee80211_qosframe_addr4))) { max_linkhdr = ALIGN(sizeof(struct ieee80211_qosframe_addr4)); } @@ -459,28 +463,32 @@ cleanup: * * TBD condition CTLFLAG_PERMANENT on being a module or not */ -SYSCTL_SETUP(sysctl_ieee80211, sysctl ieee80211 subtree setup) +static struct sysctllog *ieee80211_sysctllog; +static void +ieee80211_sysctl_setup(void) { int rc; const struct sysctlnode *cnode, *rnode; - if ((rnode = ieee80211_sysctl_treetop(clog)) == NULL) + if ((rnode = ieee80211_sysctl_treetop(ieee80211_sysctllog)) == NULL) return; - if ((rc = sysctl_createv(clog, 0, rnode, NULL, + if ((rc = sysctl_createv(ieee80211_sysctllog, 0, rnode, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, nodes, client/peer stations, ieee80211_sysctl_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, + if ((rc = sysctl_createv(ieee80211_sysctllog, 0, rnode, cnode, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, debug, SYSCTL_DESCR(control debugging printfs), NULL, 0, ieee80211_debug, 0, CTL_CREATE, CTL_EOL)) != 0) goto err; #endif /* IEEE80211_DEBUG */ + ieee80211_rssadapt_sysctl_setup(ieee80211_sysctllog); + return; err: printf(%s: sysctl_createv failed (rc = %d)\n, __func__, rc); Index: src/sys/net80211/ieee80211_netbsd.h diff -u src/sys/net80211/ieee80211_netbsd.h:1.18 src/sys/net80211/ieee80211_netbsd.h:1.19 --- src/sys/net80211/ieee80211_netbsd.h:1.18 Thu Jun 27 17:47:18 2013 +++ src/sys/net80211/ieee80211_netbsd.h Mon Apr 7 00:07:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_netbsd.h,v 1.18 2013/06/27 17:47:18 christos Exp $ */ +/* $NetBSD: ieee80211_netbsd.h,v 1.19 2014/04/07 00:07:40 pooka Exp $ */ /*- * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * All rights reserved. @@ -240,6 +240,8 @@ void ieee80211_sysctl_attach(struct ieee void ieee80211_sysctl_detach(struct ieee80211com *); void ieee80211_load_module(const char *); +void ieee80211_rssadapt_sysctl_setup(struct sysctllog **); + void ieee80211_init(void); #define IEEE80211_CRYPTO_SETUP(name)\ static void name(void); \ Index: src/sys/net80211/ieee80211_rssadapt.c diff -u src/sys/net80211/ieee80211_rssadapt.c:1.18 src/sys/net80211/ieee80211_rssadapt.c:1.19 --- src/sys/net80211/ieee80211_rssadapt.c:1.18 Tue Feb 25 18:30:12 2014 +++ src/sys/net80211/ieee80211_rssadapt.c Mon Apr 7 00:07:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_rssadapt.c,v 1.18 2014/02/25 18:30:12 pooka Exp $ */ +/* $NetBSD: ieee80211_rssadapt.c,v 1.19 2014/04/07 00:07:40 pooka Exp $ */ /*- * Copyright (c) 2003, 2004 David Young. All rights reserved. * @@ -28,7 +28,7 @@ #include sys/cdefs.h #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_rssadapt.c,v 1.18 2014/02/25 18:30:12 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_rssadapt.c,v 1.19 2014/04/07 00:07:40 pooka Exp $); #endif #include sys/param.h @@ -141,8 +141,8 @@ sysctl_ieee80211_rssadapt_expavgctl(SYSC * * TBD condition CTLFLAG_PERMANENT on being a module or not */
CVS commit: src/sys/net80211
Module Name:src Committed By: pooka Date: Mon Apr 7 00:07:40 UTC 2014 Modified Files: src/sys/net80211: ieee80211_netbsd.c ieee80211_netbsd.h ieee80211_rssadapt.c Log Message: Use module-compatible sysctl init instead of link sets. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_netbsd.h \ src/sys/net80211/ieee80211_rssadapt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Jan 25 00:59:44 UTC 2014 Modified Files: src/sys/net80211: ieee80211_ioctl.c Log Message: fix monitor mode channel. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/net80211/ieee80211_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_ioctl.c diff -u src/sys/net80211/ieee80211_ioctl.c:1.58 src/sys/net80211/ieee80211_ioctl.c:1.59 --- src/sys/net80211/ieee80211_ioctl.c:1.58 Thu Sep 12 16:44:02 2013 +++ src/sys/net80211/ieee80211_ioctl.c Fri Jan 24 19:59:44 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.c,v 1.58 2013/09/12 20:44:02 martin Exp $ */ +/* $NetBSD: ieee80211_ioctl.c,v 1.59 2014/01/25 00:59:44 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.58 2013/09/12 20:44:02 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.59 2014/01/25 00:59:44 christos Exp $); #endif /* @@ -2837,6 +2837,9 @@ ieee80211_ioctl(struct ieee80211com *ic, if (ic-ic_des_chan != IEEE80211_CHAN_ANYC ic-ic_bss-ni_chan != ic-ic_des_chan) error = ENETRESET; + } else if (ic-ic_opmode == IEEE80211_M_MONITOR) { +ic-ic_curchan = ic-ic_ibss_chan; +error = ENETRESET; } else { if (ic-ic_bss-ni_chan != ic-ic_ibss_chan) error = ENETRESET;
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Jan 25 00:59:44 UTC 2014 Modified Files: src/sys/net80211: ieee80211_ioctl.c Log Message: fix monitor mode channel. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/net80211/ieee80211_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: martin Date: Thu Sep 12 20:44:02 UTC 2013 Modified Files: src/sys/net80211: ieee80211_ioctl.c Log Message: Fix return value of ieee80211_ioctl_setoptie To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/net80211/ieee80211_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_ioctl.c diff -u src/sys/net80211/ieee80211_ioctl.c:1.57 src/sys/net80211/ieee80211_ioctl.c:1.58 --- src/sys/net80211/ieee80211_ioctl.c:1.57 Sat Dec 31 20:41:58 2011 +++ src/sys/net80211/ieee80211_ioctl.c Thu Sep 12 20:44:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.c,v 1.57 2011/12/31 20:41:58 christos Exp $ */ +/* $NetBSD: ieee80211_ioctl.c,v 1.58 2013/09/12 20:44:02 martin Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.57 2011/12/31 20:41:58 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.58 2013/09/12 20:44:02 martin Exp $); #endif /* @@ -1615,7 +1615,7 @@ ieee80211_ioctl_setoptie(struct ieee8021 free(ic-ic_opt_ie, M_DEVBUF); ic-ic_opt_ie = ie; ic-ic_opt_ie_len = ireq-i_len; - return 0; + return error; } static int
CVS commit: src/sys/net80211
Module Name:src Committed By: martin Date: Thu Sep 12 20:44:02 UTC 2013 Modified Files: src/sys/net80211: ieee80211_ioctl.c Log Message: Fix return value of ieee80211_ioctl_setoptie To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/net80211/ieee80211_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/net80211
Now current/GENERIC doesn't compile: In file included from ../../../../net80211/ieee80211_var.h:62:0, from ../../../../dev/ic/an.c:108: ../../../../net80211/ieee80211_proto.h: In function ‘ieee80211_hdrsize’: ../../../../net80211/ieee80211_proto.h:109:2: error: implicit declaration of function ‘IEEE80211_QOS_HAS_SEQ’ *** Error code 1 Thomas On Fri, Mar 29, 2013 at 11:25:47PM -0400, Christos Zoulas wrote: Module Name: src Committed By: christos Date: Sat Mar 30 03:25:47 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h Log Message: remove obsolete macro To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/net80211
On Fri, Mar 29, 2013 at 09:05:49PM -0400, Christos Zoulas wrote: Module Name: src Committed By: christos Date: Sat Mar 30 01:05:49 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: EDCA and QOS additions from OpenBSD Beware: our net80211 derives from FreeBSD's. IIUC, OpenBSD's and FreeBSD's are (or were?) quite divergent. Excessive whitespace probably comes from FreeBSD, too. :-) Dave -- David Young dyo...@pobox.comUrbana, IL(217) 721-9981
Re: CVS commit: src/sys/net80211
In article 20130330221106.gm1...@pobox.com, David Young dyo...@pobox.com wrote: Beware: our net80211 derives from FreeBSD's. IIUC, OpenBSD's and FreeBSD's are (or were?) quite divergent. Excessive whitespace probably comes from FreeBSD, too. :-) I know :-) I really miss having 'N' too, and if you remember, I have synced once the code with FreeBSD's and never finished. The opposing force is that many of the wireless drivers are written for OpenBSD. christos
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 19:03:03 UTC 2013 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Putting extra l's in align does not make it more so. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.75 src/sys/net80211/ieee80211_input.c:1.76 --- src/sys/net80211/ieee80211_input.c:1.75 Sat Mar 30 11:12:28 2013 +++ src/sys/net80211/ieee80211_input.c Sat Mar 30 15:03:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.75 2013/03/30 15:12:28 christos Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.76 2013/03/30 19:03:02 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.75 2013/03/30 15:12:28 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.76 2013/03/30 19:03:02 christos Exp $); #endif #include opt_inet.h @@ -1340,7 +1340,7 @@ ieee80211_ssid_mismatch(struct ieee80211 } while (0) #endif /* !IEEE80211_DEBUG */ -/* unalligned little endian access */ +/* unaligned little endian access */ #define LE_READ_2(p) \ ((u_int16_t) \ const u_int8_t *)(p))[0] ) | \
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 15:12:28 UTC 2013 Modified Files: src/sys/net80211: ieee80211_crypto_ccmp.c ieee80211_input.c ieee80211_proto.h Log Message: remove trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/net80211/ieee80211_crypto_ccmp.c cvs rdiff -u -r1.74 -r1.75 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 19:03:03 UTC 2013 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Putting extra l's in align does not make it more so. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/net80211
Hi, 2013/3/30 Christos Zoulas chris...@netbsd.org: Module Name:src Committed By: christos Date: Sat Mar 30 01:05:49 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: EDCA and QOS additions from OpenBSD You have to add the following lines. It seems same as WME_AC_ *. - /* + * EDCA Access Categories. + */ +enum ieee80211_edca_ac { + EDCA_AC_BK = 1, /* Background */ + EDCA_AC_BE = 0, /* Best Effort */ + EDCA_AC_VI = 2, /* Video */ + EDCA_AC_VO = 3 /* Voice */ +}; +#define EDCA_NUM_AC 4 + - WME_AC_ * - sys/net80211/ieee80211.h #define WME_AC_BE 0 /* best effort */ #define WME_AC_BK 1 /* background */ #define WME_AC_VI 2 /* video */ #define WME_AC_VO 3 /* voice */ - Regards, -- NONAKA Kimihiro
Re: CVS commit: src/sys/net80211
In article cam+xf6bdtr4hjg5z7jwojhwgig5e24zq2ujiy_nijsl60pz...@mail.gmail.com, NONAKA Kimihiro nona...@gmail.com wrote: Hi, 2013/3/30 Christos Zoulas chris...@netbsd.org: Module Name:src Committed By: christos Date: Sat Mar 30 01:05:49 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: EDCA and QOS additions from OpenBSD You have to add the following lines. It seems same as WME_AC_ *. - /* + * EDCA Access Categories. + */ +enum ieee80211_edca_ac { + EDCA_AC_BK = 1, /* Background */ + EDCA_AC_BE = 0, /* Best Effort */ + EDCA_AC_VI = 2, /* Video */ + EDCA_AC_VO = 3 /* Voice */ +}; +#define EDCA_NUM_AC 4 + - WME_AC_ * - sys/net80211/ieee80211.h #define WME_AC_BE 0 /* best effort */ #define WME_AC_BK 1 /* background */ #define WME_AC_VI 2 /* video */ #define WME_AC_VO 3 /* voice */ - They are there? I should gc the old one I guess. christos
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 01:05:49 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: EDCA and QOS additions from OpenBSD To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211.h cvs rdiff -u -r1.19 -r1.20 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.22 src/sys/net80211/ieee80211.h:1.23 --- src/sys/net80211/ieee80211.h:1.22 Mon Aug 20 03:30:10 2012 +++ src/sys/net80211/ieee80211.h Fri Mar 29 21:05:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.22 2012/08/20 07:30:10 christos Exp $ */ +/* $NetBSD: ieee80211.h,v 1.23 2013/03/30 01:05:48 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -149,6 +149,21 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_FC0_SUBTYPE_QOS 0x80 #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 +/* + * DS bit usage + * + * TA = transmitter address + * RA = receiver address + * DA = destination address + * SA = source address + * + * ToDSFromDS A1(RA) A2(TA) A3 A4 Use + * - + * 0 0 DA SA BSSID - IBSS/DLS + * 0 1 DA BSSID SA - AP - STA + * 1 0 BSSID SA DA - AP - STA + * 1 1 RA TA DA SA unspecified (WDS) + */ #define IEEE80211_FC1_DIR_MASK 0x03 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA-STA */ #define IEEE80211_FC1_DIR_TODS 0x01 /* STA-AP */ @@ -188,12 +203,24 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_QOS_TID 0x000f /* does frame have QoS sequence control data */ +/* XXX: use ieee80211_has_qos() instead */ #define IEEE80211_QOS_HAS_SEQ(wh) \ (((wh)-i_fc[0] \ (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) /* + * EDCA Access Categories. + */ +enum ieee80211_edca_ac { + EDCA_AC_BK = 1, /* Background */ + EDCA_AC_BE = 0, /* Best Effort */ + EDCA_AC_VI = 2, /* Video */ + EDCA_AC_VO = 3 /* Voice */ +}; +#define EDCA_NUM_AC 4 + +/* * WME/802.11e information element. */ struct ieee80211_wme_info { @@ -346,6 +373,50 @@ struct ieee80211_frame_cfend { /* NB: a /* FCS */ } __packed; +static __inline int +ieee80211_has_seq(const struct ieee80211_frame *wh) +{ + return (wh-i_fc[0] IEEE80211_FC0_TYPE_MASK) != + IEEE80211_FC0_TYPE_CTL; +} + +static __inline int +ieee80211_has_addr4(const struct ieee80211_frame *wh) +{ + return (wh-i_fc[1] IEEE80211_FC1_DIR_MASK) == + IEEE80211_FC1_DIR_DSTODS; +} + +static __inline int +ieee80211_has_qos(const struct ieee80211_frame *wh) +{ + return (wh-i_fc[0] + (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == + (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS); +} + +static __inline int +ieee80211_has_htc(const struct ieee80211_frame *wh) +{ + return (wh-i_fc[1] IEEE80211_FC1_ORDER) + (ieee80211_has_qos(wh) || + (wh-i_fc[0] IEEE80211_FC0_TYPE_MASK) == + IEEE80211_FC0_TYPE_MGT); +} + +static __inline u_int16_t +ieee80211_get_qos(const struct ieee80211_frame *wh) +{ + const u_int8_t *frm; + + if (ieee80211_has_addr4(wh)) + frm = ((const struct ieee80211_qosframe_addr4 *)wh)-i_qos; + else + frm = ((const struct ieee80211_qosframe *)wh)-i_qos; + + return le16toh(*(const u_int16_t *)frm); +} + /* * BEACON management packets * Index: src/sys/net80211/ieee80211_proto.h diff -u src/sys/net80211/ieee80211_proto.h:1.19 src/sys/net80211/ieee80211_proto.h:1.20 --- src/sys/net80211/ieee80211_proto.h:1.19 Thu Jan 10 12:40:10 2013 +++ src/sys/net80211/ieee80211_proto.h Fri Mar 29 21:05:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_proto.h,v 1.19 2013/01/10 17:40:10 christos Exp $ */ +/* $NetBSD: ieee80211_proto.h,v 1.20 2013/03/30 01:05:48 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -223,7 +223,7 @@ void ieee80211_wme_updateparams_locked(s #define ieee80211_new_state(_ic, _nstate, _arg) \ (((_ic)-ic_newstate)((_ic), (_nstate), (_arg))) -extern int ieee80211_compute_duration(const struct ieee80211_frame_min *, +int ieee80211_compute_duration(const struct ieee80211_frame_min *, const struct ieee80211_key *, int, uint32_t, int, int, struct ieee80211_duration *, struct ieee80211_duration *, int *, int); @@ -263,4 +263,5 @@ void ieee80211_notify_node_join(struct i void ieee80211_notify_node_leave(struct ieee80211com *, struct ieee80211_node *); void ieee80211_notify_scan_done(struct ieee80211com *); + #endif /* !_NET80211_IEEE80211_PROTO_H_ */
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 01:06:38 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/net80211/ieee80211.h cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.23 src/sys/net80211/ieee80211.h:1.24 --- src/sys/net80211/ieee80211.h:1.23 Fri Mar 29 21:05:48 2013 +++ src/sys/net80211/ieee80211.h Fri Mar 29 21:06:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.23 2013/03/30 01:05:48 christos Exp $ */ +/* $NetBSD: ieee80211.h,v 1.24 2013/03/30 01:06:37 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -52,7 +52,7 @@ struct ieee80211_plcp_hdr { u_int16_t i_crc; } __packed; -#define IEEE80211_PLCP_SFD 0xF3A0 +#define IEEE80211_PLCP_SFD 0xF3A0 #define IEEE80211_PLCP_SERVICE 0x00 /* @@ -723,7 +723,7 @@ enum { #define IEEE80211_AID(b) ((b) ~ 0xc000) -/* +/* * RTS frame length parameters. The default is specified in * the 802.11 spec as 512; we treat it as implementation-dependent * so it's defined in ieee80211_var.h. The max may be wrong @@ -732,7 +732,7 @@ enum { #define IEEE80211_RTS_MIN 1 #define IEEE80211_RTS_MAX 2346 -/* +/* * TX fragmentation parameters. As above for RTS, we treat * default as implementation-dependent so define it elsewhere. */ Index: src/sys/net80211/ieee80211_proto.h diff -u src/sys/net80211/ieee80211_proto.h:1.20 src/sys/net80211/ieee80211_proto.h:1.21 --- src/sys/net80211/ieee80211_proto.h:1.20 Fri Mar 29 21:05:48 2013 +++ src/sys/net80211/ieee80211_proto.h Fri Mar 29 21:06:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_proto.h,v 1.20 2013/03/30 01:05:48 christos Exp $ */ +/* $NetBSD: ieee80211_proto.h,v 1.21 2013/03/30 01:06:37 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -82,7 +82,7 @@ struct mbuf *ieee80211_get_rts(struct ie const struct ieee80211_frame *, uint16_t); struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *, uint16_t); -void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *, +void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *, struct mbuf *); void ieee80211_reset_erp(struct ieee80211com *);
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 03:24:55 UTC 2013 Modified Files: src/sys/net80211: ieee80211_crypto_ccmp.c ieee80211_input.c Log Message: remove trailing space To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_crypto_ccmp.c cvs rdiff -u -r1.73 -r1.74 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto_ccmp.c diff -u src/sys/net80211/ieee80211_crypto_ccmp.c:1.8 src/sys/net80211/ieee80211_crypto_ccmp.c:1.9 --- src/sys/net80211/ieee80211_crypto_ccmp.c:1.8 Wed Dec 17 15:51:37 2008 +++ src/sys/net80211/ieee80211_crypto_ccmp.c Fri Mar 29 23:24:55 2013 @@ -34,7 +34,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7 2005/07/11 03:06:23 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_ccmp.c,v 1.8 2008/12/17 20:51:37 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_ccmp.c,v 1.9 2013/03/30 03:24:55 christos Exp $); #endif /* @@ -45,8 +45,8 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211_cr * it's license is included below. */ #include sys/param.h -#include sys/systm.h -#include sys/mbuf.h +#include sys/systm.h +#include sys/mbuf.h #include sys/malloc.h #include sys/kernel.h Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.73 src/sys/net80211/ieee80211_input.c:1.74 --- src/sys/net80211/ieee80211_input.c:1.73 Thu Jan 10 12:40:10 2013 +++ src/sys/net80211/ieee80211_input.c Fri Mar 29 23:24:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.73 2013/01/10 17:40:10 christos Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.74 2013/03/30 03:24:55 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.73 2013/01/10 17:40:10 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.74 2013/03/30 03:24:55 christos Exp $); #endif #include opt_inet.h @@ -46,11 +46,11 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211_in #include sys/param.h #include sys/systm.h -#include sys/mbuf.h +#include sys/mbuf.h #include sys/malloc.h #include sys/endian.h #include sys/kernel.h - + #include sys/socket.h #include sys/sockio.h #include sys/endian.h @@ -70,7 +70,7 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211_in #include net/bpf.h #ifdef INET -#include netinet/in.h +#include netinet/in.h #include net/if_ether.h #endif @@ -919,7 +919,7 @@ ieee80211_auth_open(struct ieee80211com ic-ic_stats.is_rx_bad_auth++; /* XXX */ if (ic-ic_opmode == IEEE80211_M_HOSTAP) { /* XXX hack to workaround calling convention */ - ieee80211_send_error(ic, ni, wh-i_addr2, + ieee80211_send_error(ic, ni, wh-i_addr2, IEEE80211_FC0_SUBTYPE_AUTH, (seq + 1) | (IEEE80211_STATUS_ALG16)); } @@ -1340,7 +1340,7 @@ ieee80211_ssid_mismatch(struct ieee80211 } while (0) #endif /* !IEEE80211_DEBUG */ -/* unalligned little endian access */ +/* unalligned little endian access */ #define LE_READ_2(p) \ ((u_int16_t) \ const u_int8_t *)(p))[0] ) | \ @@ -1618,7 +1618,7 @@ ieee80211_parse_rsn(struct ieee80211com int n; /* - * Check the length once for fixed parts: + * Check the length once for fixed parts: * version, mcast cipher, and 2 selector counts. * Other, variable-length data, must be checked separately. */ @@ -1686,7 +1686,7 @@ ieee80211_parse_rsn(struct ieee80211com n = LE_READ_2(frm); frm += 2, len -= 2; if (len n*4) { - IEEE80211_DISCARD_IE(ic, + IEEE80211_DISCARD_IE(ic, IEEE80211_MSG_ELEMID | IEEE80211_MSG_WPA, wh, RSN, key mgmt alg data too short; len %u, n %u, len, n); @@ -1861,7 +1861,7 @@ ieee80211_recv_mgmt(struct ieee80211com * updates such as 802.11g slot time), or *o adhoc mode (to discover neighbors) * Frames otherwise received are discarded. - */ + */ if (!((ic-ic_flags IEEE80211_F_SCAN) || (ic-ic_opmode == IEEE80211_M_STA ni-ni_associd) || ic-ic_opmode == IEEE80211_M_IBSS)) { @@ -2249,7 +2249,7 @@ ieee80211_recv_mgmt(struct ieee80211com } #endif /* !IEEE80211_NO_HOSTAP */ return; - } + } break; } @@ -2348,7 +2348,7 @@ ieee80211_recv_mgmt(struct ieee80211com ieee80211_node_leave(ic, ni); /* XXX distinguish WPA/RSN? */ ic-ic_stats.is_rx_assoc_badwpaie++; - return; + return; } if (wpa != NULL) { /* @@ -2723,7 +2723,7 @@ ieee80211_node_pwrsave(struct ieee80211_ IEEE80211_NODE_SAVEQ_DEQUEUE(ni, m, qlen); if (m == NULL) break; - /* + /* * If this is the last packet, turn off the TIM bit. * If there are more
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 03:25:47 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h Log Message: remove obsolete macro To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.24 src/sys/net80211/ieee80211.h:1.25 --- src/sys/net80211/ieee80211.h:1.24 Fri Mar 29 21:06:37 2013 +++ src/sys/net80211/ieee80211.h Fri Mar 29 23:25:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.24 2013/03/30 01:06:37 christos Exp $ */ +/* $NetBSD: ieee80211.h,v 1.25 2013/03/30 03:25:47 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -202,13 +202,6 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_QOS_ESOP_S 4 #define IEEE80211_QOS_TID 0x000f -/* does frame have QoS sequence control data */ -/* XXX: use ieee80211_has_qos() instead */ -#define IEEE80211_QOS_HAS_SEQ(wh) \ - (((wh)-i_fc[0] \ - (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ - (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) - /* * EDCA Access Categories. */
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 01:05:49 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: EDCA and QOS additions from OpenBSD To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211.h cvs rdiff -u -r1.19 -r1.20 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 01:06:38 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h ieee80211_proto.h Log Message: remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/net80211/ieee80211.h cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 03:24:55 UTC 2013 Modified Files: src/sys/net80211: ieee80211_crypto_ccmp.c ieee80211_input.c Log Message: remove trailing space To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_crypto_ccmp.c cvs rdiff -u -r1.73 -r1.74 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sat Mar 30 03:25:47 UTC 2013 Modified Files: src/sys/net80211: ieee80211.h Log Message: remove obsolete macro To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:20:17 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: trailing blanks police. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.64 src/sys/net80211/ieee80211_node.c:1.65 --- src/sys/net80211/ieee80211_node.c:1.64 Thu Jan 10 12:40:10 2013 +++ src/sys/net80211/ieee80211_node.c Thu Mar 28 22:20:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.64 2013/01/10 17:40:10 christos Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.65 2013/03/29 02:20:17 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,14 +36,14 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.64 2013/01/10 17:40:10 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.65 2013/03/29 02:20:17 christos Exp $); #endif #include opt_inet.h #include sys/param.h -#include sys/systm.h -#include sys/mbuf.h +#include sys/systm.h +#include sys/mbuf.h #include sys/malloc.h #include sys/kernel.h @@ -66,7 +66,7 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211_no #include net/bpf.h #ifdef INET -#include netinet/in.h +#include netinet/in.h #include net/if_ether.h #endif @@ -213,7 +213,7 @@ ieee80211_node_detach(struct ieee80211co } } -/* +/* * Port authorize/unauthorize interfaces for use by an authenticator. */ @@ -453,7 +453,7 @@ ieee80211_create_ibss(struct ieee80211co else ni-ni_bssid[0] |= 0x02; /* local bit for IBSS */ } - /* + /* * Fix the channel and related attributes. */ ieee80211_set_chan(ic, ni, chan); @@ -763,7 +763,7 @@ ieee80211_end_scan(struct ieee80211com * goto notfound; } } - + /* * Handle 802.11 ad hoc network merge. The * convention, set by the Wireless Ethernet Compatibility Alliance @@ -846,7 +846,7 @@ ieee80211_sta_join(struct ieee80211com * * Set the erp state (mostly the slot time) to deal with * the auto-select case; this should be redundant if the * mode is locked. - */ + */ ic-ic_curmode = ieee80211_chan2mode(ic, selbs-ni_chan); ic-ic_curchan = selbs-ni_chan; ieee80211_reset_erp(ic); @@ -1199,7 +1199,7 @@ dump_probe_beacon(u_int8_t subtype, int printf(\n); if (isnew) { - printf([%s] caps 0x%x bintval %u erp 0x%x, + printf([%s] caps 0x%x bintval %u erp 0x%x, ether_sprintf(mac), sp-capinfo, sp-bintval, sp-erp); if (sp-country != NULL) { #ifdef __FreeBSD__ @@ -1374,7 +1374,7 @@ ieee80211_add_neighbor(struct ieee80211c * are required to pass some node so we fall back to ic_bss * when this frame is from an unknown sender. The 802.11 layer * knows this means the sender wasn't in the node table and - * acts accordingly. + * acts accordingly. */ struct ieee80211_node * #ifdef IEEE80211_DEBUG_REFCNT
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:26:45 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: Don't hold 2 locks at the same time, causes lockdebug panic. Triggered by running usb wifi interfaces as access points. What we do instead is check the generation number upon restart, and if it changed we give up. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.65 src/sys/net80211/ieee80211_node.c:1.66 --- src/sys/net80211/ieee80211_node.c:1.65 Thu Mar 28 22:20:17 2013 +++ src/sys/net80211/ieee80211_node.c Thu Mar 28 22:26:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.65 2013/03/29 02:20:17 christos Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.66 2013/03/29 02:26:45 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.65 2013/03/29 02:20:17 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.66 2013/03/29 02:26:45 christos Exp $); #endif #include opt_inet.h @@ -1908,9 +1908,18 @@ ieee80211_timeout_stations(struct ieee80 ic-ic_opmode == IEEE80211_M_AHDEMO); IEEE80211_SCAN_LOCK(nt); gen = ++nt-nt_scangen; + IEEE80211_SCAN_UNLOCK(nt); IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, %s: %s scangen %u\n, __func__, nt-nt_name, gen); restart: + IEEE80211_SCAN_LOCK(nt); + if (gen != nt-nt_scangen) { + printf(%s: scan aborted %u\n, __func__, gen); + IEEE80211_SCAN_UNLOCK(nt); + return; + } + IEEE80211_SCAN_UNLOCK(nt); + IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH(ni, nt-nt_node, ni_list) { if (ni-ni_scangen == gen) /* previously handled */ @@ -2039,8 +2048,6 @@ IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWE } IEEE80211_NODE_UNLOCK(nt); - IEEE80211_SCAN_UNLOCK(nt); - nt-nt_inact_timer = IEEE80211_INACT_WAIT; } @@ -2052,7 +2059,16 @@ ieee80211_iterate_nodes(struct ieee80211 IEEE80211_SCAN_LOCK(nt); gen = ++nt-nt_scangen; + IEEE80211_SCAN_UNLOCK(nt); restart: + IEEE80211_SCAN_LOCK(nt); + if (gen != nt-nt_scangen) { + printf(%s: scan aborted %u\n, __func__, gen); + IEEE80211_SCAN_UNLOCK(nt); + return; + } + IEEE80211_SCAN_UNLOCK(nt); + IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH(ni, nt-nt_node, ni_list) { if (ni-ni_scangen != gen) { @@ -2065,8 +2081,6 @@ restart: } } IEEE80211_NODE_UNLOCK(nt); - - IEEE80211_SCAN_UNLOCK(nt); } void
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:30:18 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: one we is enough. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_node.c diff -u src/sys/net80211/ieee80211_node.c:1.66 src/sys/net80211/ieee80211_node.c:1.67 --- src/sys/net80211/ieee80211_node.c:1.66 Thu Mar 28 22:26:45 2013 +++ src/sys/net80211/ieee80211_node.c Thu Mar 28 22:30:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.66 2013/03/29 02:26:45 christos Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.67 2013/03/29 02:30:18 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.66 2013/03/29 02:26:45 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_node.c,v 1.67 2013/03/29 02:30:18 christos Exp $); #endif #include opt_inet.h @@ -1161,7 +1161,7 @@ ieee80211_find_node(struct ieee80211_nod /* * Fake up a node; this handles node discovery in adhoc mode. - * Note that for the driver's benefit we we treat this like + * Note that for the driver's benefit we treat this like * an association so the driver has an opportunity to setup * it's private state. */
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:20:17 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: trailing blanks police. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:26:45 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: Don't hold 2 locks at the same time, causes lockdebug panic. Triggered by running usb wifi interfaces as access points. What we do instead is check the generation number upon restart, and if it changed we give up. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Fri Mar 29 02:30:18 UTC 2013 Modified Files: src/sys/net80211: ieee80211_node.c Log Message: one we is enough. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/net80211/ieee80211_node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Thu Mar 21 17:10:25 UTC 2013 Modified Files: src/sys/net80211: _ieee80211.h Log Message: Don't attempt to dereference ANYC (since it is a pointer to 0x1). Fixes random crashes in hostap mode (race conditions in the interrupt handler while the interface comes up or down). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/_ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/_ieee80211.h diff -u src/sys/net80211/_ieee80211.h:1.8 src/sys/net80211/_ieee80211.h:1.9 --- src/sys/net80211/_ieee80211.h:1.8 Sat Jan 10 07:53:45 2009 +++ src/sys/net80211/_ieee80211.h Thu Mar 21 13:10:25 2013 @@ -151,43 +151,35 @@ struct ieee80211_channel { #define IEEE80211_CHAN_ALLTURBO \ (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO) -#define IEEE80211_IS_CHAN_FHSS(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS) -#define IEEE80211_IS_CHAN_A(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_A) == IEEE80211_CHAN_A) -#define IEEE80211_IS_CHAN_B(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_B) == IEEE80211_CHAN_B) -#define IEEE80211_IS_CHAN_PUREG(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG) -#define IEEE80211_IS_CHAN_G(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_G) == IEEE80211_CHAN_G) -#define IEEE80211_IS_CHAN_ANYG(_c) \ - (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c)) -#define IEEE80211_IS_CHAN_T(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_T) == IEEE80211_CHAN_T) -#define IEEE80211_IS_CHAN_108G(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) - -#define IEEE80211_IS_CHAN_2GHZ(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_2GHZ) != 0) -#define IEEE80211_IS_CHAN_5GHZ(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_5GHZ) != 0) -#define IEEE80211_IS_CHAN_OFDM(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_OFDM) != 0) -#define IEEE80211_IS_CHAN_CCK(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_CCK) != 0) -#define IEEE80211_IS_CHAN_GFSK(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_GFSK) != 0) -#define IEEE80211_IS_CHAN_HALF(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_HALF) != 0) -#define IEEE80211_IS_CHAN_QUARTER(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_QUARTER) != 0) +#define IEEE80211_IS_CHAN_ANYC(_c) \ + ((_c) == IEEE80211_CHAN_ANYC) + +#define _IEEE80211_IS_CHAN(_c, _ch) \ + (!IEEE80211_IS_CHAN_ANYC(_c) \ + ((_c)-ic_flags IEEE80211_CHAN_ ## _ch) == IEEE80211_CHAN_ ## _ch) + +#define IEEE80211_IS_CHAN_FHSS(_c) _IEEE80211_IS_CHAN(_c, FHSS) +#define IEEE80211_IS_CHAN_A(_c) _IEEE80211_IS_CHAN(_c, A) +#define IEEE80211_IS_CHAN_B(_c) _IEEE80211_IS_CHAN(_c, B) +#define IEEE80211_IS_CHAN_PUREG(_c) _IEEE80211_IS_CHAN(_c, PUREG) +#define IEEE80211_IS_CHAN_G(_c) _IEEE80211_IS_CHAN(_c, G) +#define IEEE80211_IS_CHAN_ANYG(_c) _IEEE80211_IS_CHAN(_c, ANYG) +#define IEEE80211_IS_CHAN_T(_c) _IEEE80211_IS_CHAN(_c, T) +#define IEEE80211_IS_CHAN_108G(_c) _IEEE80211_IS_CHAN(_c, 108G) + +#define IEEE80211_IS_CHAN_2GHZ(_c) _IEEE80211_IS_CHAN(_c, 2GHZ) +#define IEEE80211_IS_CHAN_5GHZ(_c) _IEEE80211_IS_CHAN(_c, 5GHZ) +#define IEEE80211_IS_CHAN_OFDM(_c) _IEEE80211_IS_CHAN(_c, OFDM) +#define IEEE80211_IS_CHAN_CCK(_c) _IEEE80211_IS_CHAN(_c, CCK) +#define IEEE80211_IS_CHAN_GFSK(_c) _IEEE80211_IS_CHAN(_c, GFSK) +#define IEEE80211_IS_CHAN_HALF(_c) _IEEE80211_IS_CHAN(_c, HALF) +#define IEEE80211_IS_CHAN_QUARTER(_c) _IEEE80211_IS_CHAN(_c, QUARTER) #define IEEE80211_IS_CHAN_FULL(_c) \ - (((_c)-ic_flags (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0) -#define IEEE80211_IS_CHAN_GSM(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_GSM) != 0) -#define IEEE80211_IS_CHAN_PASSIVE(_c) \ - (((_c)-ic_flags IEEE80211_CHAN_PASSIVE) != 0) + (!IEEE80211_IS_CHAN_ANYC(_c) \ + ((_c)-ic_flags (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0) + +#define IEEE80211_IS_CHAN_GSM(_c) _IEEE80211_IS_CHAN(_c, GSM) +#define IEEE80211_IS_CHAN_PASSIVE(_c) _IEEE80211_IS_CHAN(_c, PASSIVE) /* ni_chan encoding for FH phy */
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Thu Mar 21 18:30:09 UTC 2013 Modified Files: src/sys/net80211: _ieee80211.h ieee80211.c Log Message: Instead of always checking for ANYC, make it a valid channel To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/net80211/_ieee80211.h cvs rdiff -u -r1.53 -r1.54 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/_ieee80211.h diff -u src/sys/net80211/_ieee80211.h:1.9 src/sys/net80211/_ieee80211.h:1.10 --- src/sys/net80211/_ieee80211.h:1.9 Thu Mar 21 13:10:25 2013 +++ src/sys/net80211/_ieee80211.h Thu Mar 21 14:30:09 2013 @@ -107,11 +107,12 @@ struct ieee80211_channel { u_int16_t ic_flags; /* see below */ }; +extern const struct ieee80211_channel ieee80211_channel_anyc; + #define IEEE80211_CHAN_MAX 255 #define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */ #define IEEE80211_CHAN_ANY 0x /* token for ``any channel'' */ -#define IEEE80211_CHAN_ANYC \ - ((struct ieee80211_channel *) 0x1) +#define IEEE80211_CHAN_ANYC (__UNCONST(ieee80211_channel_anyc)) /* bits 0-3 are for private use by drivers */ /* channel attributes */ @@ -155,8 +156,7 @@ struct ieee80211_channel { ((_c) == IEEE80211_CHAN_ANYC) #define _IEEE80211_IS_CHAN(_c, _ch) \ - (!IEEE80211_IS_CHAN_ANYC(_c) \ - ((_c)-ic_flags IEEE80211_CHAN_ ## _ch) == IEEE80211_CHAN_ ## _ch) + (((_c)-ic_flags IEEE80211_CHAN_ ## _ch) == IEEE80211_CHAN_ ## _ch) #define IEEE80211_IS_CHAN_FHSS(_c) _IEEE80211_IS_CHAN(_c, FHSS) #define IEEE80211_IS_CHAN_A(_c) _IEEE80211_IS_CHAN(_c, A) Index: src/sys/net80211/ieee80211.c diff -u src/sys/net80211/ieee80211.c:1.53 src/sys/net80211/ieee80211.c:1.54 --- src/sys/net80211/ieee80211.c:1.53 Mon Apr 5 03:22:24 2010 +++ src/sys/net80211/ieee80211.c Thu Mar 21 14:30:09 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.c,v 1.53 2010/04/05 07:22:24 joerg Exp $ */ +/* $NetBSD: ieee80211.c,v 1.54 2013/03/21 18:30:09 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.53 2010/04/05 07:22:24 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.54 2013/03/21 18:30:09 christos Exp $); #endif /* @@ -73,6 +73,10 @@ __KERNEL_RCSID(0, $NetBSD: ieee80211.c, #include net/if_ether.h #endif +const struct ieee80211_channel ieee80211_channel_anyc = { + 0, 0 +}; + struct ieee80211com_head ieee80211com_head = LIST_HEAD_INITIALIZER(ieee80211com_head);
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Thu Mar 21 17:10:25 UTC 2013 Modified Files: src/sys/net80211: _ieee80211.h Log Message: Don't attempt to dereference ANYC (since it is a pointer to 0x1). Fixes random crashes in hostap mode (race conditions in the interrupt handler while the interface comes up or down). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/_ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Thu Mar 21 18:30:09 UTC 2013 Modified Files: src/sys/net80211: _ieee80211.h ieee80211.c Log Message: Instead of always checking for ANYC, make it a valid channel To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/net80211/_ieee80211.h cvs rdiff -u -r1.53 -r1.54 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Mon Feb 4 15:44:45 UTC 2013 Modified Files: src/sys/net80211: ieee80211_netbsd.c Log Message: don't print the interface name 2ice. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_netbsd.c diff -u src/sys/net80211/ieee80211_netbsd.c:1.22 src/sys/net80211/ieee80211_netbsd.c:1.23 --- src/sys/net80211/ieee80211_netbsd.c:1.22 Wed Nov 14 13:34:05 2012 +++ src/sys/net80211/ieee80211_netbsd.c Mon Feb 4 10:44:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_netbsd.c,v 1.22 2012/11/14 18:34:05 matt Exp $ */ +/* $NetBSD: ieee80211_netbsd.c,v 1.23 2013/02/04 15:44:45 christos Exp $ */ /*- * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * All rights reserved. @@ -30,7 +30,7 @@ #ifdef __FreeBSD__ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $); #else -__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.22 2012/11/14 18:34:05 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.23 2013/02/04 15:44:45 christos Exp $); #endif /* @@ -655,8 +655,8 @@ ieee80211_notify_node_join(struct ieee80 struct ifnet *ifp = ic-ic_ifp; struct ieee80211_join_event iev; - IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, %s: %snode %s join\n, - ifp-if_xname, (ni == ic-ic_bss) ? bss : , + IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, %snode %s join\n, + (ni == ic-ic_bss) ? bss : , ether_sprintf(ni-ni_macaddr)); memset(iev, 0, sizeof(iev)); @@ -680,8 +680,8 @@ ieee80211_notify_node_leave(struct ieee8 struct ifnet *ifp = ic-ic_ifp; struct ieee80211_leave_event iev; - IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, %s: %snode %s leave\n, - ifp-if_xname, (ni == ic-ic_bss) ? bss : , + IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, %snode %s leave\n, + (ni == ic-ic_bss) ? bss : , ether_sprintf(ni-ni_macaddr)); if (ni == ic-ic_bss) { @@ -701,7 +701,7 @@ ieee80211_notify_scan_done(struct ieee80 struct ifnet *ifp = ic-ic_ifp; IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, - %s: notify scan done\n, ic-ic_ifp-if_xname); + %s, notify scan done\n); /* dispatch wireless event indicating scan completed */ rt_ieee80211msg(ifp, RTM_IEEE80211_SCAN, NULL, 0);
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Mon Feb 4 15:44:45 UTC 2013 Modified Files: src/sys/net80211: ieee80211_netbsd.c Log Message: don't print the interface name 2ice. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Thu Jan 10 17:40:10 UTC 2013 Modified Files: src/sys/net80211: ieee80211_input.c ieee80211_node.c ieee80211_proto.c ieee80211_proto.h Log Message: The IEEE80211_F_ flag prefix was used for both the flags in ieee80211_var.h and for the rates in ieee80211_proto.h; rename the rate bits as _R_ to avoid confusion. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/net80211/ieee80211_input.c cvs rdiff -u -r1.63 -r1.64 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.29 -r1.30 src/sys/net80211/ieee80211_proto.c cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: matt Date: Wed Nov 14 18:34:05 UTC 2012 Modified Files: src/sys/net80211: ieee80211_netbsd.c Log Message: Set max_linkhdr when attaching so when bridging/forwarding ethernet drivers have a chance to reserve enough space to insert a max-sized 802.11 header. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_netbsd.c diff -u src/sys/net80211/ieee80211_netbsd.c:1.21 src/sys/net80211/ieee80211_netbsd.c:1.22 --- src/sys/net80211/ieee80211_netbsd.c:1.21 Sat Jun 2 21:36:47 2012 +++ src/sys/net80211/ieee80211_netbsd.c Wed Nov 14 18:34:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_netbsd.c,v 1.21 2012/06/02 21:36:47 dsl Exp $ */ +/* $NetBSD: ieee80211_netbsd.c,v 1.22 2012/11/14 18:34:05 matt Exp $ */ /*- * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * All rights reserved. @@ -30,7 +30,7 @@ #ifdef __FreeBSD__ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.8 2005/08/08 18:46:35 sam Exp $); #else -__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.21 2012/06/02 21:36:47 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_netbsd.c,v 1.22 2012/11/14 18:34:05 matt Exp $); #endif /* @@ -81,6 +81,10 @@ ieee80211_init0(void) { ieee80211_setup_func * const *ieee80211_setup, f; + if (max_linkhdr ALIGN(sizeof(struct ieee80211_qosframe_addr4))) { + max_linkhdr = ALIGN(sizeof(struct ieee80211_qosframe_addr4)); + } + __link_set_foreach(ieee80211_setup, ieee80211_funcs) { f = (void*)*ieee80211_setup; (*f)();
CVS commit: src/sys/net80211
Module Name:src Committed By: matt Date: Wed Nov 14 18:34:05 UTC 2012 Modified Files: src/sys/net80211: ieee80211_netbsd.c Log Message: Set max_linkhdr when attaching so when bridging/forwarding ethernet drivers have a chance to reserve enough space to insert a max-sized 802.11 header. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Mon Aug 20 07:30:10 UTC 2012 Modified Files: src/sys/net80211: ieee80211.h Log Message: add more QoS bits To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.21 src/sys/net80211/ieee80211.h:1.22 --- src/sys/net80211/ieee80211.h:1.21 Wed Nov 3 16:05:21 2010 +++ src/sys/net80211/ieee80211.h Mon Aug 20 03:30:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.21 2010/11/03 20:05:21 christos Exp $ */ +/* $NetBSD: ieee80211.h,v 1.22 2012/08/20 07:30:10 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -170,13 +170,22 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_NWID_LEN 32 -#define IEEE80211_QOS_TXOP 0x00ff +/* + * QoS Control field (see 7.1.3.5). + */ /* bit 8 is reserved */ -#define IEEE80211_QOS_ACKPOLICY 0x60 +#define IEEE80211_QOS_TXOP 0xff00 +#define IEEE80211_QOS_AMSDU 0x0080 /* 11n */ +#define IEEE80211_QOS_ACKPOLICY_NORMAL 0x +#define IEEE80211_QOS_ACKPOLICY_NOACK 0x0020 +#define IEEE80211_QOS_ACKPOLICY_NOEXPLACK 0x0040 +#define IEEE80211_QOS_ACKPOLICY 0x0060 #define IEEE80211_QOS_ACKPOLICY_S 5 -#define IEEE80211_QOS_ESOP 0x10 +#define IEEE80211_QOS_ACKPOLICY_MASK 0x0060 +#define IEEE80211_QOS_ACKPOLICY_BA 0x0060 +#define IEEE80211_QOS_ESOP 0x0010 #define IEEE80211_QOS_ESOP_S 4 -#define IEEE80211_QOS_TID 0x0f +#define IEEE80211_QOS_TID 0x000f /* does frame have QoS sequence control data */ #define IEEE80211_QOS_HAS_SEQ(wh) \
CVS commit: src/sys/net80211
Module Name:src Committed By: dyoung Date: Fri Oct 7 16:51:45 UTC 2011 Modified Files: src/sys/net80211: ieee80211_netbsd.c ieee80211_netbsd.h ieee80211_node.h Log Message: Use atomic_ops(3) to increase/decrease node reference counts, just like the upstream code did, because the current reference counting is potentially racy. This works fine in light testing. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.15 -r1.16 src/sys/net80211/ieee80211_netbsd.h cvs rdiff -u -r1.23 -r1.24 src/sys/net80211/ieee80211_node.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sun Jun 12 00:07:19 UTC 2011 Modified Files: src/sys/net80211: ieee80211_acl.c ieee80211_ioctl.c ieee80211_ioctl.h Log Message: Change i_len in ieee80211req to be unsigned and fix other signed/unsigned issues. From Dan Rosenberg (drosenberg at vsecurity dot com). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_acl.c cvs rdiff -u -r1.55 -r1.56 src/sys/net80211/ieee80211_ioctl.c cvs rdiff -u -r1.19 -r1.20 src/sys/net80211/ieee80211_ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_acl.c diff -u src/sys/net80211/ieee80211_acl.c:1.8 src/sys/net80211/ieee80211_acl.c:1.9 --- src/sys/net80211/ieee80211_acl.c:1.8 Wed Dec 17 15:51:37 2008 +++ src/sys/net80211/ieee80211_acl.c Sat Jun 11 20:07:19 2011 @@ -34,7 +34,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_acl.c,v 1.4 2005/08/13 17:31:48 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_acl.c,v 1.8 2008/12/17 20:51:37 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_acl.c,v 1.9 2011/06/12 00:07:19 christos Exp $); #endif /* @@ -79,7 +79,7 @@ struct aclstate { acl_lock_t as_lock; int as_policy; - int as_nacls; + uint32_t as_nacls; TAILQ_HEAD(, acl) as_list; /* list of all ACL's */ LIST_HEAD(, acl) as_hash[ACL_HASHSIZE]; struct ieee80211com *as_ic; @@ -281,7 +281,8 @@ struct aclstate *as = ic-ic_as; struct acl *acl; struct ieee80211req_maclist *ap; - int error, space, i; + int error; + uint32_t i, space; switch (ireq-i_val) { case IEEE80211_MACCMD_POLICY: Index: src/sys/net80211/ieee80211_ioctl.c diff -u src/sys/net80211/ieee80211_ioctl.c:1.55 src/sys/net80211/ieee80211_ioctl.c:1.56 --- src/sys/net80211/ieee80211_ioctl.c:1.55 Sat Apr 2 04:11:32 2011 +++ src/sys/net80211/ieee80211_ioctl.c Sat Jun 11 20:07:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.c,v 1.55 2011/04/02 08:11:32 mbalmer Exp $ */ +/* $NetBSD: ieee80211_ioctl.c,v 1.56 2011/06/12 00:07:19 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.55 2011/04/02 08:11:32 mbalmer Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_ioctl.c,v 1.56 2011/06/12 00:07:19 christos Exp $); #endif /* @@ -932,9 +932,8 @@ { size_t len = ireq-i_len; - if (sizeof(ic-ic_chan_active) len) { + if (len sizeof(ic-ic_chan_active)) len = sizeof(ic-ic_chan_active); - } return copyout(ic-ic_chan_active, ireq-i_data, len); } @@ -942,7 +941,8 @@ ieee80211_ioctl_getchaninfo(struct ieee80211com *ic, struct ieee80211req *ireq) { struct ieee80211req_chaninfo *chans; - int i, space, error; + uint32_t i, space; + int error; /* * Since channel 0 is not available for DS, channel 1 @@ -1004,7 +1004,7 @@ { struct ieee80211_node *ni; u_int8_t macaddr[IEEE80211_ADDR_LEN]; - const int off = __offsetof(struct ieee80211req_sta_stats, is_stats); + const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats); int error; if (ireq-i_len off) @@ -1075,7 +1075,8 @@ struct ieee80211req_scan_result *sr = u.res; struct ieee80211_node_table *nt; struct ieee80211_node *ni; - int error, space; + int error; + uint32_t space; u_int8_t *p, *cp; p = ireq-i_data; Index: src/sys/net80211/ieee80211_ioctl.h diff -u src/sys/net80211/ieee80211_ioctl.h:1.19 src/sys/net80211/ieee80211_ioctl.h:1.20 --- src/sys/net80211/ieee80211_ioctl.h:1.19 Mon Jul 28 13:54:02 2008 +++ src/sys/net80211/ieee80211_ioctl.h Sat Jun 11 20:07:19 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.h,v 1.19 2008/07/28 17:54:02 christos Exp $ */ +/* $NetBSD: ieee80211_ioctl.h,v 1.20 2011/06/12 00:07:19 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -413,7 +413,7 @@ char i_name[IFNAMSIZ]; /* if_name, e.g. wi0 */ u_int16_t i_type; /* req type */ int16_t i_val; /* Index or simple value */ - int16_t i_len; /* Index or simple value */ + u_int16_t i_len; /* Index or simple value */ void *i_data; /* Extra data */ };
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Sun Jun 12 00:07:19 UTC 2011 Modified Files: src/sys/net80211: ieee80211_acl.c ieee80211_ioctl.c ieee80211_ioctl.h Log Message: Change i_len in ieee80211req to be unsigned and fix other signed/unsigned issues. From Dan Rosenberg (drosenberg at vsecurity dot com). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/net80211/ieee80211_acl.c cvs rdiff -u -r1.55 -r1.56 src/sys/net80211/ieee80211_ioctl.c cvs rdiff -u -r1.19 -r1.20 src/sys/net80211/ieee80211_ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: drochner Date: Sun Apr 3 10:04:32 UTC 2011 Modified Files: src/sys/net80211: ieee80211_crypto_tkip.c Log Message: make michael_mic() robust against degenerate mbuf layouts like odd sizes in the middle of a chain To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/net80211/ieee80211_crypto_tkip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_crypto_tkip.c diff -u src/sys/net80211/ieee80211_crypto_tkip.c:1.10 src/sys/net80211/ieee80211_crypto_tkip.c:1.11 --- src/sys/net80211/ieee80211_crypto_tkip.c:1.10 Wed Dec 17 20:51:37 2008 +++ src/sys/net80211/ieee80211_crypto_tkip.c Sun Apr 3 10:04:32 2011 @@ -34,7 +34,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.10 2005/08/08 18:46:35 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_tkip.c,v 1.10 2008/12/17 20:51:37 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_crypto_tkip.c,v 1.11 2011/04/03 10:04:32 drochner Exp $); #endif /* @@ -802,6 +802,8 @@ u32 l, r; const uint8_t *data; u_int space; + uint8_t spill[4]; + int nspill = 0; michael_mic_hdr(mtod(m, struct ieee80211_frame *), hdr); @@ -824,6 +826,20 @@ for (;;) { if (space data_len) space = data_len; + if (nspill) { + int n = min(4 - nspill, space); + memcpy(spill + nspill, data, n); + nspill += n; + data += n; + space -= n; + data_len -= n; + if (nspill == 4) { +l ^= get_le32(spill); +michael_block(l, r); +nspill = 0; + } else +goto next; + } /* collect 32-bit blocks from current buffer */ while (space = sizeof(uint32_t)) { l ^= get_le32(data); @@ -832,84 +848,27 @@ space -= sizeof(uint32_t); data_len -= sizeof(uint32_t); } - /* - * NB: when space is zero we make one more trip around - * the loop to advance to the next mbuf where there is - * data. This handles the case where there are 4*n - * bytes in an mbuf followed by 4 bytes in a later mbuf. - * By making an extra trip we'll drop out of the loop - * with m pointing at the mbuf with 3 bytes and space - * set as required by the remainder handling below. - */ - if (!data_len || (data_len sizeof(uint32_t) space != 0)) + if (space) { + memcpy(spill, data, space); + nspill = space; + data_len -= space; + } +next: + if (!data_len) break; m = m-m_next; - if (m == NULL) { - IASSERT(0, (out of data, data_len %zu\n, data_len)); - break; - } - if (space != 0) { - const uint8_t *data_next; - /* - * Block straddles buffers, split references. - */ - data_next = mtod(m, const uint8_t *); - IASSERT(m-m_len = sizeof(uint32_t) - space, -(not enough data in following buffer, -m_len %u need %zu\n, m-m_len, -sizeof(uint32_t) - space)); - switch (space) { - case 1: -l ^= get_le32_split(data[0], data_next[0], - data_next[1], data_next[2]); -data = data_next + 3; -space = m-m_len - 3; -break; - case 2: -l ^= get_le32_split(data[0], data[1], - data_next[0], data_next[1]); -data = data_next + 2; -space = m-m_len - 2; -break; - case 3: -l ^= get_le32_split(data[0], data[1], - data[2], data_next[0]); -data = data_next + 1; -space = m-m_len - 1; -break; - } - michael_block(l, r); - data_len -= sizeof(uint32_t); - } else { - /* - * Setup for next buffer. - */ - data = mtod(m, const uint8_t *); - space = m-m_len; - } + KASSERT(m); + /* + * Setup for next buffer. + */ + data = mtod(m, const uint8_t *); + space = m-m_len; } - /* - * Catch degenerate cases like mbuf[4*n+1 bytes] followed by - * mbuf[2 bytes]. I don't believe these should happen; if they - * do then we'll need more involved logic. - */ - KASSERT(data_len = space); - /* Last block and padding (0x5a, 4..7 x 0) */ - switch (data_len) { - case 0: - l ^= get_le32_split(0x5a, 0, 0, 0); - break; - case 1: - l ^= get_le32_split(data[0], 0x5a, 0, 0); - break; - case 2: - l ^= get_le32_split(data[0], data[1], 0x5a, 0); - break; - case 3: - l ^= get_le32_split(data[0], data[1], data[2], 0x5a); - break; - } + spill[nspill++] = 0x5a; + for (; nspill 4; nspill++) + spill[nspill] = 0; + l ^= get_le32(spill); michael_block(l, r); /* l ^= 0; */ michael_block(l, r);
CVS commit: src/sys/net80211
Module Name:src Committed By: drochner Date: Sun Apr 3 10:04:32 UTC 2011 Modified Files: src/sys/net80211: ieee80211_crypto_tkip.c Log Message: make michael_mic() robust against degenerate mbuf layouts like odd sizes in the middle of a chain To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/net80211/ieee80211_crypto_tkip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/net80211
On 02/25/11 11:45, Matthias Scheler wrote: Module Name:src Committed By: tron Date: Fri Feb 25 10:45:57 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: Remove duplicate definitions which break the build. Thanks. I was about testing a fix but your release build finished earlier than mine. Christoph
Re: CVS commit: src/sys/net80211
On Fri, Feb 25, 2011 at 08:01:50AM +, Christoph Egger wrote: Module Name: src Committed By: cegger Date: Fri Feb 25 08:01:49 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: sync with FreeBSD rev 1.11. No binary changes. Careful: NetBSD follows the standard, http://www.radiotap.net/defined-fields, and field 18 has not been standardized. Please back out this change (and all of the subsequent changes) and send a patch for review to tech-net. Dave -- David Young OJC Technologies dyo...@ojctech.com Urbana, IL * (217) 344-0444 x24
Re: CVS commit: src/sys/net80211
On 25.02.11 17:15, David Young wrote: On Fri, Feb 25, 2011 at 08:01:50AM +, Christoph Egger wrote: Module Name: src Committed By:cegger Date:Fri Feb 25 08:01:49 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: sync with FreeBSD rev 1.11. No binary changes. Careful: NetBSD follows the standard, http://www.radiotap.net/defined-fields, and field 18 has not been standardized. Please back out this change (and all of the subsequent changes) and send a patch for review to tech-net. Do you mean that bit field or the whole revision ? Christoph
CVS commit: src/sys/net80211
Module Name:src Committed By: tron Date: Fri Feb 25 10:45:57 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: Remove duplicate definitions which break the build. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/net80211/ieee80211_radiotap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_radiotap.h diff -u src/sys/net80211/ieee80211_radiotap.h:1.23 src/sys/net80211/ieee80211_radiotap.h:1.24 --- src/sys/net80211/ieee80211_radiotap.h:1.23 Fri Feb 25 08:04:18 2011 +++ src/sys/net80211/ieee80211_radiotap.h Fri Feb 25 10:45:57 2011 @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.11 2007/12/13 01:23:40 sam Exp $ */ -/* $NetBSD: ieee80211_radiotap.h,v 1.23 2011/02/25 08:04:18 cegger Exp $ */ +/* $NetBSD: ieee80211_radiotap.h,v 1.24 2011/02/25 10:45:57 tron Exp $ */ /*- * Copyright (c) 2003, 2004 David Young. All rights reserved. @@ -211,22 +211,6 @@ IEEE80211_RADIOTAP_EXT = 31 }; -#ifndef _KERNEL -/* Channel flags. */ -#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ -#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ -#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ -#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ -#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ -#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ -#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ -#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ -#define IEEE80211_CHAN_GSM 0x1000 /* 900 MHz spectrum channel */ -#define IEEE80211_CHAN_STURBO 0x2000 /* 11a static turbo channel only */ -#define IEEE80211_CHAN_HALF 0x4000 /* Half rate channel */ -#define IEEE80211_CHAN_QUARTER 0x8000 /* Quarter rate channel */ -#endif /* !_KERNEL */ - /* For IEEE80211_RADIOTAP_FLAGS */ #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received * during CFP
CVS commit: src/sys/net80211
Module Name:src Committed By: cegger Date: Fri Feb 25 08:01:49 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: sync with FreeBSD rev 1.11. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211_radiotap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: cegger Date: Fri Feb 25 08:04:18 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: fix botched line break. How did this even compile for me? To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/net80211/ieee80211_radiotap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: tron Date: Fri Feb 25 10:45:57 UTC 2011 Modified Files: src/sys/net80211: ieee80211_radiotap.h Log Message: Remove duplicate definitions which break the build. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/net80211/ieee80211_radiotap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: jmcneill Date: Mon Feb 21 23:50:08 UTC 2011 Modified Files: src/sys/net80211: ieee80211_output.c ieee80211_proto.h Log Message: add ieee80211_get_rts and ieee80211_get_cts_to_self from openbsd, ok dyoung@ To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/net80211/ieee80211_output.c cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_output.c diff -u src/sys/net80211/ieee80211_output.c:1.49 src/sys/net80211/ieee80211_output.c:1.50 --- src/sys/net80211/ieee80211_output.c:1.49 Tue Jan 19 22:08:17 2010 +++ src/sys/net80211/ieee80211_output.c Mon Feb 21 23:50:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_output.c,v 1.49 2010/01/19 22:08:17 pooka Exp $ */ +/* $NetBSD: ieee80211_output.c,v 1.50 2011/02/21 23:50:08 jmcneill Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.34 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_output.c,v 1.49 2010/01/19 22:08:17 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_output.c,v 1.50 2011/02/21 23:50:08 jmcneill Exp $); #endif #include opt_inet.h @@ -1706,6 +1706,58 @@ } /* + * Build a RTS (Request To Send) control frame. + */ +struct mbuf * +ieee80211_get_rts(struct ieee80211com *ic, const struct ieee80211_frame *wh, +uint16_t dur) +{ + struct ieee80211_frame_rts *rts; + struct mbuf *m; + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return NULL; + + m-m_pkthdr.len = m-m_len = sizeof(struct ieee80211_frame_rts); + + rts = mtod(m, struct ieee80211_frame_rts *); + rts-i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_CTL | + IEEE80211_FC0_SUBTYPE_RTS; + rts-i_fc[1] = IEEE80211_FC1_DIR_NODS; + *(uint16_t *)rts-i_dur = htole16(dur); + IEEE80211_ADDR_COPY(rts-i_ra, wh-i_addr1); + IEEE80211_ADDR_COPY(rts-i_ta, wh-i_addr2); + + return m; +} + +/* + * Build a CTS-to-self (Clear To Send) control frame. + */ +struct mbuf * +ieee80211_get_cts_to_self(struct ieee80211com *ic, uint16_t dur) +{ + struct ieee80211_frame_cts *cts; + struct mbuf *m; + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return NULL; + + m-m_pkthdr.len = m-m_len = sizeof(struct ieee80211_frame_cts); + + cts = mtod(m, struct ieee80211_frame_cts *); + cts-i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_CTL | + IEEE80211_FC0_SUBTYPE_CTS; + cts-i_fc[1] = IEEE80211_FC1_DIR_NODS; + *(uint16_t *)cts-i_dur = htole16(dur); + IEEE80211_ADDR_COPY(cts-i_ra, ic-ic_myaddr); + + return m; +} + +/* * Allocate a beacon frame and fillin the appropriate bits. */ struct mbuf * Index: src/sys/net80211/ieee80211_proto.h diff -u src/sys/net80211/ieee80211_proto.h:1.17 src/sys/net80211/ieee80211_proto.h:1.18 --- src/sys/net80211/ieee80211_proto.h:1.17 Mon Jul 28 17:54:02 2008 +++ src/sys/net80211/ieee80211_proto.h Mon Feb 21 23:50:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_proto.h,v 1.17 2008/07/28 17:54:02 christos Exp $ */ +/* $NetBSD: ieee80211_proto.h,v 1.18 2011/02/21 23:50:08 jmcneill Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -78,6 +78,10 @@ struct ieee80211_node *); struct mbuf *ieee80211_encap(struct ieee80211com *, struct mbuf *, struct ieee80211_node *); +struct mbuf *ieee80211_get_rts(struct ieee80211com *, + const struct ieee80211_frame *, uint16_t); +struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *, + uint16_t); void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *, struct mbuf *);
CVS commit: src/sys/net80211
Module Name:src Committed By: jmcneill Date: Mon Feb 21 23:50:08 UTC 2011 Modified Files: src/sys/net80211: ieee80211_output.c ieee80211_proto.h Log Message: add ieee80211_get_rts and ieee80211_get_cts_to_self from openbsd, ok dyoung@ To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/net80211/ieee80211_output.c cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_proto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Wed Nov 3 20:05:22 UTC 2010 Modified Files: src/sys/net80211: ieee80211.h Log Message: From: Anon Ymous add a few constants so that if_otus.c compiles. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.h diff -u src/sys/net80211/ieee80211.h:1.20 src/sys/net80211/ieee80211.h:1.21 --- src/sys/net80211/ieee80211.h:1.20 Wed Nov 5 22:28:59 2008 +++ src/sys/net80211/ieee80211.h Wed Nov 3 16:05:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.h,v 1.20 2008/11/06 03:28:59 dyoung Exp $ */ +/* $NetBSD: ieee80211.h,v 1.21 2010/11/03 20:05:21 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -159,7 +159,8 @@ #define IEEE80211_FC1_RETRY 0x08 #define IEEE80211_FC1_PWR_MGT 0x10 #define IEEE80211_FC1_MORE_DATA 0x20 -#define IEEE80211_FC1_WEP 0x40 +#define IEEE80211_FC1_PROTECTED 0x40 +#define IEEE80211_FC1_WEP 0x40 /* pre-RSNA compat */ #define IEEE80211_FC1_ORDER 0x80 #define IEEE80211_SEQ_FRAG_MASK 0x000f @@ -402,6 +403,7 @@ IEEE80211_ELEMID_TIM = 5, IEEE80211_ELEMID_IBSSPARMS = 6, IEEE80211_ELEMID_COUNTRY = 7, + IEEE80211_ELEMID_EDCAPARMS = 12, IEEE80211_ELEMID_CHALLENGE = 16, /* 17-31 reserved for challenge text extension */ IEEE80211_ELEMID_PWRCNSTR = 32, @@ -415,10 +417,13 @@ IEEE80211_ELEMID_QUIET = 40, IEEE80211_ELEMID_IBSSDFS = 41, IEEE80211_ELEMID_ERP = 42, - IEEE80211_ELEMID_HTCAP = 45, + IEEE80211_ELEMID_HTCAP = 45, /* 11n */ + IEEE80211_ELEMID_QOS_CAP = 46, IEEE80211_ELEMID_RSN = 48, IEEE80211_ELEMID_XRATES = 50, - IEEE80211_ELEMID_HTINFO = 61, + IEEE80211_ELEMID_TIE = 56, /* 11r */ + IEEE80211_ELEMID_HTINFO = 61, /* 11n */ + IEEE80211_ELEMID_MMIE = 76, /* 11w */ IEEE80211_ELEMID_TPC = 150, IEEE80211_ELEMID_CCKM = 156, IEEE80211_ELEMID_VENDOR = 221 /* vendor private */
CVS commit: src/sys/net80211
Module Name:src Committed By: christos Date: Wed Nov 3 20:05:22 UTC 2010 Modified Files: src/sys/net80211: ieee80211.h Log Message: From: Anon Ymous add a few constants so that if_otus.c compiles. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/net80211/ieee80211.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: dyoung Date: Fri Apr 2 03:46:50 UTC 2010 Modified Files: src/sys/net80211: ieee80211.c Log Message: Delete ieee80211_setbasicrates(). It's buggy, and we drivers can get along fine without it. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.c diff -u src/sys/net80211/ieee80211.c:1.51 src/sys/net80211/ieee80211.c:1.52 --- src/sys/net80211/ieee80211.c:1.51 Fri Mar 26 17:18:05 2010 +++ src/sys/net80211/ieee80211.c Fri Apr 2 03:46:50 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $ */ +/* $NetBSD: ieee80211.c,v 1.52 2010/04/02 03:46:50 dyoung Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.52 2010/04/02 03:46:50 dyoung Exp $); #endif /* @@ -92,8 +92,6 @@ SLIST_HEAD_INITIALIZER(ieee80211_list); static u_int8_t ieee80211_vapmap[32]; /* enough for 256 */ -static void ieee80211_setbasicrates(struct ieee80211com *); - static void ieee80211_add_vap(struct ieee80211com *ic) { @@ -216,7 +214,6 @@ if (ic-ic_caps IEEE80211_C_WME) ic-ic_flags |= IEEE80211_F_WME; #endif - ieee80211_setbasicrates(ic); (void) ieee80211_setmode(ic, ic-ic_curmode); if (ic-ic_bintval == 0) @@ -809,41 +806,6 @@ { 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } }; /* - * Mark the basic rates for the 11g rate table based on the - * operating mode. For real 11g we mark all the 11b rates - * and 6, 12, and 24 OFDM. For 11b compatibility we mark only - * 11b rates. There's also a pseudo 11a-mode used to mark only - * the basic OFDM rates. - */ -static void -ieee80211_setbasicrates(struct ieee80211com *ic) -{ - static const struct ieee80211_rateset basic[] = { - { 0, { } }, /* IEEE80211_MODE_AUTO */ - { 3, { 12, 24, 48 } }, /* IEEE80211_MODE_11A */ - { 2, { 2, 4 } },/* IEEE80211_MODE_11B */ - { 4, { 2, 4, 11, 22 } },/* IEEE80211_MODE_11G */ - { 0, { } }, /* IEEE80211_MODE_TURBO */ - }; - enum ieee80211_phymode mode; - struct ieee80211_rateset *rs; - int i, j; - - for (mode = 0; mode IEEE80211_MODE_MAX; mode++) { - rs = ic-ic_sup_rates[mode]; - for (i = 0; i rs-rs_nrates; i++) { - rs-rs_rates[i] = IEEE80211_RATE_VAL; - for (j = 0; j basic[mode].rs_nrates; j++) { -if (basic[mode].rs_rates[j] != rs-rs_rates[i]) - continue; -rs-rs_rates[i] |= IEEE80211_RATE_BASIC; -break; - } - } - } -} - -/* * Set the current phy mode and recalculate the active channel * set based on the available channels for this mode. Also * select a new default/current channel if the current one is
CVS commit: src/sys/net80211
Module Name:src Committed By: dyoung Date: Fri Apr 2 03:46:50 UTC 2010 Modified Files: src/sys/net80211: ieee80211.c Log Message: Delete ieee80211_setbasicrates(). It's buggy, and we drivers can get along fine without it. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: dyoung Date: Fri Mar 26 17:18:05 UTC 2010 Modified Files: src/sys/net80211: ieee80211.c Log Message: In ieee80211_media_init(), change a pointer that we never write through to a pointer to const. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211.c diff -u src/sys/net80211/ieee80211.c:1.50 src/sys/net80211/ieee80211.c:1.51 --- src/sys/net80211/ieee80211.c:1.50 Tue Jan 19 22:08:17 2010 +++ src/sys/net80211/ieee80211.c Fri Mar 26 17:18:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211.c,v 1.50 2010/01/19 22:08:17 pooka Exp $ */ +/* $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.50 2010/01/19 22:08:17 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $); #endif /* @@ -352,7 +352,7 @@ struct ifnet *ifp = ic-ic_ifp; struct ifmediareq imr; int i, j, mode, rate, maxrate, mword, mopt, r; - struct ieee80211_rateset *rs; + const struct ieee80211_rateset *rs; struct ieee80211_rateset allrates; /*
CVS commit: src/sys/net80211
Module Name:src Committed By: dyoung Date: Fri Mar 26 17:18:05 UTC 2010 Modified Files: src/sys/net80211: ieee80211.c Log Message: In ieee80211_media_init(), change a pointer that we never write through to a pointer to const. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/net80211/ieee80211.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net80211
Module Name:src Committed By: joerg Date: Wed Sep 2 22:03:08 UTC 2009 Modified Files: src/sys/net80211: ieee80211_input.c Log Message: Fix ALTQ for bridge mode. Based on FreeBSD's revision 1.115. Tested by r...@. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/net80211/ieee80211_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net80211/ieee80211_input.c diff -u src/sys/net80211/ieee80211_input.c:1.67 src/sys/net80211/ieee80211_input.c:1.68 --- src/sys/net80211/ieee80211_input.c:1.67 Wed Dec 17 20:51:37 2008 +++ src/sys/net80211/ieee80211_input.c Wed Sep 2 22:03:08 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_input.c,v 1.67 2008/12/17 20:51:37 cegger Exp $ */ +/* $NetBSD: ieee80211_input.c,v 1.68 2009/09/02 22:03:08 joerg Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID($FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.67 2008/12/17 20:51:37 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: ieee80211_input.c,v 1.68 2009/09/02 22:03:08 joerg Exp $); #endif #include opt_inet.h @@ -710,6 +710,7 @@ struct ether_header *eh = mtod(m, struct ether_header *); struct ifnet *ifp = ic-ic_ifp; ALTQ_DECL(struct altq_pktattr pktattr;) + int error; /* perform as a bridge within the AP */ if (ic-ic_opmode == IEEE80211_M_HOSTAP @@ -756,9 +757,11 @@ } #endif len = m1-m_pkthdr.len; - IF_ENQUEUE(ifp-if_snd, m1); - if (m != NULL) + IFQ_ENQUEUE(ifp-if_snd, m1, pktattr, error); + if (error) { ifp-if_omcasts++; +m = NULL; + } ifp-if_obytes += len; } }