wireshark/tools
John Thacker ca230a59e0 wiretap, pcapng: Distinguish WTAP_ENCAP_UNKNOWN and _NONE
WTAP_ENCAP_UNKNOWN is used for two different cases:
1. Encapsulation type values that are unsupported by libwiretap or
bogus values (and thus "unknown" to libwiretap).

2. An initial state where the encapsulation type is "not yet" known
for a file type like pcapng without a single encapsulation type in the
header, before any packets or interfaces that set the encapsulation type
have been read. (If the file has no packets, this may be the value after
the file is entirely read in.) This can be the value when an output file
is written out simultaneously with reading an input file, rather than
reading the entire input file first, and, e.g., there is a custom block
before any IDBs.

The first case can never be handled when writing out a file, but the
second case can possibly be handled, so long as (for pcapng) IDBs
are available to write when they become necessary, or (for file
types like pcap with a single link-layer type in the header) the
writer waits until a link-layer type is seen to create the output
header. (It is possible, of course, that writing would fail in the
middle if an unsupported encapsulation type appears, or if the
encapsulation becomes per-packet for file types that don't support that,
but that is an unavoidable risk when writing without reading the entire
input file(s).)

Introduce WTAP_ENCAP_NONE for the second case, and use it for pcapng,
where we guarantee that any necessary IDBs will be passed along.
Continue to use WTAP_ENCAP_UNKNOWN for the first case.

Allow pcapng files to open a file for writing with WTAP_ENCAP_NONE.

There are some other file types that support per-packet link-types,
and could also use WTAP_ENCAP_NONE, but they require more work to
generate IDBs. (Note that all of them currently are impossible to
write to pcapng when they have multiple encapsulations, even if
the encapsulations are all supported by pcapng, because they don't
properly generate IDBs.)

Remove the workaround in ef43fd48b4
for tshark writing to pcapng when the source file is WTAP_ENCAP_UNKNOWN,
since now such files will be WTAP_ENCAP_NONE and work properly (and
also work in editcap, mergcap, etc.)

Along with 8cddc32d35, fix #18449.
2023-02-07 13:33:20 +00:00
..
asterix asterix: asterix-specs converter fix 2022-08-03 17:10:36 +00:00
cppcheck CPPcheck: When we say C11 do check for C11 2022-01-28 04:31:07 +00:00
json2pcap Minor Python3 script fixups. 2022-06-27 16:46:55 +00:00
lemon Lemon: Update code and remove cruft 2023-01-01 18:18:06 +00:00
oss-fuzzshark fuzzshark: integrate oss-fuzz targets in CMake 2018-10-20 07:00:43 +00:00
pidl Clean up URLs. 2020-10-02 20:13:42 -07:00
radiotap-gen Remove wspcap.h and use config.h instead 2023-02-06 15:05:36 +00:00
Get-HardenFlags.ps1 HTTPS In More Places, update some URLs. 2019-07-27 07:55:36 +00:00
SkinnyProtocolOptimized.xml skinny: Resync xml code with dissector, regenerate 2022-11-03 20:55:05 -04:00
WiresharkXML.py Fix more repeated words throughout 2021-12-31 22:50:40 +00:00
alpine-setup.sh Tools: Move speexdsp to the Alpine and RPM basic lists. 2022-12-22 17:44:37 +00:00
arch-setup.sh CMake+etc: Enable Qt6 by default for Unix builds 2022-08-22 09:08:06 +00:00
asn2deb Packaging+GitLab CI: Move debian to the packaging directory. 2022-02-13 13:21:58 -08:00
asn2wrs.py asn2wrs: disable template line directive by default 2022-11-30 17:31:46 +00:00
bsd-setup.sh tools/bsd_setup.sh: speexdsp is a required package 2022-12-20 12:27:41 +00:00
checkAPIs.pl Do not require using wsgcrypt.h 2023-02-06 15:52:10 +00:00
check_dissector_urls.py tools/check_*.py: allow multiple --file entries 2022-02-20 23:12:10 +00:00
check_help_urls.py Tools: add script to check help URLs vs. available User's Guide chapters 2022-03-07 08:04:08 +00:00
check_spelling.py Fix some spellings. 2022-07-06 09:02:37 +01:00
check_static.py tools/check_static.py - fix remaining errors 2022-11-30 08:49:38 +00:00
check_tfs.py check_tfs: find entries that define value_string identical to common tfs 2022-12-30 11:56:41 +00:00
check_typed_item_calls.py Ignore or fix more warnings (check_typed_item_calls) 2023-02-06 09:24:26 +00:00
checkfiltername.pl pre-commit: Add an exception to duplicate filter name check 2022-02-15 11:38:16 +00:00
checkhf.pl HTTPS In More Places, update some URLs. 2019-07-27 07:55:36 +00:00
checklicenses.py tools/checklicense: Skip build directories 2022-12-08 07:15:52 +00:00
colorfilters2js.py tools: Port colorfilters2js.pl to colorfilters2js.py 2022-06-28 19:05:29 +00:00
commit-msg Add a commit-msg that may be installed to verify commit msg line length. 2021-03-23 09:09:19 +00:00
compress-pngs.py tools/compress-png: migration to python typos 2022-10-25 17:52:28 +00:00
convert_expert_add_info_format.pl Lua: reconcile expert info groups; add PI_ASSUMPTION 2021-06-21 15:27:51 +00:00
convert_proto_tree_add_text.pl Lua: reconcile expert info groups; add PI_ASSUMPTION 2021-06-21 15:27:51 +00:00
debian-nightly-package.sh Packaging+GitLab CI: Move debian to the packaging directory. 2022-02-13 13:21:58 -08:00
debian-setup.sh debian-setup.sh - install libspeexdsp-dev as default as is now required 2022-12-19 09:35:44 +00:00
delete_includes.py Tools+test: Call python3 explicitly. 2020-11-05 06:46:35 +00:00
detect_bad_alloc_patterns.py First pass pinfo->pool conversion 2021-07-21 05:38:29 +00:00
eti2wireshark.py EOBI: Disable dissector by default 2022-05-27 19:04:59 +00:00
extract_asn1_from_spec.pl extract_asn1_from_spec.pl: add support for M2AP and M3AP specs 2023-01-11 12:52:23 +01:00
fix-encoding-args.pl fix-encoding-args: Remove a string check 2022-06-09 20:27:26 +00:00
fuzz-test.sh Tools: Test for UTF-8 errors in fuzz tests 2022-10-02 18:01:35 +00:00
gen-bugnote Tools: Add trailing periods to our bug notes if needed. 2022-05-04 10:39:18 -07:00
generate-bacnet-vendors.py spdx: more licenses converted. 2018-03-09 04:50:23 +00:00
generate-dissector.py generate-dissector.py: allow creating plugin 2023-02-06 14:32:55 +00:00
generate-nl80211-fields.py Netlink nl80211: Convert to normal proto tree API 2021-12-11 16:32:33 +00:00
generate-sysdig-event.py tools: updated generate-sysdig-event python script. 2021-12-13 14:30:30 +00:00
generate_authors.py Update authors file in place 2023-01-20 12:04:57 +00:00
generate_cbor_pcap.py CBOR: Avoid infinite loop when sequence has not-well-formed data 2021-10-26 12:18:13 +00:00
html2text.py Tools: Handle table rows and admonition titles in html2text. 2022-04-24 23:59:48 +00:00
idl2deb Packaging+GitLab CI: Move debian to the packaging directory. 2022-02-13 13:21:58 -08:00
idl2wrs HTTPS (almost) everywhere. 2019-07-26 18:44:40 +00:00
indexcap.py Tools+test: Call python3 explicitly. 2020-11-05 06:46:35 +00:00
lex.py spdx: more licenses converted. 2018-03-09 04:48:20 +00:00
licensecheck.pl Tools: Be more clear that we're matching the BSD 1-Clause license. 2022-01-01 15:25:21 -08:00
list_protos_in_cap.sh More licenses converted to SPDX. 2018-03-07 13:35:49 +00:00
macos-setup-brew.sh Tools: Update macos-setup-brew.sh 2023-02-03 10:45:01 -08:00
macos-setup.sh macos-setup: go with the current autoconf and automake releases. 2023-01-08 15:17:15 -08:00
make-authors-csv.py GUI: Ship authors as a Qt resource file 2023-01-20 13:35:03 +00:00
make-enums.py wiretap: Add enum generation 2022-10-07 10:28:47 +01:00
make-manuf.py Tools: Switch make-manuf.py URLs to HTTPS. 2022-09-05 17:55:33 +00:00
make-no-reassembly-profile.py Tools: Fix make-no-reassembly-profile.py. 2022-05-01 09:50:40 -07:00
make-packet-dcm.py Update to DICOM Edition 2021b 2021-05-03 19:51:19 +00:00
make-pci-ids.py Tools: make-pci-ids fixups. 2021-11-02 17:20:24 +00:00
make-plugin-reg.py Align plugin reg function search with epan reg function search 2022-03-18 21:01:40 +00:00
make-regs.py wiretap: more work on file type/subtypes. 2021-02-17 21:54:28 +00:00
make-services.py Tools: Fetch IANA data over HTTPS. 2021-11-02 16:46:18 +00:00
make-sminmpec.py tools: Port make-sminmpec.pl to make-sminmpec.py 2022-06-28 21:59:53 +00:00
make-tls-ct-logids.py Tools: Check the last modified date in make-tls-ct-logids.py 2022-12-19 19:52:55 +00:00
make-usb.py Update USB ID list straight from the sources 2022-01-08 17:59:40 +00:00
make-version.py make-version.py: Add missing parentheses on function call 2022-07-28 15:08:58 -07:00
make_charset_table.c
msnchat spdx: more licenses converted. 2018-03-09 04:50:23 +00:00
msys2-setup.sh Update msys2-setup.sh 2023-01-29 22:08:47 +00:00
ncp2222.py NCP: Add offset overflow checking. 2022-12-14 08:57:44 +00:00
netscreen2dump.py Fix issues discovered by common python linters 2020-09-26 04:38:18 +00:00
parse_xml2skinny_dissector.py skinny: Convert parse_xml2skinny_dissector.py to Py3 2022-11-03 20:28:19 -04:00
pkt-from-core.py wiretap, pcapng: Distinguish WTAP_ENCAP_UNKNOWN and _NONE 2023-02-07 13:33:20 +00:00
pre-commit Exclude wmem_test.c from pre-commit 2021-12-18 20:13:41 +00:00
pre-commit-ignore.conf Rename the "image" directory to "resources". 2022-03-09 02:07:51 +00:00
pre-commit-ignore.py Tools+test: Call python3 explicitly. 2020-11-05 06:46:35 +00:00
process-x11-fields.pl Remove popcount in favor of ws_count_ones. 2018-03-13 17:18:01 +00:00
process-x11-xcb.pl Fix the type of arrays of pointers to hf_ values for bitfield routines. 2020-06-19 11:32:26 +00:00
randpkt-test.sh Tools: Try to exit more gracefully from fuzzing. 2021-05-11 11:07:27 -07:00
rdps.py rdps.py: Use string equality for comparing strings 2021-01-25 11:32:12 +00:00
release-update-debian-soversions.sh Packaging+GitLab CI: Move debian to the packaging directory. 2022-02-13 13:21:58 -08:00
rpm-setup.sh Tools: Move speexdsp to the Alpine and RPM basic lists. 2022-12-22 17:44:37 +00:00
sharkd_shell.py sharkd_shell.py: add interactive debug shell for sharkd 2019-10-02 22:05:29 +00:00
test-captures.sh More shellcheck checks and fixes. 2018-06-07 18:11:12 +00:00
test-common.sh Tools: Fuzz subsets of large files. 2022-09-26 18:38:14 -07:00
update-appdata.py Move Freedesktop files to resources/freedesktop. 2022-03-12 00:19:13 +00:00
update-tools-help.py Tools: Improve update-tools-help's version handling. 2022-02-14 23:13:36 +00:00
update-tx Qt+tools: Fix most of our lupdate warnings. 2021-01-18 16:56:20 +00:00
valgrind-wireshark.sh Revert temp changes to valgrind-wireshark.sh 2020-10-19 10:35:26 +00:00
validate-clang-check.sh Tools: Don't validate file_util.c. 2022-05-16 10:13:23 -07:00
validate-commit.py Strip comment lines before validating format 2021-06-11 16:46:13 +02:00
validate-diameter-xml.sh Move a bunch of protocol resources to resources/protocols. 2022-03-11 18:34:41 +00:00
vg-suppressions vg-suppressions: suppress more GLib-related memleaks 2018-04-24 21:12:49 +00:00
win-setup.ps1 Windows: Use SpeexDSP binary package 2022-12-16 11:11:28 +00:00
wireshark_be.py Fix spelling errors. 2021-09-11 10:01:27 +00:00
wireshark_gen.py GIOP and idl2wrs: Implementation of Any type and fixes and improvements for idl2wrs 2022-09-29 11:40:44 +00:00
wireshark_words.txt Fix some spelling errors 2023-02-02 12:13:21 +00:00
ws-coding-style.cfg Update our issue tracker URL in some places. 2020-09-16 01:29:07 +00:00
yacc.py Fix more repeated words throughout 2021-12-31 22:50:40 +00:00