Commit Graph

72 Commits

Author SHA1 Message Date
Michael Mann ad6fc87d64 Add proto_tree_add_checksum.
This is an attempt to standardize display/handling of checksum fields for all dissectors.
The main target is for dissectors that do validation, but dissectors that just report the
checksum were also included just to make them easier to find in the future.

Bug: 10620
Bug: 12058
Ping-Bug: 8859
Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf
Reviewed-on: https://code.wireshark.org/review/16380
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-21 12:35:22 +00:00
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
moshekaplan cd7026951b Fix a lot of typos and misspellings
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3
Reviewed-on: https://code.wireshark.org/review/13069
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: Michael Mann <mmann78@netscape.net>
2016-01-08 20:04:56 +00:00
Michael Mann 31a54708f4 new_register_dissector -> register_dissector for dissector directory.
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c
Reviewed-on: https://code.wireshark.org/review/12485
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:38:06 +00:00
Michael Mann 443a7ed259 new_create_dissector_handle -> create_dissector_handle for dissector directory.
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now.

Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f
Reviewed-on: https://code.wireshark.org/review/12484
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:37:36 +00:00
Michael Mann 799d6fd057 create_dissector_handle -> new_create_dissector_handle
Picking off "easy" dissectors that only have one or two exit points at most.

Change-Id: I96aa9cf53533cbb07105aa400d42922baf3016b3
Reviewed-on: https://code.wireshark.org/review/11860
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-11-16 22:00:30 +00:00
Michael Mann 8faf5c80b3 register_dissector -> new_register_dissector
Picking off "easy" dissectors that only have one or two exit points at most.

Change-Id: I25fe6a0aac93980333217d007702799d16946563
Reviewed-on: https://code.wireshark.org/review/11816
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-11-14 18:00:00 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-22 11:45:56 +00:00
Alexis La Goutte ecc51f3ea6 H223: fix will never be executed [-Wunreachable-code]
Found by Clang 3.7

Change-Id: I3a7c41eba2ee636bb74326598a3de47f5a23126a
Reviewed-on: https://code.wireshark.org/review/10325
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-04 14:31:49 +00:00
AndersBroman 5fa57ecb67 [MSVC 2015]Once agin revert tho original, now as a separate patch.
Change-Id: If25a1e4ced74d88c87def010b9d8032b5d870307
Reviewed-on: https://code.wireshark.org/review/9898
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-06 11:33:04 +00:00
Michal Labedzki 3b2e6d9610 Revert "[MSVC 2015] Fix errors seen with the released version by reverting the code to what failed on the RC version *sigh*"
Reverted commit break DecodeAs for Bluetooth, also caused crashes.

This reverts commit 2221153a9c.

Change-Id: Idb91747b986f110fffa3444f8c52d800c128e141
Reviewed-on: https://code.wireshark.org/review/9877
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-05 17:29:54 +00:00
AndersBroman 2221153a9c [MSVC 2015] Fix errors seen with the released version by reverting the
code to what failed on the RC version *sigh*

Change-Id: I1b7f6d57da4cb71473a074291da7e5a0d5242c95
Reviewed-on: https://code.wireshark.org/review/9874
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-05 12:40:36 +00:00
Anders Broman e92086849a Revert "[MSVC2015] TRy to fix Warnings turned errors."
This reverts commit 8d78077d0d.

Reverted as requested.

Change-Id: I99461820d28215a52cc6bae6792f2892018d28b8
Reviewed-on: https://code.wireshark.org/review/9609
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-12 20:05:21 +00:00
Peter Wu ea46cf4f73 Split init of misc dissectors into init/cleanup functions
Convert remaining dissectors to use cleanup routines when possible.
(Single-)linked lists require NULL, so do reset their pointers to NULL.

Generated with
https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=69af86e6c2cf965ba3d7f9636b647b195f0b7d57
(with AUDIT = ALWAYS_EMIT_CLEANUP_CODE = True)

Remaining dissectors which did not need further changes:
epan/dissectors/packet-aeron.c
epan/dissectors/packet-bootp.c
epan/dissectors/packet-brdwlk.c
epan/dissectors/packet-drda.c
epan/dissectors/packet-etch.c
epan/dissectors/packet-fix.c
epan/dissectors/packet-fw1.c
epan/dissectors/packet-lbm.c
epan/dissectors/packet-ldss.c
epan/dissectors/packet-simulcrypt.c
epan/dissectors/packet-spdy.c
epan/dissectors/packet-starteam.c
epan/dissectors/packet-udp.c

Change-Id: Idcacfea6a5de38d40e67db4cdcd0452ad9f9a6a9
Reviewed-on: https://code.wireshark.org/review/9228
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:37:18 +00:00
Anders 8d78077d0d [MSVC2015] TRy to fix Warnings turned errors.
Change-Id: I1156e66daad84004f4f7acae0175fcbb475db71a
Reviewed-on: https://code.wireshark.org/review/8760
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-04 13:32:17 +00:00
Gerald Combs cf142c6b67 Get Wireshark to compile with afl-gcc.
Fix errors found by American Fuzzy Lop's afl-gcc
(http://lcamtuf.coredump.cx/afl/):

peektagged.c:
error: 'fileVersion' may be used uninitialized in this function

packet-h223.c:
error: variable 'circuit_id' might be clobbered by 'longjmp' or 'vfork'

wslua_proto.c:
error: variable 'd' might be clobbered by 'longjmp' or 'vfork'

wslua_proto.c:
error: variable 'dt' might be clobbered by 'longjmp' or 'vfork'

Change-Id: Idd74a3ad7b236d3a8756c1e7e917b1c74143f381
Reviewed-on: https://code.wireshark.org/review/6767
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-24 19:14:38 +00:00
Martin Mathieson 48db2548a9 Deleting unneccessary #includes from dissectors.
Second batch (packet-eth.c -> packet-icmpv6.d).

Will look at cleaning up and committing script afterwards.

Change-Id: I14295758b81a59115d8c88899f166cc3d5d17594
Reviewed-on: https://code.wireshark.org/review/6013
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-23 12:22:54 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Michael Mann a2c2f872f4 Remove the use of pinfo->private_data from dissectors that just save it to restore it.
Change-Id: I13197cc48068bb35ee12a7023cfe5f76bbc4e264
Reviewed-on: https://code.wireshark.org/review/5486
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-11-26 16:20:59 +00:00
AndersBroman f2fc562eda Replace tvb_length()
Change-Id: I0b5ad4d588f0b658abaf3892d08d6520ecd2f645
Reviewed-on: https://code.wireshark.org/review/5431
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-11-21 15:05:33 +00:00
Michael Mann d1696a6569 "Bubble up" the use of pinfo->circuit_id and pinfo->ctype to make it more obvious where in used in hopes that it can be eliminated through passing dissector data (or methods other than using packet_info)
Change-Id: Ib0e7efc123a3f9c06f58b5579c3c25b18818205c
Reviewed-on: https://code.wireshark.org/review/5326
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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-11-16 13:46:07 +00:00
Michael Mann 3d359da2b5 Refactor pinfo->circuit_id from H.223 dissector.
Change-Id: Id63e0088047c7948fd190ba4dd5fbcb536e0cc6b
Reviewed-on: https://code.wireshark.org/review/4921
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-10-28 07:11:26 +00:00
Michael Mann 48da429a04 Add a "placeholder protocol" for H.223 to avoid confusion when using Decode As.
The Decode As dialog presents two H.223 options and only "trial and error" can determine if you want bitswapping or not.

Change-Id: I9303c73375d130d3097d347bb374019dfc714068
Reviewed-on: https://code.wireshark.org/review/4909
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-23 18:14:41 +00:00
Guy Harris ce3d2ff3de Rename dissector_add_handle() to dissector_add_for_decode_as().
Hopefully that name makes it clear what the routiner's purpose is, and
will encourage people to use it rather than using dissector_add_uint()
with a bogus integer value.

Change-Id: Ic5be456d0ad40b176aab01712ab7b13aed5de2a8
Reviewed-on: https://code.wireshark.org/review/2483
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 16:43:56 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +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
Alexis La Goutte 0a202bc4f6 Fix packet-h223.c:842:18: error: will never be executed [-Werror,-Wunreachable-code]
Change-Id: I8255a3841add78eaa167ef631effe58d9fb12736
Reviewed-on: https://code.wireshark.org/review/323
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-02 13:19:31 +00:00
Jakub Zawadzki bc8d5a1e61 Fix previous commit + rename to bitswap.
svn path=/trunk/; revision=53375
2013-11-16 22:44:29 +00:00
Jakub Zawadzki 004220fb63 Exporting/importing variables cause problems, so create function to do bitswaping.
svn path=/trunk/; revision=53374
2013-11-16 22:31:07 +00:00
Jakub Zawadzki 3b9f6dfab4 Move bitswap.[ch] from epan to wsutil.
svn path=/trunk/; revision=53365
2013-11-16 09:16:57 +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
Michael Mann b38ee917b1 Convert proto_tree_add_uint_format to proto_tree_add_uint_format_value if hf_ field name is the first part of the formatted string. This was done with a perl script on the dissectors directory (packet-*.c), followed by manual inspection of the output. The manual inspection yielded a few cases that really should have been proto_tree_add_uint or proto_tree_add_item, so I updated them accordingly.
The script didn't catch as many as I would have liked, but it's a start.

The most common (ab)use of proto_tree_add_uint_format was for appending strings to CRC/checksum values to note good or bad CRC/checksum.

svn path=/trunk/; revision=52045
2013-09-15 01:48:30 +00:00
Pascal Quantin b46f9bebe2 Change some dissectors to use pinfo memory pool instead of malloc if it can trigger an exception between between buffer allocation and tvb_set_free_cb call
svn path=/trunk/; revision=51427
2013-08-19 14:55:41 +00:00
Anders Broman 434aae5245 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48396
2013-03-18 19:47:33 +00:00
Guy Harris 6b629c4d92 Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c.  Update their callers to include
<epan/show_exception.h> to get their declaration.

Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff.  Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).

Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).

Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.

Use show_exception() to report non-fatal errors, rather than doing it
yourself.
 
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.

Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.

Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.

svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
Bill Meier c439b805e2 Comment out unused hf[] entries & etc.
(found by checkhf)

svn path=/trunk/; revision=47389
2013-01-31 17:55:31 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Jeff Morriss aa5d9d78dd From Robert Bullen via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7683 :
The reassembled fragments tree in the Packet Details view is awesome, but it
lacks one thing: a field that exposes the reassembled data.

tcp.data already exists for exposing a single TCP segment's payload as a byte
array. It would be handy to have something similar for a single application
layer PDU when TCP segment reassembly is involved. I propose
tcp.reassembled.data, named and placed after the already existing field
tcp.reassembled.length.

My primary use case for this feature is outputting tcp.reassembled.data with
tshark for further processing with a script.

The attached patch implements this very feature. Because the reassembled
fragment tree code is general purpose, i.e. not specific to just TCP, any
dissector that relies upon it can add a similar field very cheaply. In that
vein I've also implemented ip.reassembled.data and ipv6.reassembled.data, which
expose reassembled fragment data as a single byte stream for IPv4 and IPv6,
respectively. All other protocols that use the reassembly code have been left
alone, other than inserting NULL into their initializer lists for the newly
introduced struct field reassemble.h:fragment_items.hf_reassembled_data.

svn path=/trunk/; revision=44802
2012-09-07 02:09:59 +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 2a35f59066 From Jeff Morriss:
H223: Buildbot crash output: fuzz-2012-01-25-22599.pcap

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

svn path=/trunk/; revision=41148
2012-02-23 08:40:23 +00:00
Bill Meier 30cee99009 Fix a number of proto_tree_add_item() encoding args.
svn path=/trunk/; revision=39774
2011-11-09 17:33:18 +00:00
Bill Meier 794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier 4e57694d4a Convert 'encoding' parameter of certain proto_tree_add_item() calls in non-autogenerated epan/dissectors:
Specifically:  Replace FALSE|0 and TRUE|1 by ENC_BIG_ENDIAN|ENC_LITTLE_ENDIAN as
 the encoding parameter for proto_tree_add_item() calls which directly reference
 an item in hf[] which has a type of:
    FT_UINT8
    FT_UINT16
    FT_UINT24
    FT_UINT32
    FT_UINT64
    FT_INT8
    FT_INT16
    FT_INT24
    FT_INT32
    FT_INT64
    FT_FLOAT
    FT_DOUBLE


svn path=/trunk/; revision=39288
2011-10-06 03:35:44 +00:00
Bill Meier 94f36ca4ff Use ENC_NA as encoding for proto_tree_add_item() calls which directly reference an hf item (in hf[] with types:
FT_NONE
   FT_BYTES
   FT_IPV6
   FT_IPXNET
   FT_OID

Note: Encoding field set to ENC_NA only if the field was previously TRUE|FALSE|ENC_LITTLE_ENDIAN|ENC_BIG_ENDIAN

svn path=/trunk/; revision=39260
2011-10-04 22:44:31 +00:00
Bill Meier e6bd9d1a8c Whitespace cleanup:
Use consistent indentation;
 Convert "4 space tabs" to spaces;
 Remove trailing whitespace.

svn path=/trunk/; revision=39082
2011-09-21 18:55:03 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Alexis La Goutte c09449b55d Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36869
2011-04-26 14:41:33 +00:00
Stephen Fisher 56237d0c90 Use _U_ for unused function parameters instead of assigning the
variable to itself.  Found by clang 3.0 (trunk) compiler.


svn path=/trunk/; revision=36819
2011-04-22 17:30:06 +00:00