* Make the code more readable.
* Add a panic in ieee80211_compute_duration(). I'm not sure there's
a bug here - I don't have the hardware -, but looking at the code, it
may be possible for 'paylen' to go negative. Obviously that's not the
correct way to fix it, but at least we'll see if it happens.
* Make the code more readable. In particular, declare variables as const
along the way.
* Explain what we're doing in ieee80211_send_mgmt(). The
IEEE80211_FC0_SUBTYPE_PROBE_RESP case has some inconsistencies, but
they are not inherently wrong so I'm not changing that.
* When sending IEEE80211_FC0_SUBTYPE_REASSOC_RESP frames, make sure to
zero out the 'association ID', otherwise two bytes are leaked.
* Fix a possible memory leak in ieee80211_send_probereq().
* They call M_PREPEND, but don't pass the updated pointer back to the
caller.
* They use memmove on the mbuf data, but they don't ensure that the
area they touch is contiguous.
This fix is not complete, ieee80211_crypto_encap too needs to pass back
the updated pointer. This will be done in another commit.
* 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.
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.
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
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