Commit Graph

262 Commits

Author SHA1 Message Date
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