aboutsummaryrefslogtreecommitdiffstats
path: root/extcap
AgeCommit message (Collapse)AuthorFilesLines
2022-04-04wsutil: Add configuration namespaces.Gerald Combs9-17/+17
Rename init_progfile_dir to configuration_init. Add an argument which specifies our configuration namespace, which can be "Wireshark" (default) or "Logwolf".
2022-03-21etwdump: Clarify "ETW".Gerald Combs1-1/+1
Not everyone knows what ETW is.
2022-03-14wiretap: have wtap_dump_close() provide a "needs to be reloaded" indication.Guy Harris1-2/+2
This allows the "needs to be reloaded" indication to be set in the close process, as is the case for ERF; having a routine that returns the value of that indication is not useful if it gets seet in the close process, as the handle for the wtap_dumper is no longer valid after wtap_dump_close() finishes. We also get rid of wtap_dump_get_needs_reload(), as callers should get that information via the added argument to wtap_dump_close(). Fixes #17989.
2022-03-13sshdump: fix remote-sudo parameter on restartDylan Ulis1-1/+1
2022-03-09extcap: new interface, wifidump, to capture Wi-Fi frames using a remote SSH hostAdrian Granados3-1/+772
2021-12-22Corrects repeated words throughout the code.Moshe Kaplan2-2/+2
Repeated words were found with: egrep "(\b[a-zA-Z]+) +\1\b" . -Ir and then manually reviewed. Non-displayed strings (e.g., in comments) were also corrected, to ease future review.
2021-12-22Use UINT64_C() with two constantsJoão Valverde1-2/+2
2021-12-21Extcap logging: Corrected incorrect selector default value syntaxj.novak@netsystem.cz1-2/+2
2021-12-21Clean up some printf() format stringsJoão Valverde1-9/+9
2021-12-19Replace g_strdup_printf() with ws_strdup_printf()João Valverde11-40/+40
Use macros from inttypes.h.
2021-12-19Replace g_snprintf() with snprintf()João Valverde2-14/+14
Use macros from inttypes.h with format strings.
2021-12-14wslog: Avoid logging any output to stdoutJoão Valverde1-0/+2
For historical reasons our logging inherited from GLib the logging of some levels to stdout. Namely levels "info" and "debug" (to which we added "noisy"). However this practice is discouraged because it mixes debug output with application output for CLI tools and breaks many common usage scenarios, like using tshark in pipes. This change flips the logic on wslog to make logging to stderr the default behavior. Extcap subprocess have a hidden dependency on stdout so add that. Some GUI users may also have a dependency on stdout. Because GUI tools are unlikely to depend on stdout for programatic output add another exception for wireshark GUI, to preserve backward compatibility.
2021-12-11Fix extcap-base.[ch] indentationJoão Valverde2-51/+50
Make header indentation consistent with C source. Fix EditorConfig settings.
2021-12-07extcap: Use standard --log-level and --log-file CLI optionsJoão Valverde2-43/+33
This should allow simultaneous logging to the console and the log file when running an extcap from the CLI. One difference is that the extcap error/warning dialogs in the GUI have extra information in standard wslog format (may or may not be a good thing).
2021-12-06Extcap: Improve the log handler logicJoão Valverde1-6/+14
If we have a log file write everything to the file, to provide a complete picture in the log. Debug information cannot be written to the parent process when running in child mode.
2021-12-06extcap: Register log handler conditionallyJoão Valverde1-1/+2
This matches the original implementation and allows displaying logs to the console, including debug information, when running an extcap from the CLI for testing and development purposes. This should make extcap logging bug-for-bug compatible with the behavior before dc7f0b88bb.
2021-12-06Extcap/ssh-base: Use password authentication before keysj.novak@netsystem.cz1-10/+20
2021-12-05Define more log domains for extcapsJoão Valverde7-0/+8
2021-12-03Fix logging with extcapsJoão Valverde10-34/+32
Extcaps require a log file when invoked in child mode. It also has a specific flag to enable debugging, other that the wslog options. Fix the logging to: 1. Enable debug log level if --debug is used. 2. Do not emit messages to the stderr if debug is enabled. This brings extcap logging to the same feature level it had before wslog replaced GLib logging.
2021-11-30extcap: Add header files to DoxygenMoshe Kaplan5-7/+10
Add @file markers for extcap headers so that Doxygen will generate documentation for them.
2021-10-22Add new global header wireshark.h with guidelineJoão Valverde1-0/+2
Remove ws_diag_control.h from config.h because that was a workaround for the lack of a public global header. Fix the resultant build errors.
2021-10-13extcap: reword error message referencing captypeChuck Craft8-8/+8
There exists a program called "captype" but it's not used here.
2021-09-30ws_getopt: Rename struct and macrosJoão Valverde11-73/+73
This is part of the API and should also be renamed to avoid conflicts.
2021-09-28Fix some spelling errors.Martin Mathieson1-2/+2
2021-09-22MinGW-w64: Fix extcap build output pathJoão Valverde1-1/+1
Build output must not be placed in run/<config>/subdir. This should be done using CMAKE_GENERATOR_IS_MULTI_CONFIG instead of just MSVC but that wasn't working for me when I tried briefly.
2021-09-22CMake: Remove an unnecessary version checkJoão Valverde1-2/+3
MINGW implies WIN32 which implies CMake >= 3.13. Follow-up to 1dad8190b1ec4ab730de428437f2f6bbbf7ce345.
2021-09-22CMake: Fix minimum version requirements for CentOS 8João Valverde1-7/+5
target_link_options() requires CMake >= 3.13.
2021-09-21MinGW-w64: Need to link using -municodeJoão Valverde1-0/+7
Some targets are not using unicode/WinMain (not sure why), so this really needs to be a per target setting (better anyway).
2021-09-20Fix config.h include orderJoão Valverde3-2/+1
The header "config.h" needs to be the first header included in the source file, no exceptions.
2021-09-17Use the musl in-tree getopt_long() everywhereJoão Valverde11-149/+126
Besides the obvious limitation of being unavailable on Windows, the standard is vague about getopt() and getopt_long() has many non-portable pitfalls and buggy implementations, that increase the maintainance cost a lot. Also the GNU libc code currently in the tree is not suited for embedding and is unmaintainable. Own maintainership for getopt_long() and use the musl implementation everywhere. This way we don't need to worry if optreset is available, or if the $OPERATING_SYSTEM version behaves in subtly different ways. The API is under the Wireshark namespace to avoid conflicts with system headers. Side-note, the Mingw-w64 9.0 getopt_long() implementation is buggy with opterr and known to crash. In my experience it's a headache to use the embedded getopt implementation if the system provides one.
2021-09-06dpauxmon(extcap): Fix Dead Store found by Clang AnalyzerAlexis La Goutte1-4/+7
dpauxmon.c:290:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores] dpauxmon.c:432:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores] dpauxmon.c:437:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores] dpauxmon.c:443:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores]
2021-08-20androiddump: get the WIRESHARK_UPPER_PDU tags from the header.Guy Harris1-5/+4
Don't define WIRESHARK_UPPER_PDU_TAG_DISSECTOR_NAME ourselves and use it, use EXP_PDU_TAG_PROTO_NAME from wsutil/exported_pdu_tlvs.h.
2021-08-20Move LINKTYPE_WIRESHARK_UPPER_PDU definitions to a separate header.Guy Harris1-7/+1
Have wsutil/exported_pdu_tlvs.h define the LINKTYPE_WIRESHARK_UPPER_PDU TLV type and length values, as well as the port type values written to files in EXP_PDU_TAG_PORT_TYPE TLVs. Update the comment that describes the LINKTYPE_WIRESHARK_UPPER_PDU TLVs to more completely and correctly reflect reality (it was moved from epan/exported_pdu.h to wsutil/exported_pdu_tlvs.h). Rename those port type values from OLD_PT_ to EXP_PDU_PT_; there is nothing "old" about them - yes, they originally had the same numerical values as the PT_ enum values in libwireshark, but that's no longer the case, and the two are now defined independently. Rename routines that map between libwireshark PT_ values and EXP_PDU_PT_ values to remove "old" from the name while we're at it. Don't include epan/exported_pdu.h if we only need the LINKTYPE_WIRESHARK_UPPER_PDU definitions - just include wsutil/exported_pdu_tlvs.h. In extcap/udpdump.c, include wsutil/exported_pdu_tlvs.h rather than defining the TLV types ourselves.
2021-08-20Use the wsutil/pint.h functions to fill in "exported PDU" headers.Guy Harris1-24/+19
That makes the code cleaner, including making it clearer that the fields in those headers are big-endian.
2021-07-21CMake: Remove unneeded GLIB2_LIBRARIES.Gerald Combs1-10/+1
GLib is part of wsutil's link interface, so we don't need to link to it explictly.
2021-07-20CMake: add GCRYPT to sdjournal_LIBSJoakim Karlsson1-0/+1
2021-07-19Carry drop count/packet ID/queue ID as options on packet blockDavid Perry1-1/+0
2021-07-12etwdump: Fixup our rec struct syntax.Gerald Combs1-2/+2
Fix ``` C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232: '->block': left operand has 'struct' type, use '.' [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj] C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232: rec->block = wtap_block_create(WTAP_BLOCK_PACKET); [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj] C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232: ^ [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj] C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(591,39): error C2232: '->block': left operand has 'struct' type, use '.' [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj] C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(591,39): error C2232: ^ [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj] ```
2021-07-12Carry EPB flags as an option on the packet blockDavid Perry2-3/+2
As requested by [this comment][1] on !2859, move `pack_flags` from a dedicated field in `wtap_rec` to a block option on the packet block in `wtap_rec.block`. [1]: https://gitlab.com/wireshark/wireshark/-/merge_requests/2859#note_615984624
2021-07-07Use wtap_blocks for packet commentsDavid Perry1-2/+1
Mostly functioning proof of concept for #14329. This work is intended to allow Wireshark to support multiple packet comments per packet. Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`. It attaches a `wtap_block` structure to `wtap_rec` in place of its current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT and OPT_PKT_VERDICT option values.
2021-06-26wslog: Check environment initialization for errorsJoão Valverde8-7/+25
Initialiaze the cmdarg error stream earlier. Dumpcap also needs to know earlier if it is running in capture child mode.
2021-06-21wslog: Check if we are initialized and add missing initsJoão Valverde8-14/+24
Instead of receiving the program name from GLib, pass it explicitly to ws_log_init() instead and use that to initialize the GLib program name. ws_log_parse_args() will now exit the program when it encounters an argument error if exit_failure >= 0.
2021-06-19Replace g_assert() with ws_assert()João Valverde1-2/+3
2021-06-17Make various names match the name of the systemd journal export block.Guy Harris1-2/+2
The name of the block, in the pcapng specification is the systemd Journal Export Block; add "export" after "journal" in various variable/enum/define names.
2021-06-16dissectors: Replace g_log() with ws_log()João Valverde2-0/+2
2021-06-16Replace g_log() calls with ws_log()João Valverde11-304/+314
2021-06-14wslog: Parse cmd line options in one passJoão Valverde2-10/+2
2021-06-14wslog: Include pid in formatJoão Valverde2-0/+4
2021-06-14wslog: Add support for domain filteringJoão Valverde2-0/+2
A domain filter can be given in the environment variable 'WS_LOG_DOMAINS' or in a command-line options "--log-domains". The filter is specified as a comma separated case insensitive list, for example: ./tshark --log-domains=main,capture Domain data type switches from an enum to a string. There is no constaint on adding new domains, neither in code or at runtime. The string format is arbitrary, only positive matches will produce output.
2021-06-11Refactor our logging and extend the wslog APIJoão Valverde4-36/+40
Experience has shown that: 1. The current logging methods are not very reliable or practical. A logging bitmask makes little sense as the user-facing interface (who would want debug but not crtical messages for example?); it's computer-friendly and user-unfriendly. More importantly the console log level preference is initialized too late in the startup process to be used for the logging subsystem and that fact raises a number of annoying and hard-to-fix usability issues. 2. Coding around G_MESSAGES_DEBUG to comply with our log level mask and not clobber the user's settings or not create unexpected log misses is unworkable and generally follows the principle of most surprise. The fact that G_MESSAGES_DEBUG="all" can leak to other programs using GLib is also annoying. 3. The non-structured GLib logging API is very opinionated and lacks configurability beyond replacing the log handler. 4. Windows GUI has some special code to attach to a console, but it would be nice to abstract away the rest under a single interface. 5. Using this logger seems to be noticeably faster. Deprecate the console log level preference and extend our API to implement a log handler in wsutil/wslog.h to provide easy-to-use, flexible and dependable logging during all execution phases. Log levels have a hierarchy, from most verbose to least verbose (debug to error). When a given level is set everything above that is also enabled. The log level can be set with an environment variable or a command line option (parsed as soon as possible but still later than the environment). The default log level is "message". Dissector logging is not included because it is not clear what log domain they should use. An explosion to thousands of domains is not desirable and putting everything in a single domain is probably too coarse and noisy. For now I think it makes sense to let them do their own thing using g_log_default_handler() and continue using the G_MESSAGES_DEBUG mechanism with specific domains for each individual dissector. In the future a mechanism may be added to selectively enable these domains at runtime while trying to avoid the problems introduced by G_MESSAGES_DEBUG.