Commit Graph

124 Commits

Author SHA1 Message Date
AndersBroman 338f3a5eb1 Remove deprecated tvb_lengt APIs
Change-Id: Ic3c364384dcc1d87089d646665f5900081de13df
Reviewed-on: https://code.wireshark.org/review/8089
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-16 14:01:45 +00:00
Gerald Combs 3f765b3ef9 Add a CF_FUNC macro for casting BASE_CUSTOM functions.
Add a CF_FUNC macro to match VALS, TFS, etc. This should help us to avoid
the following warning:

    warning: ISO C forbids initialization between function pointer and 'void *' [-Wpedantic]

We could start adding DIAG_OFF+DIAG_ON everywhere but this seems to be
more consistent with the other macros in proto.h. Update each instance
of BASE_CUSTOM to use CF_FUNC.

Adjust a dummy variable name generated by asn2wrs.py that was triggering
an invalid error in checkhf.pl.

Fix an encoding arguement in packet-elasticsearch.c found by
fix-encoding-args.pl.

Change-Id: Id0e75076c2d71736639d486f47b87bab84e07d22
Reviewed-on: https://code.wireshark.org/review/7150
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-18 00:05:38 +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
Michael Mann 64a7bac641 tvb_bytes_to_ep_str -> tvb_bytes_to_str
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4
Reviewed-on: https://code.wireshark.org/review/6371
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-01-07 18:16:23 +00:00
Michael Mann 9cfe67fde6 tvb_bytes_to_ep_str_punct -> tvb_bytes_to_str_punct
Also change bytestring_to_str to match bytes_to_ep_str_punct functionality (limiting byte string size)

Change-Id: Idb958c7f0c203d103629469302b81fa922714f7e
Reviewed-on: https://code.wireshark.org/review/6369
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:05:35 +00:00
Alexis La Goutte beb50e627a DHCPv6: fix Nesting level does not match indendation (CID 1159219)
Change-Id: Id57a9f2df6a4011078b0bef359b2cd5503f6f7ce
Reviewed-on: https://code.wireshark.org/review/6171
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-31 15:17:51 +00:00
Michael Mann 1d598bbff7 Replace ip6_to_str and ip6_guint8_to_str with address_to_str and tvb_ip_to_str.
Change-Id: I1d258923a7a63539ec8456d3e306bca5016a1e4b
Reviewed-on: https://code.wireshark.org/review/6060
Petri-Dish: Michael Mann <mmann78@netscape.net>
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-12-28 14:09:27 +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 6e5d84f1e1 Rename some filter names to fix cases of duplicate filter names.
Note: Use of most of these filter names could have caused a Wireshark crash.

Change-Id: I393402a25dd26d174baff77f4706f6d5f43a94ae
Reviewed-on: https://code.wireshark.org/review/5610
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-04 03:44:45 +00:00
Michael Mann e899c3e262 Eliminate proto_tree_add_text from some dissectors.
Change-Id: Iadd80aab291e5de714891a9f3c79edeca19e9b93
Reviewed-on: https://code.wireshark.org/review/5458
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>
2014-11-25 02:51:03 +00:00
Bill Meier 18d72987cb Do encoding-arg changes (all benign)
For:
- FT_BYTES: Always use just ENC_NA
- integral/floating (other than FT_[U]INT8): Do ENC_NA --> ENC_BIG_ENDIAN

Also:
- FT_UINT... --> FT_UINT8 in a few cases (to match proto_tree_add_item...)
- Change one case of incorrect '||' to '|'

Change-Id: I427e0e61618ff8faf55691c8a695930f67d455b0
Reviewed-on: https://code.wireshark.org/review/4184
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-19 01:38:08 +00:00
Jérôme LAFORGE 00a244445d Check hopcount is correctly incremented by 1
Extract RFC3315 about hop-count :
20.1.2. Relaying a Message from a Relay Agent

   If the message received by the relay agent is a Relay-forward message
   and the hop-count in the message is greater than or equal to
   HOP_COUNT_LIMIT, the relay agent discards the received message.

   The relay agent copies the source address from the IP datagram in
   which the message was received from the client into the peer-address
   field in the Relay-forward message and sets the hop-count field to
   the value of the hop-count field in the received message incremented
   by 1.

Bug:10449
Change-Id: Ifb94e7c54c0a26714fc543862d4358d3e60c2676
Reviewed-on: https://code.wireshark.org/review/4017
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>
2014-09-08 16:28:35 +00:00
Jérôme LAFORGE c1325e8378 Check whether the hop-count of most inner message is equal to 0
Extract RFC3315 about relay message and hop-count :

20.1.1. Relaying a Message from a Client

   If the relay agent received the message to be relayed from a client,
   the relay agent places a global or site-scoped address with a prefix
   assigned to the link on which the client should be assigned an
   address in the link-address field.  This address will be used by the
   server to determine the link from which the client should be assigned
   an address and other configuration information.  The hop-count in the
   Relay-forward message is set to 0.

20.3. Construction of Relay-reply Messages

   A server uses a Relay-reply message to return a response to a client
   if the original message from the client was relayed to the server in
   a Relay-forward message or to send a Reconfigure message to a client
   if the server does not have an address it can use to send the message
   directly to the client.

   A response to the client MUST be relayed through the same relay
   agents as the original client message.  The server causes this to
   happen by creating a Relay-reply message that includes a Relay
   Message option containing the message for the next relay agent in the
   return path to the client.  The contained Relay-reply message
   contains another Relay Message option to be sent to the next relay
   agent, and so on.  The server must record the contents of the
   peer-address fields in the received message so it can construct the
   appropriate Relay-reply message carrying the response from the
   server.

   For example, if client C sent a message that was relayed by relay
   agent A to relay agent B and then to the server, the server would
   send the following Relay-Reply message to relay agent B:

   msg-type:       RELAY-REPLY
   hop-count:      1
   link-address:   0
   peer-address:   A
   Relay Message option, containing:
     msg-type:     RELAY-REPLY
     hop-count:    0
     link-address: address from link to which C is attached
     peer-address: C
     Relay Message option: <response from server>

Change-Id: I774cc22c9c090af1a5d3732115c7cd3478343288
Bug:10437
Reviewed-on: https://code.wireshark.org/review/3936
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-03 11:18:31 +00:00
Jérôme LAFORGE 26731e8cc6 Check whether the hop-count exceeds the HOP_COUNT_LIMIT or not.
Change-Id: If1c089e069b93a7b90cb525cd642ac26c5efa2d0
Reviewed-on: https://code.wireshark.org/review/3924
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: Evan Huus <eapache@gmail.com>
2014-08-30 23:29:26 +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
Michael Mann d13e1394b3 Interpret DHCPv6 option 18 as a byte array. RFC 3315, section 22.18 strongly suggests that any other such interpretation is inappropriate:
The Interface-ID SHOULD be considered an opaque value, with policies
   based on exact match only; that is, the Interface-ID SHOULD NOT be
   internally parsed by the server.

This reverts the "Cable Lab specific" functionality added in SVN rev 32928, git rev a541950ca8.

bug:9877
Change-Id: Id4a8cbd01ab3cd6d5a0a44aa2066ea395190f51a
Reviewed-on: https://code.wireshark.org/review/1579
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-11 07:28:43 +00:00
Pascal Quantin 58db464aff Remove executable bit from a few files
Change-Id: Ib9be221e3d325379c8b665ab73d976254bb23bb6
Reviewed-on: https://code.wireshark.org/review/342
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-02-24 22:34:26 +00:00
Bill Meier 5ae232664c Fix "off by 1" bug in dissection of OPTION_AFTR_NAME introduced in 0548a7d5.
Change-Id: I461601cd952f1c4d27a004c0a65cfefe82dc0f49
Reviewed-on: https://code.wireshark.org/review/272
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-20 21:49:17 +00:00
Bill Meier dc53a65bef Fix minor bug; Use a consistent whitespace & formatting style; add extended value-string.
Bug fix: don't call col_...() under 'if (tree)'

Change-Id: I5f586f16f0e64b30da49fbbb0bb8e41b04ba8833
Reviewed-on: https://code.wireshark.org/review/267
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-20 04:55:08 +00:00
Bill Meier 2bb54d5e20 Create/Use some extended value strings.
Change-Id: I750d04a25a4f7d600e4156aaac4a4580a1f7a345
Reviewed-on: https://code.wireshark.org/review/259
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-19 20:55:33 +00:00
Bill Meier 0548a7d549 Simplify/improve handling of FQDN field in various options; Fix some minor bugs.
Details:
- Use dhcpv6_domain() to handle dissection of certain FQDN fields:
  + OPTION_AFTR_NAME:           Don't use get_dns_name(); It allows "compression"
                                 which is not valid forthis field.
  + OPTION_CCCV6_IETF_PROV_SRV: Replace use of swap_field_length_with_char();
                                Fix bug which caused invalid "expert" message.
  + OPTION_CCCV6_KRB_REALM:     Remove validation; replace use of swap_field_length_with_char().

- Allow filtering for each different FQDN field (rather than using a generic "dhcpv6.domain"
   for the various FQDN fields).

- Fix some bugs in the display of the dissection for NTP_SERVER_OPTION;
- Add some "XXX ToDo" comments.
- Add some comments as the to specific RFC for certain options;
- Note that RFC 4075 is now "deprecated";
- CL-SP-CANN-DHCP-Reg: version I10 is the latest as  Feb 2014.

Change-Id: I82edafb8293b71037b84629406ce609f9a835f04
Reviewed-on: https://code.wireshark.org/review/257
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-19 18:30:52 +00:00
Bill Meier 0d244eeb28 Remove code which dissects CableLabs options 17.2170.3 thru 17.2170.9
inasmuch as these options don't exist per the spec.

 See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9690
      (especially comment #5).

Change-Id: Iab757a71fe1865bbd0b97443512bf947f027dbe1
Reviewed-on: https://code.wireshark.org/review/256
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-19 18:28:29 +00:00
Bill Meier ff85833235 Fix Bug #9690: DHCPv6 Packet dissector incorrectly handling FQDN in option 17.2171.6
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9690

Change-Id: I606bb73f4a226cbf1eb56cc0a27b926b97a453a0
Reviewed-on: https://code.wireshark.org/review/131
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-02-06 23:27:34 +00:00
Jakub Zawadzki deb2b236f2 Add missing includes
svn path=/trunk/; revision=54332
2013-12-21 17:23:17 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Jakub Zawadzki f049bec3ca DHCPv6: update list of message types and options (from IANA)
svn path=/trunk/; revision=53992
2013-12-12 21:29:51 +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 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
Evan Huus 4212b20048 Don't use g_strv_length on a single string, just use strlen. Also do the
null-check *before* calling strlen (if it's even necessary?)

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

svn path=/trunk/; revision=52156
2013-09-20 14:41:22 +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
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
Alexis La Goutte 1dfecc041c Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=50244
2013-06-29 22:00:50 +00:00
Alexis La Goutte 0a249bf647 Fix errors found by fix-encoding-args script
epan/dissectors/packet-dhcpv6.c:  FT_IPv6:          proto_tree_add_item(pkt_s_tree, hf_packetcable_cccV6_prov_srv_ipv6, tvb, suboptoff+1, 4, [[ENC_BIG_ENDIAN]-->[ENC_NA]]);
epan/dissectors/packet-dhcpv6.c:  FT_BYTES:         proto_tree_add_item(subtree2, hf_capabilities_encoding_bytes, tvb, tlv5_cap_index, tlv5_cap_len, [[ENC_BIG_ENDIAN]-->[ENC_NA]]);

svn path=/trunk/; revision=50084
2013-06-20 20:17:21 +00:00
Alexis La Goutte dc82f1cc93 Fix packet-dhcpv6.c: In function 'dhcpv6_option': packet-dhcpv6.c:1826:36: error: 'ti' may be used uninitialized in this function [-Werror=maybe-uninitialized]
svn path=/trunk/; revision=50082
2013-06-20 18:32:18 +00:00
Evan Huus 612d14c883 From Brian Otte via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8592
Numerous fixes and improvements to DHCPv6 Cable Television Labs vendor-specific
information dissection.

svn path=/trunk/; revision=50075
2013-06-20 16:22:53 +00:00
Pascal Quantin 285bc53826 Fix typo error
svn path=/trunk/; revision=49918
2013-06-13 14:20:20 +00:00
Pascal Quantin 53c658bb19 Add basic dissection of Prefix Exclude option
svn path=/trunk/; revision=49917
2013-06-13 14:18:10 +00:00
Michael Mann 57fc882623 Simplify the "bad length" expert info into a single filterable item with formatting determining the particulars because the filter names just didn't make much sense to separate.
svn path=/trunk/; revision=49801
2013-06-06 02:10:22 +00:00
Michael Mann 7e8e5b347e Batch of filterable expert_infos.
svn path=/trunk/; revision=49581
2013-05-25 17:06:40 +00:00
Michael Mann b2027be0f8 Add filterable expert info.
svn path=/trunk/; revision=49573
2013-05-25 03:27:31 +00:00
Michael Mann 478ee0ae73 DHCPv6 option 56, RFC 5908
Bug 8421 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8421)

svn path=/trunk/; revision=49473
2013-05-21 03:24:55 +00:00
Alexis La Goutte 12517d1309 Fix encoding args (via fix-encodings-args tools) Add Modelines info
svn path=/trunk/; revision=48965
2013-04-22 17:28:16 +00:00
Anders Broman 2e52e2ac99 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48347
2013-03-17 09:11:21 +00:00
Anders Broman 263a9d0683 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48341
2013-03-16 16:25:41 +00:00