Commit Graph

785 Commits

Author SHA1 Message Date
Dario Lombardo 2e9f3c5d36 tap: change glib functions to wmem.
Change-Id: I878ae6b121a669f9b7f4e1e57bc079f0cb44c0bf
Reviewed-on: https://code.wireshark.org/review/15270
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-17 15:38:03 +00:00
Martin Kacer 42b060905e tshark JSON and Elasticsearch output
Added ouput -T for json|ek
Added -j switch fo filter EK json|ek fields.
Added -x switch to work with json|ek to insert raw fields.

Bug: 11754

Change-Id: Iad5a9092b843c074b0b774d1745fa14fca09f6b7
Reviewed-on: https://code.wireshark.org/review/15869
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-17 06:09:29 +00:00
Michael Mann 614d09af13 Add data structures necessary to support multiple Name Resolution blocks.
This doesn't try to use any data from multiple Name Resolution blocks, it
just converts single Name Resolution block usage into a GArray, so the
potential is there to then use/support multiple Name Resolution blocks
within a file format (like pcapng)

Change-Id: Ib0b584af0bd263f183bd6d31ba18275ab0577d0c
Reviewed-on: https://code.wireshark.org/review/15684
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01 22:58:06 +00:00
Michael Mann 6fa77a6acb Add data structures necessary to support multiple Section Header blocks.
This doesn't try to use any data from multiple Section Header blocks, it
just converts single Section Header block usage into a GArray, so the
potential is there to then use/support multiple Section Header blocks
within a file format (like pcapng)

Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486
Reviewed-on: https://code.wireshark.org/review/15636
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01 14:33:23 +00:00
Michael Mann 81d65ccec6 Add wtap_optionblock_set_option_string_format
Also add a length parameter to wtap_optionblock_set_option_string

Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee
Reviewed-on: https://code.wireshark.org/review/15505
Reviewed-by: Anthony Coddington <anthony.coddington@endace.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-22 23:39:14 +00:00
Gerald Combs fee7e95b3a TShark: Separate columns using UTF-8 arrows.
Use UTF8_RIGHTWARDS_ARROW and UTF8_LEFTWARDS_ARROW instead of "->" and
"<-" between addresses. This matches the port-printing behavior of the
TCP, UDP, and SCTP dissectors.

Change-Id: I0add8bfb1748319758a1ce7dbd362af818139db8
Reviewed-on: https://code.wireshark.org/review/15319
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-11 17:31:05 +00:00
Gerald Combs d7cbea9428 TShark: Add a "-E bom=" option.
Add an option to print the UTF-8 BOM.

Change-Id: I3d30c67852b9b89d1548b0f957d97fd8e8741049
Reviewed-on: https://code.wireshark.org/review/15318
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-11 17:30:33 +00:00
AndersBroman 505bf5945b [tshark] Document -U option and create a list of tap names when entering
an empty name "".

Change-Id: I2b8332ff6900c8a88514a25a416f342d7b696d34
Reviewed-on: https://code.wireshark.org/review/15332
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-11 11:27:49 +00:00
AndersBroman 6d2ea733dd Implement Export PDU for tshark
This patch introduces the "-U tap_name[,filter]" tshark option and
is similar to the "Export PDUs as file" option in Wireshark.

Wireshark implements this feature by reopening a capture file, applying
a tap and finally opening the temporary file. Since tshark knows
in advance that a PDU export is needed, it can optimize by not creating
the temporary file and perform the export at the first opportunity.

This patch splits the opening/tapping functionality from error reporting
since tshark does not need a temp file and has no dialogs.

The capture file comment is now specified explicitly as there is no
"current file" anymore if the tap is running without active file.

TODO:

 - Review whether it is acceptable to overwrite save_file in tshark.
 - Add documentation (tshark manpage).

Bug: 3444
Change-Id: Ie159495d42c32c2ba7400f2991b7b8185b3fda09
Reviewed-on: https://code.wireshark.org/review/5890
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-03 10:17:46 +00:00
João Valverde 3db13a7fc9 Link version code statically again
This allows keeping the code-sharing with the static linking.

This "fixes" a hypothetical ABI mismatch with wsutil and avoids pulling more
external dependencies to wsutil than strictly necessary.

A nice side-effect is that libwsutil no longer depends on version.h.

Follow up to f95976eefc.

Change-Id: I8f0d6a557ab3f7ce6f0e2c269124c89f29d6ad23
Reviewed-on: https://code.wireshark.org/review/15002
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-21 18:59:56 +00:00
Gerald Combs cf6501eb45 Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.
Replace some function calls with their non-deprecated equivalents so
that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and
config.nmake.

Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145
warnings and 72 errors.

Note that we could probably improve startup performance by using wmem
in diam_dict.*.

Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb
Reviewed-on: https://code.wireshark.org/review/14883
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-13 02:16:20 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317
Reviewed-on: https://code.wireshark.org/review/14749
Petri-Dish: João Valverde <j@v6e.pt>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-04 23:05:31 +00:00
João Valverde e005bc819c Remove synchronous DNS name resolution
Change-Id: Ie5e670b769eb0674950f3679ef511047641c2873
Reviewed-on: https://code.wireshark.org/review/14751
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-04 06:49:55 +00:00
João Valverde f95976eefc Move zlib version check to wsutil
Change-Id: I0950f61e90af5bb21c0017204de0c0b509616e5c
Reviewed-on: https://code.wireshark.org/review/14747
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-03 02:58:04 +00:00
Gerald Combs d877dcc1c4 Parallelize fuzz-test.sh
Run each "argument" test (e.g. "-nVxr" and "-nr") simultaneously in
the background. This should speed up our tests without reducing the
amount of fuzzing that we do.

Change-Id: I737d1dc09b31e07910d56632bec62da0f35fe222
Reviewed-on: https://code.wireshark.org/review/14432
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-03-14 15:54:26 +00:00
Michael Mann 08d49ff2e0 Making wiretap option blocks more generic.
This was inspired by https://code.wireshark.org/review/9729/, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom".  It should be easier to add "custom" options in this design. Some, but not all blocks have been converted.
Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks.

Also what could be added/refactored is registering block behavior.

Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a
Reviewed-on: https://code.wireshark.org/review/13667
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-23 00:39:38 +00:00
Michael Mann 14881e72d6 tshark: load decode_as_entries file
With Wireshark 2.0, some dissector preferences were removed in favor of 'Decode As' functionality.
But the settings saved in the GUI are not loaded in tshark, preventing their use without an explicit call to '-d' option.
Let's load decode_as_entries file by default and have it overridden by the '-d' option if required.

Ping-Bug: 12124
Change-Id: I134a424cb6cf8fc89b7096a659ef1605314a70a2
Reviewed-on: https://code.wireshark.org/review/13956
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-21 18:25:01 +00:00
Mike78 ef752689da Allow/Create an option to use "capture filter" labels defined in wireshark GUI from CLI
Move ui/filters.[ch] to filter_files.[ch] because dumpcap is using functionality.

Bug: 8091
Change-Id: I195c82fc023f97d6f331b8718c45a2d83d30faea
Reviewed-on: https://code.wireshark.org/review/5925
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-27 13:40:24 +00:00
Michael Mann ea2a3ac402 Initialize Qt info_data_t structure in constructor.
GTK and TShark should already have structure initialized to 0 because they are global variables.

Change-Id: I43a38c58f32967d201ddf78e450b2483f28f8bd6
Reviewed-on: https://code.wireshark.org/review/12847
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-23 18:22:38 +00:00
Roland Knall 35ee09e0f0 capture_info: Fix initialization of packet counter
g_hash_table_destroy will crash, if it is called on
 non-initialized memory. For some reason, this does not happen
 with other glib lists (e.g. GList seems to guard cleanly).

 This change initializes at the earliest possible time the
 packet counter hash with NULL

Change-Id: Ice66652fc9639d10b49d006ecbe80efe3f41e2ff
Reviewed-on: https://code.wireshark.org/review/12841
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-23 11:35:25 +00:00
Michael Mann 444dfda793 Allow "capture info data" to not be a singleton.
It was buried as a static variable in capture_info.c, and functions were refactored to allow a pointer to the info_data_t structure to be passed in. TShark and GTK will have their own single (global) copy of the structure, while it opens up Qt to have multiple instances.

Change-Id: Ic2d7a2ad574de43f457cb18b194d6bc3fffb6120
Reviewed-on: https://code.wireshark.org/review/12691
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-19 14:22:56 +00:00
João Valverde fbf2e3cf8f Make init_progfile_dir() take a function pointer [-Wpedantic]
Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98
Reviewed-on: https://code.wireshark.org/review/12557
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-14 23:52:28 +00:00
João Valverde 2aab706c5a Remove -Wwrite-strings compiler flag
The "-Wwrite-strings" flag produces nuisance warnings. These warnings are
not useful, they're impossible to fix in a sane way and therefore are being
handled with casts of static strings to (char *).

This just moves the warning to [-Wcast-qual] and a compiler pragma is
in turn required (and used) to squelch that warning.

Remove the Wwrite-strings warning. Let that responsibility fall on the
programmer (as is done by casting).

Change-Id: I5a44dfd9decd6d80797a521a3373593074962fb5
Reviewed-on: https://code.wireshark.org/review/12162
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-12 16:21:19 +00:00
Gerald Combs 4a9705774a Fixup a couple of stdout checks.
Change-Id: I942cd9010901d7b6c4f5b390fb23f79d72fb05d0
Reviewed-on: https://code.wireshark.org/review/11740
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-11 18:15:36 +00:00
Guy Harris 827b7dd756 Skip only the actual file descriptor close when writing to stdout.
Have a "this is stdout" flag for a wtap_dumper, and have "open the
standard output for dumping" routines that set that flag.  When closing
a wtap_dumper, do most of the work regardless of whether we're writing
to the standard output or not (so that everything gets written out) and
only skip the closing of the underlying file descriptor.

Change-Id: I9f7e4d142b3bd598055d806b7ded1cb4c378de8e
Reviewed-on: https://code.wireshark.org/review/11673
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10 10:11:50 +00:00
Guy Harris 6c3c6de340 Treat "-" as "standard input" in the CLI, not in libwiretap.
That's a UI convention, and the GUI shouldn't honor that convention - a
user might get confused if they try to save to "-" and end up with
nothing (and with a ton of crap in a log file if programs launched from
the GUI end up with their standard output and error logged).

While we're at it, make randcap report write and close errors.

Change-Id: I9c450f0ca0320ce4c36d13d209b56d72edb43012
Reviewed-on: https://code.wireshark.org/review/11666
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10 01:23:22 +00:00
Guy Harris 0162e54075 Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".

Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).

Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07 21:52:23 +00:00
Guy Harris ff9f9fc431 Don't include "file.h" if you don't need it.
It ends up dragging in libwireshark headers, which programs not linking
with libwireshark shouldn't do.  In particular, including
<epan/address.h> causes some functions that refer to libwireshark
functions to be defined if the compiler doesn't handle "static inline"
the way GCC does, and you end up requiring libwireshark even though you
shouldn't require it.

Move plurality() to wsutil/str_util.h, so that non-libwireshark code can
get it without include epan/packet.h.  Fix includes as necessary.

Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3
Reviewed-on: https://code.wireshark.org/review/11545
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-04 08:46:30 +00:00
Guy Harris c7e42be2e5 Catch REPORT_DISSECTOR_BUG() calls in dissector registration routines.
Have epan_init() return a success/failure Boolean indication.  Catch
exceptions when calling the dissector registration routines and, if we
get one, report the error and return a failure indication.

If epan_init() fails, quit, but first make sure the reported error is
displayed.

Change-Id: I0300cbb1f66a5644f857a205235124909d684c50
Reviewed-on: https://code.wireshark.org/review/11340
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-28 00:44:26 +00:00
Peter Wu 6d7b29592a Allow use of variadic macros
Remove variadic macros restriction (c99, c++11 feature) from
README.developer. GCC, Clang, MSVC 2005 all support it.

Enable -Wno-variadic-macros in configure.ac and CMakeLists.txt when
-Wpedantic is enabled (which would enable -Wvariadic-macros).

For all files matching 'define\s*\w+[0-9]\(', replace "FOO[0-9]" by
"FOO" and adjust the macro definition accordingly. The nbap dissector
was regenerated after adjusting its template and .cnf file. The
generated code is the same since all files disabled the debug macros.

Discussed at:
https://www.wireshark.org/lists/wireshark-dev/201209/msg00142.html
https://www.wireshark.org/lists/wireshark-dev/201510/msg00012.html

Change-Id: I3b2e22487db817cbbaac774a592669a4f44314b2
Reviewed-on: https://code.wireshark.org/review/10781
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-05 07:57:14 +00:00
Jeff Morriss 3ff5afd541 Add a test to verify we pre-allocated enough hf entries.
This way we'll know as soon as we drop below the pre-allocated limit. As
suggested by Graham on https://code.wireshark.org/review/10601

Change-Id: Ieeb14bdcf991d7a67c30787c97ca24ebb35d1763
Reviewed-on: https://code.wireshark.org/review/10627
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-09-23 20:09:39 +00:00
Jeff Morriss cd7387d22b Add a "fieldcount" report to tshark -G to let us easily see how many fields
are registered.

Change-Id: I06f10d96916640cb9a782cae87898a5dd6c9c6e3
Reviewed-on: https://code.wireshark.org/review/10601
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-23 04:38:01 +00:00
Matthieu Coudron 68dd2c823a Display the name of the invalid field when tshark is run with -T fields
-e invalidfield

Change-Id: Iaf8733096d9e1d15510a38363397b1dcd972ff59
Reviewed-on: https://code.wireshark.org/review/10504
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-12 20:19:59 +00:00
Hadriel Kaplan 78007fa1d2 Add debug printing to tshark
Add g_warning functions for tshark debug printing, disabled by default.

Change-Id: If1720b790b75bd1228afa62efac49dc04bc8addb
Reviewed-on: https://code.wireshark.org/review/10314
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-08-30 17:09:00 +00:00
Hadriel Kaplan e25562badd Pcapng: clean up Section Header Block handling
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258
Reviewed-on: https://code.wireshark.org/review/9726
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-18 05:52:45 +00:00
Hadriel Kaplan 910438b17f Pcapng: support Name Resolution Block options
Make pcapng decode options in an NRB during read, and store the comment
option, and write it back out as well. Also make it handle plugin handlers
for unknown options in received NRB(s).

Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f
Reviewed-on: https://code.wireshark.org/review/9723
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-06 03:32:13 +00:00
Hadriel Kaplan 8b316ff49d Tshark doesn't display column text as field in 2-pass mode
Bug: 11401
Change-Id: I6aa43d5cdd996aaf0980ab59b690212e41046acc
Reviewed-on: https://code.wireshark.org/review/9800
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-26 22:46:41 +00:00
Hadriel Kaplan 190e313e9d DNS: move DNS name resolution pref to Name Resolution prefs
Move the boolean flag for using captured DNS packet info for name resolution
to the Name Resolution preferences settings, as it was rather surprising to
disable Name Resolution preferences and still have names being resolved. Also
disble them all if the '-n' command line switch is used, and re-enable it for
a 'd' character in the '-N' option.

Bug: 10337
Change-Id: Ie4d47bab0100db3360cc447cd3e446b2e39aa917
Reviewed-on: https://code.wireshark.org/review/9786
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-25 17:05:01 +00:00
Pascal Quantin 6452caa3b3 Fix retrieval of data link type supported by remote interfaces with authentication
Make use of -A parameter when querying data link types supported by a given interface with dumpcap.
Ensure to pass the authentication parameters configured for a remote interface when calling capture_get_if_capabilities()

Bug: 11366
Change-Id: I4efea615084a82108e4a12a64e8c46817f30a5c6
Reviewed-on: https://code.wireshark.org/review/9690
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-22 07:10:10 +00:00
Jim Young ad82dfd554 Add new long options to GUIs to allow arbitrary protocols and heuristics to be disabled via command-line
Future: Allow multiple protocols to be disabled in one option statement
(perhaps using a comma or colon delmited set of names in <proto_name>)
instead of having to specify --disable-protocol <proto_name> multiple times.

Change-Id: I9b8f960acf75298ebb098d9b667fca49dca52306
Reviewed-on: https://code.wireshark.org/review/9631
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-17 11:27:52 +00:00
Michael Mann cdeae7e72b Add a "heuristic dissectors" tab to the Enable Protocols dialog.
This allows for a global place to enable/disable all heuristic dissectors.  This removes the need for individual dissector preferences, but those will be removed at a later date.  The more important part is the epan code to save/restore the enabled state of the heuristic dissector.  The GTK dialog was more for quickly testing the feature (there was already some GTK code in place that started the heuristic dialog tab)

Change-Id: Ie10687505c27a4456c49d5c4c69a5fc5f6394275
Ping-Bug:11152
Reviewed-on: https://code.wireshark.org/review/9508
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-14 11:28:55 +00:00
Michael Mann a8ff1e2778 Create very basic "generic" stat tap API to create a "GUI" independent table.
A few sample tap/dissectors (ANSI/A, ANSI MAP) are also included to test the API.  The "GUI output" is a bit raw and could use some "prettying up", but all the basic hooks are there.

Telephony "stat grouping" needs to be better alphabetized to properly populate menu (on GTK, probably Qt)

Change-Id: I98514171f69c4ab3a304dccb26c71d629703c9ab
Reviewed-on: https://code.wireshark.org/review/9110
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:08:28 +00:00
Michael Mann da09a1bfd8 Take all epan_column_info members that always get allocated to "number of columns" to share their own data structure.
Change-Id: Ib982662db6cf68730a7d121eac60d9bc5ae67429
Reviewed-on: https://code.wireshark.org/review/9195
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-29 02:11:04 +00:00
Peter Wu 2b68a6f450 tshark: fix memleak from version lookup
Immediately release memory after using it, fixes a direct memleak
warning from ASAN.

Change-Id: Icd3ff19c607da790a4a093966e1966cb0df6bb9d
Reviewed-on: https://code.wireshark.org/review/9069
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-23 20:18:37 +00:00
Michael Mann 8f390d4975 Refactor RTD stats.
Very similar to the refactoring of SRT stats, it provides more commonality of the stats for all GUI interfaces.  Currently implemented for TShark and GTK.  Affected dissectors: MEGACO, MGCP, Radius

Change-Id: Icb73a7e603dc3502b39bf696227fcaae37d4ed21
Reviewed-on: https://code.wireshark.org/review/8998
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-22 15:13:39 +00:00
Michael Mann 6de6f7f0f8 Further refactor SRT stats.
Create "common" SRT tap data collection intended for all GUIs.   Refactor/merge functionality of existing dissectors that have SRT support (AFP, DCERPC, Diameter, FC, GTP, LDAP, NCP, RPC, SCIS, SMB, and SMB2) for both TShark and GTK.

SMB and DCERPC "tap packet filtering" were different between TShark and GTK, so I went with GTK filter logic.
CAMEL "tap packet filtering" was different between TShark and GTK, so GTK filtering logic was pushed to the dissector and the TShark tap was left alone.

Change-Id: I7d6eaad0673fe628ef337f9165d7ed94f4a5e1cc
Reviewed-on: https://code.wireshark.org/review/8894
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-21 03:35:13 +00:00
Guy Harris 2e76bb466a Use pid_t on UN*X, and HANDLE on Windows, for the process ID.
This avoids type punning; at least with Xcode 7 beta on El Capitan beta,
that produces warnings that get turned into errors.

Change-Id: I57f47455b9630f359828c07c92a190b5cb33816f
Reviewed-on: https://code.wireshark.org/review/8862
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-10 00:30:57 +00:00
Anders 4e60e8fb39 [MSVC 2015] Use intptr_t for "pointer stored as int" to make MSVC happy.
Change-Id: I5dbbea8527a8bb73b17e5a8a5611c3923d82459c
Reviewed-on: https://code.wireshark.org/review/8852
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-09 14:13:14 +00:00
Guy Harris d4bfa9c43b Have a common routine for constructing strings listing interfaces.
We have a bunch of duplicated code to make those lists; make a common
routine for that.  (dumpcap currently doesn't use it, as the routine in
question uses a routine in libui, which dumpcap doesn't use.  We should
probably fix that.)

Change-Id: I9058bf3320d420b8713e90743618972da1d1c6ed
Reviewed-on: https://code.wireshark.org/review/7934
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-05 23:43:01 +00:00
Guy Harris 083f6b6e6d Have a #define for whether the capture buffer size can be set.
It can be set if either 1) this is Windows (where we're assumed to be
using WinPcap, which includes calls to set the buffer size) or 2) we
have pcap_create() (in which case we also have pcap_set_buffer_size(),
at least in a normal libpcap release).

Use that rather than testing "defined(_WIN32) ||
defined(HAVE_PCAP_CREATE)"; that makes it a bit more obvious what's
being tested.

Change-Id: Id9f8455019d19206b04dd6820a748cb97ae5ad12
Reviewed-on: https://code.wireshark.org/review/7816
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-25 03:22:33 +00:00
Gerald Combs cac102eee3 Change a lot of http:// URLs to https://.
Most of our sites are now HTTPS-only. Update URLs accordingly. Update
other URLs while we're at it. Remove or comment out dead links.

Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33
Reviewed-on: https://code.wireshark.org/review/7621
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-10 19:30:50 +00:00
Gerald Combs 95382c3afb Suppress a bunch of cast-qual warnings.
Squelch

    warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

similar to g630f54f.

Change strtod to g_ascii_strtod to squelch a checkAPIs error.

Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e
Reviewed-on: https://code.wireshark.org/review/7269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-20 04:04:15 +00:00
Guy Harris 9423a13b2d Just have init_progfile_dir() take a void pointer.
dladdr() takes a void * as a code pointer; have init_progfile_dir() do
so, and do the casting in the calls.  We don't care about the signature
of the function whose address we're passing, we just want to pass a
pointer to *something* in the main program.

Change-Id: I9372620a97b0eb53c2bb3c0c41a238b4408f3709
Reviewed-on: https://code.wireshark.org/review/7270
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-20 00:24:08 +00:00
Guy Harris cfcbb28671 Clean up ftype-conversion and dfilter error message string handling.
Have dfilter_compile() take an additional gchar ** argument, pointing to
a gchar * item that, on error, gets set to point to a g_malloc()ed error
string.  That removes one bit of global state from the display filter
parser, and doesn't impose a fixed limit on the error message strings.

Have fvalue_from_string() and fvalue_from_unparsed() take a gchar **
argument, pointer to a gchar * item, rather than an error-reporting
function, and set the gchar * item to point to a g_malloc()ed error
string on an error.

Allow either gchar ** argument to be null; if the argument is null, no
error message is allocated or provided.

Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c
Reviewed-on: https://code.wireshark.org/review/6608
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 10:22:59 +00:00
Guy Harris 938485436e Use g_strdup_printf(), rather than a fixed-length buffer, for the app name.
Add some missing g_free()s while we're at it.

Change-Id: Id38acc21d3c0b337e5d05baaf5ebbcd63699ff50
Reviewed-on: https://code.wireshark.org/review/6287
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-03 22:35:27 +00:00
Michael Mann 860cb393d8 tshark: Add endpoints statistics
"stat name" has been official changed to "endpoints" for all dissectors, rather than a mixture of "host"/"endpoints" based on dissector.

Change-Id: If34bcb5165b493948e784ba038ab202803a59843
Reviewed-on: https://code.wireshark.org/review/6154
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-02 00:02:18 +00:00
Guy Harris 5981dab95b Declare read_keytab_file() in epan/dissectors/packet-kerberos.h.
Don't throw its declaration in file.h, as it's not defined in file.c.
Instead, include it in epan/dissectors/packet-kerberos.h and include
that wherever read_keytab_file() is called.

Yes, that means you also have to include <epan/asn1.h> and, therefore,
you have to include <epan/packet.h>.  Yes, that should be cleaned up,
perhaps by splitting the Kerberos support code into "stuff that handles
encryption keys without any reference to dissection" and "stuff that
does dissection-related work".

Change-Id: Ide5c31e6d85e6011d57202f728dbc656e36138ef
Reviewed-on: https://code.wireshark.org/review/6210
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-01 23:05:57 +00:00
Guy Harris 114e7735b9 Call setlocale() before getting version information.
That way, the setlocale() call used to get the current locale will get
the right answer.

Change-Id: Ib43e16a9d98d08e5ddaff81fd3235f5b64d7b95b
Reviewed-on: https://code.wireshark.org/review/6197
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-01 00:47:17 +00:00
Guy Harris 1bc2565bff Don't include signal.h unless we need it.
Change-Id: I3965e0951eee919720f780b5e52732fd18fd9786
Reviewed-on: https://code.wireshark.org/review/6194
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 22:54:01 +00:00
Guy Harris 27be466c9b Do the full string in get_{compiled,runtime}_version_info().
Have them start the string with "Compiled" or "Running on", and return
the string when done.

Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810
Reviewed-on: https://code.wireshark.org/review/6155
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 06:29:11 +00:00
Pascal Quantin 84110d2981 tshark: endpoints statistics are not supported for now, do not list them in -z
Move statistics registration to "GUI" callback registration

Change-Id: Id27c049dc8f91d311e9231342ae40749ca0ff5fc
Reviewed-on: https://code.wireshark.org/review/6151
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-31 04:24:18 +00:00
Guy Harris c1f30471ca Move the version_info.c stuff to wsutil/ws_version_info.c.
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde
Reviewed-on: https://code.wireshark.org/review/6153
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 03:41:02 +00:00
Dario Lombardo 63ebe918d9 Removed duplicated #include lines
Change-Id: I9cafa3cd5c74121168777d8c656e7e94e89efd3c
Reviewed-on: https://code.wireshark.org/review/6065
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-28 00:02:39 +00:00
Guy Harris 4536271c0a Don't use a leading - in getopt_long() option strings.
The behavior of a leading - is platform-dependent.  It also means that
non-option arguments are treated in a fashion that we're not handling,
so capture filters given as non-option arguments at the end of the
command line don't work.  (The Linux getopt() man page says that a
leading - "is used by programs that were written to expect options and
other argv-elements in any order and that care about the ordering of the
two."  We are not such a program.)

Change-Id: I5610cf90a8218d48f7516abacc367e0affa3b549
Based-On-A-Change-From: Peter Hatina <phatina@redhat.com>
Reviewed-on: https://code.wireshark.org/review/6071
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-27 02:47:04 +00:00
Guy Harris c2c9a09880 Use getopt_long() for the first pass through the argument list.
That way:

	1) we don't have to worry about the system getopt() and our
	   getopt_long(), on platforms that have getopt() but not
	   getopt_long() (Solaris prior to Solaris 10, HP-UX, AIX), not
	   working well together;

	2) if necessary, we can handle long options in the first pass.

Switch to using getopt_long() for the *second* pass for the GTK+ version
of Wireshark.

Use the documented mechanism for resetting the argument parser for the
glibc version of getopt_long(); use the mostly-undocumented-but-at-least-
they-documented-optreset mechanism for the *BSD version.

(We should look into doing only one pass, saving away arguments that
can't fully be processed in the first pass for further processing after
initializing libwireshark.)

Change-Id: Ide5069f1c7c66a5d04acc712551eb201080ce02f
Reviewed-on: https://code.wireshark.org/review/6063
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-26 22:39:46 +00:00
Guy Harris e08eba9b9e Only include <wsutil/os_version_info.h> if we need it.
Change-Id: Idee0e7205969ac2e7b33c4748a1463a0bfffe0a6
Reviewed-on: https://code.wireshark.org/review/6051
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25 21:03:45 +00:00
Guy Harris 20503c7047 Check for getopt_long(), not getopt().
We support three types of platforms:

	1) UN*Xes that have both getopt() and getopt_long();

	2) UN*Xes that have getopt() but not getopt_long();

	3) Windows, which has neither.

Checking for getopt_long() lets us distinguish between 1) and 2) and
build getopt_long() for them.

Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45
Reviewed-on: https://code.wireshark.org/review/6045
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25 01:11:10 +00:00
Stephen Fisher 2d8ec49ffa Move twelve show_version() functions from the varoius programs and
Wireshark UI files into a single one in wsutil.

Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad
Reviewed-on: https://code.wireshark.org/review/6026
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-24 16:51:45 +00:00
Gerald Combs 9ba9cd83a4 Qt: Add a CaptureFile class.
Wrap the capture_file struct in a QObject which translates cf_cb_* and
capture_cb_* events into signals. Move the global cfile to
capture_file.cpp.

Don't use a void pointer for the capture file struct.

Change-Id: Ic5d5efb4bb1db64aa0247245890e5669b1da723a
Reviewed-on: https://code.wireshark.org/review/5885
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-20 17:39:29 +00:00
Guy Harris 0885d29451 Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-on: https://code.wireshark.org/review/5830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 04:04:19 +00:00
Guy Harris 6011a047d3 WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.
Check for them *only* on opening for writing and writes.

Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067
Reviewed-on: https://code.wireshark.org/review/5827
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:41:43 +00:00
Guy Harris aa27e665b1 Rename WTAP_ERR_REC_TYPE_UNSUPPORTED to WTAP_ERR_UNWRITABLE_REC_TYPE.
That indicates that it's a problem specific to *writing* capture files;
we've already converted some errors to that style, and added a new one
in that style.

Change-Id: I8268316fd8b1a9e301bf09ae970b4b1fbcb35c9d
Reviewed-on: https://code.wireshark.org/review/5826
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:32:14 +00:00
Guy Harris 51522b3372 Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out
in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along
with an err_info string.

Report (and free) that err_info string in cases where
WTAP_ERR_UNWRITABLE_REC_DATA is returned.

Clean up some other error reporting cases, and flag with an XXX some
cases where we aren't reporting errors at all, while we're at it.

Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3
Reviewed-on: https://code.wireshark.org/review/5823
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:03:26 +00:00
Guy Harris d2eddde5bd Report WTAP_ERR_UNSUPPORTED correctly.
WTAP_ERR_FILE_UNKNOWN_FORMAT is reported if the file is in a format that
libwiretap doesn't know about (either because it's not a capture file at
all or because it's a capture file in a format it doesn't support).
WTAP_ERR_UNSUPPORTED is for files in a *known* format that are using
features or file format elements (record type, link-layer header type,
etc.) that libwireshark doesn't support.  Fix some copy-and-pasteos
causing WTAP_ERR_UNSUPPORTED to be reported with a message appropriate
for WTAP_ERR_FILE_UNKNOWN_FORMAT.

Change-Id: Ic675ffd501c52838d8944a6c61e1b01041b73098
Reviewed-on: https://code.wireshark.org/review/5799
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:47:59 +00:00
Guy Harris ddcc2aee3d Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442
Reviewed-on: https://code.wireshark.org/review/5798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:31:49 +00:00
Guy Harris dbdcae80ba Rename WTAP_ERR_UNSUPPORTED_ENCAP to WTAP_ERR_UNWRITABLE_ENCAP.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: Icc5c9cff43be6c073f0467607555fa7138c5d074
Reviewed-on: https://code.wireshark.org/review/5797
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 06:41:45 +00:00
Guy Harris 846bb53948 Add a Buffer to wtap_pkthdr to hold file-type-specific packet metadata.
For example, this can be used for pcap-ng options not mapped to
file-type-independent metadata values.

Change-Id: I398b324c62c1cc1cc61eb5e9631de00481b4aadc
Reviewed-on: https://code.wireshark.org/review/5549
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-01 00:31:03 +00:00
Guy Harris 81ab6012fe Clean up routine names, don't pass capture_file into libwireshark.
Give all routines in epan/print.c that write a particular format a name
beginning with write_{formatname}.

If routines write columns, rather than the raw protocol tree, don't give
it a name containing proto_tree.

Get rid of empty preamble/finale routines.

For CSV, the preamble routine writes out column titles, so call it
write_csv_column_titles().

For C arrays, the body routine writes out raw hex data, so call it
write_carrays_hex_data().

capture_file isn't a structure defined by libwireshark, so don't make it
an argument passed into libwireshark.

Change-Id: I5a7e04de9382cf51a59d9d9802f815b8b3558332
Reviewed-on: https://code.wireshark.org/review/5536
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-29 22:44:29 +00:00
Guy Harris 741db4c751 Get rid of another global in the print code.
Pass the "output only these protocols" hash table as an argument,
instead.

Change-Id: Id8540943037e7b9bbfe377120c3f60dbe54fe0f1
Reviewed-on: https://code.wireshark.org/review/5440
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 09:07:46 +00:00
Guy Harris b19b12a85d Get rid of write_headers global variable.
Have write_psml_preamble() and write_csv_preamble() take a capture_file *
as an argument, so they can print the column titles themselves, rather
than having to defer it to the routine that prints packet data.

Change-Id: Ifd1b7a13062be8ad46846315976922a752778153
Reviewed-on: https://code.wireshark.org/review/5438
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 08:07:24 +00:00
Guy Harris 25f950eca9 Add tshark -G dissector-tables to dump a list of dissector tables.
That list doesn't show the entries in the dissector tables, just
information about the tables themselves.

Clean up some tshark man page issues while we're at it.

Change-Id: I70beee34110f5c0d58105944dd71105a8400f5ca
Reviewed-on: https://code.wireshark.org/review/5360
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-17 02:26:57 +00:00
Guy Harris 225c86f7a2 Do the "-z help" processing separately, and do it for Wireshark as well.
Yes, Wireshark does a bunch of GUI stuff, and then takes the window down
before printing the help, but the same is true for some command-line
error messages as well.

Change-Id: Id501468416c83308e4c0a9e7a66116d8d33a9d84
Reviewed-on: https://code.wireshark.org/review/5317
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-15 00:27:48 +00:00
Guy Harris 4d3c4c4f12 Rename stat_cmd_args.[ch] to stat_tap_ui.[ch].
The intent is to handle more than just command-line arguments; reflect that.

Change-Id: Ia10efda85a9d11c6579d1bec6f789cee30d9e825
Reviewed-on: https://code.wireshark.org/review/5304
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14 18:52:06 +00:00
Guy Harris 9f2a87803b Get rid of unnecessary includes of ctype.h.
Change-Id: Ibf9385715b85186f5c7289165acea7233b3fabde
Reviewed-on: https://code.wireshark.org/review/4804
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-18 00:06:19 +00:00
Guy Harris a566f617d8 No need for WTAP_ERR_CANT_READ.
Unlike the standard I/O routines, the code we introduced that supports
fast random seeking on gzipped files will always supply some specific
error code for read errors, so we don't need WTAP_ERR_CANT_READ.

Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard
I/O routines for that.  Set errno to WTAP_ERR_CANT_WRITE before calling
fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails
without setting errno.

Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63
Reviewed-on: https://code.wireshark.org/review/4540
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07 23:19:56 +00:00
Guy Harris 54b733ce9a Make the time stamp resolution per-packet.
Pcap-ng files don't have a per-file time stamp resolution, they have a
per-interface time stamp resolution.  Add new time stamp resolution
types of "unknown" and "per-packet", add the time stamp resolution to
struct wtap_pkthdr, have the libwiretap core initialize it to the
per-file time stamp resolution, and have pcap-ng do the same thing with
the resolution that it does with the packet encapsulation.

Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which
means "use the packet's resolution to determine how many significant
digits to display".  Rename all the WTAP_FILE_TSPREC_XXX values to
WTAP_TSPREC_XXX, as they're also used for per-packet values.

Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69
Reviewed-on: https://code.wireshark.org/review/4349
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28 18:38:18 +00:00
Pascal Quantin a3c4133847 tshark: fix -H option
The dump of the address info list must be differed to the end of the processing so as to know which host name was actually used in the capture

Bug: 10507
Change-Id: I44dbfae918d4ae92f9740c309804c7ff21bb4e1b
Reviewed-on: https://code.wireshark.org/review/4327
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-27 12:13:06 +00:00
Gerald Combs ea6fa049c9 Update the simple dialog code.
Rename simple_dialog_qt.{cpp,h} to simple_dialog.{cpp,h}. Make it a
subclass of QMessageBox. Queue messages at startup similar to GTK+.

Move the GTK+-specific simple_dialog declarations to
gtk/simple_dialog.h.

Don't yell at the user so much. Replace exclamation points with periods.

Change-Id: I1cc771106222d5e06f1f52d67ac29d6dc367cce4
Reviewed-on: https://code.wireshark.org/review/4288
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-25 22:02:43 +00:00
Guy Harris 22a0d65a9a Free err_info on WTAP_ERR_DECOMPRESS.
Change-Id: I57fbb17baf43b0f1365fef72778ac0e65935456a
Reviewed-on: https://code.wireshark.org/review/4210
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-20 19:07:22 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Reviewed-on: https://code.wireshark.org/review/3798
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-24 08:04:08 +00:00
Michael Mann 018b84de84 Refactor "common" hostlist/endpoint table functionality.
This is very similar in architecture to the changes made to the Conversation table functionality.  Since all conversations have endpoints/hostlists, the "registered" list is shared for both.

Change-Id: Ie8c6910a68a1b3f27c5b18c4494f49b9404a7b31
Reviewed-on: https://code.wireshark.org/review/3214
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-18 04:24:39 +00:00
Bill Meier f3dd7fe1eb Fix whitespace/indentation to match editor modelines.
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca
Reviewed-on: https://code.wireshark.org/review/3452
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-05 20:42:21 +00:00
Guy Harris 0734ac385f Rename buffer_ routines to ws_buffer_ to avoid name collisions.
In particular, epan/wslua/lrexlib.c has its own buffer_ routines,
causing some linker warnings on some platforms, as reported in bug
10332.

(Not to be backported to 1.12, as that would change the API and ABI of
libwsutil and libwiretap.  We should also make the buffer_ routines in
epan/wslua/lrexlib.c static, which should also address this problem, but
the name change avoids other potential namespace collisions.)

Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28
Reviewed-on: https://code.wireshark.org/review/3351
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02 11:01:29 +00:00
Michael Mann dcf6d44b7f Apply refactored "conversation" (tap) data to TShark.
I intentionally left the fields displayed alone (so they don't exactly match Wireshark GUI), because as Guy points out in bug 6310, not sure its A Bug or A Feature.  But at least all types of conversations allowed are in sync with Wireshark GUI.

Bug:6310
Change-Id: I722837df510a39dadc1f9a07a99275509516698c
Reviewed-on: https://code.wireshark.org/review/3212
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-30 16:12:54 +00:00
Michael Mann 31ecdf5b06 Refactor "common" Conversation table functionality.
Refactor (non-GUI) conversation table functionality from gtk/Qt to epan.  Also refactor "common GUI" conversation table functionality.

The idea is to not have to modify the GUI when a dissector adds a new "conversation type"

Change-Id: I11f08d0d7edd631218663ba4b902c4a4c849acda
Reviewed-on: https://code.wireshark.org/review/3113
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-07-26 20:59:42 +00:00
Peter Wu 0492921adc Replace lseek/fstat by ws_lseek64/ws_fstat64
lseek returns an off_t type which is system-dependent. Use ws_lseek64 in
favor of lseek as that supports 64-bit quanities.

Use ws_fstat64 instead of stat to support 64-bit file sizes on Windows.
For the majority of the changes, this makes no difference as they do not
apply to Windows ("ifndef _WIN32"; availability of st_blksize).

There are no other users of "struct stat" besides the portability code
in wsutil. Forbid the use of fstat and lseek in checkAPIs.

Change-Id: I17b930ab9543f21a9d3100f3795d250c9b9ae459
Reviewed-on: https://code.wireshark.org/review/3198
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-25 21:26:01 +00:00
Guy Harris 4028f56709 Clean up indentation (get rid of tabs).
Change-Id: I14917737db30c80af2d40e40efd79ceb6aea79f8
Reviewed-on: https://code.wireshark.org/review/3170
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-22 23:57:02 +00:00
Guy Harris f6ce0cdacd Get rid of NO_INTERFACES_FOUND - it's not an error.
It just means "pcap didn't give me any interfaces, and didn't report an
error".  Hopefully, in the future, there will be pcap APIs that
distinguish between the (admittedly unlikely, these days) case of "there
really *are* no interfaces on which *anybody* can capture" and "you
don't have sufficient permission to capture", and we can report the
latter as an error.  (Given that pcap supports more than just "regular
interfaces", though, there are cases where you don't have permission to
capture on those but you have permission to capture raw USB traffic, for
example, so perhaps what's really needed is per-interface indications of
permissions.)

Change-Id: I7b8abb0829e8502f5259c95e8af31655f79d36a1
Reviewed-on: https://code.wireshark.org/review/3169
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-22 23:53:49 +00:00
Evan Huus 42b537ea49 Reset state when cycling ring-buffer files in tshark.
This has several implications:
 - we match user expectations that a ring-buffered tshark capture will run
   forever without running out of resources (except where we still have leaks)
 - we lose reassembly and request/response matching when the relevant packets
   are split across files, but this actually makes our output more consistent
   with dissecting those files after-the-fact

I have not made it configurable in this change because I'm not really sure
there's a use case for the old behaviour - if you're running a ring-buffer
capture in the first place it's because you're willing to discard old data to
limit resource usage. If you want the full dissection without breaks, just don't
use a ring buffer at all and take the resource hit in both disk and memory.

Change-Id: I7d8f84b2e6040b430b7112a45538041f2c30f489
Reviewed-on: https://code.wireshark.org/review/2669
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-05 22:08:59 +00:00
Guy Harris 9e6487f247 Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in
TShark and Wireshark as well.

Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7
Reviewed-on: https://code.wireshark.org/review/2841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-04 07:25:26 +00:00
Guy Harris 66b02c75ed Include <sys/capaibility.h> to get _LINUX_CAPABILITY_VERSION defined.
It's no longer used in version_info.c, but is used in the main source
files of TShark and Wireshark (it's already included in dumpcap).

Change-Id: I2169a2bbed678baf26fc8711d7c13d95cce3ee2a
Reviewed-on: https://code.wireshark.org/review/2819
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 15:22:45 +00:00
Guy Harris 1692c520ef Include "capture-pcap-util.h" even if we don't have libpcap.
The routines to get libpcap version information just say "no pcap here"
if we don't have it, so they're called regardless of whether we were
compiled with it.

Change-Id: I4e58cce83f7c0e36aa6ef9b40ec7075732402f3b
Reviewed-on: https://code.wireshark.org/review/2800
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 09:16:39 +00:00
Guy Harris 35c47214e9 Get rid of an extra blank line.
Change-Id: I321ef1404e37ebb13a456d18eeb81285b7ba477f
Reviewed-on: https://code.wireshark.org/review/2796
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 08:56:00 +00:00
Guy Harris b4ce352539 Make --help and --version information a bit more uniform.
Have --version print the version number, the copyright information, the
"compiled with" information, the "running on/with" information, and the
compiler information.

Have --help print the version number, a one-line summary of what the
program does, a reference to http://www.wireshark.org for more
information, a Usage: line, and a list of command-line options.

This means programs doing that don't need to include version.h; that's
left up to get_ws_vcs_version_info() to do.

Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb
Reviewed-on: https://code.wireshark.org/review/2794
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 08:46:01 +00:00
Guy Harris 6b3391c60a Regularize the help output of programs.
Only print to the standard output, and only give the version
information, if a "print help" command-line option is specified.
Otherwise, leave out the version information, and print to the standard
error.

Leave out the copyright information; it's extra cruft, and

	http://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html

doesn't say anything about it (and bash, at least, doesn't print it).

Change-Id: Ic5029ccf96e096453f3bd38383cc2dd355542e8a
Reviewed-on: https://code.wireshark.org/review/2789
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 02:29:54 +00:00
Guy Harris 66c342ed59 Regularize the first line of version output.
For Wireshark, say "Wireshark", not "wireshark".

For other programs, put "(Wireshark)" after the program name, as per

	http://www.gnu.org/prep/standards/html_node/_002d_002dversion.html

("If the program is a subsidiary part of a larger package, mention the
package name in parentheses, like this").

Change-Id: I68558f64cfa6ee4423e42f3d6b120633ef1b2716
Reviewed-on: https://code.wireshark.org/review/2788
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 02:03:35 +00:00
Guy Harris 0cf54e7827 Drop privileges even earlier.
Do it at the same point at which Wireshark does so.  Do some other
things in the same order as well.

Change-Id: I2925366d49d14271ceffa1a938b5e3450337c772
Reviewed-on: https://code.wireshark.org/review/2743
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-01 10:11:49 +00:00
Guy Harris efafca71a3 Drop privileges very early on.
TShark relies on dumpcap to capture packets, and TFShark doesn't even do
packet capturing (it dissects files, not network traffic), so neither of
them need, or should run with, special privileges.  If you *must* run
with special privileges in order to capture, grant those privileges to
dumpcap, which has a *lot* fewer lines of code than libwireshark and
TShark/TFShark.

Change-Id: I8f8fedead355ca163895e025df37240d2f232ba4
Reviewed-on: https://code.wireshark.org/review/2736
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 23:12:32 +00:00
Guy Harris b33512b704 Move capture_session.h to capchild; what it declares is defined there.
Change-Id: I8b1407839390b7ac0b45bf6f583c1a509073f002
Reviewed-on: https://code.wireshark.org/review/2709
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 05:09:31 +00:00
Guy Harris df5833723c Move capture_ui_utils.[ch] to libui.
Change-Id: Id0f3d4d60a1acc7aa64fd3737b8f16df5bca4e5a
Reviewed-on: https://code.wireshark.org/review/2708
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 01:36:56 +00:00
Guy Harris fe42762f23 Move some more stuff into wsutil.
Move the routines to parse numerical command-line arguments there.

Make cmdarg_err() and cmdarg_err_cont() routines in wsutil that just
call routines specified by a call to cmdarg_err_init(), and have
programs supply the appropriate routines to it.

Change-Id: Ic24fc758c0e647f4ff49eb91673529bcb9587b01
Reviewed-on: https://code.wireshark.org/review/2704
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-29 23:03:24 +00:00
Jeff Morriss 9d4af5fccd Check the validity of fields given to tshark with "-e": complain and exit if
they aren't valid.

Should help avoid confusion like that in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10201

Bug: 10201
Change-Id: Iff7f51ae042ca1a92d1c803b6cb61aa5d81ce205
Reviewed-on: https://code.wireshark.org/review/2654
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-27 00:48:51 +00:00
Jeff Morriss e0461ecd43 Indicate tshark can read (-r) from stdin and named pipes now.
(Though it works only with certain formats.)  As requested in:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2874#c4

Change-Id: I2ce0509d8750b21ae0167d12459074ba0f9506f8
Reviewed-on: https://code.wireshark.org/review/2646
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-25 18:01:28 +00:00
Guy Harris 0fb9369a5e Support -w even if we're not built with pcap.
You can, for example, do

	tshark -r file1 -Y filter -w file2

to read a file, apply a read filter, and write the packets that match
the filter to another file even if you can't capture traffic.

Change-Id: Ifd5e1d5c0e745edef5e98ec4babc720bfbcee6d9
Reviewed-on: https://code.wireshark.org/review/2627
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24 20:49:06 +00:00
Guy Harris 5a3632ef40 Load WinPcap before we get the run-time information string.
That way, we can include the WinPcap version in that string.

Change-Id: I01fa0defce158e122d1c602fdfbc81916a9e80ef
Reviewed-on: https://code.wireshark.org/review/2625
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24 20:05:28 +00:00
Guy Harris adf6b1a8df For capchild headers, include <capchild/XXX.h>.
Change-Id: I780c69ee637dcd9846756a2e2d6a35baf02d826d
Reviewed-on: https://code.wireshark.org/review/2594
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24 00:28:08 +00:00
Guy Harris 1d92195de8 Have individual programs get libpcap and libz version info.
That way, the code that constructs the runtime version string doesn't
itself have to call libpcap and libz, and could be usable in programs
that don't call them.

While we're at it, add "with" to the run-time version information for
GnuTLS and libgcrypt, to match the compile-time version information, and
add the version information from libwireshark to TShark.

Change-Id: I3726a027d032270b032292da9314c1cec535dcd2
Reviewed-on: https://code.wireshark.org/review/2587
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-23 21:56:42 +00:00
Guy Harris c46329c27b Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree
checked out from Wireshark's version control system, returns a string
that includes both the Wireshark version number and an indication of
what particular VCS version was checked out, and just returns
Wireshark's version number for other builds.

Use that routine rather than manually gluing VERSION and the Git version
number together.

("vcs", not "git", just in case we do something bizarre or mercurial
some day. :-))

Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d
Reviewed-on: https://code.wireshark.org/review/2529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22 01:06:25 +00:00
Guy Harris a70dea1956 Move get_os_major_version() to wsutil and rename it to get_windows_major_version().
It's Windows-specific, so name it appropriately.

Change-Id: Ic518cbfabebf95757f6b308a4d547a6cabed6a5e
Reviewed-on: https://code.wireshark.org/review/2528
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21 21:33:11 +00:00
Guy Harris 43443af0ac Move get_copyright_info() to wsutil.
Change-Id: I75c1c747cd2b4a9845c659636582d54b2caecf1a
Reviewed-on: https://code.wireshark.org/review/2510
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21 17:33:05 +00:00
Guy Harris b2622e1194 Move the "capture-comment" long option to LONGOPT_CAPTURE_COMMON.
Change-Id: I55884d48911de307cde52accfebbda69f2989526
Reviewed-on: https://code.wireshark.org/review/2505
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 23:43:41 +00:00
Guy Harris 235d3a2a3a Fix build without pcap.
The files that use LONGOPT_CAPTURE_COMMON and OPTSTRING_CAPTURE_COMMON
include capture_opts.h unconditionally, so there's no need to define
them if we don't have pcap.  In addition, we want the capture options
"available" even if we don't have pcap, so we can tell the user "you're
using a version of *shark without pcap, but you gave a capture option".

Change-Id: I0bd3893b73d3d903610d0bc6cacb60bfb37096f4
Reviewed-on: https://code.wireshark.org/review/2503
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 23:26:46 +00:00
Guy Harris b3885a9387 Fix builds without pcap.
Change-Id: I6c67f9ea9d115a8396af0904ef9a73d2c528dcaa
Reviewed-on: https://code.wireshark.org/review/2498
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:51:34 +00:00
Guy Harris cc4710ac5f Also define LONGOPT_CAPTURE_COMMON as nothing if we don't have pcap.
While we're at it, simplify the #ifdefs and #defines in capture_opts.h -
don't do the same tests twice.

Change-Id: I2079167f31789470ef77120054d769d5914745e3
Reviewed-on: https://code.wireshark.org/review/2496
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:39:08 +00:00
Guy Harris 9a50b0f20b Define OPTSTRING_CAPTURE_COMMON as nothing if we don't have pcap.
No capturing, no capture options.

Change-Id: I0023184b9c358d5876f19a098590f34d641c8649
Reviewed-on: https://code.wireshark.org/review/2493
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:14:27 +00:00
Guy Harris 26bbee3fad Add some long options for capture short options.
The names match tcpdump trunk's names for the corresponding options.

Also have capture_opts.h provide a #define for the part of the short
option string that corresponds to the capture short options that all our
programs that take capture short options take (those are largely the
ones we have in common with tcpdump).

Change-Id: Ia209425959c801725850b56a7d63441ee99b5001
Reviewed-on: https://code.wireshark.org/review/2492
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:00:16 +00:00
Guy Harris 312ed10900 Add --help and --version long options.
Also, make the convention for long-only options be that their
case-statement values start at 128, so they avoid colliding with any
ASCII code points, including control characters.

Make the tables of long options "static const" while we're at it, and
get rid of unnecessary casts.

Change-Id: I55702a85e9bc078b1cd0f2803ebb68a710405bab
Reviewed-on: https://code.wireshark.org/review/2491
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 19:19:47 +00:00
Bill Meier 68a1b552f7 tshark.c: 'tshark -F pcap -w ...' should create a pcap (not pcapng) file; fixes Bug #9991.
Change-Id: I182357fc57d6e57033319afc762549d805c2c10c
Reviewed-on: https://code.wireshark.org/review/1954
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-04 19:31:08 +00:00
Bill Meier dc02627adf tshark.c: Change "Live captures can only be saved in libpcap format" to "[...] in pcap or pcapng format"
Change-Id: I18dd0d15e261ecbc1ec086b4870a994afc7665ee
Reviewed-on: https://code.wireshark.org/review/1953
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-06-04 19:30:29 +00:00
Guy Harris 318cf8a678 Add support for dissecting non-packet records.
Add a dissector table indexed by the file type, and, for the
file-type-specific records, have the frame dissector skip the usual
pseudo-header processing, as the pseudo-header has a file-type-specific
record subtype in it, and call the dissector for that file type's
records.

Change-Id: Ibe97cf6340ffb0dabc08f355891bc346391b91f9
Reviewed-on: https://code.wireshark.org/review/1782
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-25 00:05:07 +00:00
Guy Harris a344c9736e Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c.

A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes.  That is in-progress.

Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6
Reviewed-on: https://code.wireshark.org/review/1741
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 10:50:10 +00:00
Guy Harris 716fdc8e39 Revert "Fix some white space issues."
This reverts commit 2456b22cd3.

Next step: revert my other change.

Change-Id: I7a2302c527c8a85ce9f37d6e4f68c1e2d0adb741
Reviewed-on: https://code.wireshark.org/review/1740
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 10:48:57 +00:00
Guy Harris 2456b22cd3 Fix some white space issues.
Change-Id: I3b4f57c2d1ceffeea1770494fe19a0eee8717a76
Reviewed-on: https://code.wireshark.org/review/1737
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 03:05:56 +00:00
Guy Harris c0c480d08c Allow wtap_read() and wtap_seek_read() to return non-packet records.
This is the first step towards implementing the mechanisms requestd in
bug 8590; currently, we don't return any records other than packet
records from libwiretap, and just ignore non-packet records in the rest
of Wireshark, but this at least gets the ball rolling.

Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574
Reviewed-on: https://code.wireshark.org/review/1736
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 03:02:32 +00:00
Peter Wu 3aee917058 wiretap: remove unused code, drop number_of_interfaces
While investigating an ASAN issue (fixed in
commit dcdd076ab0), I got greatly confused
by three different types having the same "interface_data" field name:

 * pcapng_t *pn stores an array of interface_data_t objects.
 * wtap *wth stores an array of wtapng_if_descr_t objects.
 * pcapng_dump_t should store an array of interface_data_t objects.

pcapng_dump_t and friends are unused since
commit c7f1a431d2, so drop it.

To fix the confusion, rename the interface_data_t type to
interface_info_t type and use the local variable "iface_info"
everywhere. Rename interface_data of pcapng_t to "interfaces" and
add a comment what this exactly means (interfaces listed in the capture
file).

Drop the number_of_interfaces field for interfaces as the array
length is already available from GArray. Now interface_data is always
initialized for wth (which also gets copied to idb).

s/int/guint/g and replace cast at some places.

There are no regressions for the in-tree test suite.

Change-Id: I2d5985c9f1e43f8230dbb4a73bd1e243c4858170
Reviewed-on: https://code.wireshark.org/review/1656
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-17 12:41:50 +00:00
Guy Harris a1b1c8bed5 Revert "Refactor Wiretap"
This reverts commit 1abeb277f5.

This isn't building, and looks as if it requires significant work to fix.

Change-Id: I622b1bb243e353e874883a302ab419532b7601f2
Reviewed-on: https://code.wireshark.org/review/1568
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09 05:21:01 +00:00
Michael Mann 1abeb277f5 Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality.

The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes.

bug:9607
Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-on: https://code.wireshark.org/review/1485
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-09 03:04:39 +00:00
Guy Harris cb16dff992 Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it.  Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.

Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.

Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 22:27:22 +00:00
Hadriel Kaplan e7b3eff721 Fix tshark.c to pass checkAPIs script
Since tshark.c was using strdup, perror, and g_main_quit, changes to
the file won't pass checkAPIs; so this commit replaces those with
the approved functions; except strdup, which was unecessary.

Change-Id: I031aa44594f2b96960a45f48537ab4e9a10d34b1
Reviewed-on: https://code.wireshark.org/review/898
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01 06:06:00 +00:00
Hadriel Kaplan b63b503456 Fix Bug 9938 'tshark "-Y -2 -w" saves non-dependent frames'
When the '-Y' display filter option is given with a '-2', and a '-w' to write out
the packets, tshark grabs *all* dependent frames in the catprue file, even those
that weren't dependents of a matching packet. Note that this also uses the '-2'
two-pass option, since only two-pass mode writes out dependent frames to begin with.

Change-Id: I17726447bec434ba2566e98fb78893d1331e3056
Reviewed-on: https://code.wireshark.org/review/866
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-30 17:36:18 +00:00
Hadriel Kaplan ca9c160933 Fix bug9931 'Encapsulated ethernet packets sometimes show invalid FCS'
This fixes part-1 of bug9931: the uninitialized use of a wtap_pkthdr
struct. The second part of the bug deals with dissectors calling
the Ethernet dissector for ecnapsulated Ethernet packets but using
the wrong dissector handle to do so. That's unrelated to the issue this
commit addresses, so I'm splitting them up.

Change-Id: I87be7b736f82dd74d8c261062f88143372b5344c
Reviewed-on: https://code.wireshark.org/review/848
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-27 21:39:57 +00:00
Hadriel Kaplan d1873dbcc8 Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'
There's a relatively new feature in 1.11.3 to select a specific file format
reader, instead of relying on magics or heuristics. If you select a file
reader and open a file, open it, and then click the reload-file button or go
to View->Reload or press the ctrl-R keymap, the file is reloaded but using the
magic/heuristics again instead of the file format reader you previously chose.
Likewise, the Lua relaod() function has the same issue (which is how I found
this problem).

I have tested this change by hand, using a Lua script, but I didn't add it
to the testsuite because I need another change for my test script to work
correctly. (an enhancement rather than a bug fix, which I'll submit separately)

Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01
Reviewed-on: https://code.wireshark.org/review/764
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21 17:51:45 +00:00
Hadriel Kaplan 041f844d72 Add command-line arg for input file format for tshark/wireshark
Now that we have the ability to choose input file format type
in the GUI, we might as well have it in the command-line too.
Plus it would help me in test-stuies if we had a commandline.
So I've added a '-X read_format:Foo' for this.  Using just
'-X read_format:', or with a bad name, will make it print out
the full list (in tshark); just like the '-F' does for output
file formats.

Note: I am *not* putting in code for Win32 GUI,
because I can't compile that and I wouldn't have even
done the GTK one if I could compile Qt originally. (I don't think we need
to add any more features to GTK or Win32, just Qt from now on,
right?)

Change-Id: I2fe6481d186f63bd2303b9e591edf397a2e14b64
Reviewed-on: https://code.wireshark.org/review/493
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-05 18:38:05 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Michal Labedzki 579e7e19ce Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.

On the other side now it is possible to open capture file
as file format to be dissected.

Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-on: https://code.wireshark.org/review/16
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-25 17:43:13 +00:00
Guy Harris c65fbffc95 Force "printing" if -T is specified, even if -w is also specified.
Just as "tshark ... -P -w xxx" writes raw packets to xxx *and* writes
text packet summaries to the standard output, and just as "tshark ...
-V -w xxx" writes raw packets to xxx *and* writes text packet details to
the standard output, so should "tshark ... -T fff -w xxx" write raw
packets to xxx *and* write whatever "-T fff" (and any "-e" options)
specifies to the standard output.

Change-Id: I28ab3a4d48531f297533ec4dfb3742031eb69885
Reviewed-on: https://code.wireshark.org/review/278
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-21 01:51:58 +00:00
Guy Harris 114d051aef Fix crash when doing "tshark -2 -r file -w newfile".
We were using cf->buf in some places and a local variable buf in others;
consistenly use the local variable.

Have a local variable for the struct wtap_pkthdr while we're at it; with
some work we may be able to get rid of the struct wtap_pkthdr and the
Buffer in the capture_file structure.

Change-Id: I4762e22e11ef576be6bf9015450d1a270dd3d16b
Reviewed-on: https://code.wireshark.org/review/178
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-11 19:50:26 +00:00
Gerald Combs f966980937 Replace "svn" with "git" all over the place.
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate.
Rename "svnversion.h" to "version.h" as Evan suggested. Update some
URLs. In make-version.pl, make sure we don't set an improper upstream
branch name. Use the number of commits + short hash from `git describe`
for package names by default.

Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96
Reviewed-on: https://code.wireshark.org/review/139
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-07 23:03:03 +00:00
Peter Hatina f62450ff93 allow tshark reading from pipes
Change-Id: If20a14b949667911df44f09c6a705b7645d4c49e
Reviewed-on: https://code.wireshark.org/review/85
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-03 13:31:27 +00:00
Guy Harris 90d7c5f59b Don't write out packets that have a "captured length" bigger than we're
willing to read or that's bigger than will fit in the file format;
instead, report an error.

For the "I can't write a packet of that type in that file type" error,
report the file type in question.

svn path=/trunk/; revision=54882
2014-01-22 00:26:36 +00:00
Guy Harris 97137766e7 In a source file that defines external functions, the header file that
declares the functions must be included, in order to make sure the
declarations match the function signature.  Make it so.

Said header declares pipe_input_cb_t, so we don't have to do it
ourselves.

svn path=/trunk/; revision=54750
2014-01-14 01:44:36 +00:00
Evan Huus 1678d378e7 Explicitly reject two-pass live capture, it doesn't work anyways.
svn path=/trunk/; revision=54643
2014-01-08 00:29:56 +00:00
Guy Harris 9d41c658fe No seek-read routines use the length argument, so eliminate it from
wtap_seek_read().

svn path=/trunk/; revision=54570
2014-01-02 20:47:21 +00:00
Chris Maynard 4c19d29b7c Improve tshark command-line error help. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9548 and adds addtional help, better formatting, sorting and some minimal documentation of the -u option to the tshark man page.
svn path=/trunk/; revision=53938
2013-12-11 16:52:40 +00:00
Guy Harris 125a17f8e5 Initialize the error-reporting routines before scanning for plugins, as
the code to scan for them uses those routines.

This means epan_init() no longer takes those routines as arguments -
which is just as well, given that the mechanism in question is no longer
part of libwireshark, but is part of libwsutil.

This should fix bug 9508.

svn path=/trunk/; revision=53796
2013-12-05 09:30:22 +00:00
Chris Maynard f98625c0d0 Don't forget to test even the simplest fixes.
svn path=/trunk/; revision=53763
2013-12-03 19:45:10 +00:00
Chris Maynard c28c8ed214 Wrap usage text at column 80.
svn path=/trunk/; revision=53761
2013-12-03 19:40:23 +00:00
Guy Harris c3de2cb2fe Don't assume we have Lua just because we have plugin support.
svn path=/trunk/; revision=53714
2013-12-02 09:10:13 +00:00
Guy Harris 0cc1545d05 Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins.  Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.

In particular applications, only process the relevant plugin types.

Add a Makefile.common to the codecs directory.

svn path=/trunk/; revision=53710
2013-12-02 08:30:29 +00:00
Guy Harris b5e698553e Report the interface when an open or an attempt to set the link-layer
header type fails, as we might be capturing on more than one interface.

Report the failing interface name in single quotes in some places where
we weren't doing so, for stylistic consistency.

svn path=/trunk/; revision=53593
2013-11-26 03:13:16 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Guy Harris 853da2eb9b The "file types" we have are actually combinations of types and
subtypes, e.g. Network Monitor version 1 and Network Monitor version 2
are separate "file types", even though they both come from Network
Monitor.

Rename various functions, #defines, and variables appropriately.

svn path=/trunk/; revision=53166
2013-11-08 09:53:01 +00:00
Guy Harris 2a088c1d53 Add support for displaying dates as year and day-of-year (1-origin).
In the process, fix various man page descriptions of the -t flag,
and add support for UTC absolute times in the iousers and iostat TShark
taps.

svn path=/trunk/; revision=53114
2013-11-06 20:39:09 +00:00
Chris Maynard 62b66aca7c Display the frame number on the packet summary line if it's one of the configured columns. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9317
#BACKPORT(1.10,1.8)

svn path=/trunk/; revision=52838
2013-10-25 12:51:16 +00:00
Jakub Zawadzki fe937ac3ad tshark: use epan_dissect_reset()
svn path=/trunk/; revision=52709
2013-10-20 12:35:55 +00:00
Chris Maynard 63e4539229 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9272
Add tshark -G column-formats report and document the missing ftypes, heuristic-decodes and plugins reports.

From me: Sort the reports.  Add modelines to epan/column.c.  Minor whitespace changes.

svn path=/trunk/; revision=52627
2013-10-15 18:27:35 +00:00
Jakub Zawadzki 6bb579ea87 Micro-optimize print_columns(): replace g_snprintf() & g_strlcat() with memcpy().
svn path=/trunk/; revision=52625
2013-10-15 18:20:59 +00:00
Jeff Morriss bcf51e8131 Fix the core dump reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9258 :
After calling wtap_close(), set the wth to NULL so we don't try to close it
again later. (The core only happens when tshark isn't keeping up with dumpcap's
file rotation.)

Wireshark still has a problem but it's a different one.

svn path=/trunk/; revision=52493
2013-10-10 14:53:19 +00:00
Michael Mann ba3e8e070a Make column "filter name" prefixed with _ws. to be the same as other "*shark application filters" created in r52462.
svn path=/trunk/; revision=52474
2013-10-09 19:43:02 +00:00
Evan Huus 8eb0bfdc5b Fix one small memory leak.
svn path=/trunk/; revision=51747
2013-09-04 12:01:09 +00:00
Evan Huus 5c851858d9 Fully deprecate read filter (-R) without two-pass (-2). It does exactly the same
thing as the display filter (-Y) in that case except with more confusing
semantics.

This also lets us fix -c in the single-pass case to unconditionally count
packets. This isn't the old behaviour (which counted them only if they passed
the read filter) but is more consistent with two-pass mode where they are
counted even if they pass the display filter, since they are counted on the
first pass and the display filter is applied on the second pass.

Anyone who wants to use -c to limit packet count conditionally on them passing a
filter should use it in tandem with -2 and -R: the read filter is applied on the
first pass before the count.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9048

svn path=/trunk/; revision=51556
2013-08-28 00:56:19 +00:00
Anders Broman 71f7093cf3 Output a warning about kernel BPF JIT compiler beeing activated.
svn path=/trunk/; revision=51488
2013-08-23 05:25:30 +00:00
Evan Huus 7e59f1fce6 Move a brace outside an #ifdef, it was confusing vim's folding.
svn path=/trunk/; revision=51461
2013-08-22 02:29:32 +00:00
Evan Huus 2161550470 Don't look at packet or byte limits during the second pass of two-pass analysis.
The limits are enforced during the first pass, and frames that get dropped from
the first pass for this reason aren't available to the second pass at all, so
checking again is redundant.

svn path=/trunk/; revision=51460
2013-08-22 02:19:22 +00:00
Guy Harris da7c920853 I guess Solaris's getopt_long() "struct option" declaration doesn't have
enough cowbell^wconst; throw in a comment to squelch warnings.

svn path=/trunk/; revision=51351
2013-08-14 01:21:13 +00:00
Evan Huus d8f00e22e1 As suggested in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033
Make epan_free a no-op if the pointer is NULL. This fixes 99% of the cases
causing problems for wmem_leave_file_scope() - remove that XXX comment and add
back the assertion.

Remove the cleanup_dissection call from epan_cleanup, it doesn't make sense
there. init_dissection is only called from epan_new, so cleanup_dissection
should only be called from epan_free.

Add one missing epan_free call to tshark revealed by the above changes.

svn path=/trunk/; revision=51342
2013-08-13 22:41:34 +00:00
Guy Harris 5c0baee2a9 Don't print the packet counter when capturing if we're also printing
packet information to a terminal (which we assume is the same terminal
as the one to which the packet counts are being printed), as they get in
the way of each other.

Don't print it if we're sending the standard error to a terminal, or if
-q is specified, either.

Put all the setting of print_packet_counts together; it looks as if the
default value of print_packet_counts may have been changed to TRUE and
the code to handle -q wasn't changed to set it to FALSE if -q was
specified rather than setting it to TRUE if it wasn't specified.

svn path=/trunk/; revision=51227
2013-08-09 00:24:31 +00:00
Guy Harris d017443979 Now that we're using getopt_long(), and have some options available only
as long options, and thus identified with numbers rather than option
letters as the return value of getopt_long(), we now have to include
capture_opts.h even if we're *not* building with libpcap, to provide
#defines for those numbers.

svn path=/trunk/; revision=51115
2013-08-02 07:07:35 +00:00
Martin Kaiser 6ae3372687 fix buildbot error on OSX-10.6-x64
include capture_opts.h

svn path=/trunk/; revision=51099
2013-08-01 22:21:53 +00:00
Martin Kaiser 24c88b8007 pass --capture-comment from tshark to dumpcap
handle error cases in tshark

svn path=/trunk/; revision=51094
2013-08-01 21:09:19 +00:00
Martin Kaiser 5863aaa51b add --capture-comment to tshark's print_usage() function
make it clear that a capture comment can only be added when we
create a new file

svn path=/trunk/; revision=51091
2013-08-01 21:04:28 +00:00
Jakub Zawadzki 08eb36b5af Remove fdata->opt_comment, add pkt_comment to pinfo
Original (read from file) comments can be accessed by pkthdr->opt_comment
Keep user comments in seperated BST, add new method for epan session to get it.

svn path=/trunk/; revision=51090
2013-08-01 20:59:38 +00:00
Martin Kaiser 6c5e16185d add --capture-comment to tshark
make sure that getopt() does not permute tshark's argv[] array

svn path=/trunk/; revision=51089
2013-08-01 20:57:47 +00:00
Martin Kaiser 7cdd97b089 use getopt_long() in tshark
svn path=/trunk/; revision=51087
2013-08-01 20:45:59 +00:00
Martin Kaiser 0cbe856098 simplify argument checking for tshark
if a capture file is read, do all corresponding checks in one place

svn path=/trunk/; revision=51086
2013-08-01 20:44:50 +00:00
Guy Harris 9e77cc4bf3 Make some functions not used outside tshark.c static.
svn path=/trunk/; revision=50858
2013-07-23 23:48:51 +00:00
Jakub Zawadzki 7ec1a78fe8 Abuse epan_t more: add callback to get interface name.
svn path=/trunk/; revision=50794
2013-07-22 19:38:38 +00:00
Jakub Zawadzki c702e92121 Replace relative timestamp with reference frame number. Saves 16B per frame.
svn path=/trunk/; revision=50772
2013-07-21 23:07:33 +00:00
Jakub Zawadzki 5d52e16734 Add helper function to epan_session which can be used to get absolute timestamp of given frame.
Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number.

This patch reduce size of frame_data by 8B (amd64)
This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13)

svn path=/trunk/; revision=50765
2013-07-21 20:48:30 +00:00
Jakub Zawadzki 28e9dcc4a9 Some work on multi file dissection
- make init_dissection/cleanup_dissection private for libwireshark
- implement epan_new(), epan_free()
- pass epan_t to epan_dissect*

svn path=/trunk/; revision=50761
2013-07-21 18:38:03 +00:00
Jeff Morriss 4dcc156cf3 Move the print modules into epan.
svn path=/trunk/; revision=50526
2013-07-12 03:50:50 +00:00
Jeff Morriss 16206348d9 Move disabled_protos.{h,c} into epan.
svn path=/trunk/; revision=50521
2013-07-12 01:40:06 +00:00
Jakub Zawadzki ce81449ed9 packet dissection now takes pointer to tvb instead of guint8 data
implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497
2013-07-11 05:47:02 +00:00
Jeff Morriss 36d3734dcb From Jim Young via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8906 :
This patch augments Wireshark's and tshark's augument usage reports (-? and
-t?) and the Wireshark and tshark man pages to list all available timestamp
options available for the -t option.

svn path=/trunk/; revision=50445
2013-07-08 16:25:13 +00:00
Evan Huus 56db3a238e Fix the last remnant of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8160
Correctly calculate delta-displayed time when using two-pass dissection with a
display filter.

svn path=/trunk/; revision=50397
2013-07-06 02:49:57 +00:00
Luis Ontanon 0bdc0efc46 get main_window_update out of the way... pass an update_cb to the capture_sync stuff
... as per the XXX comment removed from tshark.c this was a mess to keep the linker
happy... I couldn't!

I did this without even understanding whether calling main_window_update was realy
necessary in most cases. I guess nothing or more specific update cbs would be best.


svn path=/trunk/; revision=50188
2013-06-27 17:10:50 +00:00
Guy Harris 8c9edf1280 Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.

This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.

svn path=/trunk/; revision=49949
2013-06-16 00:20:00 +00:00
Chris Maynard fd1746412b Allow tshark to read a pcap file and either save it as a new pcap file or for packets to be read from the original pcap file, possibly filtered, then sent to stdout and piped to either tshark or wireshark, which can then read those filtered packets from stdin. Patch submitted by me in bug 2868, although it doesn't actually fix that bug.
#BACKPORT(1.10)

svn path=/trunk/; revision=49780
2013-06-05 03:07:57 +00:00
Jeff Morriss 7dddfb1784 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8714 :
If we're not doing dissection (in 2-pass mode) then don't try to mark frames
as depended upon: in that case epan has not been initialized so we shouldn't
be looking in the edt (and anyway without dissection there won't be any
dependent frames).

(I'm not convinced there's any reason to run 2-pass mode without dissection,
however...)

svn path=/trunk/; revision=49554
2013-05-24 15:28:04 +00:00
Guy Harris f334c4a0c8 No capture options if no libpcap.
svn path=/trunk/; revision=49519
2013-05-22 19:21:31 +00:00
Guy Harris 9ac21fd6cc AAAAAArgh. The capture_input_new_XXX routines are called from
capture_sync.c, not from capture.c, so they should be declared in
capture_sync.h, so callers that use the capture_sync.c stuff but not the
capture.c stuff - such as TShark - get the declarations and get their
implementations compared with the signatures that they should have.

Doing so points out that some of them in TShark *don't*, so fix that.

svn path=/trunk/; revision=49517
2013-05-22 19:14:52 +00:00
Guy Harris 90e2456849 Another Win32-only fix.
svn path=/trunk/; revision=49501
2013-05-22 08:59:13 +00:00
Guy Harris 8596d17d7f Pull the capture-session state information out of capture_opts and put
it into a separate capture_session structure.  capture_opts should
contain only user-specified option information (and stuff directly
derived from it, such as the "capturing from a pipe" flag).

svn path=/trunk/; revision=49493
2013-05-22 07:44:28 +00:00
Guy Harris 1ca63098ac Rename capture_opts_trim_iface() to
capture_opts_default_iface_if_necessary(), to reflect what it actually
does.

svn path=/trunk/; revision=49491
2013-05-22 04:49:31 +00:00
Guy Harris 39779a7bee Send the output of the -D and -L options to the standard output rather
than the standard error.

In Wireshark on Windows, create a console before doing so and destroy it
before exiting.  Don't do that in TShark or dumpcap, as those are
console-mode programs on Windows.

This should fix bug 8609 and still allow "wireshark -D" and "wireshark
-L" to work when the standard output isn't redirected.

svn path=/trunk/; revision=49025
2013-04-25 05:47:11 +00:00
Chris Maynard 4ac2441d7c Coalesce "-G fields2" and "-G fields3" into "-G fields", as discussed on -dev.
See: http://www.wireshark.org/lists/wireshark-dev/201304/msg00015.html

svn path=/trunk/; revision=48753
2013-04-05 21:58:43 +00:00
Evan Huus 2fba8c0f9d Update -2, -R and -Y to behave consistently as per the concensus reached on
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8223

Mention the new -Y flag and associated changes in the release notes.

svn path=/trunk/; revision=48654
2013-03-30 15:38:03 +00:00
Evan Huus d935a280e3 From Hadriel Kaplan via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8223
Add a 2-pass display-filter flag to tshark so that reassembly and other forward-
looking dissections can be used with filters.

It's a bit of a hack, but this entire area of 2-pass analysis etc. is a giant
pile of hacks to begin with and needs cleaning up. For now just having this
feature is a big enough win.

svn path=/trunk/; revision=48589
2013-03-27 17:14:42 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Evan Huus 32799db42c Fix the leaking of packet comments, i.e. the rest of
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7530

The frame_data_cleanup function was ambiguous; it was being used for two
different purposes, and did neither of them quite properly. Split it instead
into frame_data_reset and frame_data_destroy, and call the correct one depending
on why we were originally calling frame_data_cleanup.

svn path=/trunk/; revision=48324
2013-03-15 18:04:50 +00:00
Anders Broman 7990a0e4d0 Use explicit casts.
svn path=/trunk/; revision=48137
2013-03-06 17:35:11 +00:00
Jeff Morriss 19214234ae Followup to r48081: use the DEFAULT_CAPTURE_BUFFER_SIZE macro from r47942.
svn path=/trunk/; revision=48085
2013-03-05 15:22:28 +00:00
Chris Maynard 2b93c3b31e Default capture buffer size is now 2MB. (See also r47920 and r47937)
svn path=/trunk/; revision=48081
2013-03-05 02:09:37 +00:00
Evan Huus 14ab37223b Fix case where we were leaking frame_data if, during 2-pass analysis,
a frame did not pass the filter.

svn path=/trunk/; revision=48031
2013-03-03 03:29:40 +00:00
Jakub Zawadzki 347232ea90 Fix bug #8101: tshark -2 -r fragments.pcap -R snmp -w out.pcap segmentation fault
When doing second pass tshark, packet data is read to cf->pd (and not already freed cf->wth buffer).
Writting files with two pass analysis never worked, buggy since introducing two pass analysis in r30076.

svn path=/trunk/; revision=47851
2013-02-24 14:39:56 +00:00
Jakub Zawadzki aeebbe9af8 Fix bug #8160, one case left where delta of previously captured frame is incorrectly calculated:
two passes wireshark && previously captured frame hasn't pass filter

svn path=/trunk/; revision=47849
2013-02-24 00:45:59 +00:00
Chris Maynard 503cab9ff7 From Edwin Groothuis via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8353 : Document http-related '-z' statistics; also add document -z help.
From me: Don't print an error message for "-z help".

(Only "http,stat," is suitable for backport to 1.8 and 1.6)

svn path=/trunk/; revision=47763
2013-02-20 03:06:46 +00:00
Gerald Combs bd4cffae58 When any of our executables start on Windows create or open a "Wireshark
is running" mutex. Have the NSIS installer check for this mutex and ask
the user to close Wireshark if it's found. While not perfect this makes
the WinSparkle update process much less annoying.

svn path=/trunk/; revision=47758
2013-02-20 01:19:42 +00:00
Evan Huus ec7d4f0cfd Run epan_cleanup after printing the version information in tshark,
as it makes the results of ./tools/valgrind-wireshark.sh -n
much more interesting and useful.

svn path=/trunk/; revision=47221
2013-01-23 02:30:15 +00:00
Guy Harris 05825b02cd Add some routines to wsutil to, at least on some platforms, add
information to crash dumps and the like.  (Currently, we only handle OS
X's CrashReporter, but we should do this on other platforms where this
information can be added and would be helpful.)

White space tweaks.

svn path=/trunk/; revision=47104
2013-01-15 21:54:41 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Michael Mann 0bdfbe97d4 Add -Q option to TShark to force only "true" errors to stderr. No "status" messages should be included if -Q option is specified. Bug 2881 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2881)
svn path=/trunk/; revision=46627
2012-12-20 01:22:42 +00:00
Jeff Morriss 20211340e5 Make the "-g" argument to tshark actually work (by passing it to dumpcap).
svn path=/trunk/; revision=46515
2012-12-12 03:25:35 +00:00
Jeff Morriss 05ee001d73 Document the "-g" option to dumpcap.
Add that option to tshark, too, and document it.

The option can't be given to Wireshark because the GUI already has a "-g"
(goto packet).

svn path=/trunk/; revision=46513
2012-12-12 02:07:08 +00:00
Michael Mann 40eca5f0de Allow TShark to specify columns as fields with -e option (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2892)
svn path=/trunk/; revision=46465
2012-12-08 02:42:40 +00:00
Gerald Combs bd19dcd8bf Add an add_hosts_file routine that adds a "hosts" path to an array and
use it in tshark.c instead of read_hosts_file. This lets us use "-H"
multiple times. Make read_hosts_file static.

svn path=/trunk/; revision=46273
2012-11-29 00:32:39 +00:00
Jeff Morriss 38b58bd671 Delay the reading of the hosts file ("-H") until after cf_open() has been
called.  (cf_open() calls init_dissection() which, since r45511,
re-initializes the name resolution database.)

Complain if the user gives an invalid argument to "-W".

Specify the invalid argument if we don't like a "-z" argument.

svn path=/trunk/; revision=46238
2012-11-27 23:05:03 +00:00
Bill Meier 552323e7fb Fix a number of [-Wshadow] warnings;
Also: Do some minor whitespace changes

svn path=/trunk/; revision=46182
2012-11-25 18:35:41 +00:00
Guy Harris d415d3d87c On error, have capture_opts_trim_iface() return the exit status that
should be used (on success, have it return 0).  Exit with that exit
status; if the problem is that we couldn't get the interface list or if
there are no interfaces in that list, return 2, as that's not a
command-line syntax error.

svn path=/trunk/; revision=46108
2012-11-21 17:14:54 +00:00
Anders Broman 28474fe8ef From Mike Garratt:
Friendly Names for interfaces on Windows

Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
  + Win32: "dumpcap -D" shows friendly_name in place of descript if known
  + All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
  + When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name). 
  + console_display_name is used as the basis of the autogenerated temp
filenames
  + console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
  + Can now specify the interface using its name and friendly_name
  + Interface name matching is case insenstive
  + Name matching first attempts exact matching, then falls back to prefix
matching
    (e.g. dumpcap -i local)
  + Validates interface names, instead of blindly sending them off to
winpcap/libpcap
  + Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
  + Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
  + Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name.  Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
  + void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
  + Now uses wireshark_pcapng_* or  wireshark_pcap_* depending on file format
  + Basis temp filename format on console_display_name
  + Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing) 

GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
  + "Friendly Name" renamed to "NDIS Friendly Name"
  + Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
  + The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
    Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces. 
  + Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"

svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
Jakub Zawadzki 418f56d093 Don't use wtap_phdr() for getting pkthdr struct after wtap_seek_read().
svn path=/trunk/; revision=45808
2012-10-27 08:32:41 +00:00
Chris Maynard 26989e9d11 Inspired by http://www.wireshark.org/lists/wireshark-users/201206/msg00025.html, add support for being able to specify a numeric range as the <selector> part of tshark's -d <layer type>==<selector>,<decode-as protocol> option.
svn path=/trunk/; revision=45734
2012-10-23 00:58:38 +00:00
Chris Maynard 573dd5b3dc 1) Allow for the possibility for both packet summary and packet details to be
printed when either -T is not specified or "-T text" or "-T ps" is selected.

2) Allow for packet hex/ascii to be printed without necessarily requiring that
either packet summary or packet details also be printed.  This just means that
if you want packet summary information, use "-Px" instead of just "-x".

3) Fix bug with order of evaluation of -V and "-T psml".

4) If a packet separator is specified, always use it regardless of the -PVx
options chosen.

5) Don't print 2 lines of separation between packets when only printing
hex/ascii.  Print 1 line of separation as in all other cases.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7782 plus other misc. enhancements.

svn path=/trunk/; revision=45715
2012-10-22 15:56:59 +00:00
Jakub Zawadzki 77368c3668 Introduce epan_dissect_run_with_taps() which run dissection with taps.
unexport tap_queue_init, tap_push_tapped_queue

svn path=/trunk/; revision=45670
2012-10-20 19:27:24 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Evan Huus 9433de4c8a Unused variable
svn path=/trunk/; revision=45544
2012-10-14 19:48:22 +00:00
Gerald Combs 71ed773862 Add a capture_file * element to packet_range_t and pass it explicitly in
packet_range_init(). Get rid of global cfile references in
packet-range.c. C++-ize packet-range.h. Shuffle some includes around.

svn path=/trunk/; revision=45333
2012-10-05 18:52:42 +00:00
Guy Harris 73dd0321ea Get rid of the always-null and unused argument to
host_name_lookup_process().  If, in the future, we find that we need an
argument for changes we're making, we can add it then.

svn path=/trunk/; revision=45269
2012-10-02 21:13:59 +00:00
Guy Harris 692bd92699 Fix a comment, add another comment, and fix indentation.
svn path=/trunk/; revision=45268
2012-10-02 20:47:20 +00:00
Jakub Zawadzki 72ca9d0e61 Store pointers to previously displayed and captured packet, not nstime_t deltas.
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure.

Part of bug 5821: Reduce per-packet memory requirements.

svn path=/trunk/; revision=45071
2012-09-23 16:25:28 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Evan Huus baf111a23c Add casts to fix compilation with GCC.
Remove * from gconstpointers, they are already pointer types.
Add modelines to packet.c and clean up indentation a bit.

svn path=/trunk/; revision=44698
2012-08-29 22:19:29 +00:00
Michael Mann e5e09f7016 Fix Bug 7348 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7348)
svn path=/trunk/; revision=44696
2012-08-29 21:23:07 +00:00
Michael Mann e0e533d643 Have (almost) all preferences use the generic preferences API (per https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7402). This cleaned up a lot of hardcoded code and allows breaking up the prefs structure (or at least prevent it from growing too large) if desired.
Bugfixed problems mentioned in
http://www.wireshark.org/lists/wireshark-dev/201208/msg00001.html

Column preferences now support default '#' character

svn path=/trunk/; revision=44348
2012-08-08 16:54:02 +00:00
Irene Rüngeler 3a3b4a1fdc Add -A as command line option to wireshark and tshark.
svn path=/trunk/; revision=44339
2012-08-08 14:30:55 +00:00
Evan Huus 10c9e21812 Only initialize fields in the print_args that are actually used.
This prevents a memory leak where we were allocating for print_args.range
but never freeing.

svn path=/trunk/; revision=43921
2012-07-22 22:01:10 +00:00
Anders Broman c19583b72c From Michael Mann:
Generic preferences implementation - Printing and Name Resolution.

svn path=/trunk/; revision=43579
2012-07-06 04:48:36 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman 3814106d7e From Michael Mann:
generic preferences implementation

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7402

svn path=/trunk/; revision=43484
2012-06-25 21:05:36 +00:00
Gerald Combs 49849233c3 If we're making two passes and we have a display filter applied, create
a protocol tree in process_packet_first_pass(). Otherwise we crash with

ERROR:dfvm.c:434:dfvm_apply: assertion failed: (tree)

svn path=/trunk/; revision=43420
2012-06-20 20:44:05 +00:00
Guy Harris 4a9b825c49 Change the "user_saved" member of a capture_file structure to
"unsaved_changes", and have it be TRUE iff changes have been made to the
file since it was read - *not* if it's a temporary file from a live
capture.

Check the "is_tempfile" member, and the "unsaved_changes" member, when
appropriate.

Just have a set_toolbar_for_capture_file() routine that updates the
"save", "close", and "reload" toolbar as appropriate, given a
capture_file structure - absorb the function of
set_toolbar_for_unsaved_capture_file() into it.

svn path=/trunk/; revision=42721
2012-05-20 08:56:06 +00:00
Gerald Combs bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +00:00
Anders Broman fc41d4ad51 From Evan Huus:
Duplicate and misplaced 'break' statements.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7106

svn path=/trunk/; revision=42091
2012-04-16 08:39:34 +00:00
Jeff Morriss 603b4d4348 Don't free idb_inf in wtap_dump_open_ng(): free it in the callers. This fixes the double-free editcap crashes that the buildbot's been seeing lately.
svn path=/trunk/; revision=41542
2012-03-14 01:08:09 +00:00
Anders Broman 7605b01482 From Jose Pedro Oliveira:
the shb_userappl value wasn't being changed.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6937

svn path=/trunk/; revision=41530
2012-03-13 14:11:08 +00:00
Anders Broman ead0764cd9 A modified version of "pcapng: shd_userappl in newly created files"
to only add the name if no name if there yet. Original patch from
Jose Pedro Oliveira. 

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6937

svn path=/trunk/; revision=41524
2012-03-13 09:13:27 +00:00
Anders Broman 3394b453af Free idb_inf and shb_hdr when done.
svn path=/trunk/; revision=41501
2012-03-12 14:18:04 +00:00
Michael Tüxen 2764d9977b Use wtap_dump_open_ng() in tshark.
svn path=/trunk/; revision=41123
2012-02-21 17:19:45 +00:00
Michael Tüxen acb9414db9 This should fix the buildbots...
The problem was that when reading a .pcap file, we don't have any IDBs.
If reqested to write out an pcapng file, we (now) build a dummy IDB which
uses the file's encapsulation as the interface encapsulation. Therefore
it can't be per=packet.
We need to fix this by using wtap_dump_open_ng()...

svn path=/trunk/; revision=41122
2012-02-21 17:07:57 +00:00
Jörg Mayer 35508464b2 Start moving files to ui/ and ui/cli/
svn path=/trunk/; revision=41047
2012-02-17 12:30:27 +00:00
Guy Harris 55001ef198 With the WTAP_ERR_UNSUPPORTED error, Wiretap supplies a string giving
the details of what in particular is unsupported; report it in TShark
and Wireshark.

Handle WTAP_ERR_RANDOM_OPEN_PIPE in TShark.

Handle WTAP_ERR_COMPRESSION_NOT_SUPPORTED in TShark, and have its error
message in Wireshark not speak of gzip, in case we support compressed
output in other formats in the future.

If we see a second section header block in a pcap-NG file, don't report
it as "the file is corrupted", report it as "the file uses a feature we
don't support", as that's the case - and don't free up the interface
data array, as the file remains open, and Wireshark might still try to
access the packets we were able to read.

svn path=/trunk/; revision=41041
2012-02-16 18:58:40 +00:00
Guy Harris 31204e8406 It is a complete mistake to have *ANY* messages during packet capture
sent to the standard output if "-w" is specified because, when you
capture, you can capture with the output directed to the standard
output, and dumping some text crap to the standard output will corrupt
your capture file.

svn path=/trunk/; revision=40966
2012-02-11 03:57:49 +00:00
Anders Broman 3a812083a8 From Michael Mann:
Went through all stderr cases within tshark trying to make tshark "quieter".  I
basically ended up agreeing with the submitted in terms of what should be
switched to stdout from stderr.  The attached patch does that.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2881

svn path=/trunk/; revision=40862
2012-02-05 13:05:15 +00:00
Michael Tüxen 14b1a44c0f Third try. This time pipes and stdin are supported and the
test scripts are passed.

Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=40715
2012-01-25 13:04:32 +00:00
Michael Tüxen 4fece25e7f We need a 3rd try. (After learning how to run the testuite on Windows locally).
svn path=/trunk/; revision=40695
2012-01-24 17:12:56 +00:00
Michael Tüxen 08d6785412 Second try. This time pipes and stdin are supported.
Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.


svn path=/trunk/; revision=40693
2012-01-24 16:05:26 +00:00
Anders Broman e553c70fe8 From Michael Mann:
help page update (pcapng is now the default file format).

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6551

svn path=/trunk/; revision=40658
2012-01-23 07:48:53 +00:00
Guy Harris 53eb852fa7 Leave it up to dumpcap to determine whether WinPcap was loaded and, if
it wasn't, whether it matters; that way you can still capture from a
pipe (named or "-" for standard input) even if you don't have WinPcap.

svn path=/trunk/; revision=40336
2011-12-29 23:21:18 +00:00
Guy Harris 7e531049a0 Swallow cant_load_winpcap_err() up into capture-wpcap.c, so that
anything that uses WinPcap can use that message text in its error
messages.

svn path=/trunk/; revision=40335
2011-12-29 23:09:42 +00:00
Guy Harris 3864d5d19d Add an additional DONT_HAVE_PCAP return value from get_interface_list()
and capture_interface_list().  Return it if, on Windows, we ask for the
interface list but don't have WinPcap installed.  Handle it like
CANT_GET_INTERFACE_LIST.

svn path=/trunk/; revision=40334
2011-12-29 22:49:49 +00:00
Bill Meier ebe33ba92a Add tshark option '-G heuristic-decodes' to dump heuristic dissector tables.
svn path=/trunk/; revision=40309
2011-12-28 15:05:59 +00:00
Gerald Combs 3c1b8a6ca1 Add a "-G ftypes" option, which dumps our supprted FT_… names and
descriptions. Captitalize and fix up the descriptions. Use its output to
create the field type list in the wireshark-filter man page.

svn path=/trunk/; revision=40306
2011-12-27 20:35:41 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +00:00
Chris Maynard 37bb6e88fd Add the -H and -W options to the "tshark -h" output. Ref: http://www.wireshark.org/lists/wireshark-users/201112/msg00044.html
svn path=/trunk/; revision=40172
2011-12-13 03:17:49 +00:00
Guy Harris 2929c93ea2 When reporting "sorry, *this* packet can't be written to a file of that
type" when writing out a capture file (i.e., writing a
per-packet-encapsulation capture to a file type that supports it but
doesn't support one of the packet's encapsulations), report the packet
number and, when doing this in a merge operation, report the file from
which it came.

When reporting "sorry, that file can't be written to a file of that
type, period", show the file type rather than the input file link-layer
type that causes the problem.  (We could show both.  We could be
*really* ambitious and iterate through all possible file types and show
the ones that will or at least might work....)

file_write_error_message() is documented as handling only UNIX-style
errnos, and libwireshark should be usable without libwiretap, so leave
it up to its callers to handle Wiretap errors such as
WTAP_ERR_SHORT_WRITE.

Clean up indentation.

svn path=/trunk/; revision=39949
2011-11-19 20:18:01 +00:00
Martin Mathieson e31d76c4cd Make exit_status volatile to avoid warning.
svn path=/trunk/; revision=39825
2011-11-14 11:36:53 +00:00
Guy Harris 640ad2b623 Catch the OutOfMemoryError exception and print a message.
svn path=/trunk/; revision=39798
2011-11-12 06:35:51 +00:00
Gerald Combs c657812a91 Initialize threads at program startup. Hopefully this will fix the
current build test failures.

svn path=/trunk/; revision=39790
2011-11-11 00:04:14 +00:00
Gerald Combs aa0c9c965c Try to fix the GLib thread API deprecations listed in bug 6552.
svn path=/trunk/; revision=39776
2011-11-09 23:43:50 +00:00
Chris Maynard aa1199d01f Rather than complain and quit if -V is missing when -O <protocols> is used, do the user a favor and continue as if -V had been specified. Add explicit documentation of the -O <protocols> option to the man page.
svn path=/trunk/; revision=39175
2011-09-28 14:50:07 +00:00
Guy Harris 2062d71c2c The separator between packets is an output option, not a capture option,
so it should be present even when building without libpcap.

svn path=/trunk/; revision=39171
2011-09-27 19:52:19 +00:00
Chris Maynard 311c5ef686 Add a new tshark option for being able to specify an alternate line separator between packets. The option chosen was "-S <separator>". The former -S option was renamed to -P, and the former -P option, which was previously undocumented, was renamed to -2. This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5342.
svn path=/trunk/; revision=39168
2011-09-27 18:32:59 +00:00
Stig Bjørlykke c66df8b030 From Yann via bug 6245:
Fixed crash in write_preamble().

svn path=/trunk/; revision=38562
2011-08-16 13:27:41 +00:00
Jeff Morriss bf95c7b5e4 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
2011-08-09 21:02:10 +00:00
Guy Harris 053c583fda Add some additional routine variants that handle string encodings, and
make FT_STRING and FT_UINT_STRING handle string encodings.

Get rid of FT_EBCDIC in favor of FT_STRING with ENC_EBCDIC.

Add some URLs for DRDA.

Clean up some stuff in TN3270 and TN5250, including using ENC_ values
for proto_tree_add_item().

svn path=/trunk/; revision=37909
2011-07-05 23:59:23 +00:00
Anders Broman 2f05cf4dcf From Michael Mann:
Added ability to display UTC time or UTC time with date.  I liked having the
difference between UTC and local time, not just setting local=UTC.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2629

svn path=/trunk/; revision=37898
2011-07-04 21:43:34 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Michael Tüxen 6c094f6775 Use the filter argument as the capture filter for all interfaces.
Signal an error if another capture filter is provided using the
-f option.

svn path=/trunk/; revision=37811
2011-06-28 08:00:14 +00:00
Michael Tüxen 741c973afe Put variable under the correct #ifdef.
svn path=/trunk/; revision=37807
2011-06-27 20:00:30 +00:00
Michael Tüxen df70b4c15c Fix the bug reported by Guy. Now
tshark -i en0 icmpp
returns a correct error message.


svn path=/trunk/; revision=37806
2011-06-27 19:07:36 +00:00
Michael Tüxen 2c8c178f71 Improve the report of illegal capture filters. Also show the interface description.
svn path=/trunk/; revision=37802
2011-06-27 11:30:39 +00:00
Michael Tüxen 65d8f7c4c0 Use the interface description instead of the interface name when
reporting an error.

svn path=/trunk/; revision=37799
2011-06-27 10:11:15 +00:00
Michael Tüxen 421dafd2de Get rid of old non-interface specific settings which are now interface
specifc. This finalizes the change of the infrastructure.
This patch is based on work by Irene Ruengeler.

svn path=/trunk/; revision=37794
2011-06-27 00:09:03 +00:00
Gerald Combs 4d603719d0 Have mergecap, tshark, and editcap write pcap-ng files by default. This
is mainly an attempt to fix the currently-broken "test.sh" step on the
XP buildbot. If this causes too many problems we might want to have
suite-capture.sh:capture_step_snapshot pass "-P" to dumpcap instead.

svn path=/trunk/; revision=37736
2011-06-20 23:31:26 +00:00
Guy Harris cdd23c3bd0 See if this squelches some compiler warnings.
svn path=/trunk/; revision=37670
2011-06-15 19:27:01 +00:00
Gerald Combs 0272ec5dd3 Show the plugin paths in Help→About→Plugins. Add a "-G plugins" option
to TShark which dumps a list of plugins.

svn path=/trunk/; revision=37512
2011-06-01 21:48:17 +00:00
Michael Tüxen 8f8f0e9ad6 Get rid of has_cfilter to simplify the handling of multiple interfaces.
svn path=/trunk/; revision=37478
2011-05-31 14:49:21 +00:00
Guy Harris b44838bd2e Don't print hidden columns.
svn path=/trunk/; revision=37374
2011-05-24 16:17:43 +00:00
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Gerald Combs 99d4de66e5 From Dirk Jagdmann via bug 5875:
My attachment adds a link to a XSLT file to the preamble of the PDML.
The XSLT will transform the PDML to a HTML page, and the HTML page
features a look similar to Wireshark. See
http://cubic.org/~doj/ebay/a.pdml for an example.

The patch also contains a small perl program which converts the
Wireshark colortable into javascript code which is used in the XSLT
file. If you want to use a different color scheme you would execute the
perl program and insert the generated javascript function into your XSLT
file.

To view the HTML you could either place the PDML and XSLT file on your
webserver and verify that your webserver sends the PDML file as
"text/xml".  Then your webbrowser will find the linked XSLT file,
download that as well and convert the PDML to HTML on the fly.

You could also use an XSLT processor like xsltproc to convert the PDML
and XSLT into a static HTML file.


From me:

Minor fixups.

svn path=/trunk/; revision=37298
2011-05-19 18:10:21 +00:00
Michael Tüxen 1d19739c9f Remove unused define.
svn path=/trunk/; revision=37288
2011-05-19 12:14:27 +00:00
Michael Tüxen 487f03612f Don't print too many interface names...
svn path=/trunk/; revision=37253
2011-05-18 18:35:57 +00:00
Michael Tüxen 985c2b78fd Support multiple interfaces when used with -L option.
Show multiple interfaces when capturing from them.

svn path=/trunk/; revision=37249
2011-05-18 18:03:58 +00:00
Michael Tüxen cfe3d2d0da Get -L and -d working with multiple interface. Internally get some functions
using the array of interface data.
Improve output of -L by printing the interface name.

svn path=/trunk/; revision=37120
2011-05-13 11:28:51 +00:00
Jeff Morriss 009156289f Fix the test.sh failures based on Guy's suggestion in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5445#c15 :
Add a new tap flag to indicate that a tap listener is just a "dissector helper",
that is, a tap which is used by a dissector to help it do its dissection but
does not, itself, require dissection.

Use this new flag in the dissectors which register taps.

Remove the (now-unused) have_tap_listeners() function.

svn path=/trunk/; revision=37069
2011-05-12 03:18:34 +00:00
Chris Maynard 5b0365d6c2 Wrap text of description for -O.
svn path=/trunk/; revision=36976
2011-05-03 15:38:22 +00:00
Stig Bjørlykke 6be87f6f90 Untabify
svn path=/trunk/; revision=36948
2011-04-29 06:55:49 +00:00
Stig Bjørlykke 65910b2479 From Edwin Groothuis via bug 5870:
The supplied patch adds a new option -O, which specifies a list of protocols
(names can be found with the "-G protocols" option) to be fully decoded while
the others only show the layer header.

svn path=/trunk/; revision=36947
2011-04-29 06:53:29 +00:00
Guy Harris c9b9dd690b Create a new frame_data_sequence data type; it represents a dense
sequence of frame_data structures, indexed by the frame number.  Extract
the relevant bits of the capture_file data structure and move them to
the frame_data_sequence, and move the relevant code from cfile.c and
tweak it to handle frame_data_sequence structures.

Have a possibly-null pointer to a frame_data_sequence structure in the
capture_file structure; if it's null, we aren't keeping a sequence of
frame_data structures (we don't keep that sequence when we're doing
one-pass processing in TShark).

Nothing in libwireshark should care about a capture_file structure; get
rid of some unnecessary includes of cfile.h.

svn path=/trunk/; revision=36881
2011-04-27 02:54:44 +00:00
Guy Harris 6c09e1cf95 Another hack to handle the one-pass case.
svn path=/trunk/; revision=36880
2011-04-27 00:43:31 +00:00
Guy Harris 71b31d92fc Store the frame_data structures in a tree, rather than a linked list.
This lets us get rid of the per-frame_data-structure prev and next
pointers, saving memory (at least according to Activity Monitor's report
of the virtual address space size on my Snow Leopard machine, it's a
noticeable saving), and lets us look up frame_data structures by frame
number in O(log2(number of frames)) time rather than O(number of frames)
time.  It seems to take more CPU time when reading in the file, but
seems to go from "finished reading in all the packets" to "displaying
the packets" faster and seems to free up the frame_data structures
faster when closing the file.

It *is* doing more copying, currently, as we now don't allocate the
frame_data structure until after the packet has passed the read filter,
so that might account for the additional CPU time.

(Oh, and, for what it's worth, on an LP64 platform, a frame_data
structure is exactly 128 bytes long.  However, there's more stuff to
remove, so the power-of-2 size is not guaranteed to remain, and it's not
a power-of-2 size on an ILP32 platform.)

It also means we don't need GLib 2.10 or later for the two-pass mode in
TShark.

It also means some code in the TCP dissector that was checking
pinfo->fd->next to see if it's NULL, in order to see if this is the last
packet in the file, no longer works, but that wasn't guaranteed to work
anyway:

	we might be doing a one-pass read through the capture in TShark;

	we might be dissecting the frame while we're reading in the
	packets for the first time in Wireshark;

	we might be doing a live capture in Wireshark;

in which case packets might be prematurely considered "the last packet".
#if 0 the no-longer-working tests, pending figuring out a better way of
doing it.

svn path=/trunk/; revision=36849
2011-04-25 19:01:05 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
by the gunzipping code.  Have it also supply a err_info string, and
report it.  Have file_error() supply an err_info string.

Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to
suggest a decompression error - into the rawshark and tshark errors,
along the lines of what other programs print.

Fix a case in the Netscaler code where we weren't fetching the error
code on a read failure.

svn path=/trunk/; revision=36748
2011-04-21 09:41:52 +00:00
Anders Broman efeaabdd9a Cast away size_t warnings on win64.
svn path=/trunk/; revision=36617
2011-04-13 04:53:02 +00:00
Chris Maynard 5773340023 Use g_snprintf instead of sprintf and g_strlcat instead of strcat: Coverity 698
svn path=/trunk/; revision=36597
2011-04-12 17:57:22 +00:00
Guy Harris 92c974f2f7 Now that wtap_read() checks for delayed errors on EOF, there's no need
to check for it on close.

svn path=/trunk/; revision=36593
2011-04-12 17:37:05 +00:00
Guy Harris e5fe0128d7 Allow wtap_sequential_close() and wtap_close() to return an error; this
may happen if, when reading a compressed file, we find an error in the
file's contents past the last packet (e.g., the file being cut short so
that we can't get a full buffer worth of compressed data), and that
reporting of that error is delayed (so that you can get all of the
packets that we *can* decompress).  Check for those errors, at least on
the sequential read pass (the only errors we should see when closing the
random stream are errors we've already seen in the sequential stream).

svn path=/trunk/; revision=36576
2011-04-12 01:36:12 +00:00
Bill Meier 18fc4872bc Rename local 'pipe_input' so it doesn't shadow global 'pipe_input';
Use consistent indentation and remove trailing whitespace.

svn path=/trunk/; revision=36428
2011-03-31 20:57:40 +00:00
Chris Maynard a3fe8fbd1a Fix a couple of typos.
svn path=/trunk/; revision=36410
2011-03-30 15:54:28 +00:00
Chris Maynard 9e55be72fc Wrap all text lines of help at column 80.
svn path=/trunk/; revision=36408
2011-03-30 14:44:18 +00:00
Gerald Combs fcf51fc73b Add initial pcapng name resolution record support. Wireshark has read
support; TShark has read+write support. Additionally TShark can read a
"hosts" file and write those records to a capture file.

This uses "struct addrinfo" in many places and probably won't compile on
some platforms.

svn path=/trunk/; revision=36318
2011-03-24 22:47:57 +00:00
Stig Bjørlykke d188988e83 Added functionality for handling global profiles.
Global profiles can be installed in a "profiles" directory in the
Global configuration directory, and a global profile will be copied
to the users profiles on first time usage.

svn path=/trunk/; revision=36077
2011-02-26 17:23:24 +00:00
Chris Maynard 7180a53aff Sort capture file types listed by "-F" like editcap does.
svn path=/trunk/; revision=36008
2011-02-19 22:01:14 +00:00
Gerald Combs 0c9649929e From Huzaifa Sidhpurwala of the Red Hat Security Response Team: Don't
free uninitialized memory.

See also: bug 5652.

svn path=/trunk/; revision=35791
2011-02-03 22:50:49 +00:00
Gerald Combs 3bc1fc3802 On Windows, convert all of our command-line arguments from UTF-16 to
UTF-8 where we don't already do so. In Wireshark use g_utf16_to_utf8
instead of utf_16to8. This should fix bug 5520.

svn path=/trunk/; revision=35411
2011-01-06 23:28:58 +00:00
Jaap Keuter 8d6a5fba46 Avoid the need for cf_mark_frame stubs.
svn path=/trunk/; revision=35248
2010-12-22 23:09:31 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Anders Broman f5cf823e1a Bug fix: Running tshark with the following command will leave a temp file on the file system.
\tshark -f "port 53" -a duration:1 -z proto,col info,dns.qry.type,dns.qry.type

svn path=/trunk/; revision=34791
2010-11-05 15:01:05 +00:00
Stig Bjørlykke 2cedc69849 Fixed "Compiled with" information in the About box.
svn path=/trunk/; revision=34601
2010-10-21 07:13:43 +00:00
Bill Meier c78221d4ce Rename g_resolv_flags --> gbl_resolv_flags; Also: cleanup some whitespace & indentation.
svn path=/trunk/; revision=34487
2010-10-12 13:15:08 +00:00
Gerald Combs a87bdf9660 Turn on ASLR via /DYNAMICBASE and DEP via SetProcessDEPPolicy().
svn path=/trunk/; revision=34137
2010-09-16 19:20:06 +00:00
Gerald Combs cfa9982492 Make sure we call wtap_cleareof() before each read.
svn path=/trunk/; revision=33555
2010-07-16 18:20:32 +00:00
Guy Harris cc3540b0fb Move the code to get version information for libraries used by
libwireshark into libwireshark, and call it only in programs linked with
libwireshark.  That way, programs that don't link with libwireshark
don't have to link with libgcrypt or libgnutls solely so that they can
say that they're linked with a particular version of libgcrypt or
libgnutls.

Don't link dumpcap with libgcrypt or libgnutls any more.

svn path=/trunk/; revision=33531
2010-07-15 02:07:16 +00:00
Sake Blok e10147fb73 Add an option to print the first, the last or all occurrences of each field
(when using tshark -T fields)


svn path=/trunk/; revision=33529
2010-07-14 21:53:57 +00:00
Sake Blok 717abac483 Make 'tshark -T fields' print all values for fields with multiple occurences.
svn path=/trunk/; revision=33527
2010-07-14 20:28:34 +00:00
Guy Harris 7d45ac7dd5 Get rid of no-longer-used variable.
svn path=/trunk/; revision=33511
2010-07-14 02:12:55 +00:00
Guy Harris b0b7697dea From Petr Lautrbach: when capturing, return the exit status of dumpcap,
so we give a non-zero exit status for invalid interfaces or capture
filters.

From me: don't exit immediately if dumpcap failed, print out information
from taps and the like.

svn path=/trunk/; revision=33393
2010-07-01 00:12:16 +00:00
Gerald Combs 0b9c5b9248 r32715 fixed bug 4708 (zlib-1.2.5 cause wireshark to stop live capture)
for Wireshark but not TShark. Apply the fix to TShark as well. Fixes bug
4916.

svn path=/trunk/; revision=33327
2010-06-25 22:24:26 +00:00
Anders Broman 4e220d29ff From Jim Young:
The attached patch simply documents a long supported but hidden tshark -G
option.

Tshark's print_usage() has been augmented as well as the tshark man page.

svn path=/trunk/; revision=33253
2010-06-18 17:18:00 +00:00
Guy Harris c731e7f921 Alas, the stuff to see whether the standard output and error are the
same works only on UN*X; note that, and don't bother compiling it on
Windows.

svn path=/trunk/; revision=33125
2010-06-07 09:43:32 +00:00
Guy Harris fc18b399fd If we get an error reading the capture file, don't give up - run the
taps, etc., so we at least print the statistics for the packets we
*could* read.

Also, if we're printing packet data, and the standard output and
standard error are going to the same place, before printing the error
message for that error, flush the standard output and print a newline to
the standard error, so the error appears after all the packet data, and
has a newline separating it from the packet data.

This fixes bug 4845.

svn path=/trunk/; revision=33124
2010-06-07 08:42:29 +00:00
Guy Harris cc574686ba Clarify an error message (and the corresponding comment).
Fix the no-libpcap build.

svn path=/trunk/; revision=33103
2010-06-05 01:55:06 +00:00
Guy Harris 71ada2c31b Catch some cases that don't currently work.
svn path=/trunk/; revision=33100
2010-06-05 00:08:37 +00:00
Guy Harris 7ecae442c5 capture() can, in some cases, return FALSE when the capture succeeds;
back out the change to check its return value until we fix that.

Also back out the test suite changes to look for an error exit for
invalid capture filters and interfaces.

svn path=/trunk/; revision=33029
2010-06-01 03:37:51 +00:00
Jeff Morriss 47e2d75820 Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
2010-05-28 20:19:55 +00:00
Guy Harris 8d949600af Use return rather than exit in main().
Return 2 for a capture error - we mainly use 1 for command-line syntax
errors (rather than, say, filter syntax errors or an invalid interface).

Now that TShark exits with an error status when given an invalid capture
filter or invalid interface, check for "error" rather than "success" as
an exit status.

svn path=/trunk/; revision=33006
2010-05-28 01:09:28 +00:00
Bill Meier ece0ada557 Fix bug #4735: tshark returns 0 on non-valid filter and interface.
See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4735

svn path=/trunk/; revision=33004
2010-05-27 23:46:01 +00:00
Guy Harris 80fda10f18 Make -q not a capture option again - it's used by tshark even when not
capturing, and thus even when we build without pcap.

svn path=/trunk/; revision=32988
2010-05-27 01:13:49 +00:00
Guy Harris 391b5127d6 Clean up the error reporting. An EOF from the sync pipe when capturing
is just an indication that the capture child exited; don't treat it as
an error, unless the child process exits with an abnormal status.
 
As tshark sends a "stop capture" indication to the child when it's
^C'ed, the child will exit and we'll get an EOF from the capture pipe;
don't make SIGINT etc. interrupt system calls, so they don't cause reads
from the capture pipe to get EINTR errors.

svn path=/trunk/; revision=32986
2010-05-27 00:48:08 +00:00
Guy Harris b0bfae2a85 Don't send ^T output to the standard error if we're a capture child.
Make SIGINFO a restart-the-system-call signal, so reads etc. don't
return an error.

svn path=/trunk/; revision=32968
2010-05-26 04:29:36 +00:00