Commit Graph

368 Commits

Author SHA1 Message Date
João Valverde c6a920686c wslog: Check environment initialization for errors
Initialiaze the cmdarg error stream earlier.

Dumpcap also needs to know earlier if it is running in capture
child mode.
2021-06-26 00:18:26 +01:00
João Valverde 759bb234d0 wslog: Check if we are initialized and add missing inits
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-21 16:03:29 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
Guy Harris 6eb3703379 Make various names match the name of the systemd journal export block.
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-17 13:52:45 -07:00
Guy Harris 57a1514ac7 Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've
already decided that we're perfectly willing to live with string
truncation.  Hopefully this keeps Coverity from whining that those
routines could return an error code (NARRATOR: They don't) and thus that
we're ignoring the possibility of failure (as indicated, we've already
decided that we can live with string truncation, so truncation is *NOT*
a failure).
2021-04-30 03:19:19 -07:00
Guy Harris 9b70baac96 Add a new header defining commonly-used exit codes.
"Commonly-used" meaning "used by more than one source file".

Clean up the exit codes, combining some duplicates with different names,
and using some instead of raw numbers in some places.
2021-04-13 01:23:21 -07:00
Guy Harris ce20c00049 Remove unnecessary inclues of wiretap/pcapng.h. 2021-03-15 15:29:40 -07: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 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
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
Gerald Combs b8ce02e6fb editcap: Fixup our help output.
Make sure list_capture_types prints to the designated stream so that
tools/update-tools-help.py works correctly for `editcap -F`.
2021-02-21 22:57:13 +00: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 c0711693ab Enable -Wredundant-decls.
Add it to the default list of checks, and fix some errors it causes.
(Sadly, it doesn't work in CLang.)
2021-02-14 14:43:42 -08: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 09684644ee wiretap: clean up WTAP_BLOCK_ names.
Remove NG from the names - it adds nothing.

Don't use the abbreviations for pcapng block names, spell out what the
block does (e.g. "WTAP_BLOCK_DECRYPTION_SECRETS" rather than
"WTAP_BLOCK_DSB"), to make it more obvious what the block does.

Spell out some other abbreviations.

Add WTAP_BLOCK_PACKET for future use for packet blocks; there's no need
to distinguish between the Enhanced Packet Block, the Simple Packet
Block, and the deprecated Packet Block here.
2021-02-09 22:32:57 +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
Jaap Keuter b3d6580b4f editcap: clarify relation between -A/-B and -r
Change wording so that the order of processing becomes more apparent.

Closes #17109
2020-12-31 10:50:17 +00:00
Guy Harris f75e2e5956 editcap: one more integer -> Boolean.
selected() returns a Boolean value indicating whether the packet with a
given number was selected by the packet-range arguments or not.
2020-12-23 23:09:19 -08:00
Guy Harris 0d0071a302 editcap: make verbose a Boolean as well.
And, to catch people habituated to -r and -v toggling the flag, fail if
it's already been set, to dishabituate them.

Not having them toggle makes it easier to document their semantics.
2020-12-23 17:55:20 -08:00
Guy Harris d98106876c editcap: treat the "keep packets" flag as a Boolean.
Give it the type gboolean, initialize it to FALSE, and have -r set it to
TRUE.

This makes it a little clearer what it's doing.
2020-12-23 15:49:07 -08:00
Jaap Keuter 38ab00a094 Let the CLI programs tell about how to show their version
Add to the help text the option to show the version of the CLI program.
2020-12-22 21:18:21 +00:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Guy Harris a11e5261e1 editcap: add IDBs to second and subsequent output files.
Remember all the IDBs we've seen from the input file so far and, if
we're writing multiple files (splitting an input file into multiple
output files), add all those IDBs to each of the output files.

Fixes issue #17060.
2020-12-05 13:22:49 -08:00
Guy Harris 889e0d5cb6 Add a new record type REC_TYPE_SYSTEMD_JOURNAL.
Systemd journal entries aren't file-type-specific; they're found in both
systemd journal entry blocks in pcapng files and in systemd journal
export files.  Give it a record type, for use with both file types.

This fixes #16955.

It also means that you can open a systemd journal export file and save
it as a pcapng file.
2020-10-27 20:06:26 -07: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 194e74321a editcap: use packet encapsulation, not file type, to check for DCT2000.
What we care about here is the packet type, not the file type, as we
care what's at the beginning of the packet.  This should have no effect
in practice, but it makes it clearer what we're testing for.
2020-10-20 01:50:00 -07:00
Guy Harris 3f412284a2 Fix message printed for --skip-radiotap-header for non-radiotap packets.
If the encapsulation is WTAP_ENCAP_PER_PACKET, all we know about the
file is that it might not include radiotap packets and, if it does, it
also includes non-radiotap packets.

If it's *not* WTAP_ENCAP_PER_PACKET, properly report it
(wtap_file_type_subtype() returns the *file type* of the file, not the
*link-layer header type* - yes, that *happens* to work for a pcap file
with Ethernet packets, because the values of WTAP_ENCAP_ETHERNET and
WTAP_FILE_TYPE_SUBTYPE_PCAP both *happen* to be 1, but that's pure
luck).

While we're at it, test only once for --skip-radiotap-header and put
both tests inside that if.
2020-10-14 21:22:53 -07:00
Guy Harris 6e6233521a Have WTAP_ERR_INTERNAL include an err_info string giving details.
That way, users won't just see "You got an internal error", the details
will be given, so they can report them in a bug.
2020-10-14 04:51:45 +00:00
David Perry 06702303da editcap: use constant for maximum nanosecs in 1sec
Change-Id: I35991da41437617e816edfa3220f7de2705eac14
Reviewed-on: https://code.wireshark.org/review/38075
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-07 08:24:34 +00:00
David Perry d24c9df384 editcap: add capture-file comments to output file
Add the `--capture-comment "comment"` option for appending pcapng
comments to the SHB of the output file(s).

Add the `--discard-capture-comment` option for removing pcapng comments
present in the input file SHB(s) before writing to the output file(s).

Supports multiple comments per SHB. Noted in the documentation that
Wireshark itself doesn't support multiple comments.

Bug: 15033
Change-Id: If07a4e7a93505438639018783a11343cd5992f2a
Reviewed-on: https://code.wireshark.org/review/38074
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-07 08:24:19 +00:00
Guy Harris 818bb96e5f editcap: clean up an error message.
"XXX isn't a valid time format" could be read as "XXX isn't a valid
format to use for times" in the sense of, for example, a format argument
to strftime() or strptime().  It's also a date *and* time, so just say
it "isn't a valid date and time".

Change-Id: I7e0f01914c5e16b7eaa89b798cf94a2964fc764c
Reviewed-on: https://code.wireshark.org/review/38068
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-06 10:34:55 +00:00
Guy Harris 61e8381ab2 editcap: allow the UNIX/POSIX Epoch to be a start or stop time.
Have separate Boolean flags to indicate whether the start and stop times
were specified, rather than having a value of 0 meaning it wasn't.

Change-Id: Ie9968ebd588df6b150062caa50f0b23e6f77f214
Reviewed-on: https://code.wireshark.org/review/38067
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-06 10:31:26 +00:00
Guy Harris 47e9852213 editcap: fix check of start and stop times.
Only check whether the start time is after the stop time if both a start
time and a stop time were specified.

Change-Id: I864480a789c52312dc934c217910e7b68597f066
Reviewed-on: https://code.wireshark.org/review/38066
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-06 10:04:22 +00:00
Guy Harris 613c1bd931 editcap: clean up the parsing of fractional time in -A and -B.
Use ws_strtou32() so that we're guaranteed to produce a value that fits
in a 32-bit integer (and don't get a narrowing warning on LP64 platforms
for converting a long to an int), and then make sure it's less than one
billion.

Note, while we're at it, that you can, for example, specify a date of
2020-10-40 and it won't produce an error.

Change-Id: I26c36d346cfa5c2bdc9ecdbdf821a9bc3529c940
Reviewed-on: https://code.wireshark.org/review/38065
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-06 09:26:09 +00:00
David Perry 555b89492a editcap: support fractional seconds in -A/-B opts
Allow user to specify time resolutions as fine as 1 nanosecond for the
start and stop times (-A and -B options) for editcap. Uses `nstime_t`
for the user options and `nstime_cmp()` to compare with packet
timestamps.

Change-Id: I2340bc4830c7d9a6b17a5e53fa4e8837e231bcb6
Reviewed-on: https://code.wireshark.org/review/38057
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-05 21:32:45 +00:00
Peter Wu ef717da61a CMake: remove ENABLE_PCAP_NG_DEFAULT option
pcapng has been the compile-time default since 2011. If there are any
users who would like to use the libpcap format, then they should use
runtime options instead (e.g. `tshark -P` or `editcap -F pcap`).

Change-Id: I54b70368cdc3ca78bc8617bc488cc687740a1eb9
Reviewed-on: https://code.wireshark.org/review/36721
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-06 01:29:37 +00:00
Gerald Combs e54bcb0100 editcap: Remove an arbitrary time boundary.
As pointed out by @debookee in

https://twitter.com/debookee/status/1229711779648933888

if you pass a start time (-A) and no stop time (-B) to editcap, it will
set the stop time to December 31, 2035. Adjust our logic to work without
a stop time instead.

Change-Id: Ic724ce8ee6d8c346be1d4caf2899d3e10e68fa94
Reviewed-on: https://code.wireshark.org/review/36138
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-02-24 07:43:22 +00:00
Jaap Keuter d90a22c1cc Reorganize long option values
For long options, without corresponding short options, to be processed
they need to be assigned a value, preferably outside of the range of
all possible short options. The code in various places tries to stay
clear of these low values, but further coordination is missing, easily
leading to issues when option processing code gets extended and/or
reorganized.

This change introduces a single location from where each catagory of
command line long option can derive a base value, which should minimize
potential option value collisions.

Change-Id: Ic8861a347d0050f74002de3aa1fcfb01202866e5
Reviewed-on: https://code.wireshark.org/review/35459
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-12-15 20:02:09 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Gerald Combs 8147af211d Editcap: Allow floating point split intervals.
Update the `-i` option to allow floating point values as suggested at
https://stackoverflow.com/questions/57004719/split-wireshark-to-miliseconds

Change-Id: I24028d409bc441ed3b45ac2179f7c42b2bc424bc
Reviewed-on: https://code.wireshark.org/review/33938
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>
2019-07-16 06:43:09 +00:00
Guy Harris dc7b757c91 With -T, change the packet's encapsulation type as well.
Bug: 15873
Change-Id: I8d36b0fba42481b5e27e9ad9643d3603486c3645
Reviewed-on: https://code.wireshark.org/review/33745
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-06-26 20:38:45 +00:00
Peter Wu 94b211977a Add support for embedding WireGuard keys in a pcapng file
pcapng spec update is here: https://github.com/pcapng/pcapng/pull/62

Bug: 15571
Change-Id: I2f1921b1da70ac0bab8c38dd5138a9dfe7843fea
Reviewed-on: https://code.wireshark.org/review/33300
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-17 00:48:29 +00:00
Guy Harris ac66f39727 Small cleanups.
Rename a variable to reflect the final name given to the option to get
rid of decryption secrets stored in the file.

Fix whitespace.

Change-Id: I19ea14fa205369500790adaa00244a15412548eb
Reviewed-on: https://code.wireshark.org/review/33154
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-11 04:00:47 +00:00
Guy Harris 937ec02581 1514 is a better initial Buffer size than 1500.
Ethernet packets without the CRC are 1514 bytes long, not 1500 bytes
long; using 1514 bytes will avoid a reallocation for a full-sized
Ethernet packet.

Change-Id: Ie8da3f13bf3df07e23e4478b7dcf84f06dec6a9d
Reviewed-on: https://code.wireshark.org/review/32761
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06 21:04:02 +00:00
Guy Harris 8a5b26efb1 Have wtap_read() fill in a wtap_rec and Buffer.
That makes it - and the routines that implement it - work more like the
seek-read routine.

Change-Id: I0cace2d0e4c9ebfc21ac98fd1af1ec70f60a240d
Reviewed-on: https://code.wireshark.org/review/32727
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05 02:49:43 +00:00
Guy Harris 28f49a0a9a Add --discard-all-secrets to remove decryption secrets.
Bug: 15435
Change-Id: I78503c9c31ab3eda39908b91dca3ef3fb9af34bf
Reviewed-on: https://code.wireshark.org/review/32100
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-19 09:57:52 +00:00
Guy Harris da70ea1c30 Use #defines for long-option codes.
Change-Id: Ife800efd4d2621b295a1c07ae182758a3b6f276c
Reviewed-on: https://code.wireshark.org/review/32095
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-19 03:59:30 +00:00
Guy Harris a325c949bc Clean up indentation.
Change-Id: I28280eddda1c318ba82ec8f0372e38093abbaa14
Reviewed-on: https://code.wireshark.org/review/32091
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-19 03:13:05 +00:00
Peter Wu 53b55bfb5f editcap: warn when --inject-secrets is given a RSA private key
While the documentation of "editcap --inject-secrets" mentions support
for key log files only, people might misinterpret that and assume
support for RSA private keys. This is explicitly not supported due to
the sensitivity of these files. In order to be helpful, print a warning.

Change-Id: Ia7b464c17f1dfb550729dd35775290ed28e14510
Reviewed-on: https://code.wireshark.org/review/31893
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-02-05 15:36:40 +00:00