Commit Graph

78 Commits

Author SHA1 Message Date
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
Peter Wu 80f7ee063d Call reassembly_table_destroy for some dissectors
This patch adds reassembly_table_destroy calls as cleanup function for
dissectors which have a simple init routine that just calls
reassembly_table_init (comments are ignored).

The changes were automatically generated using
https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=4cc0aec05dc67a51926a045e1955b7a956757b5e
(with the if and assignment parsers disabled).

The only difference from the autogenerated output is that the XXX
comments from the init routines in smb-pipe and tds dissectors are kept.

Change-Id: I64aedf7189877247282b30b0e0f83757be6199e7
Reviewed-on: https://code.wireshark.org/review/9222
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:34:28 +00:00
Evan Huus 958cef5d68 Remove more deprecated tvb_length
Change-Id: Iac23a6c804ad3720d37186559477909b2ff33eb2
Reviewed-on: https://code.wireshark.org/review/9042
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-23 00:19:41 +00:00
Bill Meier 9c866ff971 Replace tabs by spaces when editor modelines has "expandtab"
Change-Id: If7a6f2697be732ae4f94ed8b845fd293c32510f7
Also: tabs-stops should be 8
Reviewed-on: https://code.wireshark.org/review/7100
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-13 17:34:53 +00:00
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +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
Bill Meier f412c9a01a Use ENC_BIG_ENDIAN when fetching FT_U?INT8 fields ...
(for some dissectors which fetch all other integral fields using
   ENC_BIG_ENDIAN).

Change-Id: Ic18e3172aad76af12b12d6732c88497be22aed56
Reviewed-on: https://code.wireshark.org/review/5748
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-13 18:45:56 +00:00
Michael Mann 4f9af8608c Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 2 of many

Change-Id: I50815e7738b011382392f3078a7107d3d9eec4ec
Reviewed-on: https://code.wireshark.org/review/5542
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-01 08:52:03 +00:00
Bill Meier 44693468b2 Fix a number of dup hf[] filter-names probably mostly resulting from cut/paste errs
Change-Id: Id658b9e1803b2f5b92e711a3ce981ff602333d98
Reviewed-on: https://code.wireshark.org/review/5513
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-27 01:44:00 +00:00
Michael Mann ba008bf746 Eliminate proto_tree_add_text from several dissectors.
Change-Id: I6d3125f15d268edd47ef74dd655eb86cb25ee52d
Reviewed-on: https://code.wireshark.org/review/5047
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-02 15:42:28 +00:00
Michael Mann 888f22de16 convert to proto_tree_add_subtree[_format]
Change-Id: I2ea1892b5963cc5578cbdd2b03029ca8424f2267
Reviewed-on: https://code.wireshark.org/review/2640
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-25 16:35:14 +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
Dario Lombardo 971ffd683e Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe
Reviewed-on: https://code.wireshark.org/review/2376
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:13:58 +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
Bill Meier d973799957 Constify a character array;
'localize' some variables;
Remove some unneeded initializers;
Move proto_reg_handoff_...() to the end of the file as per convention;
Add forward declarations for proto_register_...() & proto_reg_hand_off_...();
Reformat some long lines;
Tweak some whitespace;
Add editor modelines.

svn path=/trunk/; revision=53358
2013-11-16 02:46:04 +00:00
Michael Mann 8081cf1d90 Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that?

Should tcp_dissect_pdus return length (bytes consumed)?  There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb).  Seems like that could all be rolled into one.

svn path=/trunk/; revision=53198
2013-11-09 17:46:28 +00:00
Bill Meier 2ac134b3c5 whitespace fixes; mostly: remove trailing blanks
svn path=/trunk/; revision=52591
2013-10-13 19:56:52 +00:00
Pascal Quantin 102c452bcb More emem -> wmem conversion:
- tvb_get_g_stringz()/tvb_get_ephemeral_stringz()/tvb_get_seasonal_stringz() -> tvb_get_stringz()
- tvb_get_g_stringz_enc()/tvb_get_ephemeral_stringz_enc() -> tvb_get_stringz_enc()
- tvb_get_ephemeral_unicode_stringz() -> tvb_get_unicode_stringz()
- tvb_bcd_dig_to_ep_str() -> tvb_bcd_dig_to_wmem_packet_str()
- update docs accordingly

svn path=/trunk/; revision=52180
2013-09-22 20:04:35 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Pascal Quantin 074349264e Convert some dissectors to wmem (leaving uat-like memory with emem for now)
svn path=/trunk/; revision=52031
2013-09-14 10:53:29 +00:00
Michael Mann 9e3f9b449f expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51852
2013-09-09 00:44:09 +00:00
Guy Harris e4c4c6fbfb Get rid of set-but-not-used variable. Link to the tools.ietf.org HTML
version of RFC 5050.

svn path=/trunk/; revision=51380
2013-08-15 09:09:49 +00:00
Michael Mann 7eb98fe481 A few more improvements:
1. Make a "dissect_dictionary" function for the common dissection of the different primary header versions.
2. Remove some of the "dissection aborts" if sdnv values are bad.  Detecting malformed packets can be a good thing.
3. Make fields that use a sdnv value filterable, with expert info if the value is bad.


svn path=/trunk/; revision=51365
2013-08-15 03:05:51 +00:00
Evan Huus 1eab806d9b Make what appear to be the intended changes so that all variables are used or
removed and it compiles.

svn path=/trunk/; revision=51341
2013-08-13 22:24:59 +00:00
Guy Harris 4771fdbb7e Fix intended proto_tree_add_item() call that mistakenly called
proto_tree_add_uint(); caught by the checkAPI script run in a Windows
build.

svn path=/trunk/; revision=51340
2013-08-13 18:03:17 +00:00
Evan Huus 69e9d50a23 Use start_offset to set the item length in the usual pattern (assuming this was
intended). Fixes the unused variable warning on start_offset.

svn path=/trunk/; revision=51338
2013-08-13 13:28:14 +00:00
Michael Mann 0776754488 Some improvements to the bundle protocol:
1. Cleanly break out Convergence Layer Protocol (TCPCL) into its own (new-style) pure dissector.
2. Make Bundle dissection into a new style dissector and clean so that it can be called using call_disssector.
3. Use tcp_dissect_pdus for TCPCL protocol instead of "manual" while loop.  This allows contact header to benefit from TCP fragmentation.
4. Make time fields use time field types so they can be filterable.
5. A few functions were move to remove need for static declaration at top of file.
6. Remove pri_hdr_procflags global variable.

Next up - making more fields filterable.

svn path=/trunk/; revision=51337
2013-08-13 11:37:27 +00:00
Jakub Zawadzki a18172147f Remove fragment_data, add fragment_head, fragment_item - for now alias it to the same structure.
This is begin of work to split fragment head and fragments items.

svn path=/trunk/; revision=50708
2013-07-17 21:12:24 +00:00
Michael Mann 7e8e5b347e Batch of filterable expert_infos.
svn path=/trunk/; revision=49581
2013-05-25 17:06:40 +00:00
Guy Harris a2414d8909 Don't wire into the reassembly code the notion that reassemblies should
be done on flows from one address to another; reassembly for protocols
running atop TCP should be done on flows from one TCP endpoint to
another.

We do this by:

	adding "reassembly table" as a data structure;

	associating hash tables for both in-progress reassemblies and
	completed reassemblies with that data structure (currently, not
	all reassemblies use the latter; they might keep completed
	reassemblies in the first table);

	having functions to create and destroy keys in that table;

	offering standard routines for doing address-based and
	address-and-port-based flow processing, so that dissectors not
	needing their own specialized flow processing can just use them.

This fixes some mis-reassemblies of NIS YPSERV YPALL responses (where
the second YPALL response is processed as if it were a continuation of
a previous response between different endpoints, even though said
response is already reassembled), and also allows the DCE RPC-specific
stuff to be moved out of epan/reassembly.c into the DCE RPC dissector.

svn path=/trunk/; revision=48491
2013-03-22 23:59:54 +00:00
Anders Broman 263a9d0683 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48341
2013-03-16 16:25:41 +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 c858bd1452 Get rid of another tvb_get_ptr() abuse (just like r46577 but in a different
function).

svn path=/trunk/; revision=46579
2012-12-18 02:20:38 +00:00
Jeff Morriss b66af9eea7 Fix the fuzz failure reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7945
(or at least the complaints from Valgrind; I couldn't reproduce the crash).

What part of:

~~~
 * If you're thinking of using tvb_get_ptr, STOP WHAT YOU ARE DOING
 * IMMEDIATELY. Go take a break. Consider that tvb_get_ptr hands you
 * a raw, unprotected pointer that you can easily use to create a
 * security vulnerability or otherwise crash Wireshark. Then consider
 * that you can probably find a function elsewhere in this file that
 * does exactly what you want in a much more safe and robust manner.
~~~

did someone not read?

Use tvb_get_ephemeral_stringz() instead of adding (apparently not sufficiently
checked!) offsets to the result of tvb_get_ptr() and assuming that the result
is a) in bounds and b) a NULL-terminated string.

svn path=/trunk/; revision=46577
2012-12-18 02:02:28 +00:00
Bill Meier aa882d5a47 Fix several [-Wshadow] warnings;
Also: Do some minor whitespace and formatting changes.

svn path=/trunk/; revision=46192
2012-11-25 23:33:11 +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 ab58c26ff3 From Jim Wright:
Enhance the DTN dissector so that it understands ECOS blocks (Extended Class of Service)

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

svn path=/trunk/; revision=42804
2012-05-23 06:25:00 +00:00
Anders Broman 572fcbe463 From Jim Wright:
Add decoding of CTEB to packet-dtn.c

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

svn path=/trunk/; revision=42507
2012-05-08 14:17:16 +00:00
Anders Broman 203fa68972 From Jim Wright:
Add decoding of ACS to packet-dtn.c
- Changed to use proto_tree_add_item();

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

svn path=/trunk/; revision=42384
2012-05-02 12:47:59 +00:00
Alexis La Goutte e5862b1deb Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40898
2012-02-06 22:12:32 +00:00
Guy Harris baa84e09f2 An SDNV length > 8 is also not dissectable. Should fix bug 6601.
svn path=/trunk/; revision=39974
2011-11-21 17:49:27 +00:00
Bill Meier a25e421a10 Fix some [-Wunused-but-set-variable] warnings
(in some cases by changing proto_tree_add_item() to use
  what appears to be the correct 'tree' arg);
Do whitespace cleanup.

svn path=/trunk/; revision=39772
2011-11-09 02:48:51 +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 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +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
Anders Broman 6c987f0b0c From Michael Mann:
Extend 64-bit SDNV decoding to Administrative Records.

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

svn path=/trunk/; revision=38967
2011-09-11 19:54:11 +00:00
Jeff Morriss f3039a3a97 From Johannes via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5440 :
Metadata Blocks in the bundle protocol (DTN) can contain EID references. These
are not considered by the current implementation and following blocks are
parsed wrong. The attached patch solves this bug and increment the offset as
much as needed to skip the EID references.

svn path=/trunk/; revision=38448
2011-08-10 15:52:52 +00:00