Commit Graph

90 Commits

Author SHA1 Message Date
Evan Huus 0eda51a646 to_str: scope tvb_ip6_to_str 2021-10-07 13:31:23 -04:00
Evan Huus 07f5472aa7 to_str: scope tvb_ip_to_str 2021-10-07 10:25:12 -04:00
Evan Huus cdfab0d6e9 tvbuff: convert helper methods to pinfo->pool
A few of them just needed scratch memory, so allocate and free it
manually after doing any exception-raising checks.

A few others were returning memory, and needed conversion to accept a
wmem scope argument.
2021-09-01 03:54:52 +00:00
David Perry 6e8c7283d6 Change some `wmem_packet_scope()` to `pinfo->pool` 2021-07-27 21:36:43 +00:00
Alexis La Goutte 7530c337b5 cdp: fix item length
reported by check_typed_proto_items.py
packet-cdp.c:298 proto_tree_add_item called for hf_cdp_ttl  -  item type is FT_UINT16 but call has len  1
packet-cdp.c:1225 proto_tree_add_item called for hf_cdp_nrgyz_tlvtype  -  item type is FT_UINT16 but call has len  4
2020-11-15 10:02:44 +00:00
Jaap Keuter 28bec58f05 CDP: Improve CDP port ID TLV hack heuristic
The heuristic used for dissection of the port ID TLV breaks in the face
of subsequent TLVs with tags starting with 0x10xx. This change fixes the
heuristic to allow these new TLVs to follow the port ID TLV without
triggering the workaround for buggy CDP senders.

Bug: 16742
Change-Id: I40c7ce790263c6de9b59ce543485cf3827f77fe7
Reviewed-on: https://code.wireshark.org/review/37985
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-07-29 14:27:37 +00:00
Roman Koshelev e57b37137d Compilation fixes when CMAKE_BUILD_TYPE = MinSizeRel (-Os flag).
Compiler - gcc 8.3.0
These are mostly errors 'may be used uninitialized in this function'

Change-Id: I6a8f7172c99024fd449570937b030e37c0ea5c3d
Reviewed-on: https://code.wireshark.org/review/35746
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-01-11 20:46:52 +00:00
Joerg Mayer a8c7beb070 Use symbolic values for Cisco's LLC PIDs
Change-Id: I4cc99cef1e52fcce308608dd95befa2286787b16
Reviewed-on: https://code.wireshark.org/review/35728
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-10 23:36:33 +00:00
Guy Harris e206eb2992 Use ENC_NA, not ENC_BIG_ENDIAN, for a sequence of bytes.
Change-Id: I90023c940b7a6a89f57c9394b5b21596f560c6e2
Reviewed-on: https://code.wireshark.org/review/34176
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-08-04 02:26:37 +00:00
Oliver fc926c0e97 CDP: Expand dissection of capabilites
Adds four extra capability definitions that could exist in a CDP packet. Useful for identifying phones.

Change-Id: I2b542a8a079a8483d8c1ee10df60c8df0933af95
Reviewed-on: https://code.wireshark.org/review/34169
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-08-03 14:45:57 +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
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
Guy Harris 37e364b241 Improve handling of VOIP VLAN queries and replies.
For queries, there appear to be two different versions, one with a
2-byte value of some unknown type and one with a 1-byte value that
appears to be an "appliance type" code followed by a 2-byte VLAN ID.

For replies, there only appears to be a version with a 1-byte "appliance
type" followed by a 2-byte VLAN ID, but handle a too-short payload.

Also point to http://www.rhyshaden.com/cdp.htm in some comments.

Change-Id: If1b476d5e6b23c7e0ba027835c6f0c84c8b723b7
Reviewed-on: https://code.wireshark.org/review/25249
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-10 20:17:10 +00:00
Guy Harris 7c56f4776b Clean up dissection of "power requested" and "power available" TLVs.
Fix the addition of power values to the top-level item for the TLV so
that it actually adds power values.

Make the list of power values in that item display correctly, without
extra commas.

Fail if the length of the TLV is less than 8.  (We should really add an
expert info item for that.)

Change-Id: Ic4229c0652306f69156b8341c9fbb67cacc8154c
Reviewed-on: https://code.wireshark.org/review/25215
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 05:09:53 +00:00
Uli Heilmeier 6f93baced0 CDP: Resolve 802.2 Protocol type protocols, show IPv6
Protocols of protocol type 802.2 (PT = 2) are encoded with the
"normal" ethernet type when PT length == 8.

Used reference: https://docs.fd.io/vpp/17.10/d2/d71/cdp__protocol_8h_source.html

Show IPv6 addresses as IPv6 and not as bytes.

Change-Id: I0f192e758bcc1a562f042609fa5d0d9527551bb8
Bug: 14311
Reviewed-on: https://code.wireshark.org/review/25168
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-07 16:09:13 +00:00
Michael Mann 4e3114d01d Eliminate #include <epan/oui.h> from dissectors that don't need it.
Correct include patch for packet-lldp.c

Change-Id: I5e2a267943ccd39616ef323848104fdba23c8f38
Reviewed-on: https://code.wireshark.org/review/24009
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-21 15:08:05 +00:00
Michael Mann b289699ace Remove oui_vals value_string and epan/oui.c
oui.c is a very small subset of what comes from http://standards.ieee.org/regauth/oui/oui.txt,
so use the "full" OUI list (and more) out of the manuf file and convert
hf_ fields to just use BASE_OUI.

Change-Id: Ic0c2ff618d8a6212f498e3b7475e0a7856c22b5b
Reviewed-on: https://code.wireshark.org/review/24007
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-21 08:22:30 +00:00
Michael Mann b7f4e25059 Adjust proto_tree_add_uint_format_value calls to use unit string
Several calls to proto_tree_add_uint_format_value could be better served
using BASE_UNIT_STRING with a "unit string" in hf_ field.  There also
a few cases where proto_tree_add_uint_format_value could just be
proto_tree_add_uint.

Added a few more "common" unit string values to unit_strings.[ch]

Change-Id: Iaedff82c515269c9c31ab9100dff19f5563c932d
Reviewed-on: https://code.wireshark.org/review/19242
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-13 22:56:50 +00:00
Alexis La Goutte a156a0021d CDP: Add CDP over GRE
http://www.cisco.com/c/en/us/td/docs/wireless/access_point/15-3-3-JB/configuration/guide/cg_book/cg-appA-protfilters.html

Bug:12934
Change-Id: If6498446c86f509a44dc28d3c2e4d86cc61cd167
Reviewed-on: https://code.wireshark.org/review/17853
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-22 21:41:09 +00:00
Uli Heilmeier dc42aadcac CDP: Don't read outside payload for Port ID
Check if tvb remaining length is greater than expected length.

Bug: 12767
Change-Id: Ia04b559432af417db519cfcfbec06e6010b496bf
Reviewed-on: https://code.wireshark.org/review/17208
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-08-21 17:44:49 +00:00
Michael Mann 8b0e9c6672 Follow up for proto_tree_add_checksum.
Fill in the "gaps" so that all dissectors that verify checksums have both a
status and expert info field.

Also address comments from original proto_tree_add_checksum patch that didn't make it.

Ping-Bug: 8859
Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f
Reviewed-on: https://code.wireshark.org/review/16590
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-27 03:40:02 +00:00
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 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
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 bbdd89b973 create_dissector_handle -> new_create_dissector_handle
Picking off "easy" dissectors that only have one or two exit points at most.

Change-Id: Ie514f126352e7598acc4f7c38db9c61d105d5e48
Reviewed-on: https://code.wireshark.org/review/11850
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 03:50:05 +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 3d3f97320b Replace ip_to_str with [ep_]address_to_str and tvb_ip_to_str.
Change-Id: I40d0c8253743183aecef252040b7dd6742ae5c71
Reviewed-on: https://code.wireshark.org/review/5934
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-26 21:17:10 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Bill Meier f412c9a01a Use ENC_BIG_ENDIAN when fetching FT_U?INT8 fields ...
(for some dissectors which fetch all other integral fields using
   ENC_BIG_ENDIAN).

Change-Id: Ic18e3172aad76af12b12d6732c88497be22aed56
Reviewed-on: https://code.wireshark.org/review/5748
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-13 18:45:56 +00:00
Michael Mann f5ed47dbbc Eliminate proto_tree_add_text from packet-q933.c
Change-Id: If5b85609d3daaf66cbcc15e3127af4e7f5736e52
Reviewed-on: https://code.wireshark.org/review/4995
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-30 20:53:52 +00:00
Michael Mann 4963d99c4a Eliminate proto_tree_add_text from packet-cdp.c
Change-Id: I77e1f5788e0567dcaef9f75e1f45e61c63d54b4e
Reviewed-on: https://code.wireshark.org/review/4849
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-10-20 01:20:34 +00:00
Bill Meier 01b093c24d Add editor modelines; Adjust whitespace as needed.
Change-Id: I434da226c842298f4fb2a4335d06d51e164af2af
Reviewed-on: https://code.wireshark.org/review/4394
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-30 23:17:01 +00:00
Guy Harris 480fcfd702 Update some URLs.
Change-Id: Iaba677670907dbfb028c1112cd11986d859329cb
Reviewed-on: https://code.wireshark.org/review/3600
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-15 01:29:13 +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
Guy Harris a11879e218 Get rid of an unused variable.
Change-Id: I8e436b7e4724c85943200087783d3cf7dd7c1535
Reviewed-on: https://code.wireshark.org/review/2639
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-25 02:38:24 +00:00
Michael Mann 29ecd114bf convert to proto_tree_add_subtree[_format]
Change-Id: I5f573dffabb8685a8e5a334ff2bfb24d9838daa6
Reviewed-on: https://code.wireshark.org/review/2601
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-24 23:42:13 +00:00
Lasse Luttermann Poulsen 03cb700571 Added fields used by HP MSM access points.
Change-Id: I367c99bb351993f05161d683eb54f08e5852145f
Reviewed-on: https://code.wireshark.org/review/1347
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-26 02:46:59 +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
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 7b89063243 Don't include <epan/strutil.h> when not needed.
svn path=/trunk/; revision=53194
2013-11-09 14:58:28 +00:00
Jakub Zawadzki 1899903f69 Include <epan/to_str.h> only when needed.
svn path=/trunk/; revision=53189
2013-11-09 13:41:10 +00:00
Evan Huus bcadba5f4b Revert r52730, it is unnecessary with r52695 reverted.
svn path=/trunk/; revision=52764
2013-10-22 15:49:32 +00:00
Evan Huus 23191ea6e6 Don't go into a loop if we find a zero-length line. Fixes
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9312

Anders, this may be related to your recent TVB optimizations, since I don't
think it happened before that? Did you change the behaviour of tvb_find_line_end
or its callees at all?

svn path=/trunk/; revision=52730
2013-10-21 13:07:19 +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
Jörg Mayer 23d3e3d665 Dario Lombardo <lomato@gmail.com> via
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9147

Migration from emem to wmem for trivial cases (ep_alloc only).


svn path=/trunk/; revision=52002
2013-09-13 10:13:19 +00:00
Chris Maynard f2c276ec21 Change the name of the Cisco HDLC dissector table from chdlctype to chdlc.protocol and change the UI name to match. It is by far much more common to name the tables after the field than to pick another name.
svn path=/trunk/; revision=51958
2013-09-11 21:37:58 +00:00
Alexis La Goutte 9b4a914c8f Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=48984
2013-04-22 21:25:23 +00:00
Anders Broman ef249623e6 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48313
2013-03-15 06:26:47 +00:00
Michael Mann 1c0ef12021 Fix typos in display filters caught by checkfiltername.pl
svn path=/trunk/; revision=47645
2013-02-12 21:26:47 +00:00
Michael Mann 97c808c75c replaced decode_boolean_bitfield calls with itemized filters
svn path=/trunk/; revision=45152
2012-09-26 18:10:29 +00:00