Commit Graph

73 Commits

Author SHA1 Message Date
Gerald Combs b662f565f0 STP: Remove an unused variable.
Fix

```
epan/dissectors/packet-bpdu.c:327:36: error: variable 'msti' set but not used [-Werror,-Wunused-but-set-variable]
  int   total_msti_length, offset, msti, msti_format;
                                   ^
```
2022-11-08 08:54:16 -08:00
Evan Huus e578c6caee to_str: pull scope arg up into tvb_ether_to_str
There are a bunch of near-identical macros here, but I'm gonna change
one at a time or else the builder times out at the number of files
changed in one merge.
2021-10-04 17:10:17 +00:00
Guy Harris 3fa8f42c76 bpdu: fix some string types.
As per IEEE Std 802.1Q-2016, section 13.8 "MST Configuration Identifier
(MCID)",

	The Configuration Name, a variable length text string encoded
	within a fixed field of 32 octets, conforming to IETF RFC 2271's
	definition of SnmpAdminString.  If the Configuration Name is
	less than 32 characters, the text string should be terminated by
	the NUL character, with the remainder of the 32-octet field
	filled with NUL characters.  Otherwise, the text string is
	encoded with no terminating NUL character.

so it's not FT_STRINGZ, it's FT_STRINGZPAD.

This applies to other configuration names as well.
2020-09-10 16:20:09 -07:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

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

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

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
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 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
Michael Mann f4b0abc729 Dissectors don't need a journey of self discovery.
They already know who they are when they register themselves.  Saving the
handle then to avoid finding it later.
Not sure if this will increase unnecessary register_dissector functions
(instead of using create_dissector_handle in proto_reg_handoff function)
when other dissectors copy/paste, but it should make startup time
a few microseconds better.

Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43
Reviewed-on: https://code.wireshark.org/review/19481
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-12-31 07:31:42 +00:00
Alexis La Goutte 3509b072a6 LLC/STP (Cisco): Add Cisco Root Link Query PDU (STP)
Cisco RLQ BPDUs, request (PID 0x0108) and response (PID 0x0109) used to support Cisco's extension (Backbone Fast [1]) to original 802.1D spanning-tree protocol. The format of the BPDUs is same as original STP configuration BPDUs
[1] http://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/12014-18.html
[2] http://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/12014-18.html#anc9

Issue reported by Garri

Bug:12772
Change-Id: I0ffd169bf252ae11817c7a44ca3a67dfd4e221eb
Reviewed-on: https://code.wireshark.org/review/17204
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-21 16:26:06 +00:00
Michael Mann 525fd71b36 proto_tree_add_boolean -> proto_tree_add_bitmask_list_value
Change-Id: Ic644042d238b5f2abcd874bca92c6dea55804ba9
Reviewed-on: https://code.wireshark.org/review/15913
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-15 15:18:37 +00:00
Michael Mann 9bcac48403 Manually add protocol dependencies derived from find_dissector.
Started by grepping call_dissector_with_data, call_dissector_only and call_dissector and traced the handles passed into them to a find_dissector within the dissector.  Then replaced find_dissector with find_dissector_add_dependency and added the protocol id from the dissector.
"data" dissector was not considered to be a dependency.

Change-Id: I15d0d77301306587ef8e7af5876e74231816890d
Reviewed-on: https://code.wireshark.org/review/14509
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-20 12:48:48 +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
Michael Mann 10261d1202 Remove manual setting of pinfo->current_proto.
Calling a protocol dissection function will properly set/restore pinfo->current_proto, so there's no need to duplicate it.

Change-Id: Ic2ec0b35fa4d46a98f3410bf238056425076e4a9
Reviewed-on: https://code.wireshark.org/review/12205
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-27 05:00:37 +00:00
Michael Mann 01f7356f85 register_dissector -> new_register_dissector
Picking off "easy" dissectors that only have one or two exit points at most.

Change-Id: I3d5e576b796556ef070bb36d8b55da0b175dcba8
Reviewed-on: https://code.wireshark.org/review/11805
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-13 17:44:24 +00:00
Alexis La Goutte 2eec7fec86 BPDU: Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I91cc96f92ae2e6b07144120d70f8db5b7ad45fce
Reviewed-on: https://code.wireshark.org/review/10070
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-17 15:05:02 +00:00
Michael Mann beb5c0b765 Eliminate proto_tree_add_text from some dissectors.
Change-Id: I1e6bf52fad1b1fffefc174a557ff836f400e8fd7
Reviewed-on: https://code.wireshark.org/review/9996
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: Anders Broman <a.broman58@gmail.com>
2015-08-13 04:19:48 +00:00
Michael Mann aeb9827e4a Convert proto_tree_add_boolean to proto_tree_add_bitmask_[value|value_with_flags|list]
Part 1 of a few

Change-Id: I413f23dfa92da5488ca8a7f62ca0738b25004635
Reviewed-on: https://code.wireshark.org/review/8117
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-18 16:32:27 +00:00
Bill Meier eefd529835 bpdu: Fix minor bug introduced in g188aa9a
Change-Id: Ibce8848dded5896223af117a85bc0b6e321160e8
Reviewed-on: https://code.wireshark.org/review/6689
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-20 20:52:09 +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 ebfe8f6d28 Add editor modelines; Reformat as appropriate.
Change-Id: I8e9c58b75eea85877d22024201e5d8d0e9a3dbfd
Reviewed-on: https://code.wireshark.org/review/4459
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-04 15:34:02 +00:00
Michael Mann 188aa9a80e convert to proto_tree_add_subtree[_format]
Change-Id: Ib60ca75b7da8cfa21cfe2999c9b9448a02c332df
Reviewed-on: https://code.wireshark.org/review/2560
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 21:07:16 +00:00
Michael Mann b40cb1adea Apply found fix-encoding-args.pl errors in the dissector directory.
I coincidentally found a few files with errors, so I thought it might be time to run it on the whole directory again.

Change-Id: Ia32e54b3b1b94e5a418ed758ea79807c8bc7e798
Reviewed-on: https://code.wireshark.org/review/978
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-06 15:11:36 +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
Bill Meier a3a15ff90b Remove instances of unused 'data_handle' (and of one other handle).
svn path=/trunk/; revision=52767
2013-10-22 16:13:32 +00:00
Evan Huus 67da8b61fd From Peter Paluch via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9160
Extend the BPDU dissector in packet-bpdu.c so that it recognizes and displays
the PVID TLV in Cisco's PVST+/RPVST+ BPDUs.

svn path=/trunk/; revision=52294
2013-09-30 11:57:14 +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
Pascal Quantin dffff25801 From Andreas Urke via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9088 :
STP: fix dissection of MSTI Root Identifiers for all MSTIs

svn path=/trunk/; revision=51610
2013-08-31 09:42:11 +00:00
Alexis La Goutte d34f4c3b53 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=50347
2013-07-03 16:42:53 +00:00
Jaap Keuter 97136126bc Typo's. That is all.
svn path=/trunk/; revision=48685
2013-04-01 15:29:49 +00:00
Anders Broman 54eb4a6cec [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48319
2013-03-15 16:39:30 +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
Guy Harris 84afa22969 It's not going to pass the
if (protocol_version_identifier >= 4 && version_1_length == 0
          && tvb_reported_length(tvb) >= 106) {

test if it doesn't pass the

    if (protocol_version_identifier >= 3 && version_1_length == 0 &&
        tvb_reported_length(tvb) >= 102) {

test.

svn path=/trunk/; revision=46258
2012-11-28 21:24:32 +00:00
Guy Harris 33b1d3abd9 Redo the MSTI stuff a bit, making a copy of total_msti_length at the
time we start processing the MSTI messages and decrementing the copy;
it's a bit clearer, and may make it easier to avoid the "uninitialized
variable" problem.

svn path=/trunk/; revision=46257
2012-11-28 21:08:28 +00:00
Guy Harris fe9fe6b6e9 Squelch a "may be uninitialized" warning.
svn path=/trunk/; revision=46255
2012-11-28 20:31:13 +00:00
Guy Harris bab056d43c Clean up indentation.
svn path=/trunk/; revision=46254
2012-11-28 20:29:24 +00:00
Anders Broman 70b35e6583 Remove an unused variable
svn path=/trunk/; revision=46252
2012-11-28 19:59:32 +00:00
Anders Broman ff85ba42ac From gyanesh:
BPDU dissector enhancement to recognize Shortest Path Bridging(SPB) BPDUs version 4 .

- Got rid of a couple of tvb_get_ptr().
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7970

svn path=/trunk/; revision=46248
2012-11-28 15:59:53 +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
Alexis La Goutte 90ca174c9e From Vasu D. Dasari via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7550
Decode Provider Bridge GVRP Address

Packets with destination MAC address to be that of, provider bridge GVRP address
 or 01:80:c2:00:00:0d, the packets are decoded as STP packets 
with "Unknown BPDU type".

svn path=/trunk/; revision=44184
2012-08-01 12:22:34 +00:00
Anders Broman db3f6fe80c From Peter Paluch:
recognize VLAN-bridge STP 

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

svn path=/trunk/; revision=43762
2012-07-17 12:55:37 +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
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +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
Anders Broman 4b952c1324 Get rid of check_col, while at it set ENC.
svn path=/trunk/; revision=39146
2011-09-26 08:25:18 +00:00
Bill Meier ad1efb6b9c (Trivial) Remove trailing whitespace from lines for a few files.
svn path=/trunk/; revision=39084
2011-09-21 23:42:55 +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 10ffd14b8f Indentation & whitespace cleanup (including: "4 space tabs" ==> spaces)
svn path=/trunk/; revision=32735
2010-05-10 15:54:57 +00:00
Bill Meier 055dd62063 #include <string.h> not needed.
svn path=/trunk/; revision=32410
2010-04-06 21:14:01 +00:00
Bill Meier 09764dd969 Remove unneeded #include <stdio.h>
svn path=/trunk/; revision=32367
2010-04-03 21:55:23 +00:00