[3.4.x] Editcap saving files as ethernet when specifying '-T ieee-802-11-*'
Summary
When using editcap and saving the file as type ieee-80211 it incorrectly saves as type ethernet.
Steps to reproduce
Obtain wireless capture obtained from mirroring such that it is encapsulated in GRE or similar. Strip out this encapsulation and save as appropriate ieee-802-11 format.
Example
./editcap -C 62 ~/Downloads/file.pcap -T ieee-802-11-radio ~/Downloads/newfile.3.4.4.pcap
Open file nefile.pcap and will be displayed as type ethernet.
- Working up to 3.3.1.
- 3.4.0-3.4.4 - Incorrectly saved as type ethernet.
- 3.4.5 and above - Does not work at all. See error below.
What is the current bug behavior?
In editcap output file when saved as type ieee-802-11-* is saved as ethernet
What is the expected correct behavior?
Output file when opened should be displayed as ieee-802-11-*
Sample capture file
file.pcap - mirror capture with 62 bits around '80211+RADIO'
newfile.3.4.4.pcap - editcap in 3.4.4 with 62 bits stripped.
Relevant logs and/or screenshots
For 3.4.5 and above the following error is seen.
./editcap -C 62 ~/Downloads/file.pcap -T ieee-802-11-radio ~/Downloads/newfile.3.4.5.pcap
editcap: An internal error occurred while writing record 1 of file "/Users/mick/Downloads/file.pcap" to the file "/Users/mick/Downloads/newfile.3.4.5.pcap"
(pcapng: interface 0 encap 1 != packet encap 22)
(Paste any relevant screenshots here)
Build information
3.4.5 (v3.4.5-0-g7db1feb42ce9)
Compiled (64-bit) with Qt 5.12.6, with libpcap, without POSIX capabilities, with
GLib 2.58.3, with zlib 1.2.11, with SMI 0.4.8, with c-ares 1.15.0, with Lua
5.2.4, with GnuTLS 3.6.15 and PKCS #11 support, with Gcrypt 1.8.7, with MIT
Kerberos, with MaxMind DB resolver, with nghttp2 1.39.2, with brotli, with LZ4,
with Zstandard, with Snappy, with libxml2 2.9.9, with QtMultimedia, with
automatic updates using Sparkle, with SpeexDSP (using system library), with
Minizip.
Running on Mac OS X 10.15.7, build 19H1323 (Darwin 19.6.0), with Intel(R)
Core(TM) i7-7700HQ CPU @ 2.80GHz (with SSE4.2), with 16384 MB of physical
memory, with locale C, with light display mode, with HiDPI, with libpcap version
1.9.1, with GnuTLS 3.6.15, with Gcrypt 1.8.7, with brotli 1.0.9, with zlib
1.2.11, binary plugins supported (21 loaded).
Built using clang 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.16).