Commit Graph

786 Commits

Author SHA1 Message Date
João Valverde 01001485b9 wslog: Add a new log-fatal option
Enviroment variable WIRESHARK_LOG_FATAL and command line
option --log-fatal set the fatal log level. Messages with
fatal or highr priority cause the program to abort. By
default the fatal level is "error", but it can be set to
"critical" or "warning" with this option.
2021-06-17 12:00:09 +01:00
Guy Harris e5ce3345db tvbuff: add tvb_ensure_reported_length_remaining().
It is to tvb_reported_length_remaining() as
tvb_ensure_captured_length_remaining() is to
tvb_captured_length_remaining() - it throws an exception if the offset
is out of range.

(Note that an offset that's just past the end of the {reported,
captured} data is *not* out of range, it just means that there is no
data remaining.  Anything *past* that is out of range and thus invalid.)
2021-06-15 13:32:46 -07:00
João Valverde 2c6d897b58 wslog: Add ws_logv_full() 2021-06-15 18:51:40 +01:00
Gerald Combs 147e7dce04 Debian: Remove a symbol.
Remove ws_log_fprint.
2021-06-15 00:39:02 -07:00
João Valverde 69a217b95b wslog: Use buffered I/O
Use standard buffered I/O instead of printing to a string.
This is more efficient, cleaner and allows custom output per stream.
2021-06-14 22:05:35 +00:00
João Valverde e86ac706ca wslog: Parse cmd line options in one pass 2021-06-14 22:05:35 +00:00
João Valverde 5a662ba3fb wslog: Add support for domain filtering
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-14 13:13:12 +01:00
João Valverde 82739fc4f5 wslog: Improve code modularity and efficiency
Also tweak format for readability.
2021-06-14 13:13:12 +01:00
John Thacker 73256b3fb7 Remove lingering circuit API from stream.h
The circuit API was removed and replaced with the conversation
"_by_id" API that uses a single uint32 value by commit
800b26edbe

Remove the lingering references to circuits from the stream API,
since it's just used with conversations now.
2021-06-13 11:51:44 +00:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
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.
2021-06-11 09:40:28 +00:00
Stig Bjørlykke 5dbaa8d3b2 wsutil: Add filesystem write_file_binary_mode()
Add a generic function to write content to file. Use this on write
TLS session keys from UI and tshark, and for export objects.

Remove the now unused export_object_ui.[ch].
2021-06-07 06:24:28 +00:00
João Valverde c015257c9f wslog: Include function name in ws_debug() output format
The GLib documentation says G_STRLOC includes the function name
but that is a lie[1]. Change ws_debug() to not use G_STRLOC and receive
__FILE__, __LINE__ and G_STRFUNC separately instead.

[1]https://bugzilla.gnome.org/show_bug.cgi?id=69097
2021-06-06 19:48:53 +00:00
Guy Harris 7477431325 wiretap: un-export some routines.
wtap_file_get_shb_for_new_file() and wtap_file_get_nrb_for_new_file()
are intended to be used only internally to libwiretap and by libwiretap
plugins.
2021-05-31 04:39:59 -07:00
Anders Broman 71e6b0498a http: Add dissection of HTTP2-Settings
Closes #17370
2021-05-08 17:14:45 +00:00
David Perry c0abaa06f7 maxmind: add optional synchronous lookups
When tshark enables synchronous resolution of IP addresses to names,
forces calls to maxmind_db_lookup_ipv4()/_ipv6() to block-wait for the
maxmind response.

Proposed fix for #14691.
2021-04-02 06:48:42 +00:00
Dario Lombardo ea929d6401 wsutils: add local implementation of g_memdup2.
g_memdup() was deprecated and replaced with g_memdup2() in GLib 2.68,
we provide our own copy of g_memdup2() for older GLib versions.
2021-03-25 09:38:10 +00:00
Guy Harris c33e2f7b51 Add more error-reporting routines that call through a function pointer.
Have routines to report capture-file errors, using libwireshark error
codes and strings, that call through a pointer, so they can pop up
dialogs in GUI apps, print a message to the standard error on
command-line apps, and possibly do something different on server
programs.

Have init_report_message() take a pointer to structure containing those
function pointers, rather than the function pointers themselves, as
arguments.

Make other API changes to make that work.
2021-03-15 12:17:59 -07:00
Guy Harris 03d6f39a99 libwiretap: make wtap_wtap_encap_to_pcap_encap() private to the library.
Only a tiny amount of code outside libwiretap needs to know about
pcap/pcapng LINKTYPE_ values, and all that code needs to know is, for a
given LINKTYPE_ value, what the corresponding WTAP_ENCAP_ value is.
Nothing should need to know, for a given WTAP_ENCAP_ value, what its
LINKTYPE_ value is.

Make it the case that nothing *does* need to know, for a given
WTAP_ENCAP_ value, what its LINKTYPE_ value is.  Export
wtap_dump_can_write_encap() and use *that*, in the "import hex dump"
code, what formats can be written to a pcap file.
2021-03-14 14:22:16 -07:00
Guy Harris c92f22d034 debian: wtap_register_backwards_compatibility_lua_name isn't a public API.
It's *not* for use by plugins, it's *only* for use by existing built-in
file type/subtype modules to provide support for an old deprecated
mechanism in Lua code.
2021-03-13 18:11:05 -08:00
João Valverde 4628a60740 debian: config.h is not a public header
The configuration of the build machine is not part of our public
API. 'config.h' must not be installed with system headers,
otherwise it generates all sorts of collisions and generally makes
life unpleasant.
2021-03-04 10:16:41 +00:00
Thomas Dreibholz 404f619ea2 Added decoding of ProtocolID and PPID into Component Status Protocol dissector.
This merge request adds:
* Decoding of ProtocolID and PPID in Component Status Protocol dissector.
* Moved SCTP PPID list from SCTP dissector into separate file sctpppids.c,
  due to reuse in Component Status Protocol dissector.
* Export of sctpppid_val_ext containing the PPID list.
2021-02-26 15:31:44 +00:00
Guy Harris ed86f51e49 wiretap: rename wtap_register_file_type_subtypes().
It only registers one file type/subtype, so rename it to
wtap_register_file_type_subtype().

That will also force plugins to be recompiled; that will produce compile
errors for some plugins that didn't change to match the new contents of
the file_type_subtype_info structure.

Also check to make sure that the registered file type/subtype supports
at least one type of block; a file type/subtype that doesn't return
*any* blocks and doesn't permit *any* block types to be written is not
very useful.  That should also catch most if not all other plugins that
didn't change to match the new contents of the file_type_subtype_info
structure.

Don't make errors registering a file type/subtype fatal; just complain,
don't register the bogus file type/subtype, and drive on.
2021-02-23 20:39:16 -08:00
Guy Harris 166159f15d wiretap: eliminate the pcap/nspcap/pcapng WTAP_FILE_TYPE_SUBTYPE_ values.
Register the pcap and pcapng file types/subtypes rather than hardwiring
them into the table.

Call the registration routines for them directly, rather than through a
generated table; they're always supposed to be there, as some code in
Wireshark either writes only one of those formats or defaults to writing
one of those formats.  Don't run their source code through the
registration-routine-finder script.

Have the file type/subtype codes for them be directly exported to the
libwiretap core, and provide routines to return each of them, to be used
by the aforementioned code.

When reporting errors with cfile_write_failure_message(), use
wtap_dump_file_type_subtype() to get the file type/subtype value for the
wtap_dumper to which we're writing, rather than hardcoding it.

Have the "export PDU" code capable of supporting arbitrary file
types/subtypes, although we currently only use pcapng.

Get rid of declarations of now-static can_write_encap and
dump_open routines in various headers.
2021-02-23 21:56:20 +00:00
Thomas Dreibholz 2e7f2ffb7a
Added "Follow DCCP stream" feature.
This pull request includes:
* The "Follow DCCP stream" feature.
* Updated docbook documentation for the "Follow DCCP stream" feature.
* Test for the feature.
* Corresponding packet trace for the test.
2021-02-22 12:48:46 +01:00
Grzegorz Niemirowski a57a32c04e ZVT: Addedd dissection of amount, terminal ID, date and time. Registration fix. 2021-02-22 10:39:54 +01:00
Guy Harris 842a7cccf9 wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported.  Indicate whether "supported" means "one instance" or
"multiple instances".

"Supports" doesn't just mean "can be written", it also means "could be
read".

Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file.  Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).

Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.

Provide backwards compatibility for Lua.

This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 23:18:35 +00:00
Guy Harris 1f595c435c BER: get rid of WTAP_FILE_TYPE_SUBTYPE_BER.
Save a copy of the pathname used to open a file in the wtap structure.
This allows the BER file reader to put a pointer to it in the
pseudo-header; it also would allow file readers to attempt to read
"associated" files that have the same name as the file, but with a
different extension.

Instead of having cf_open() special-case BER files, and calling a
routine in the BER dissector to specify the file name to the dissector,
have separate dissectors for "dissect packet payload as BER" and
"dissect a file as BER", and have the latter get the pathname of the
file from the pseudo-header and determine the ASN.1 syntax from that.

(Side-effect - this means that you can now dissect a BER file, and have
the syntax be determined by the file extension, in TShark as well; the
above cf_open() special-casing was *not* done in TShark, so it didn't
work before.  Now the application code doesn't need to do any of that,
so it works in TShark as well as Wireshark.)
2021-02-20 01:36:26 -08:00
Guy Harris a7256d50b5 wiretap: more work on file type/subtypes.
Provide a wiretap routine to get an array of all savable file
type/subtypes, sorted with pcap and pcapng at the top, followed by the
other types, sorted either by the name or the description.

Use that routine to list options for the -F flag for various commands

Rename wtap_get_savable_file_types_subtypes() to
wtap_get_savable_file_types_subtypes_for_file(), to indicate that it
provides an array of all file type/subtypes in which a given file can be
saved.  Have it sort all types, other than the default type/subtype and,
if there is one, the "other" type (both of which are put at the top), by
the name or the description.

Don't allow wtap_register_file_type_subtypes() to override any existing
registrations; have them always register a new type.  In that routine,
if there are any emply slots in the table, due to an entry being
unregistered, use it rather than allocating a new slot.

Don't allow unregistration of built-in types.

Rename the "dump open table" to the "file type/subtype table", as it has
entries for all types/subtypes, even if we can't write them.

Initialize that table in a routine that pre-allocates the GArray before
filling it with built-in types/subtypes, so it doesn't keep getting
reallocated.

Get rid of wtap_num_file_types_subtypes - it's just a copy of the size
of the GArray.

Don't have wtap_file_type_subtype_description() crash if handed an
file type/subtype that isn't a valid array index - just return NULL, as
we do with wtap_file_type_subtype_name().

In wtap_name_to_file_type_subtype(), don't use WTAP_FILE_TYPE_SUBTYPE_
names for the backwards-compatibility names - map those names to the
current names, and then look them up.  This reduces the number of
uses of hardwired WTAP_FILE_TYPE_SUBTYPE_ values.

Clean up the type of wtap_module_count - it has no need to be a gulong.

Have built-in wiretap file handlers register names to be used for their
file type/subtypes, rather than building the table in init.lua.

Add a new Lua C function get_wtap_filetypes() to construct the
wtap_filetypes table, based on the registered names, and use it in
init.lua.

Add a #define WSLUA_INTERNAL_FUNCTION to register functions intended
only for internal use in init.lua, so they can be made available from
Lua without being documented.

Get rid of WTAP_NUM_FILE_TYPES_SUBTYPES - most code has no need to use
it, as it can just request arrays of types, and the space of
type/subtype codes can be sparse due to registration in any case, so
code has to be careful using it.

wtap_get_num_file_types_subtypes() is no longer used, so remove it.  It
returns the number of elements in the file type/subtype array, which is
not necessarily the name of known file type/subtypes, as there may have
been some deregistered types, and those types do *not* get removed from
the array, they just get cleared so that they're available for future
allocation (we don't want the indices of any registered types to changes
if another type is deregistered, as those indicates are the type/subtype
values, so we can't shrink the array).

Clean up white space and remove some comments that shouldn't have been
added.
2021-02-17 21:54:28 +00:00
Guy Harris 24acef0885 wiretap: file types have a name and a description.
The "short name" is really just the name, used to look it up.  The
"name" is really a description intended solely for human consumption.
Rename the fields, and the functions that access them, to match.

The "description" maintained by Lua for file type handlers is used
*only* for one debugging message; we should probably just eliminate it.
Call it an "internal description" for now.
2021-02-13 01:25:39 -08:00
Guy Harris a1e03ea89e Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific".  Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).

For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support).  For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.

Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 09:05:41 +00:00
Guy Harris f0c54cc480 wiretap: add an API to get the type of a block.
When registering a custom block type, set the block type field of the
wtap_blocktype_t structure.  (We may do custom blocks differently, so
this is just for now.)

When registering a standard block type, don't pass in the block type, as
we can just use the type in the wtap_blocktype_t structure.
2021-02-09 21:23:44 -08:00
João Valverde 89fee9321e Avoid exposing HAVE_PLUGINS in the public API
Instead *_register_plugin() is turned into a noop (with a warning).

The test suit is failing with ENABLE_PLUGINS=Off (it was already failing
before and this patch didn't affect that).

Closes #17202.
2021-02-06 16:35:51 +00:00
Jirka Novak 66d84fc567 RTP dissector: Removed unused functions
Removed unused functions found by Martin Mathieson.
2021-02-04 19:50:47 +00:00
Guy Harris 0773147a55 wiretap: redo the way we handle if_filter IDB options.
Change the data structure for that option to have a type field,
indicating that it's either a pcap filter string or a BPF program,
followed by a union with a string-pointer member for pcap filter strings
and an instruction-count-and-pointer-to-instructions structure for BPF
programs.

Have routines to add, set, and fetch that option that handle that
structure; discard the "generic structured option" routines.  That means
there's more type checking possible at compile time.

Add more code to handle BPF programs.

When writing pcapng files, check, both for that option and for string
options, whether the option length is too big for the data to fit in a
pcapng option, and don't write it if it is.  (XXX - truncate the data?
Report an error?)
2021-02-01 16:50:01 -08:00
Guy Harris 1f15c0899e epan: have a routine to register all tap listeners.
Pull the code to register plugin taps, and the loop to register built-in
taps, into a single register_all_tap_listeners() routine.

This leaves it up to libwireshark, not to the programs using it, to know
how to register them.
2021-01-30 21:15:30 -08:00
Guy Harris 3db10d02e9 wiretap: add wtap_block_set_nth_string_option_value_format().
We have wtap_block_set_string_option_value(),
wtap_block_set_string_option_value_format(), and
wtap_block_set_nth_string_option_value(); complete the collection and
win valuable prizes.
2021-01-30 18:45:03 +00:00
Guy Harris ca85c516fe Refer to options whose data isn't a simple data type as "structured".
"Custom", as in "requires custom handling of the option data, collides
with "custom", as in pcapng custom options.
2021-01-30 00:12:11 -08:00
Martin Kaiser f4ac70818a stat_tap_table_ui: create tables only once during init
If you load a capture file and open any statistics dialog, you'll see the
list of collected items. Each time you press the Apply button (without entering a
display filter) another list of items will be created as a top-level entry
of the statistics tree. Only the first list will have the correct values,
all subsequent lists will not be populated.

Each statistic module defines a stat_tap_table_ui structure that contains a
stat_tap_init_cb function. This init function is called by
SimpleStatisticsDialog::fillTree before the tap listener is registered. This
happens each time we collect the statistics.

However, it seems that all init functions create a new stat_tap_table each
time they are called, even if they already have an existing stat_tap_table
of the same name.

This patch adds a stat_tap_find_table function to find a table by name.

As a first step, we update the ANSI A-I/F BSMAP Statistics to check if its
table is already registered. If it is, the table will not be created again.
2021-01-28 13:41:08 +00:00
Chema Gonzalez 03baf65ae7 editcap: add support for epoch timestamps in `-A` and `-B` options
Inspired in https://gitlab.com/wireshark/wireshark/-/merge_requests/1618.

Tested:

Timestamps on file used for comparison:
```
$ tshark -r test/captures/snakeoil-dtls.pcap -T fields -e frame.time_epoch
1150121069.248818000
1150121069.249193000
1150121069.251152000
1150121069.251384000
1150121069.293686000
1150121069.319315000
1150121075.230753000
1150121105.510885000
1150121105.510934000
```

Before:
```
$ ./build/run/editcap -B 1150121069.3 test/captures/snakeoil-dtls.pcap -
editcap: "1150121069.3" isn't a valid date and time
$ ./build/run/editcap -A 1150121069.3 test/captures/snakeoil-dtls.pcap -
editcap: "1150121069.3" isn't a valid date and time
$ ./build/run/editcap -A 1150121069 test/captures/snakeoil-dtls.pcap -
editcap: "1150121069" isn't a valid date and time
$ ./build/run/editcap -B 1150121069 test/captures/snakeoil-dtls.pcap -
editcap: "1150121069" isn't a valid date and time
```

After:
```
$ ./build/run/editcap -A 1150121069.3 test/captures/snakeoil-dtls.pcap - | tshark -r - -T fields -e frame.time_epoch
1150121069.319315000
1150121075.230753000
1150121105.510885000
1150121105.510934000
$ ./build/run/editcap -A 1150121069 test/captures/snakeoil-dtls.pcap - | tshark -r - -T fields -e frame.time_epoch
1150121069.248818000
1150121069.249193000
1150121069.251152000
1150121069.251384000
1150121069.293686000
1150121069.319315000
1150121075.230753000
1150121105.510885000
1150121105.510934000
$ ./build/run/editcap -B 1150121069.3 test/captures/snakeoil-dtls.pcap - | tshark -r - -T fields -e frame.time_epoch
1150121069.248818000
1150121069.249193000
1150121069.251152000
1150121069.251384000
1150121069.293686000
$ ./build/run/editcap -B 1150121069 test/captures/snakeoil-dtls.pcap - | tshark -r - -T fields -e frame.time_epoch
```
2021-01-11 18:01:08 +00:00
David Perry b758fdaede Add iso8601_to_nstime() for editcap and nettrace
This adds a function to parse a string date-time in ISO 8601 format into
a `nstime_t` structure. It's based on code from epan/tvbuff.c and
wiretap/nettrace_3gpp_32_423.c and meant to eventually replace both.
(Currently only replaces the latter.)

Since most of Wireshark expects ISO 8601 date-times to fit a fairly
strict pattern, iso8601_to_nstime() currently rejects date-times without
separators between the components, even though ISO 8601 actually permits
this. This could be revisited later.

Also uses iso8601_to_nstime in editcap to parse the -A/-B options,
thus allowing the user to specify a time zone if desired. (See #17110)
2021-01-08 09:18:39 +00:00
Dr. Lars Völker 8902386c76 UAT: Adding support for uint64 (dec/hex), int64 (dec)
This patch adds 64bit support for uint and int to uats.
2021-01-05 11:20:47 +00:00
Gerald Combs a7c6de4c66 GitLab CI: Build merge-req:ubuntu-dpkg using Ninja.
ubuntu-dpkg is currently the slowest of the merge-req pipelines. Newer
versions of dh have a "cmake+ninja" buildsystem, so try using it
instead.
2020-12-29 10:09:36 +00:00
Anders Broman 1694820e84 GTPv2: Update IE 8.12 Indication 2020-12-17 12:35:01 +00:00
Peter Eszlari 42a09ad02e Linux: rename metadata according to spec
https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Application.html

https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id
2020-12-10 18:11:12 +00:00
Stig Bjørlykke 9cafd342ac Lua: Add get_preference() and set_preference() utility functions.
Support uint, bool, enum, string, range, filename and directory preferences.
Added apply_preferences() to write to file and apply changes.
2020-12-08 22:56:50 +00:00
Gerald Combs f21cd2e23f wiretap: Convert ascend.y to Lemon.
Convert wiretap/ascend.y.in from Bison/YACC to Lemon and rename it to
wiretap/ascend_parser.lemon. Tighten up some of our scanning and
parsing. Make the indentation in it and related files consistent. Aside
from the recent IPv4 fragment offset changes, this produces identical
output to the 3.4 branch for the Ascend trace files I have here.

Remove the comment about supporting other commands. Another timeline
might have an Ascend that successfully pivoted to DSL or 15625B+1D
gigabit ISDN, but this one has neither.

This was our last/only Bison/YACC file, so remove Bison/YACC as a
development and packaging dependency and remove references to it from
the documentation.
2020-11-30 08:15:43 +00:00
Gerald Combs 3a7966c716 Qt+epan: Print better-looking values in the packet diagram.
Pull the value-formatting code in proto_custom_set into
proto_item_fill_display_label. Use that in FieldInformation::toString
instead of fvalue_to_string_repr. Fixes #16911.
2020-11-13 19:41:51 +00:00
Gerald Combs 4653955957 Version: 3.3.0 → 3.5.0. 2020-10-22 19:15:42 +00:00
Guy Harris d0270415a9 editcap, tshark: process IDBs in the middle of input files.
Instead of grabbing the set of IDBs found at open time, have a loop
using wtap_get_next_interface_description() to read all unread IDBs run
after opening the input file, after reading a packet from the input
file, and after getting an EOF on the input file.

Add a routine wtap_uses_interface_ids() to check whether the file type
and subtype for a dump file uses interface IDs and requires IDBs.  If
so, in the aforementioned loop, add the IDBs to the dump stream.

Add a routine wtap_dump_add_idb() to add IDBs to a dump stream.  Have it
call a file-format-specific routine to add the IDBs; the only file type
that supports it is pcapng, and it 1) writes out the IDB and 2) adds it
to the set of IDBs for the stream.

Add a wtap_dump_params_init_no_idbs() routine that prevents the IDBs
from the input file from being used to initialize the output file; use
it in cases where we're using the aforementioned loop to copy over IDBs.

Don't require any IDBs to be present when opening a pcapng file for
writing; 1) the simplest pcapng file has just an SHB in it, 2) that
requirement causes dumps that don't provide IDBs at open time to fail,
and 3) the real issue is that we don't want packets with an interface ID
not corresponding to a known IDB, and we already have a check for that.

(There are some hacks here; eventually, when everything processes the
IDBs in such a loop, we may be able to get rid of the "two favors of
dump parameter initialization" hack.)

Fixes #15844.

Addresses the same issue in #15502, but there are other issues there
that also need to be addressed.

In addition, the merge code also needs to be changed to handle this.
2020-10-22 02:58:07 -07:00
Guy Harris 7c488e4c71 Add a routine to make a newly-allocated copy of a block.
It currently wraps wtap_block_create() and wtap_block_copy(); if there
are no remaining use cases for wtap_block_copy() at some point, it can
just *replace* wtap_block_copy().
2020-10-21 19:10:49 -07:00
Guy Harris b478e60b29 Add a routine to get the next as-yet-unfetched interface description.
In a wtap, keep track of the first interface description not yet fetched
with wtap_get_next_interface_description() and, when
wtap_get_next_interface_description() is called, have it return that
description, as a wtap_block_t for its IDB.  If there are no
as-yet-unfetched interface descriptions, return NULL; there may, in the
future, be more interface descriptions for the file, so this should be
called:

* after the file is opened;

* after wtap_read() returns TRUE, indicating that it's returned a
record (and *before* you process the record that wtap_read()
returns, as it might be the interface description for the
interface on which the packet in that record arrived);

* after wtap_read() returns FALSE, indicating an EOF or an error
return (as there might have been interfaces at the end of the
file or before the error point).

At each of those points, the caller should loop until
wtap_get_next_interface_description() returns NULL.

Not used yet (but tested with capinfos, which found a reason why you
have to wait until the end of the file before processing the interface
information - there's now a comment in the code giving that reason).

This will probably be used in the future.
2020-10-21 17:57:17 +00:00
John Thacker e20bd408de Use iconv to support GB 18030 and EUC-KR, allow future encodings
Add support internally to using iconv (always present with glib) to convert
strings from various encodings to UTF-8 (using REPLACEMENT CHARACTER as
recommended), and use that to support GB 18030 and EUC-KR. Replace call
directly to iconv in ANSI 637 for EUC-KR to new API. Update comments
and documentation around character encodings. It is possible to replace
the calls to iconv with an internal decoder later. Tested on Linux and
on Windows (including with illegal characters). Closes #16630.
2020-10-21 11:26:23 +00:00
Guy Harris a11b9fb7a0 Add an API to determine whether a file type uses interface IDs.
Currently, the only file types that use them are pcapng and IBM's
iptrace; we don't support writing the latter, so this is mainly of
interest for pcapng.

This makes it a bit more obvious what some "is this pcapng?" tests are
really trying to determine, and allows them to automatically support any
new file types that use them.

(With regard to interface descriptions, tere are three types of file:

1) files that contain no interface information;

2) files that contain "just FYI" interface information but that don't
tie packets or other records to particular interfaces;

3) files that contain interface information and tie all packets (and
possibly other records) to an interface.

This tests for files of type 3.)
2020-10-20 00:39:37 -07:00
John Thacker 91b792c6dc Replace ill-formed UTF-8 byte sequences with replacement character
Implement the Unicode Standard "best practices" for replacing ill-formed
sequences with the Unicode REPLACEMENT CHARACTER. Add wmem_strbuf_append_len
for appending strings with embedded null characters. Clarify why
wmem_strbuf_grow() doesn't always ensure that there's enough room for
a new string, and short-circuit some tests there. Related to #14948
2020-10-15 21:48:28 +00:00
Pascal Quantin 4744523f92 debian: proto_tree_add_item_ret_ipv4() was introduced in 3.3.2 2020-10-15 08:26:15 +02:00
Guy Harris 5dd6fc9459 Add proto_tree_add_item_ret_ipv4().
Change some guint32's to ws_in4_addr while we're at it.
2020-10-11 17:54:58 -07:00
Guy Harris e013c5ec7f Clean up URLs.
Add ui/urls.h to define some URLs on various of our websites.  Use the
GitLab URL for the wiki.  Add a macro to generate wiki URLs.

Update wiki URLs in comments etc.

Use the #defined URL for the docs page in
WelcomePage::on_helpLabel_clicked; that removes the last user of
topic_online_url(), so get rid of it and swallow it up into
topic_action_url().
2020-10-02 20:13:42 -07:00
Gerald Combs 4a82dd165b Version: 3.3.1 → 3.3.2. 2020-10-01 12:18:35 -07:00
Guy Harris c597927da8 Add some more string encodings.
Add an encoding for "unpacked" 3GPP TS 23.038 7-bit strings, in which
each code position is in a byte of its own, rather than with the code
positions packed into 7 bits.  Rename the packed encoding to explicitly
indicate that it's packed.

Add an encoding for ETSI TS 102 221 Annex A strings.

Use the new encodings.
2020-09-28 22:30:35 +00:00
Gerald Combs 573894d870 Version: 3.3.0 → 3.3.1. 2020-09-15 17:29:32 -07:00
Tomas Kukosa 82a4968bc3 plugin_if: add plugin_if_get_frame_data() and plugin_if_get_capture_file()
Change-Id: I7505d4185f18d13d6836c9c9bb8f400d12f2a524
Reviewed-on: https://code.wireshark.org/review/38217
Petri-Dish: Tomáš Kukosa <keksa@email.cz>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2020-08-22 05:32:29 +00:00
Filipe Laíns e59b3c2338 tvb: add tvb_get_bits_array
Change-Id: I2fad824ca417dcd089fabfdf06f28529c7ee9e87
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Reviewed-on: https://code.wireshark.org/review/37949
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-21 03:38:45 +00:00
Filipe Laíns 4215a55c7d wmem_array: make wmem_array_grow public
There cases where we may want to pre-allocate some memory before
appending all the fields.

Change-Id: Ic46e83733d4338dbda45b2ca3ff2d533c5b44026
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Reviewed-on: https://code.wireshark.org/review/38122
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-20 08:15:57 +00:00
Guy Harris 35418a73f7 Add format_text_string(), which gets the length with strlen().
format_text(alloc, string, strlen(string)) is a common idiom; provide
format_text_string(), which does the strlen(string) for you.  (Any
string used in a %s to set the text of a protocol tree item, if it was
directly extracted from the packet, should be run through a format_text
routine, to ensure that it's valid UTF-8 and that control characters are
handled correctly.)

Update comments while we're at it.

Change-Id: Ia8549efa1c96510ffce97178ed4ff7be4b02eb6e
Reviewed-on: https://code.wireshark.org/review/38202
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-20 07:24:32 +00:00
Martin Mathieson 3b67c5b308 TFS: Add some commonly-defined string pairs to tfs.c
'check_tfs.py --common'    can look for tfs values that appear multiple times.
Current output prior to these dssector changes was:

('No Extension', 'Extension') appears 3 times in:  ['epan/dissectors/packet-bssap.c', 'epan/dissectors/packet-camel.c', 'epan/dissectors/packet-gsm_map.c']
('Optimised for signalling traffic', 'Not optimised for signalling traffic') appears 3 times in:  ['epan/dissectors/packet-gsm_a_gm.c', 'epan/dissectors/packet-gsm_map.c', 'epan/dissectors/packet-gtp.c']
('Data PDU', 'Control PDU') appears 3 times in:  ['epan/dissectors/packet-pdcp-lte.c', 'epan/dissectors/packet-pdcp-nr.c', 'epan/dissectors/packet-rlc-nr.c']
('Message sent to originating side', 'Message sent from originating side') appears 3 times in:  ['epan/dissectors/packet-q2931.c', 'epan/dissectors/packet-q931.c', 'epan/dissectors/packet-q933.c']
('User', 'Provider') appears 3 times in:  ['epan/dissectors/packet-q2931.c', 'epan/dissectors/packet-q931.c', 'epan/dissectors/packet-q933.c']

The first and last ones were made common, the others seem a little too specialised.

Checking some of the existing items in tfs.c (using QtCreator's 'Find Usages'),
some of the common items are used a lot, but many of them are not referenced.

Change-Id: Ia4006d2c4fa7cafbc3b004dc7a367a986dbeb0c4
Reviewed-on: https://code.wireshark.org/review/38177
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-17 02:58:01 +00:00
Gerald Combs c2075185de epan: Fixup proto_item_set_bits_offset_len.
Export proto_item_set_bits_offset_len and fix

In file included from ../epan/dfilter/dfilter.h:18:
../epan/proto.h:1113:11: warning: parameter 'bits_offset' is already documented [-Wdocumentation]
 * @param bits_offset The new length in bits.
          ^~~~~~~~~~~
../epan/proto.h:1112:5: note: previous documentation
 * @param bits_offset The number of bits from the beginning of the field.
    ^     ~~~~~~~~~~~

Change-Id: Ib171ce38607b9656baea5eb7a3e6aee3b99ddbac
Reviewed-on: https://code.wireshark.org/review/38115
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>
2020-08-11 03:25:17 +00:00
Guy Harris 12621c5b64 wiretap: add a routine to add a "fake" IDB.
It generates a fake IDB for files that don't have interface information
and that have a per-file encapsulation type, snapshot length, and time
stamp precision, and adds it to the file's list of IDBs.

Use it for libpcap.

We will use it later for other file formats, so that code such as the
mergecap code to merge into a pcapng file can handle input files that
don't have interface information.

(We should have a way to indicate whether the IDBs are real or fake, so
that capinfos and Statistics > Capture File Properties don't report
meaningless IDB information and make it look as if it's known that the
capture was done on one interface with the properties in question.)

Change-Id: Iec124bf3c7cbd4c69ec2ac7d0dd776e5287f8576
Reviewed-on: https://code.wireshark.org/review/37982
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-29 07:03:02 +00:00
João Valverde 7be4a8fb00 Add wmem_destroy_array()
Change-Id: I00a0052a9c207692eddab7ac2d0f146201648f6c
Reviewed-on: https://code.wireshark.org/review/13003
Reviewed-by: João Valverde <j@v6e.pt>
2020-07-22 22:46:28 +00:00
Stig Bjørlykke 3dc5f5c2d6 epan: Keep decode_as_list when changing profile
The decode_as_list is built at startup and contains all protocols
registered for "decode as". Do not clear this list on profile change,
only on exit.

Bug: 16635
Change-Id: I832a042327603ae0f01b10ab620fccc03d4fd3a3
Reviewed-on: https://code.wireshark.org/review/37579
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-29 18:40:27 +00:00
rbroker 1f75d7b3b9 wslua: Add ability to query current temporary color filter text
The LUA API provides the "set_color_filter_slot" function, but without
a corresponding "get_" function, it's very hard for two LUA dissectors
to co-exist without one overwriting any color filters set by the other.

It also looks like the documentation comment for
"set_color_filter_slot" had an off-by-one error, which I've corrected
as I was adding almost identical documentation for the new API.

Change-Id: Ic54d23be555ec12e1830bbe6f84a1b04d04fd4f0
Reviewed-on: https://code.wireshark.org/review/37511
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-25 08:02:27 +00:00
Mikael Kanstrup 685a125729 dot11decrypt: Remove some unused code
Remove some unused defines, function parameters and functions.

Change-Id: I1bbc3ff7e0a9d11e8521ddf24b35113d8e332f08
Reviewed-on: https://code.wireshark.org/review/37305
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-25 10:33:23 +00:00
Guy Harris 582ad24c38 Remove some single-SHB assumptions.
Make wtap_file_get_shb() take a section number argument, and update code
that called it.  In most cases, we convert the code to iterate over
sections; in cases where a big code change would be required, we
temporarily pass it 0 and mark the code as "needs to be updated for
multiple sections".

Eliminate cf_read_section_comment(); in calls outside file.c, other code
directly calls the libwiretap routines it calls and, inside file.c, we
just transplant the code and then fix it not to assume a single SHB.

Change-Id: I85e94d0a4fc878e9d937088759be04cb004e019b
Reviewed-on: https://code.wireshark.org/review/37000
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 19:46:42 +00:00
Uli Heilmeier 99ecab4122 New dissector: Dynamic Link Exchange Protocol
Code based on https://github.com/mit-ll/dlep-wireshark-dissector
authored by Jeffrey Wildman <jeffrey.wildman@ll.mit.edu>

Updated types according to
https://www.iana.org/assignments/dlep-parameters/dlep-parameters.xhtml

Changed:
* removed some tvb_get_*() calls
* updated expert info handling
* changed registering the dissector

Sample capture:
https://wiki.wireshark.org/SampleCaptures#Dynamic_Link_Exchange_Protocol_.28DLEP.29

Change-Id: I13e0c918f46af036c1be4acf34acab838aeaf342
Reviewed-on: https://code.wireshark.org/review/36901
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-28 06:13:10 +00:00
Guy Harris 524baee94f Add string encoding values for various BCD encodings, and use them.
Add some ENC_ values for various flavors of packed BCD, and use that
instead of explicitly calling tvb_bcd_dig_to_wmem_packet_str() and
adding the result.

Change-Id: I07511d9d09c9231b610c121cd6ffb3b16fb017a9
Reviewed-on: https://code.wireshark.org/review/36952
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-27 01:53:09 +00:00
Guy Harris 9f03cde5a5 Add a routine to get the representation of a protocol tree item and use it.
Add proto_item_get_display_repr(), which returns a string, allocated
with a specified wmem scope, containing the display representation of
the value of a proto_item.

Use it in the LLDP dissector, to append that string to the parent
protocol tree item; use packet scope, so it doesn't hang around forever
(the previous code used the NULL scope, meaning explicit freeing was
required, but it wasn't explicitly freeing the value, so it was
leaking).

Change-Id: I146380118833b1daef9dea8bd9463001e5b9325f
Reviewed-on: https://code.wireshark.org/review/36931
Petri-Dish: Guy Harris <gharris@sonic.net>
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-25 06:27:53 +00:00
Jaap Keuter 9750d00ff1 Introduce tfs_get_string helper
true_false_strings have no helper function to properly retrieve the
string representing the true or false value, much like unit_strings,
even though this is not uncommon in dissectors.
This change introduces the helper function and modifies the dissectors,
so that they use this helper i.s.o. their own expressions.

Change-Id: I477ed2d90a9a529fc5dcfef7e3ea42ec180d27ae
Reviewed-on: https://code.wireshark.org/review/36920
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-25 04:39:46 +00:00
Pau Espin 485476d0d2 OsmoTRX: Use units from unit_strings.{c,h}
Change-Id: I79dd406fe34b623678bd8a13b2ec75930f886fe8
Reviewed-on: https://code.wireshark.org/review/36904
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-23 15:22:54 +00:00
Gerald Combs 6a8c1b9b93 epan: Add p_[gs]et_proto_depth.
Add convenience routines for getting and setting a per-protocol,
per-packet depth value, which can be used to limit recursion, nesting,
cycling, etc. Use them in the BACapp, DAAP, Mongo, VLAN, and WBXML
dissectors.

Change-Id: I172514828169253ae7fcf9162c9d7eeb3041ff9c
Reviewed-on: https://code.wireshark.org/review/36846
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>
2020-04-15 04:09:08 +00:00
Balint Reczey b5593553d4 debian: Ship codecs libraries in libwireshark0
Bug: 16430
Change-Id: I2f9b07be780d39c75898bba06fa6fb66b9895c88
Signed-off-by: Balint Reczey <balint.reczey@canonical.com>
Reviewed-on: https://code.wireshark.org/review/36433
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Petri-Dish: Balint Reczey <balint@balintreczey.hu>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-15 16:55:31 +00:00
Peter Wu e3212a49e5 debian: speed up build by running asn1 and guides target in parallel
Speeds up the asn1 build from 133 seconds to 39 seconds, and guide
builds from 40s to 33s (-j6). Extraction of parallel=x from
DEB_BUILD_OPTIONS was borrowed from the debhelper Makefile.

Switching to Ninja has even more potential speed ups and prevents
interleaving build output, but requires debhelper 11.2 (Ubuntu
bionic-backports, Debian stretch-backports).

Change-Id: I2d403863adf5bfd692300642aad7df4b1cdb6e46
Reviewed-on: https://code.wireshark.org/review/36377
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-12 06:45:56 +00:00
Guy Harris cd6134da90 Add ws_strtoi() and ws_strtoui() routines and use them.
Those fetch gint and guint values, respectively, rather than values with
specified sizes in bits.

This should squelch Coverity CID 1457357.

Change-Id: Ia8f100bd3fe90c266e24a4346f80b2667c653b93
Reviewed-on: https://code.wireshark.org/review/36177
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-02-25 08:27:52 +00:00
Dylan Ulis 7b99a82bf8 Edit Resolved Name: Don't add duplicate IPs
1. Switch list of manually resolved names from a list to a map
   (IP Address --> Custom Hostname)
2. If an address was already in the list, just update the old entry.
Previously this added a new entry anytime somebody would edit a
hostname.
3. Display the previous hostname in the GUI
4. Remove unused manually_resolve_cleanup()

Bug: 11221
Change-Id: I42d5b6267eb6613bdf7783865bc2d30d6bda1147
Reviewed-on: https://code.wireshark.org/review/36059
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-24 07:45:00 +00:00
Gerald Combs 937c7c512a Debian+RPM: Require QtSVG.
Although we don't depend on any of Qt's SVG classes directly, we do use
SVG icons in Preferences → Appearance → Language and QIcon loads its SVG
engine dynamically. If it's not present Wireshark will still run, but
the user won't see any flag icons.

Require QtSVG in the Debian and RPM packaging. It's not that large (~
400k here on Ubuntu 18.04) and ensures that we have a uniform user
experience across platforms. In this particular case, if the user
experience happens to be "Wireshark's UI is in a language I don't
understand" the little flags can come in handy.

Change-Id: If3c2e8a6040967353dbc462ee475ef12514b25f9
Reviewed-on: https://code.wireshark.org/review/36037
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-02-11 01:43:33 +00:00
Martin Mathieson 0290bd3592 HTTP: share dissector status value_string array with tshark HTTP stats
Change-Id: I6de4a8b691922f7c4a8141b581b9f3c8ca112b60
Reviewed-on: https://code.wireshark.org/review/35942
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-01-24 22:38:17 +00:00
Martin Mathieson 8a79d27010 SIP: share dissector status value_string array with tshark SIP stats
Change-Id: I8f12310f69aa5393ba8ad37e498845f2a1f17693
Reviewed-on: https://code.wireshark.org/review/35927
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-01-24 16:10:43 +00:00
Dario Lombardo 73a5236f2f debian: remove double spaces.
Change-Id: Ifee8b32bbde5947944c6f3a30b5245d173beea09
Reviewed-on: https://code.wireshark.org/review/35661
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-07 12:45:00 +00:00
Michael Mann 2925fb0850 Use g_file_open_tmp within create_tempfile
Much better to use a known library than create it ourselves.

Also remove get_tempfile_path as it's not used.

Bug: 15992
Change-Id: I17b9bd879e8bdb540f79db83c6c138f8ee724764
Reviewed-on: https://code.wireshark.org/review/34420
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-12-20 19:26:38 +00:00
Huang Qiangxiong 623b347d1e Protobuf: add dissecting protobuf fields as wireshark fields preferences, etc.
Two enhancements and one fixed bug:

1. Add dissecting protobuf fields as wireshark (header) fields preferences. User
can input the full names of protobuf fields or messages in Filter toolbar for
searching.

2. Add 'protobuf_field' dissector table. Dissector based on protobuf can register
itself to 'protobuf_field' keyed with the full names of fields of BYETS or STRING
types.

3. A bug about search MESSAGE or ENUM type in context is fixed.

4. Another small enhancement is adding prefs_set_preference_effect_fields() which
can mark a preference that affects fields change (triggering FieldsChanged event).

See the linked bug for sample capture file and .proto files.

Ping-Bug: 16209
Change-Id: Ibc3c45a6d596a8bb983b0d847dd6a22801af7e04
Reviewed-on: https://code.wireshark.org/review/35111
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-19 05:04:17 +00:00
Michael Mann f509a83381 Add format_size_wmem
It's a "wmem version" of format_size (from wsutil/str_util.h).

Also improved the flexibility in formatting of format_size() to handle future
needs of format_size_wmem

Ping-Bug: 15360
Change-Id: Id9977bbd7ec29375bbac955f685d46e75b0cef2c
Reviewed-on: https://code.wireshark.org/review/31233
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-02 05:01:16 +00:00
Gerald Combs faf3118d45 [Automatic update for 2019-12-01]
Update manuf, services enterprise numbers, translations, and other items.

Change-Id: I3baf4cf43786b1680c02514f10c526cf8dca8536
Reviewed-on: https://code.wireshark.org/review/35269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-12-01 08:20:14 +00:00
Gerald Combs beb1fee658 3.1.0 → 3.3.0.
Change-Id: Ia6217b00741f824b1f6805eb406408802dd5b5a8
Reviewed-on: https://code.wireshark.org/review/35167
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-20 23:33:02 +00:00
Gerald Combs ae58402e14 3.1.1 → 3.1.2.
Change-Id: Id89e46103f61392653cfdc60ef16d11123fe0928
Reviewed-on: https://code.wireshark.org/review/35128
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-18 20:12:27 +00:00
Gerald Combs 7d2e3fa8f5 [Automatic update for 2019-11-17]
Update manuf, services enterprise numbers, translations, and other items.

Change-Id: I5a453e0aeb29491152bce579ba11d65d0b05acc8
Reviewed-on: https://code.wireshark.org/review/35108
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-17 08:20:23 +00:00
João Valverde 5d18c9b4df dumpcap: Add support for TCP@IPv6 socket captures
Bug: 15820
Change-Id: Id32f376190c115b0808ba72e5b63e019e2a70274
Reviewed-on: https://code.wireshark.org/review/35030
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2019-11-11 17:17:36 +00:00
Gerald Combs 4ad8ff785c [Automatic update for 2019-11-10]
Update manuf, services enterprise numbers, translations, and other items.

Change-Id: Ia72b63b2fca34056e2c18d828526ff896295a9bd
Reviewed-on: https://code.wireshark.org/review/35040
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-10 08:20:55 +00:00
Gerald Combs 2ff32787c5 epan: Make proto_tree_add_oid* usable from DLLs.
Prefix proto_tree_add_oid, proto_tree_add_oid_format_value, and
proto_tree_add_oid_format with WS_DLL_PUBLIC.

Change-Id: Ia3fa8fb762869bb1afa1c1f57a3a5f02aa126a3f
Reviewed-on: https://code.wireshark.org/review/35018
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-11-07 16:43:43 +00:00
Stig Bjørlykke 551745998e wslua: Fix memleak of unregistered ProtoField strings
If a ProtoField object was created, but not linked to a Proto, then the
strings field and all elements (depending on type) would leak.

This is a follow-up to g79fef2ae and fixes the real issue in g44870fb1.

Change-Id: I01880a92bb20fae45f68c754b07daeb07630deec
Reviewed-on: https://code.wireshark.org/review/34872
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 15:05:54 +00:00
Huang Qiangxiong 62101950f3 Protobuf: Add show_details preferences. Fix two bugs.
1. Add show_details preferences. Disable it will hidden names of
message/field/enum, field number, and other details.

2. Have only one popup message with all the errors listed,
that are found during parsing .proto files. (Buffer errors and print once)
Loading .proto files and checking message types of UDP port will
be done only when protobuf dissector has been called.

3. Support parsing .proto files in legacy MAC file format
(that newline is '\r') or mixed newline (\r + \n) file format.

Change-Id: I97bcde000957e4cd1cce98a7f61120d03027423e
Reviewed-on: https://code.wireshark.org/review/34736
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-14 06:47:30 +00:00
João Valverde 97cb389a35 Revert "CMake: Don't install HTML manuals twice"
This reverts commit f1285fcf06.

NSIS package is broken with this commit.

Change-Id: Ief22a308edad188fa2d5fab79355f19493359fa6
Reviewed-on: https://code.wireshark.org/review/34758
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2019-10-10 15:58:41 +00:00
João Valverde f1285fcf06 CMake: Don't install HTML manuals twice
HTML docs are installed to both $docdir and $pkgdatadir. Fix that
to install to $docdir only.

Change-Id: I115158585b6df9170d9a01249adbc8548df91f14
Reviewed-on: https://code.wireshark.org/review/34640
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2019-10-09 13:24:58 +00:00