aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2019-02-02CMake: Fix DOCDIR on UnixJoão Valverde1-1/+1
User guides are installed to doc/Wireshark. Use doc/wireshark instead. Remove leftover variable CPACK_PACKAGE_NAME. Change-Id: I9a1d6bdc7d8f0b48c61e43679285d5ba83904a63 Reviewed-on: https://code.wireshark.org/review/31851 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2019-01-31Also check whether we have nothing but DLCI bytes.Guy Harris1-4/+8
The two failure modes are 1) no byte has the low-order bit set, so we didn't even find the end of the DLCI or 2) the byte at the end of the packet has the low-order bit set, so that it's all DLCI with no control byte after it. Expand a comment. Bug: 15463 Change-Id: Ib76686391213dd56c06d665aa87a188621fe6816 Reviewed-on: https://code.wireshark.org/review/31828 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-31Check whether you've hit the end of the packet data before going further.Guy Harris1-2/+3
If we found no bytes with the low-order bit set in the packet data, there's no point in checking the non-existent "next" byte to see if it's a HDLC-style UI control byte (0x03). Bug: 15463 Change-Id: Ibfd186e5b81d8ce229362e23f00b31a27900831a Reviewed-on: https://code.wireshark.org/review/31824 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-30ngsniffer: fix comment.Dario Lombardo1-2/+2
Change-Id: Ia25ce4841ee3831f995d1fa7cd2cb8a850f1c01e Reviewed-on: https://code.wireshark.org/review/31818 Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-25wiretap: fix memleaks with wtap_rec::opt_commentPeter Wu4-2/+11
The memory ownership of wtap_rec::opt_comment was not clear. Users of wtap were leaking memory (editcap.c). wtap readers were not sure about freeing old comments (erf) or simply ignored memleaks (pcapng). To fix this, ensure opt_comment is owned by wtap_rec and free it with wtap_rec_cleanup. The erf issue was already addressed since cf_get_packet_comment properly duplicates wth.opt_comment memory. - wtap file formats (readers): - Should allocate memory for new comments. - Should free a comment from an earlier read before writing a new one. - Users of wth: - Can only assume that opt_comment remains valid until the next read. - Can assume that wtap_dump does not modify the comment. - For random access (wtap_seek_read): should call wtap_rec_cleanup to free the comment. The test_tshark_z_expert_comment and test_text2pcap_sip_pcapng tests now pass when built with ASAN. This change was created by carefully looking at all users opt "opt_comment" and cf_get_packet_comment. Thanks to Vasil Velichkov for an initial patch which helped validating this version. Bug: 7515 Change-Id: If3152d1391e7e0d9860f04f3bc2ec41a1f6cc54b Reviewed-on: https://code.wireshark.org/review/31713 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-24wiretap: fix leak of options_buf and document memory handlingPeter Wu3-2/+10
Manually checked all callers of wtap_seek_read to ensure that wtap_rec_cleanup is called. Added missing wtap_rec_cleanup to: - Completion of sequential read: wtap_sequential_close - Callers of wtap_seek_read: - users of cf_read_record_r: - PacketListRecord::dissect This fixes one of the two ASAN memleak reports while running test_tshark_z_expert_comment and test_text2pcap_sip_pcapng (the other is about opt_comment which is still unfixed). Vasil Velichkov also found this issue and came up with a similar fix. Change-Id: I54a6aa70bfdb42a816d03ad4861d0ad821d0ef88 Reviewed-on: https://code.wireshark.org/review/31709 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-23nettrace: fix potential buffer overflow in time parsingPeter Wu1-10/+8
sscanf can consume less than 19 characters (e.g. given time format 1-1-1T1:1:1), be sure to reject such input. Fix some dead store warning while at it. Change-Id: I6148599048f1e89ea7aafdbdd6450574a97b22fd Fixes: v2.9.1rc0-372-gd38f6025b0 ("nettrace: Handle beginTime with fractions of seconds.") Reviewed-on: https://code.wireshark.org/review/31699 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-22CMake: Set a direct rpath for librariesJoão Valverde1-0/+1
Instead of using "$ORIGIN/../lib" just use "$ORIGIN". Also be explicit in configuring the relative RPATH. We don't want to assume a default relative path, in case more targets are addded, out of caution. Change-Id: I3b7f5e8de7be8bb30aca3b433212113d876c4163 Reviewed-on: https://code.wireshark.org/review/31647 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-20CMake: Replace PACKAGELIST magicJoão Valverde1-3/+8
This is more explicit and easier to read with slightly better locality while using less code. Also less awkward when the package doesn't fit the narrow package list expectations. The ws_find_package() macro doesn't include all the status messages. The choice was to rely on standard find_package() and feature_summary() output and be less verbose. Avoid polluting the CLI build interface. Per target include paths and macro definitions are preferred. Because this patch intentionally removes the global CMAKE_*_FLAGS and include_directories() usage in favor of target properties, some untested build configurations may inadvertently break because of missing ${PACKAGE}_INCLUDE_DIRS or ${PACKAGE}_DEFINITIONS. This required a manual review of dependencies that might have been incomplete. ${PACKAGE_VAR}_LINK_FLAGS seems to be unused. Changing the CMake Qt code to use more modern CMake component syntax is left as future work. Change-Id: I3ed75252189a6e05a23ed6e619088f519cd7ed78 Reviewed-on: https://code.wireshark.org/review/31496 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-19vwr: fix -Werror=maybe-uninitialized with GCC 8.2.1+20181127-1Peter Wu1-1/+1
Change-Id: I58d61d29719facb5d639bdbd7e3d790096f69486 Reviewed-on: https://code.wireshark.org/review/31599 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18ebhscr: increasing ebhscr snaplenPantar Ana3-0/+9
Change-Id: Ie033196c099927912b1e7849299e786dc8416923 Reviewed-on: https://code.wireshark.org/review/31554 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18wiretap,file.c: ensure DSBs are reapplied on redissectionPeter Wu3-7/+30
After redissection, the TLS dissector did not remember the DSB secrets anymore. Since the secrets callback is only invoked on the sequential read in wtap, be sure to reapply the existing DSBs to the new session. Bug: 15252 Change-Id: I125f095acb8d577c2439a10e3e65c8b3cfd976b9 Reviewed-on: https://code.wireshark.org/review/31584 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-17VPP: add vpp graph dispatch trace dissectorDave Barach3-0/+7
Add a dissector for http://fd.io vpp graph dispatch traces. The file format is described in detail here: https://fdio-vpp.readthedocs.io/en/latest/gettingstarted\ /developers/vnet.html#graph-dispatcher-pcap-tracing Fuzz-tested with good results. Bug: 15411 Change-Id: I3b040bb072ce43fb2fb646a9e473c5486654906a Signed-off-by: Dave Barach <dave@barachs.net> Reviewed-on: https://code.wireshark.org/review/31466 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-14nettrace: Handle beginTime with fractions of seconds.Anders Broman1-36/+68
Change-Id: If12f5430e816a373c084996a6e55846ce825a4de Reviewed-on: https://code.wireshark.org/review/31539 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-12wiretap: remove dependency on version_infoPeter Wu2-4/+3
Avoid including the precise version string in the pcapng file that is created for 3GPP TS 32.423 formats. This avoids unnecessarily relinking of applications depending on wiretap. Change-Id: Ida1f3c0c998d811cbf85734bd83438bcbfc39cf4 Reviewed-on: https://code.wireshark.org/review/31513 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-12CMake: use object libraries to avoid redundant buildsPeter Wu1-3/+1
Some source files are duplicated via add_executable. Assuming that these are not affected by target-specific preprocessor macros, they can be built only once and shared among executables. In one configuration, this reduces the number of object files by 55 (cli_main.c and version_info.c alone were built 15 times each). Removes the version dependency from each target since the 'version_info' target can now declare this dependency. Remove CLEAN_C_FILES from extcap since it is not used to set -Werror. Due to removing some files from wireshark_FILES (and others), these are no longer part of checkAPIs though. Hopefully that is acceptable. Change-Id: I0a3f1ffb950e70a6176c96d867f694fbc6476f58 Reviewed-on: https://code.wireshark.org/review/31509 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-11nettrace: Fix missing tag length for IPV4_DST.Anders Broman1-7/+14
Change-Id: I00564adaef2922ff991887f0ee5c04a3c7307019 Reviewed-on: https://code.wireshark.org/review/31488 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-09Clarify the name and description for a link-layer encapsulation type.Guy Harris3-235/+236
What we were calling the "name" is actually a description to show to users; what were calling the "short name" is just the name to use on the command line. Rename some routines and structure members, and put the name first and description second in the table. Expand some descriptions to give more details (e.g., to be more than just a capitalized version of the name). Fix the CamelCase capitalization of InfiniBand. Change-Id: I060b8bd86573880efd0fab044401b449469563eb Reviewed-on: https://code.wireshark.org/review/31472 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-06nettrace_3gpp_32_423: Fix Dead Store (Dead assignement/Dead increment) ↵Alexis La Goutte1-8/+1
Warning found by Clang Change-Id: I9f59b5ae6fe34d124b6930fa759c7c76c38aa213 Reviewed-on: https://code.wireshark.org/review/31412 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-04wiretap: fix code according to clang-tidy.Dario Lombardo6-13/+13
Change-Id: I7f539968e9dce3a49112b7aeaa052b8cdb7501a6 Reviewed-on: https://code.wireshark.org/review/31364 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-29Lua: fix crash in reloading Lua plugins that use FileHandlerPeter Wu1-1/+9
Reloading Lua plugins did not actually remove registered FileHandler instances which resulted in a use-after-free of lua_State. Fix this by tracking instances and release them in wslua_deregister_filehandlers. Other required fixes to allow reregistration after reloading: - Fix END_FILEHANDLER_ROUTINE not to block all new registrations. - wtap file subtypes are apparently persistent, even after "unregistering". Fix this by looking up the previous subtype that matches the FileHandler short name. Add a small sanity check to wtap_register_file_type_subtypes to prevent internal handlers from being overwritten. This patch creates a potential memleak of registered_file_handlers as wslua_deregister_filehandlers is not called on program exit (yet?). Bug: 13264 Change-Id: I4f5935cde6ff8dc4de333359bad3efca96d4fb9b Reviewed-on: https://code.wireshark.org/review/31068 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-27ebhscr: fixing WTAP_ENCAP_EBHSCRPantar Ana3-1/+8
Change-Id: Ie5ab56f1ee80d14032969cbe7f31e086fb2b4b91 Reviewed-on: https://code.wireshark.org/review/31159 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-12-20CMake: Don't bundle our libraries at compile time.Gerald Combs1-13/+0
Setting LIBRARY_OUTPUT_DIRECTORY to Wireshark.app/Contents/Frameworks for each of our libraries ends up installing a fully versioned .dylib along with soversion and unversioned symlinks, which is more than we want and which wastes disk space when osx-app.sh dsymifies our libraries. Leave LIBRARY_OUTPUT_DIRECTORY unset and depend on osx-app.sh to copy our libraries into place. Bug: 15361 Change-Id: If0fbaa796b4be806e2aa13887e511a330fe55df5 Reviewed-on: https://code.wireshark.org/review/31139 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-12-20erf: Add support for attribute and sensor Provenance tagsAnthony Coddington1-0/+3
Add temperature and power tags, represented using millidegrees/milliwatts. Add attribute tag, allows generic reprsentation of dynamic path like key-value pairs in the format namespace.path.to.name=value where value can be a JSON-escaped string or an integer/float number. Also fix a few implicit floating point conversions (confirmed values are the same). Change-Id: Id8a858abfa8a56b44e9e7200b11adc562e67fb3b Reviewed-on: https://code.wireshark.org/review/31136 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-17wiretap: use appropriate extension for temporary filesJaap Keuter1-1/+11
With the change from Wireshark's default capture file format from pcap to pcapng the suffix of the temporary file created in wiretap was also changed from .pcap to .pcapng. This irrespective of the actual file type requested. This change retrieves the registered extension for the requested file type (in its uncompressed form) and used that for the suffix. File types without a defined default extension will get .tmp as suffix. Change-Id: If809fef4325e483072c1fa4ee962125d991a197e Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/31065 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-13Move more version-info-related stuff to version_info.c.Guy Harris1-1/+1
Have a ws_init_version_info() routine that, given an application name string: constructs the app-name-and-version-information string, and saves it; adds the initial crash information on platforms that support it, and saves it. Have show_version() use the saved information and take no arguments. Add a show_help_header() routine to print the header for --help command-line options, given a description of the application; it prints the application name and version information, the description, and the "See {wireshark.org URL}" line. Use those routines in various places, including providing the "application name" string in pcapng SHBs. Change-Id: I0042a8fcc91aa919ad5c381a8b8674a007ce66df Reviewed-on: https://code.wireshark.org/review/31029 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-05Fix some spelling errors found by Lintian.Gerald Combs1-1/+1
Change-Id: If6fc3aab7ad4fc634567121f7b9541bc6f6c5766 Reviewed-on: https://code.wireshark.org/review/30926 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-29CMake: Fix some transitive link dependenciesJoão Valverde1-8/+7
libwireshark and libwiretap have their INTERFACE link dependencies changed to the required set. libwsutil keeps a default public visibility. Further work may show some unneeded link requirements. The executable dependencies are adjusted accordingly. Change-Id: I3a534f72403819cac136ae47a3d80acee76e0fb3 Reviewed-on: https://code.wireshark.org/review/30815 Reviewed-by: João Valverde <j@v6e.pt>
2018-11-27IxVeriWave: Fix a buffer boundary.Gerald Combs1-2/+3
Pass the correct buffer size to find_signature so that we don't read past it. Bug: 15279 Change-Id: I822ed0fe8b48196dadd9c0062ed53fa1c4f6f404 Reviewed-on: https://code.wireshark.org/review/30809 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-26CMake: Fix runtime destination for our librariesJoão Valverde1-1/+1
Ping-Bug: 15301 Change-Id: I7d461c696ce096b7687f71277a33295eb43ff8fc Reviewed-on: https://code.wireshark.org/review/30792 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-11-24Install development headers on all platformsJoão Valverde1-5/+3
Install headers to support plugins development on Windows. Change-Id: I3161bd2f730edf62ab44fee6ce4fedbb9aee0d31 Reviewed-on: https://code.wireshark.org/review/30776 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-11-20nettrace: Put address parsing in a separate routine.Anders Broman1-121/+104
Change-Id: Ia223585986c6c8ad51fba36aa16c5780fc372f70 Reviewed-on: https://code.wireshark.org/review/30714 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20Explicitly say "no extensions, no entry in this table".Guy Harris1-0/+5
Change-Id: Idd4d5143a75b7f2282460408b2f61d0d8aa3e66a Reviewed-on: https://code.wireshark.org/review/30736 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20Don't put file types without extensions into the file_type_extensions_base ↵Guy Harris1-1/+0
table. As the comment says, this is a table of "File types that can be identified by file extensions."; a file type that doesn't have an extension that's used for files with that format obviously *can't* be identified by a file extension and thus *doesn't* belong in this table. Change-Id: Ic14dc55e6d9dbad4651e535cdf44293f8b449659 Reviewed-on: https://code.wireshark.org/review/30735 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20Add new Secrets API and allow TLS to use pcapng decryption secretsPeter Wu3-0/+12
Add a new secrets API to the core, one that can outlive the lifetime of a single capture file. Expose decryption secrets from wiretap through a callback and let the secrets API route it to a dissector. Bug: 15252 Change-Id: Ie2f1867bdfd265bad11fc58f1e8d8e7295c0d1e7 Reviewed-on: https://code.wireshark.org/review/30705 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20wiretap: add read/write support for Decryption Secrets Block (DSB)Peter Wu13-10/+295
Support reading and writing pcapng files with DSBs. A DSB may occur multiple times but should appear before packets that need those decryption secrets (so it cannot be moved to the end like NRB). The TLS dissector will be updated in the future to make use of these secrets. pcapng spec update: https://github.com/pcapng/pcapng/pull/54 As DSBs may be interleaved with packets, do not even try to read it in pcapng_open (as is done for IDBs). Instead process them during the sequential read, appending them to the 'wtap::dsbs' array. Writing is more complicated, secrets may initially not be available when 'wtap_dumper' is created. As they may become available in 'wtap::dsbs' as more packets are read, allow 'wtap_dumper::dsbs_growing' to reference this array. This saves every user from checking/dumping DSBs. If the wtap user needs to insert extra DSBs (while preserving existing DSBs), they can set the 'wtap_dumper::dsbs_initial' field. The test file was creating using a patched editcap (future patch) and combined using mergecap (which required a change to preserve the DSBs). Change-Id: I74e4ee3171bd852a89ea0f6fbae9e0f65ed6eda9 Ping-Bug: 15252 Reviewed-on: https://code.wireshark.org/review/30692 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20wsutil: rename some wsjson functionsPeter Wu1-1/+1
Rename wsjson_unescape_json_string to json_decode_string_inplace (inspired by the g_base64_decode_inplace name). Rename wsjson_is_valid_json to json_validate (inspired by g_unichar_validate). Ideally json_parse is inlined with its user (sharkd_session.c), but that requires exporting the jsmn_init and jsmn_parse functions... Hence the dependency on jsmn.h remains in wsjson.h. Change-Id: I7ecfe3565f15516e9115cbd7e025362df2da5416 Reviewed-on: https://code.wireshark.org/review/30731 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20Add an API to get a list of compressed-file extensions, and use it.Guy Harris4-142/+144
Move all the compressed-file type stuff to wiretap/file_wrappers.c. Rename wtap_compressed_file_extension() to wtap_compression_type_extension() for consistency with the other compression-type-extension routine names. Move the declarations of the compression-type-extension routines in the header file. wtap_compression_type_extension() now returns NULL for WTAP_UNCOMPRESSED; there's no need to special-case it. Get rid of the now-unused wtap_compression_type_supported() and WTAP_NUM_COMPRESSION_TYPES. Change-Id: Ib93874079bea669a0c87104513dba0d21390455a Reviewed-on: https://code.wireshark.org/review/30729 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-19Convert enum increment into int incrementJaap Keuter1-10/+10
Using an enum type with the increment operator causes the following error to be emitted by newer compilers: "increment of enumeration value is invalid in C++ [-Werror=c++-compat]" Numerical operations seem only allowed when taking their integer value. Convert the loops involved to use integer and cast back to wtap_compression_type when needed. Change-Id: Ic96a6350c7d4db9ba2ba99df8b922649924c0e7a Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/30722 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-19wtap.h: Fix documentation warningsJoerg Mayer1-2/+0
Change-Id: Ib0b5ae47047d3f574bd35cab045cefb8fcb8778d Reviewed-on: https://code.wireshark.org/review/30710 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-11-18Add an API to get the file extension for a compression type, and use it.Guy Harris5-56/+114
Add wtap_compressed_file_extension(), which returns NULL for WTAP_UNCOMPRESSED and the appropriate file extension for other compression types. Add wtap_compression_type_supported(), which returns TRUE for WTAP_UNCOMPRESSED and all supported compression types and FALSE otherwise. ("Supported" means "the code can decompmress files in that compression format and can write files in that compression format", so WTAP_GAIP_COMPRESSED is supported iff libwiretap is built with zlib.) In MainWindow::fileAddExtension, instead of checking for WTAP_GZIP_COMPRESSED and using ".gz" as the extension, use the extension returned by wtap_compressed_file_extension() for the compression type. Change-Id: I47cb0eca8c887ada3562df30b54e76509008180f Reviewed-on: https://code.wireshark.org/review/30707 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-17wiretap/merge.c: consolidate three similar merge_files routinesPeter Wu1-179/+46
The three merge_files routines (filename, tempfile, stdout) have exactly the same code except for a single wtap_dump_open routine. Reduce code duplication to ease further improvements to this file. Change-Id: I4fa890730d54c11b3614e56cf4d3d3da1ae9f5fd Reviewed-on: https://code.wireshark.org/review/30678 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16nettrace: Handle failure to parse IPv6.Anders Broman1-3/+6
Reading of Address needs refacoring. Change-Id: Icca094a50bda4314bda72005bfc0d722e3d185d2 Reviewed-on: https://code.wireshark.org/review/30672 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16Add an API to get a description of a compression type, and use it.Guy Harris2-1/+16
Add wtap_compression_type_description(), which returns NULL for WTAP_UNCOMPRESSED and a descriptive string for other compression types. Instead of checking for WTAP_GZIP_COMPRESSED and appending "(gzip compressed)", just pass the compression type to wtap_compression_type_description() and, if the result is non-null, append its result, wrapped in parentheses, with a space before the left parenthesis. Change-Id: I79a999c7838a883953795d5cbab009966e14b65e Reviewed-on: https://code.wireshark.org/review/30666 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16nettrace: fix var init.Dario Lombardo1-1/+3
Error: ../wiretap/nettrace_3gpp_32_423.c:745:47: error: missing field 'src_ip' initializer [-Werror,-Wmissing-field-initializers] exported_pdu_info_t exported_pdu_info = { 0 }; ^ 1 error generated. ninja: build stopped: subcommand failed. Change-Id: I6c083b474854ea062f0a1c9f94e83af83574fc91 Reviewed-on: https://code.wireshark.org/review/30661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16Use an enum for compression types in various interfaces.Guy Harris6-47/+74
This: 1) means that we don't have to flag the compression argument with a comment to indicate what it means (FALSE doesn't obviously say "not compressed", WTAP_UNCOMPRESSED does); 2) leaves space in the interfaces in question for additional compression types. (No, this is not part 1 of an implementation of additional compression types, it's just an API cleanup. Implementing additional compression types involves significant work in libwiretap, as well as UI changes to replace "compress the file" checkboxes with something to indicate *how* to compress the file, or to always use some other form of compression). Change-Id: I1d23dc720be10158e6b34f97baa247ba8a537abf Reviewed-on: https://code.wireshark.org/review/30660 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16Use the dump parameters structure for non-pcapng-specific stuff.Guy Harris5-102/+85
Use it for all the per-file information, including the per-file link-layer type and the per-file snapshot length. Change-Id: Id75687c7faa6418a2bfcf7f8198206a9f95db629 Reviewed-on: https://code.wireshark.org/review/30616 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-15Don't set anything in *wth until we've decided it's a Peek classic file.Guy Harris1-3/+5
Change-Id: I8b6f5b46cc578a65eec3e255d468d3841f9b0197 Reviewed-on: https://code.wireshark.org/review/30652 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-15nettrace: Parse IPv6 addresses.Anders Broman1-50/+137
Change-Id: Iad583c39605ed2dd7a1c64f3729500c6b8a31fd3 Reviewed-on: https://code.wireshark.org/review/30650 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-15Simplify code.Guy Harris1-6/+3
Just directly set wth->file_encap. Change-Id: I9fb3d34d3d46d9bef6b7206e25ba72049d9b12f1 Reviewed-on: https://code.wireshark.org/review/30648 Reviewed-by: Guy Harris <guy@alum.mit.edu>