Commit Graph

163 Commits

Author SHA1 Message Date
Guy Harris 099698445b Move the proto data stuff out of frame_data.[ch].
It's not tied to the frame_data structure any more, so it belongs by
itself.

Clean up some #includes while we're at it; in particular, frame_data.h
doesn't use anything related to tvbuffs, so don't have it gratuitiously
include tvbuff.h.

Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c
Reviewed-on: https://code.wireshark.org/review/13518
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-25 02:24:34 +00:00
Kevin Bracey d1ab1590cf Clarify IPHC dissection of IPv6 ECN and DSCP
6LoWPAN IPHC dissection displayed ECN and DSCP as if they were an
IPv6-layout bitfield. Remove this extra abstraction layer, and output
them more simply as individual bit items, with a generated field
to indicate the IPv6 equivalent.

Change-Id: Iff1473ce181fb40ae07a773689a5fee7bd9e98c7
Reviewed-on: https://code.wireshark.org/review/13185
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>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-14 05:30:03 +00:00
Kevin Bracey d6ca6cbe74 6LoWPAN: correct IPHC traffic class decompression
Traffic class values from IPHC headers were shown correctly in the IPHC
dissection, but not correctly inserted into the expanded IPv6 packet.

Problem was only visible on little-endian systems - the previous
code did work if big-endian.

Error was not present in HC1 decompression, but both IPHC and HC1
IPv6 construction code clarified by avoiding writing overlapping union
members.

Bug: 11971
Change-Id: I3515f18c892f1fc28ef7f8a0830a79d134e81f48
Reviewed-on: https://code.wireshark.org/review/13109
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-01-12 13:44:41 +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
João Valverde e8b8568b7c 6LowPAN: Check for NHC IPv6 No Next Header
Bug: 11728
Change-Id: I7b7cc72b4200e53856283e0716383d661a16fa77
Reviewed-on: https://code.wireshark.org/review/12512
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-11 05:30:07 +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
Jeff Morriss 7f591e4c07 Clean up more unnecessary use of the 'volatile' key word.
Change-Id: I3e72fddc6ed380780d7e2e1c8df87e580138188d
Reviewed-on: https://code.wireshark.org/review/11271
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-26 11:28:41 +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
João Valverde a643d14187 Change proto_tree_add_ipv6() to take a struct e_in6_addr pointer
tvb_get_ipv6() takes a struct e_in6_addr *, use that here too.

Change-Id: Id8b368daa05c151a61d4bc01dc88c00da13e9c88
Reviewed-on: https://code.wireshark.org/review/10953
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: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-10-14 12:18:00 +00:00
Gerald Combs 62d901bf05 Scan into a guint32 using %u.
Change-Id: Ic0fa25f3ad78e2a1923610a17f764e1b0623eabc
Reviewed-on: https://code.wireshark.org/review/10919
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-10 01:49:08 +00:00
Pedro Jose Marron 911da8b9d5 Support in 6lowpan for RFC4944 address generation
For the conversion of a 16-bit short address in 6lowpan to an IID, there
are several RFCs that produce different results. RFC 4944 section 6
specifies that the conversion uses the given PAN ID and the 16-bit short
address. RFC 6282, on the other hand, specifies thta the conversion only
uses the 16-bit short address and no longer uses the PAN ID.

The current version of the 6lowpan dissector supports only the newer RFC
6282, but there are protocols out there that assume that the address
conversion still abides to RFC 4944.

In order to support these protocols and following the discussion from

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

this patch introduces a boolean preference in the 6lowpan dissector that
indicates whether or not the older RFC 4944 should be used for address
conversion. By default, it is set to FALSE, thus leaving the behavior of
the dissector unchanged.

Besides the boolean preference, another helper function
lowpan_addr16_with_panid_to_ifcid has been written that implements the
expected behavior from RFC 4944 using the same hint mechanism already in
place in the dissector for the support of RFC 6282.

Change-Id: I8d202c69a225d7b1212080a174e0111e5203553c
Reviewed-on: https://code.wireshark.org/review/10902
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-10 00:10:34 +00:00
Pedro Jose Marron 4a45bd5bf4 Display of reserved octet in 6lowpan IPHC header
The 6lowpan standard specifies a reserved octet in the extended header
of an IP_PROTO_FRAGMENT packet in the same place used for the header
length for other extension headers.

The current version of the 6lowpan dissector displays the reserved octet
and the rest of the header (6 more bytes) together as data, as opposed to
displaying the reserved octet by itself and then the data (using the
data dissector).

This patch does not change the functionality of the dissector in any
way, only how the 7 bytes are displayed. Instead of displaying the
header information and then 7 bytes of data, it displays the reserved
octet and then the data. This is also consistent with the way the ipv6
dissector displays it (showing the reserved octet and its value).

For this purpose, there is a new hf (hf_6lowpan_nhc_ext_reserved) and
the corresponding proto_tree calls. Also, depending on the type of
extension header, the octets sent to the general data dissector are
shifted by one.

Change-Id: I4c7fb58a3364307e79517b979808f3e34a2e0b94
Reviewed-on: https://code.wireshark.org/review/10908
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-10-09 23:34:10 +00:00
João Valverde a35311d312 Fix comments in dissect_6lowpan_iphc_nhc()
Change-Id: I9c02b8f2a64127200c9cfe2f389f773ac198ed21
Reviewed-on: https://code.wireshark.org/review/10389
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-09-05 06:18:15 +00:00
Kevin Bracey 7c4f622d68 Insert correct padding in RFC 6282 IPHC headers
IPv6 Extension Headers compressed using IPHC should have a single Pad1
or PadN inserted at the end if necessary - the previous code just left
any padding zero-initialised (equivalent to multiple Pad1s).

This guarantees correctly-compressed packets are accurately
decompressed, including the specific option padding pattern. (The type of
padding could matter, eg for IPSec authentication - padding options are
authenticated.)

Print a warning note if a non-option header needs padding - this is
invalid.

Bug: 10523
Change-Id: I66c98370862800a8fccbe02ed6a851961e2f7d1d
Reviewed-on: https://code.wireshark.org/review/10230
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>
2015-09-04 11:04:07 +00:00
Kevin Bracey eacaa1aad8 6LoWPAN: IPv6 Fragment Headers don't have a Length field
RFC 6282 specifies special handling of the "Length" field in compressed
IPv6 extension headers. However, the Fragment Header does not have a
Length field, so this special handling does not apply - the second octet
should be treated as opaque data, and the header length is always 8
octets.

Bug: 11368
Change-Id: I28fcd66d96f58a5959bb669caf4244afaca9e67e
Reviewed-on: https://code.wireshark.org/review/10231
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: Evan Huus <eapache@gmail.com>
2015-08-29 17:26:52 +00:00
Michael Mann 21e5a950ad Remove all preferences related to enabling/disabling heuristic dissectors.
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector.

Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled.

Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22
Reviewed-on: https://code.wireshark.org/review/9610
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-17 17:12:22 +00:00
Michael Mann be7d295fbf Add "user presentable" and "unique string ids" to heuristic table entries.
This allows better presentation of heuristic dissectors to the end user.

Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6
Reviewed-on: https://code.wireshark.org/review/9602
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12 03:14:38 +00:00
Peter Wu ba9aa3015f Split more init routines into init/cleanup functions
This patch is partially automatically generated, but are modified
manually. In particular, assignments and function calls have been
audited.

Some debugging comments and ifdef'd prints have been removed. The
lookup tables of the dcm and sip dissectors are now cleared. It is only
called on reopening files anyway.

The isakmp dissector is modified to use g_hash_table_new_full for
destruction of its keys and values.

Fix a memleak in ipsec dissector when libgcrypt is not enabled.

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

Change-Id: I3fd910bdee663842ac0196334fe0189b67e251b0
Reviewed-on: https://code.wireshark.org/review/9225
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:37:40 +00:00
Robert Cragie fa6ebae939 Improved prefix display and comments for IID copying
Change-Id: I58f56dd5cfc212e53bd7e9d575d2cf9b4b4f2b27
Reviewed-on: https://code.wireshark.org/review/8886
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-24 00:13:05 +00:00
AndersBroman 870d223b69 Change deprecated API tvb_length -> tvb_reported_length
Change-Id: I14577dccaed5aa5ed85e94b6810a94b4c8b2e437
Reviewed-on: https://code.wireshark.org/review/8059
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-14 06:58:40 +00:00
Michal Labedzki 6aba675431 Bluetooth: GATT/L2CAP: Add support for 6LoWPAN
6LoWPAN is used by GATT level profile called IPSP.

Change-Id: Iff2e1a8d531072d9bba03e7d84b56db59110cb35
Reviewed-on: https://code.wireshark.org/review/8045
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-04-14 05:43:20 +00:00
Bill Meier c0a403abf3 6lowpan: Fix a few minor bugs; Also: Misc
(Bugs were introduced in gf5e2b42);
Misc:
    Localize a few variables;
    Remove some dead initializers.

Change-Id: Ib7493740ecf29ed9f753475f721b47a64f54a278
Reviewed-on: https://code.wireshark.org/review/6687
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-20 20:49:18 +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
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
Alexis La Goutte def4313380 6lowpan : fix warning: no previous prototype for 'lowpan_context_free' [-Wmissing-prototypes]
Change-Id: I3fa66aa0713a0455639b04ecf129f48baa8c096f
Reviewed-on: https://code.wireshark.org/review/5718
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-11 12:09:05 +00:00
Pascal Quantin 987383da49 6LoWPAN: use manually managed memory for the stateful address decompression preferences
Bug: 10747
Change-Id: I9d1b7ce2782f7cd133ab3ba02b0dd43afab3e145
Reviewed-on: https://code.wireshark.org/review/5560
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-02 09:43:46 +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
Pascal Quantin 1e47e050dc 6LoWPAN: fix encapsulating address decoding when a Mesh header is present
Bug: 10462
Change-Id: I37d532edc41193123b1a7bb380d48cb76c118bf4
Reviewed-on: https://code.wireshark.org/review/4161
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: Michael Mann <mmann78@netscape.net>
2014-09-20 11:52:34 +00:00
Evan Huus c1bc1b6a83 Convert some deprecated tvb_length calls
Change-Id: I6337f8e02a41106a363b9bf767bc4b3697442d41
Reviewed-on: https://code.wireshark.org/review/4027
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-09-08 14:11:44 +00:00
Pascal Quantin 2eced3689d 6LoWPAN: fix dissection when using multicast address compression
Also update the value_string arrays with the various SAM/DAM combinations

Bug: 10426
Change-Id: I87f13c29f42770ec655d85e2247b847bfe28e3ba
Reviewed-on: https://code.wireshark.org/review/3915
Petri-Dish: Pascal Quantin <pascal.quantin@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>
2014-08-30 09:55:27 +00:00
Guy Harris ebff85fdbb Clean up Internet checksum handling.
Add macros to set entries of a vec_t, one for use when you have a
pointer to private data, and one for use when you have data in a tvbuff.
The latter wraps the use of tvb_get_ptr(), so that you're not directly
calling it in a dissector.

Move ip_checksum() to epan/in_cksum.c, and add an ip_checksum_tvb() that
wraps the use of tvb_get_ptr().

In the CARP dissector, give the length variable an unsigned type -
there's no benefit to it being signed, and that requires some casts to
be thrown around.

In the DCCP dissector, check only against the coverage length to see if
we have enough data, combine the "should we check the checksum?" check
with the "*can* we check the checksum?" check in a single if, and throw
a dissector assertion if the source network address type isn't IPv4 or
IPv6.

Get rid of inclues of <epan/in_cksum.h> in dissectors that don't use any
of the Internet checksum routines.

In the HIP dissector, make sure we have the data to calculate the
checksum before doing so.

Change-Id: I2f9674775dbb54c533d33082632809f7d32ec8ae
Reviewed-on: https://code.wireshark.org/review/3517
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-09 01:09:34 +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
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
Michael Mann daa70feddc Revert "Fixup: tvb_ensure_length_remaining -> tvb_ensure_captured_length_remaining"
See https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 021e7afc9f.

Change-Id: I0640eabce5ce8c4ff3a88ebf848b499f8bb8ed2f
Reviewed-on: https://code.wireshark.org/review/2429
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 17:23:41 +00:00
Dario Lombardo 021e7afc9f Fixup: tvb_ensure_length_remaining -> tvb_ensure_captured_length_remaining
Change-Id: I0228f3b6b7067bc0ce51f9d359f99fd18feb2b66
Reviewed-on: https://code.wireshark.org/review/2378
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:20:32 +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
Guy Harris b48a21588a Don't use sizeof(guintN) for sizes of data in packets.
Either

	1) sizeof(guintN) = N/8, in which case it's redundant

or

	2) sizeof(guintN) != N/8, in which case it's wrong.

This also keeps us from having to throw casts at complaints about
shortening 64-bit values.

Change-Id: I33911acfc54c0f3f21b73026a100a82b1ee2c35e
Reviewed-on: https://code.wireshark.org/review/1731
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-22 21:55:54 +00:00
Owen Kirby 177c6556f7 Tighten heuristic checks for IEEE 802.15.4 protocols, and add Decode-As by PANID for when we still get it wrong.
Change-Id: Icc2b274d2478a9426da881998bbbbfb3bf34ec4a
Reviewed-on: https://code.wireshark.org/review/1167
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-22 15:05:33 +00:00
Bill Meier fced2dd196 Do various minor changes
- Remove _U_from a function param;
   document usage of the param;
   add a DISSECTOR_ASSERT for the param;
- Remove a few unneeded variable initalizers;
- Use -1 iso tvb_length() in proto_tree_add_protocol_format(..);
- Add editor modelines.

Change-Id: I7d7a8ea1176a26ea319d9fc0dab5d3a51050edd5
Reviewed-on: https://code.wireshark.org/review/584
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-03-10 13:21:31 +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
Michael Mann d3ed64d8e3 Add ZigBee Green Power dissector. Bug 9424 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9424)
From DSR Corporation

svn path=/trunk/; revision=54478
2013-12-28 12:26:37 +00:00
Jakub Zawadzki deb2b236f2 Add missing includes
svn path=/trunk/; revision=54332
2013-12-21 17:23:17 +00:00
Jakub Zawadzki 3d6fdc55d0 New functions: str_to_ip6(), str_to_ip()
This way we can avoid including lot of system header files in some dissectors
and it might fix bug #9581

svn path=/trunk/; revision=54330
2013-12-21 16:16:56 +00:00
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +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
Michael Mann 9b7fb8a811 Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470)
I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future.  And search/replace of a function name is easy enough to do.

The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As.

All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope().  All other dissectors were converted to using file_scope() which was the original scope for "proto" data.

svn path=/trunk/; revision=53520
2013-11-23 02:20:13 +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 efe18f199c Convert a few dissectors from emem to wmem API
svn path=/trunk/; revision=51983
2013-09-12 20:37:30 +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
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
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Evan Huus bd52515b06 Use epan-scoped memory for 6lowpan preference names. Another ~300 bytes gone.
svn path=/trunk/; revision=50417
2013-07-06 18:40:56 +00:00
Michael Mann 2d37ec3cb0 Batch of filterable expert infos.
svn path=/trunk/; revision=49853
2013-06-09 03:28:05 +00:00
Anders Broman 85a8e304dd Add the posibillity to use a key for per-packet-data.
svn path=/trunk/; revision=49259
2013-05-12 18:11:02 +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 6bde918078 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48426
2013-03-19 20:00:52 +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
Evan Huus 7577443c0f Use pinfo-scoped memory for 6LoWPAN addresses.
Fixes at least part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7885

svn path=/trunk/; revision=46582
2012-12-18 03:15:23 +00:00
Guy Harris 09e4e205c7 Some of the changes claimed to be in the previous checkin weren't there.
Label the data sources for reassembled fragments as "Reassembled
6LoWPAN". 

Fix the capitalization of "6LoWPAN".

Also, label the data sources for decompressed fragments as "Decompressed
6LoWPAN xxx".

svn path=/trunk/; revision=45529
2012-10-14 02:54:25 +00:00
Guy Harris 395dd4a88e *Always* create a new data source when we decompress an IPv6 header.
Label the data sources for them as "6LoWPAN xxx", where "xxx" is the
type of compression, and label the data sources for reassembled
fragments as "Reassembled 6LoWPAN".

Fix the capitalization of "6LoWPAN".

Note that if reassembly fails, continuing dissection is not the right
thing to do, at least not if it failed because we don't *yet* have all
the fragments.

svn path=/trunk/; revision=45527
2012-10-14 02:33:26 +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
Jakub Zawadzki 5a8783f5b1 Initial commit to support yet another method of passing data between dissectors.
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL

svn path=/trunk/; revision=44860
2012-09-10 21:40:21 +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
Anders Broman e128334750 From Owen Kirby:
6LoWPAN: Automatic context detection and draft-ietf-6lowpan-nd-19 updates.

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

svn path=/trunk/; revision=44723
2012-09-01 11:54:16 +00:00
Bill Meier 638d74d43f Use val_to_str_const() where appropriate;
Also (for a few files):
- create/use some extended value strings;
- remove unneeded #include files;
- remove unneeded variable initialization;
- re-order fcns slightly so prefs_reg_handoff...() at end, etc

svn path=/trunk/; revision=44438
2012-08-10 22:55:02 +00:00
Jakub Zawadzki 40e809be57 6lowpan: cleanup dynamic configuration construction.
g_string_printf() -> g_strdup_printf()

svn path=/trunk/; revision=44065
2012-07-27 08:47:54 +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
pascal 95eb2e7288 From Martin Kaiser:
Fix some 'intermediate pointers must be const qualified' warnings
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7215

svn path=/trunk/; revision=42355
2012-04-30 19:14:14 +00:00
Bill Meier 594b358011 Use tvb_new_subset_remaining() instead of tvb_new_subset();
Reformat some long lines.

svn path=/trunk/; revision=41365
2012-03-06 02:28:04 +00:00
Alexis La Goutte eebaffcc5c Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=41306
2012-03-02 11:05:23 +00:00
Bill Meier 54b72021bb Fix encoding arg for various fcn calls:
- proto_tree_add_bits_item
 - proto_tree_add_bits_ret_val
 - proto_tree_add_bitmask
 - tvb_get_bits
 - tvb_get_bits16
 - tvb_get_bits24
 - tvb_get_bits32
 - tvb_get_bits64


svn path=/trunk/; revision=39539
2011-10-24 19:57:53 +00:00
Bill Meier ffde0a10bb Restore saved 'pinfo->fragmented' as appropriate;
Fixes gcc 4.6 "set but not used [-Wunused-but-set-variable]" warnings.

svn path=/trunk/; revision=38297
2011-07-31 23:41:20 +00:00
Alexis La Goutte 12592dab19 From Owen Kirby via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6147
6LoWPAN: Support for IP-in-IP tunnelingy

svn path=/trunk/; revision=38258
2011-07-29 14:26:41 +00:00
Jaap Keuter 8e30d1990e From Colin O'Flynn:
Avoid processing tvb when fragment dissection didn't create one.

svn path=/trunk/; revision=37426
2011-05-27 07:02:26 +00:00
Bill Meier bf271ce2d0 From beth.tridium [At] gmail.com: 6LoWPAN dissector selects wrong byte for HC_UDP Encoding subtree
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5926

svn path=/trunk/; revision=37194
2011-05-16 23:15:08 +00:00
Bill Meier 1b9144beb8 From Yaniv Kaul: some 'set but not used' compilation fixes.
svn path=/trunk/; revision=36888
2011-04-27 04:27:38 +00:00
Bill Meier aec98c121a Don't assign to a proto_item * if the value won't be used: Coverity 820/821;
Also: #include <stdio.h> & <string.h> not required;


svn path=/trunk/; revision=36447
2011-04-04 15:38:19 +00:00
Gerald Combs 3de62b03c6 Forward port r36036 from trunk-1.4: Make sure we ep_allocate enough
memory.

svn path=/trunk/; revision=36037
2011-02-23 22:49:59 +00:00
Anders Broman ed66081a4d From Alexis La Goutte:
Cleanup packet-ipv6.h and dependency.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5713

svn path=/trunk/; revision=36031
2011-02-23 13:51:49 +00:00
Stig Bjørlykke 84bc28bd6a Introduce "Fragment count" filter element for all protocols doing reassembly.
svn path=/trunk/; revision=35705
2011-01-30 21:01:07 +00:00
Anders Broman 26f0f7bc7a From Fred Fierling:
Multi-key Support and Extended Address Mapping for ZigBee Dissectors
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5331

svn path=/trunk/; revision=34647
2010-10-26 05:42:24 +00:00
Anders Broman b1e852cf70 Back out 34627 and friends again.
svn path=/trunk/; revision=34633
2010-10-24 15:22:44 +00:00
Anders Broman 43cb273d08 From Fred Fierling:
Multi-key Support and Extended Address Mapping for ZigBee Dissectors
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5331

svn path=/trunk/; revision=34627
2010-10-24 10:04:29 +00:00
Stig Bjørlykke 8d3bde0f49 Initialize length.
svn path=/trunk/; revision=34293
2010-09-30 19:41:44 +00:00
Jaap Keuter 733183a170 From Colin O'Flynn / Owen Kirby:
The 6LoWPAN dissector had as a TODO the 'stateful address compression' mode.
This patch fixes that TODO, up to HC-13.
This patch also updates to HC-08, where the PANID is no longer used in forming
the short address.

svn path=/trunk/; revision=34290
2010-09-30 19:23:31 +00:00
Anders Broman 1315fe5d29 From John Sucaet:
The committed changes in 33624 did not include all fixes of the previous patch
file - Please add the fix for the field description of the 8-bit Deep Hops Left
field
Attached file contains this fix (+as well as small correction to the field
descriptions of V and F flags, according to the terminology of RFC 4944)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5047

svn path=/trunk/; revision=33630
2010-07-26 13:04:10 +00:00
Jaap Keuter 7ca6e3a655 From John Sucaet:
packet-6lowpan.c dissects the non-compressed ipv6 fields in an order different
from the one specified in RFC 4944 §10.3.1. 
The patch fixes the wrong order and an additional problem with the dissection 
of the mesh header: support for the Deep Hops Left field (RFC 4944 §5.2)

svn path=/trunk/; revision=33624
2010-07-23 20:19:05 +00:00
Jaap Keuter afc25e015c From Jan van den Boom:
Correct the V and F flag interpretation in the Mesh Addressing Type and Header
for correct address interpretation.

svn path=/trunk/; revision=33623
2010-07-23 19:40:32 +00:00
Guy Harris 5c394ee15f Squelch some compiler warnings (including warnings about the last member
of a structure being an empty array; that is *not* supported by all the
compilers that can be used to build Wireshark).

svn path=/trunk/; revision=32412
2010-04-07 00:34:20 +00:00
Bill Meier 09764dd969 Remove unneeded #include <stdio.h>
svn path=/trunk/; revision=32367
2010-04-03 21:55:23 +00:00
Jaap Keuter e347a5f155 From Colin O'Flynn:
This is a minor change between the version in SVN which is hc-05, 
and the latest which is hc-06.

svn path=/trunk/; revision=32163
2010-03-10 19:21:17 +00:00
Guy Harris 2341d987a7 Add a sanity check in dissect_6lowpan_hc1() for the datagram length.
Fail, and add an expert item, for invalid lengths.

Having done that, add some casts to squelch compiler warnings.

svn path=/trunk/; revision=32160
2010-03-10 10:23:19 +00:00
Jaap Keuter 4732c51d52 From Owen Kirby:
I've come across a bug in the 6LoWPAN header decompression code that
incorrectly computes the length of IPv6 extension headers by adding the
protocol and length fields twice.

svn path=/trunk/; revision=32157
2010-03-10 07:15:07 +00:00
Jaap Keuter 103d684a3f From Owen Kirby:
This patch fixes 6LoWPAN fragmentation to comply with RFC4944.
I also happened across a problem with the derivations of 
interface identifiers from 16-bit IEEE 802.15.4 addresses, which 
should also be fixed in my patch.

svn path=/trunk/; revision=32155
2010-03-09 23:22:03 +00:00
Anders Broman 50f7fa97dc from Colin O'Flynn:
6lowpan dissector: copy/paste error results in 64-bit source & 16-bit dest failing
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4545

svn path=/trunk/; revision=32065
2010-03-01 11:13:54 +00:00
Jaap Keuter 3126f22a14 From Owen Kirby:
This patch fixes a bug in the 6LoWPAN dissectors that corrupts addresses when
multicast address compression is used. Testing this fix also uncovered a bug in
the computation of the length of the extension headers. And some typos.

svn path=/trunk/; revision=31870
2010-02-12 22:10:53 +00:00
Jaap Keuter 3c702d064b From Owen Kirby:
This patch fixes a bug in the 6LoWPAN dissector where link-local addresses
created from an EUI-64 address do not correctly invert the universal/local bit
as recommended by section 4 of RFC2464.

svn path=/trunk/; revision=31843
2010-02-09 08:40:40 +00:00