Commit Graph

53 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
Michael Mann 6a847b7e01 Fix expert_info errors found by new and improved checkhfs.pl.
Change-Id: I30f1b92ee438361c3bd58743f7d1ae8d5ffc96f0
Reviewed-on: https://code.wireshark.org/review/15718
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-05 06:11:12 +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
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
Evan Huus d9e5021fe7 hip: fix infinite loop in dissect_hip_tlv
We can't use tree_item == NULL to determine which branch of the previous if was
hit, since proto_tree_add_item can return NULL when run without tree, which was
leading to an infinite loop since we were never advancing the offset. Use the
actual locator_type instead.

Introduced by either g3635d7bed70 or gebff85fdbb although neither of them
directly touch this code path. I'm guess that g3635d7bed70 removed an if (tree)
guard in some calling function which would have prevented this, but I haven't
checked. The bug would still have been there before, it just wouldn't have been
hit because it's only present with a NULL tree. Somebody more familiar with the
protocol should probably go over a capture or two and make sure this isn't a
symptom of some other decoding gone awry in the recent changes.

Change-Id: Ie1ce89b16ef667b437c0d99c25e3f3cb2504347d
Reviewed-on: https://code.wireshark.org/review/3564
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-13 02:47:32 +00:00
Michael Mann 3635d7bed7 Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood.

Change-Id: Ib76f4a9f89b5933425760af0a980c6a549031b8f
Reviewed-on: https://code.wireshark.org/review/3537
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-08-10 21:39:20 +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 7bf6862ecf convert to proto_tree_add_subtree[_format]
Change-Id: Ia7014003a3cff5181295172978d6c613c3b83b0b
Reviewed-on: https://code.wireshark.org/review/2676
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-28 12:05:43 +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
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +00:00
Jakub Zawadzki d6da7a01b1 Fix warnings + remove some v. old comment from strutil.h
svn path=/trunk/; revision=54078
2013-12-13 23:11:14 +00:00
Michael Mann 9ba190f2a5 Create multiple dissection functions if packet_info->ipproto is used to distinguish behavior.
svn path=/trunk/; revision=53504
2013-11-22 02:52:41 +00:00
Bill Meier 9874da2fcb #if 0 numerous "unused const variables" (mostly value-string-arrays);
Also; fix a few "set but not used" warnings.

svn path=/trunk/; revision=52780
2013-10-23 06:29:11 +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
Michael Mann 346f803d42 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 all manual inspection and most cases were either:
1. Case sensitivity differences between hf_ field name and formatted string.
2. Unnecessary whitespace between hf_ field name and colon in formatted string

There are cases where the hf_ field name doesn't quite match the proto_tree_add_uint_format, but it's close enough that one of them should be "right", I'm just not sure which is, I just know the string in proto_tree_add_uint_format is the one displayed.

svn path=/trunk/; revision=52098
2013-09-16 10:39:06 +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
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
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
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 b18e880040 Update FSF address - part II.
svn path=/trunk/; revision=43538
2012-06-28 23:18:38 +00:00
Alexis La Goutte 990d1ad71e From Francisco Vidal Meca via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7136
HIP dissector: PUZZLE and SOLUTION parameters variable size

According to specifications, puzzle and solution parameters carry Random #I and
#J fields that has variable length depending of the Hash function. The fields
are recognized with a fixed value of 8 bytes.

The #I and #J fields should be determined depending of the TLV size.

See http://tools.ietf.org/html/draft-ietf-hip-rfc5201-bis-08#section-5.2.5 .

svn path=/trunk/; revision=42140
2012-04-19 12:41:12 +00:00
Alexis La Goutte 5187255e38 From Francisco Vidal Meca via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7136
HIP dissector: HIT_SUITE_LIST parameter from HIPv2

The HIT_SUITE_LIST Parameter from HIPv2 (
http://tools.ietf.org/html/draft-ietf-hip-rfc5201-bis-08 ) is unsupported.

svn path=/trunk/; revision=42132
2012-04-18 13:42:41 +00:00
Alexis La Goutte 2f41d15871 Make checkhf happy (a bad copy/paste ?)
Add Modelines information

svn path=/trunk/; revision=42097
2012-04-16 15:18:51 +00:00
Alexis La Goutte 4c3c50613b From Paco via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7111
HIP dissector of the HIP_CIPHER parameter is wrong

From me:
Add a hf_tlv_cipher_id and use proto_tree_add_item

svn path=/trunk/; revision=42096
2012-04-16 15:17:33 +00:00
Jakub Zawadzki 8a1dc57c03 Remove doubled semicolons and semicolons outside function.
svn path=/trunk/; revision=42053
2012-04-13 20:22:31 +00:00
Bill Meier 34a0aba9d3 Don't do fcn calls in arg of g_?to??(); Macro may very well eval args multiple times.
svn path=/trunk/; revision=40444
2012-01-12 20:40:23 +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 67ee5049d4 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_BOOLEAN
     FT_IPv4
     FT_EUI64
     FT_GUID
     FT_UINT_STRING

Also: For type FT_ITv6 use ENC_NA. (This was missed in SVN #39260)

svn path=/trunk/; revision=39328
2011-10-10 00:39:31 +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
Alexis La Goutte 50cf6ca9c3 Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36701
2011-04-18 17:44:17 +00:00
Anders Broman da9d25c9eb From Samu Varjonen:
Bug fix: Incorrect presentation of Domain Identifier type and length in HIP dissector

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

svn path=/trunk/; revision=35818
2011-02-04 12:30:42 +00:00
Jaap Keuter a54400c59f From Samu Varjonen:
This patch fixes four issues with the Host Identity Protocol (HIP dissector:

1. The incorrect parsing of the "type 1" locator of HIP. 
2. Updates the comments to reflect the approval of RFC 5770.
3. Cosmetic change (uppercase SPI)
4. Change in the checksum dissection 
   (when the HIP packet is UDP encapsulated 0 checksum is correct).

svn path=/trunk/; revision=35777
2011-02-03 06:32:35 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Bill Meier 44f9eec459 From Samu Varjonen: Whitespace cleanup
Tabs converted to 8 spaces and trailing whitespaces removed, etc.

svn path=/trunk/; revision=33086
2010-06-04 17:59:53 +00:00
Bill Meier 9beaab0ce2 From Samu Varjonen: "New patch to the locators"
See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3378#c25

From me:
 Fix typo: "REALY_UDP_HIP" --> "RELAY_UDP_HIP";
 Cleanup whitespace.

svn path=/trunk/; revision=32276
2010-03-25 15:18:39 +00:00
Bill Meier 97767a5a7b Revert SVN #32222: The handling of TLVs within the "LOCATOR" TLV needs to be reworked.
svn path=/trunk/; revision=32228
2010-03-17 20:38:43 +00:00
Bill Meier 0c1991d488 From Samu Varjonen: Locator presentation change for HIP dissector.
See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3378

From me: use consistent (tab) indentation; replace use of C++ style comment.

svn path=/trunk/; revision=32222
2010-03-17 18:23:56 +00:00
Bill Meier c63cb48b5b Minor changes:
- stdio/stdlib/string includes not req'd;
- Use less generic names for a few enum identifiers;
- Use coonsistent indentation in a few palces.

svn path=/trunk/; revision=32221
2010-03-17 18:08:45 +00:00
Jaap Keuter 6be946c4bb From Samu Varjonen:
svn diff of the changes after draft-ietf-hip-nat-traversal-09 was approved to
become an RFC.

svn path=/trunk/; revision=31148
2009-12-02 07:34:55 +00:00
Kovarththanan Rajaratnam 6fe1060cd1 Don't pass ep_alloc()'ed strings to col_set_str().
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3984

svn path=/trunk/; revision=29726
2009-09-06 04:26:50 +00:00
Kovarththanan Rajaratnam 17c9803cac Sanitize epan includes
svn path=/trunk/; revision=29499
2009-08-21 20:25:24 +00:00
Kovarththanan Rajaratnam 8b515e9340 Switch a bunch of dissectors over to using tvb_new_subset_remaining()
svn path=/trunk/; revision=29446
2009-08-16 12:36:22 +00:00
Jaap Keuter 98fa965a00 Make dissector handle unexpected data better.
svn path=/trunk/; revision=28875
2009-06-28 16:39:31 +00:00
Jörg Mayer c321f29518 Trivial warning fixes:
- Might be used uninitialized
- not a prototype
- comma at end of enum


svn path=/trunk/; revision=28730
2009-06-15 02:34:53 +00:00
Bill Meier 8ccf0f9ba4 packet_hip: (Minor): Remove unused data_handle; move proto_register... to just before proto_reg-handoff...
svn path=/trunk/; revision=28604
2009-06-02 18:47:20 +00:00