Commit Graph

80 Commits

Author SHA1 Message Date
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with
the other bitfields, we have 32 bits.  That means we put the flags at
the same structure level as the time stamp precision, so they can be
combined; that gets rid of an extra "flags." for references to the flags.

Put the two pointers next to each other, and after a multiple of 8 bytes
worth of other fields, so that there's no padding before or between them.

It's still not down to 64 bytes, which is the next lower power of 2, so
there's more work to do.

Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe
Reviewed-on: https://code.wireshark.org/review/31213
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-27 04:34:29 +00:00
Guy Harris 1075054a10 Add new encoding names for seconds/{micro,nano}second time stamps.
Add ENC_TIME_SECS_NSECS and ENC_TIME_SECS_USECS; they make it more
explicit (especially to those not familiar with UN*X data types) what
the representation is, allow for ENC_TIME_SECS_MSECS etc. if they're
needed, and match names such as ENC_TIME_SECS and ENC_TIME_MSECS.

Change-Id: I6ab36fb4da70563587141cd65ffff8523477b0c4
Reviewed-on: https://code.wireshark.org/review/28564
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-02 04:09:21 +00:00
Guy Harris 3a9b055f04 Add support for 8+8 and 8+4 struct timespec, and use it with 9P.
Add support for 8-byte-seconds/8-byte-nanoseconds and 8-byte-seconds/
4-byte-nanoseconds time values.  Use them in the 9P dissector, with
proto_tree_add_item().

Only do the length validity checking for time values in
get_time_value().

Change-Id: I0f1d791d7aa503093a491d2c33300bd55ca7866e
Reviewed-on: https://code.wireshark.org/review/28560
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-02 01:11:16 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00
Michael Mann d94d7fc3a0 wmem_map_new -> wmem_map_new_autoreset
A few dissectors can benefit from the conversion.

Change-Id: I3b7d54926b79314009e271960aff61870a115390
Reviewed-on: https://code.wireshark.org/review/19826
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-28 20:14:12 +00:00
Guy Harris 7cd6906056 Rename tvb_new_subset() to tvb_new_subset_length_caplen().
This emphasizes that there is no such thing as *the* routine to
construct a subset tvbuff; you need to choose one of
tvb_new_subset_remaining() (if you want a new tvbuff that contains
everything past a certain point in an existing tvbuff),
tvb_new_subset_length() (if you want a subset that contains everything
past a certain point, for some number of bytes, in an existing tvbuff),
and tvb_new_subset_length_caplen() (for all other cases).

Many of the calls to tvb_new_subset_length_caplen() should really be
calling one of the other routines; that's the next step.  (This also
makes it easier to find the calls that need fixing.)

Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
Reviewed-on: https://code.wireshark.org/review/19597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-10 06:19:37 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Dario Lombardo f8500f39e2 conversation: rename shadow variable
Change-Id: I8f738b2e01d7f448b21cdc1b488b16b7dd581911
Reviewed-on: https://code.wireshark.org/review/16104
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-26 06:03:14 +00:00
Dario Lombardo 7548d185ea 9p: change glib functions into wmem calls.
Change-Id: I24fc7a52d30aa28f60b0e00a972e01c56c8f63a4
Reviewed-on: https://code.wireshark.org/review/14889
Petri-Dish: Dario Lombardo <lomato@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>
2016-04-14 12:21:16 +00:00
Michael Mann 1e60d63c8c Create call_data_dissector() to call data dissector.
This saves many dissectors the need to find the data dissector and store a handle to it.

There were also some that were finding it, but not using it.
For others this was the only reason for their handoff function, so it could be eliminated.

Change-Id: I5d3f951ee1daa3d30c060d21bd12bbc881a8027b
Reviewed-on: https://code.wireshark.org/review/14530
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-20 17:38:03 +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 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 f5340b2a07 Split init routine into init/cleanup for more dissectors
This patch converts some dissectors using g_hash_table_foreach_remove.

 - 9p: drop no-op free func.
 - nfs: use g_hash_table_new_full such that a destructor function can
   be used. Drop NULL check since g_free can handle these just fine.
 - nlm: use g_hash_table_new_full such that a destructor function can
   be used. Simplify "matched" destruction by replacing the wrapper by
   a direct g_free call.

Change-Id: I455e7f0ad4e47e70dae05af7233fdcdebf583f9f
Reviewed-on: https://code.wireshark.org/review/9224
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:36:11 +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
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +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 05516b0c92 Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 1 of many

Change-Id: I77a5789ac23388e6a5f8098dc398592f39638124
Reviewed-on: https://code.wireshark.org/review/5532
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-11-29 22:42:56 +00:00
Bill Meier 24d50bc290 Adjust indentation to match editor modelines; Do other minor whitespace changes.
Change-Id: Ic020b2c92db5d14a2be9dc4d35aef4514b8b0353
Reviewed-on: https://code.wireshark.org/review/4502
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06 17:12:33 +00:00
Guy Harris ca1ac2cf69 9P2000.L also has the UID field in tattach.
See, for example:

	http://code.google.com/p/diod/wiki/protocol#attach,_auth_--_messages_to_establish_a_connection

and

	http://code.google.com/p/diod/wiki/protocol#Overview

where the latter says

	9P2000.L consists of a subset of the canonical 9P2000
	operations, the 9P2000.u attach and auth messages, plus new
	operations designed to map to the Linux VFS in a straightforward
	way.

so tattach and tauth are the same as 9P2000.u.

Don't throw a dissector assertion of there's data at the end of the
packet; in the particular case that found this bug, yes, it was a
dissector bug, but it could also be a malformed packet, and we should
not throw dissector assertions unless we know *for certain* that the
problem is a dissector bug rather than a malformed packet.

Change-Id: I5ef5d837bccb4e7c4844d31a138aa55a85ec1b60
Reviewed-on: https://code.wireshark.org/review/3758
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-20 22:15:47 +00:00
Michael Mann 3fa5625ea0 Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib6024307e85d6c23decf40e9759f549c19ffe136
Reviewed-on: https://code.wireshark.org/review/3318
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-03 16:29:16 +00:00
Peter Wu 286c191846 9p: fix version detection, fix dissect_9P retval
Fix version detection (detect against full string instead of prefix),
properly dissect Tcreate extension field (9p2000.u only), dissect
Tunlinkat flags (9p2000.L).

Refactor pattern to dissect string[s] types for DRY.

Convert to use tcp_dissect_pdus. I have not seen a fragmented case, but
maybe that may happen in the future.

The main motivation for touching 9p was that it returns bogus values
for some types. This has been fixed by properly increasing offset, and
always return the captured length.

Change-Id: If2184204ae9c853b94aca8ade3763d7fe523fa86
Reviewed-on: https://code.wireshark.org/review/2836
Reviewed-by: Christopher Maynard <Christopher.Maynard@gtech.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-05 22:04:54 +00:00
Michael Mann f5e2b4293d convert to proto_tree_add_subtree[_format]
Change-Id: I358bfaa4e5d40cd01b766f614f8bd0dbaf611dd0
Reviewed-on: https://code.wireshark.org/review/2508
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 14:34:17 +00:00
Jakub Zawadzki 923cf412f1 Fix copy/paste errors in value_string.
Also make repetition_coding_indications[] standard terminated.

Change-Id: Ice20e1f27f5ab4d111f893608a230b83899efc9f
Reviewed-on: https://code.wireshark.org/review/2288
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-17 00:08:49 +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
Guy Harris ddb966fb2f The file's name has a lower-case "p" in "9p".
svn path=/trunk/; revision=54880
2014-01-21 20:13:40 +00:00
Guy Harris 4eb619b677 Always combine ENC_UTF_8 with ENC_NA.
svn path=/trunk/; revision=54878
2014-01-21 20:12:48 +00:00
Guy Harris 4b02416cc9 9p strings are, not surprisingly, encoded using UTF-8; replace
tvb_get_string() calls with tvb_get_string_enc() calls explicitly
specifying UTF-8.

svn path=/trunk/; revision=54876
2014-01-21 19:53:52 +00:00
Guy Harris d15a6d0add Don't cast away constness.
svn path=/trunk/; revision=54814
2014-01-15 03:37:06 +00:00
Bill Meier 1ed5971a72 Remove 'L' and 'LL' from constants; they are all used as 32-bit quantities.
#if 0 an unsed constant definition.

svn path=/trunk/; revision=54269
2013-12-19 20:52:56 +00:00
Jakub Zawadzki f91eba752b Fix some warnings: cast discards `__attribute__((const))' qualifier from pointer target type
svn path=/trunk/; revision=53875
2013-12-08 23:16:06 +00:00
Bill Meier 13124b7b8b Constify two vars;
Add editor modelines;
Rework some whitespace.

svn path=/trunk/; revision=53482
2013-11-21 18:03:10 +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
Evan Huus 6df83e8078 Add _g_ to the names of functions that allocate glib memory. This is a bit more
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures
that take the appropriate wmem pool.

Majority of the conversion done with sed.

svn path=/trunk/; revision=52164
2013-09-21 17:04:41 +00:00
Alexis La Goutte c28b726878 Fix (-W)documentation error found by Clang
packet-9p.c:342:16: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint16  len; /*< Length of the string */
                      ^~~
                      /**<
packet-9p.c:343:13: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        char *str; /*< The string */
                   ^~~
                   /**<
packet-9p.c:364:15: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint8 type; /*< Type */
                     ^~~
                     /**<
packet-9p.c:365:19: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint32 version; /*< Monotonically incrementing version number */
                         ^~~
                         /**<
packet-9p.c:366:16: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint64 path; /*< Per-server-unique ID for a file system element */
                      ^~~
                      /**<
5 errors generated

svn path=/trunk/; revision=51260
2013-08-10 21:28:50 +00:00
Jeff Morriss 1dc3a29474 From Dominique Martinet via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8787 :
Follow-up on 9P dissector enhancement ( https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8589 )

"fid"s, 9P file descriptors, are valid from the moment it's allocated until
when it's freed. My original patch kept a fid hashtable updated everytime a
packet was dissected in full-view (with a non-null tree)

Attached is a patch that builds a tree for each 9P fid and stores the
corresponding path when it becomes valid/marks it as invalid when it no longer
is.

svn path=/trunk/; revision=51092
2013-08-01 21:04:32 +00:00
Chris Maynard e37533ced7 Fix warnings: comma at end of enumerator list.
svn path=/trunk/; revision=50640
2013-07-15 21:37:55 +00:00
Guy Harris ba8ead5e61 Add some casts for C++ compatibility.
Make conv_get_fid() return a "const char *", as it can return a string
constant, and they are usually *not* writable.

svn path=/trunk/; revision=49400
2013-05-18 01:42:20 +00:00
Guy Harris a274d9de4a A "pointer to something" is a "void *", not a "char *". Using "void *"
avoids some alignment warnings from clang.

svn path=/trunk/; revision=49399
2013-05-18 00:45:20 +00:00
Guy Harris d4ad2e087c Fix some more warnings that show up on platforms with 32-bit time_t.
Get rid of double semicolons.

svn path=/trunk/; revision=49371
2013-05-17 08:09:39 +00:00
Anders Broman 4b85b45281 Squelch more warnings about empty structures.
svn path=/trunk/; revision=49366
2013-05-17 05:33:53 +00:00
Guy Harris f296630024 Squelch warnings about empty structures and chopping off 64-bit values
at 32 bits.

svn path=/trunk/; revision=49364
2013-05-17 05:25:11 +00:00
Jeff Morriss 504d830981 From Dominique Martinet via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8589 :
Theses patches add alot of new message types for the 9P protocol and its
extensions (most specifically 9P2000.L), while staying compatible with the
legacy protocol (hence the hashtable with conversation information, since
version is only known at handshake)

It is still missing alot of 9P2000.u specifics, but I don't have any server
to test it with. I'm also missing some dump to test legacy, but I'm pretty
confident I didn't break much there as it is mostly compatible, most
differences are handled using different messages, the only one that was
changed would be RERROR.


second diff also adds deeper interpretation of the protocol, by following
the conversation stream and keeping a bigger hashtable associating fid (file
handles) and file names, for easier debugging.


From me: roll the contents of the (new) packet-9p.h back into the C file.

svn path=/trunk/; revision=49363
2013-05-17 02:00:05 +00:00
Anders Broman 221b249acd svn path=/trunk/; revision=48272 2013-03-12 21:58:04 +00:00
Anders Broman 455f5c8243 - [-Wmissing-prototypes]
- explicit casts.

svn path=/trunk/; revision=48265
2013-03-12 20:00:50 +00:00
Bill Meier a5b230b1d8 Add missing hf[] entries found by checkhf.
ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_exec_group
  ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_read_group
  ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_write_group


svn path=/trunk/; revision=47493
2013-02-05 14:51:59 +00:00
Evan Huus a9bb9186dd Fix some unused variable warnings from GCC.
svn path=/trunk/; revision=45064
2012-09-23 12:45:03 +00:00
Michael Mann b89a06a3e1 replaced decode_boolean_bitfield calls with itemized filters
svn path=/trunk/; revision=45059
2012-09-23 00:12:14 +00:00