Commit Graph

117 Commits

Author SHA1 Message Date
yamt b471b82f34 ieee80211_input.c: Fix a few debug messages 2022-11-19 07:57:51 +00:00
thorpej 1a2cab1766 Adopt <net/if_stats.h>. 2020-01-29 05:20:26 +00:00
maxv b1305a6d63 Replace: M_MOVE_PKTHDR -> m_move_pkthdr. No functional change, since the
former is a macro to the latter.
2018-12-22 13:11:37 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00
maxv 1f639d0627 remove unused arguments 2018-06-21 17:03:45 +00:00
maxv 0a9aff6f39 Fix use-after-free, m_cat can free m. 2018-06-21 16:53:10 +00:00
maxv 2b9c280811 Remove three useless debug messages, remove meaningless XXXs, and remove
ieee80211_note_frame (unused).
2018-05-08 07:02:07 +00:00
maxv 03cb445009 Appease the overflow check, 4 is enough. 2018-01-21 14:13:49 +00:00
maxv a45976c272 Several changes:
* Style in several places, to make the code more readable or easier to
   understand.

 * Instead of checking m->m_pkthdr.len, check m->m_len. m_pkthdr.len is
   the total size of the packet, not the size of the current mbuf (which
   may be smaller).

 * Add a missing length check when handling QoS frames.

 * Cast the lengths passed in IEEE80211_VERIFY_LENGTH to size_t.

 * Remove the length check on scan.sp_xrates, that I added yesterday.
   xrates gets silently truncated in ieee80211_setup_rates().

 * Fix several buffer overflows in the parsers of the MANAGEMENT frames.
2018-01-17 16:03:16 +00:00
maxv 11a42b5c1a Various fixes: style, remove tiring XXXs, and prevent integer overflow in
ieee80211_setup_rates (normally it already can't happen, because I added a
length check on xrates in ieee80211_recv_mgmt_beacon).
2018-01-16 18:53:32 +00:00
maxv 1df75eef54 Prepend 'sp_' to the name of the fields, so that they can easily be found
via NXR or grep.
2018-01-16 18:42:43 +00:00
maxv 3b005d6b1f Add comments about the length checks, and check xrates. 2018-01-16 16:54:54 +00:00
maxv 1551d983f8 Gather related code. 2018-01-16 16:31:37 +00:00
maxv 0170309ae1 Style on the new functions. 2018-01-16 16:20:57 +00:00
maxv 82e96ed75b Introduce ieee80211_recv_mgmt_disassoc. 2018-01-16 16:09:30 +00:00
maxv e51554e17b Introduce ieee80211_recv_mgmt_deauth. 2018-01-16 16:04:16 +00:00
maxv 24023c750d Introduce ieee80211_recv_mgmt_assoc_resp. 2018-01-16 16:00:17 +00:00
maxv 6d9e139ff1 Introduce ieee80211_recv_mgmt_assoc_req. 2018-01-16 15:55:14 +00:00
maxv f940273b30 Introduce ieee80211_recv_mgmt_auth. 2018-01-16 15:48:32 +00:00
maxv 85acfa9c16 Start splitting ieee80211_recv_mgmt. 2018-01-16 15:42:52 +00:00
maxv e54b750f47 More overflows... 2018-01-16 15:18:37 +00:00
maxv 24fb50b383 Fix overflow. 2018-01-16 14:37:24 +00:00
maxv bea24f0ecf Fix memory leak. If m1 == m, m = NULL, so it's safe to just call m_freem. 2018-01-16 14:01:13 +00:00
maxv 01f382e322 Style, remove pointless XXXs, and add a comment about LLC. 2018-01-16 09:42:11 +00:00
maxv 1151dedd75 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.
2018-01-16 08:39:29 +00:00
maxv 6d2a143a1f Start cleaning up this mess. 2018-01-16 07:53:02 +00:00
maxv 0b0687d87e 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.
2017-12-10 08:56:23 +00:00
maxv e63bca16c2 Update the pointer after m_pullup, otherwise possible use-after-free. 2017-12-10 08:48:15 +00:00
knakahara a6e88d7809 VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.
I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html

XXX need pullup to -8 branch
2017-09-26 07:42:05 +00:00
ozaki-r edaa29b022 Fix incrementing wrong counter 2017-03-06 08:36:20 +00:00
nonaka 5ffb0503f3 wlan interfaces make interrupt routine running on softint context.
see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html

tested device:
 * ath at pci: AR5212, AR5424
 * athn at pci: AR9287
 * ipw at pci: 2100BG
 * iwi at pci: 2915ABG
 * iwm at pci: 3165, 7260, 8260
 * iwn at pci: 4945, 6235
 * ral at pci: RT2560
 * rtwn at pci: RTL8192CE
2017-02-02 10:05:35 +00:00
ozaki-r dd8638eea5 Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input
The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
  - Where/When if_ipackets is counted up
  - Note that some drivers still update packet statistics in their own
    way (periodical update)
- Moved bpf_mtap run in softint
  - This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
2016-12-15 09:28:02 +00:00
christos c2ec58382b - use ether_snprintf() so that we don't overwrite our buffer for printing
ethernet-like addresses
- make this compile againw without IEEE80211_DEBUG.
2016-09-27 20:20:06 +00:00
mlelstv f3c013cf09 In station mode filter packets that or not for us in case the
interface is in promiscous mode or doesn't filter packets itself.
2016-05-14 13:35:40 +00:00
mlelstv 28f11d6152 Don't check sequence number on multicast packets in station mode.
Handle overflow of 12bit sequence number.
2016-05-07 12:36:50 +00:00
knakahara b76ec0b083 IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller 2016-04-20 09:01:03 +00:00
knakahara 40b1061c07 IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation 2016-04-20 08:58:48 +00:00
ozaki-r 9c4cd06355 Introduce softint-based if_input
This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
2016-02-09 08:32:07 +00:00
pooka 1c4a50f192 sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
joerg 7a17852c4d GC unused functions. Don't bother building ieee80211_acl.c, nothing in
it is non-static.
2013-09-13 20:19:53 +00:00
christos bf2739ea2c Putting extra l's in align does not make it more so. 2013-03-30 19:03:02 +00:00
christos 1f60acb650 remove trailing whitespace 2013-03-30 15:12:28 +00:00
christos db8452b16f remove trailing space 2013-03-30 03:24:55 +00:00
christos 9782767422 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.
2013-01-10 17:40:10 +00:00
christos 42c420856f - fix offsetof usage, and redundant defines
- kill pointer casts to 0
2011-12-31 20:41:58 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
joerg 58e867556f Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
2010-04-05 07:19:28 +00:00
pooka b014350f7f Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2010-01-19 22:08:16 +00:00
joerg 21268b3994 Fix ALTQ for bridge mode. Based on FreeBSD's revision 1.115.
Tested by roy@.
2009-09-02 22:03:08 +00:00