Commit Graph

37 Commits

Author SHA1 Message Date
Guy Harris 8195bdd340 Rename a bunch of things with "conversation".
A conversation in Wireshark might have two endpoints or might have no
endpoints; few if any have one endpoint.  Distinguish between
conversations and endpoints.
2022-08-25 20:02:20 -07:00
Roland Knall 2cf938cfa8 tap: Adding flags for tap_packet
This allows flags to be passed by the registering listener
to the collection of information
2022-06-10 05:46:15 +00:00
Joakim Karlsson f401cdeaae asn1: fix missing dissector generation 2022-03-29 12:05:27 +00:00
Evan Huus 6caf24e966 tvblist: explicitly scope memory
Allocate the root node in the same pool as the list itself, and make
that pool explicit so we can pass the pinfo scope instead of using the
global packet pool.
2021-09-08 01:37:07 +00:00
Evan Huus e8f967f162 asn1: convert more dissectors to pinfo->pool
Just h248 left of the asn1 templates, and it's gonna be tricky.
2021-08-24 12:16:15 +00:00
Evan Huus d09fb571fe asn1: convert most dissectors to pinfo->pool
Part 2/2 as the commits were too big for CI.

Largely find/replace, with a few manual tweaks. Then regenerate the asn1
dissector sources and make sure everything still builds. There are a
handful of cases I skipped as too complex, but this covers most of the
asn1 dissectors.
2021-07-26 14:00:09 -04:00
Guy Harris 57a1514ac7 Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've
already decided that we're perfectly willing to live with string
truncation.  Hopefully this keeps Coverity from whining that those
routines could return an error code (NARRATOR: They don't) and thus that
we're ignoring the possibility of failure (as indicated, we've already
decided that we can live with string truncation, so truncation is *NOT*
a failure).
2021-04-30 03:19:19 -07:00
Dario Lombardo ea929d6401 wsutils: add local implementation of g_memdup2.
g_memdup() was deprecated and replaced with g_memdup2() in GLib 2.68,
we provide our own copy of g_memdup2() for older GLib versions.
2021-03-25 09:38:10 +00:00
Martin Mathieson eef4ba7ed7 More spelling fixes. 2020-12-20 16:31:18 +00:00
Anders Broman 6dada3acf2 SNMP: Use BASE_SHOW_ASCII_PRINTABLE for octet strings
Closes #16900
2020-10-10 13:28:06 +00:00
Lajos Olah 04e400d7f7 Fix problems regarding SRT calculation in SNMP dissector
Change-Id: I904bfda538e157518e0eabf3705bf0f8816daa29
Reviewed-on: https://code.wireshark.org/review/35019
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-11-07 18:38:43 +00:00
Lajos Olah 14d398fe67 Implement service response time calculation for SNMP
Change-Id: I731b1971d404f44bf20b13496e0958057c2c94cc
Reviewed-on: https://code.wireshark.org/review/34992
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-07 13:49:15 +00:00
Jaap Keuter 54fac1e309 SNMP: handle Net-SNMP Engine Id of 12 octets
The Net-SNMP code creates an Engine Id size based on the compilation
size, either 8 or 12 octets long. The initial change added handling of
the '4B/8B random, 4B epoch seconds' format. A different format seems
more likely though, hence this change, implementing handling of the
'4B random, 4B/8B epoch seconds' format instead.

Bug: 16051
Change-Id: I8105b0ba69004f6c15e6b1926c677cb4c5b76f17
Reviewed-on: https://code.wireshark.org/review/34816
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2019-10-22 16:37:48 +00:00
Jaap Keuter 608dbda8ee SNMP: handle Net-SNMP Engine Id of 12 octets
The Net-SNMP code creates an Engine Id size based on the compilation
size, either 8 or 12 octets long. Current implementation handles 32 bit
compilation of Net-SNMP (resulting in 8 octets), this change adds
handling of 64 bit compilation of Net-SNMP (resulting in 12 octets).

Bug: 16051
Change-Id: I256f9a7ad2fd219492e4ebc413ef24cd2c210e0b
Reviewed-on: https://code.wireshark.org/review/34520
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-09-14 11:32:01 +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 f7c8f0c8a5 snmp: add missing initializers in deep copies.
Change-Id: I0a9ef25fc79c47b329a3aed6e0de456ab905c971
Reviewed-on: https://code.wireshark.org/review/25901
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-20 11:24:37 +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
Jakub Zawadzki f31e9b3154 Use gcry_strerror() to get crypt error description.
It seems using gcry_strerror() should be correct,
it also fix building when --without-gnutls (when -lgpg-error is not added):
  /usr/bin/ld: epan/.libs/libwireshark.a(packet-ipsec.o): undefined reference to symbol 'gpg_strerror@@GPG_ERROR_1.0'

Change-Id: I142e2e553fd7da501bd57635b8826ff42e114085
Reviewed-on: https://code.wireshark.org/review/25064
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-29 14:14:59 +00:00
Michael Mann abfb644117 Add conversation endpoint type
For the moment this mirrors the port_type enumeration (PT_XXX), but the
intent is to move away from using "port types", eliminating most (if not
all)

Added conversation_pt_to_endpoint_type() so that conversations deal with the
correct enumeration.  This is for dissector that use pinfo->ptype as input
to conversation APIs.  Explicit use of port types are converted to using
ENDPOINT_XXX type.

Change-Id: Ia0bf553a3943b702c921f185407e03ce93ebf0ef
Reviewed-on: https://code.wireshark.org/review/24166
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29 16:53:57 +00:00
Olivier Verriest 97dcf87a86 SNMP: add support for USM SHA-2 algorithms (RFC 7860)
Generlize the USM handling and add support for HMAC-SHA-2 authentication
protocols.

Change-Id: I7cca2f24db61620423fded078c680322aff86400
Reviewed-on: https://code.wireshark.org/review/22846
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-04 05:57:20 +00:00
João Valverde 7466880e8a Parse enterprise-numbers at run time
"enterprise-numbers" is converted to tab-separated values and renamed
"enterprises". Unused fields are stripped.

PENs are stored in a hash table loaded at run-time.

User "enterprises" file is loaded from the personal config dir.

Misc make-sminmpec.pl improvements and fixes.
Note: names of type "Entity (formerly ...)" have the formerly part commented out for a cleaner output.

Change-Id: I60c533afbe3e399077fbf432088064471ad3e1e2
Reviewed-on: https://code.wireshark.org/review/22246
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
2017-06-26 22:40:50 +00:00
Erik de Jong f1c75cf6ef Rewrite dissectors to use Libgcrypt functions.
As discussed on the mailinglist, rewriting dissectors to use Libgcrypt
functions as Libgcrypt will be mandatory after change 20030.
Removal of following functions:
- crypt_md4
- crypt_rc4*
- aes_cmac_encrypt_*
- md5_*
- sha1_*
- sha256_*

Further candidates:
- aes_*
- rijndael_*
- ...

Added functions:
- ws_hmac_buffer

Added const macros:
- HASH_MD5_LENGTH
- HASH_SHA1_LENGTH

Changes on epan/crypt/* verified with captures from
https://wiki.wireshark.org/HowToDecrypt802.11
Changes on packet-snmp.c and packet-radius.c verified with captures from
https://wiki.wireshark.org/SampleCapture
Changes on packet-tacacs.c verified with capture from
http://ccie-in-3-months.blogspot.nl/2009/04/decoding-login-credentials-regardless.html

Change-Id: Iea6ba2bf207cf0f1bf2117068fb1abcfeaafaa46
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20095
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-02 23:58:05 +00:00
Pascal Quantin 52ce1b03e0 SNMP: fix insertion of first entry in SNMP Users UAT
when using the GUI to add the first entry, num_ueas is still 0.

Change-Id: Iea03495a2e5e39b71391a01454aec5fb6e2b05eb
Reviewed-on: https://code.wireshark.org/review/20191
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-02-20 13:30:18 +00:00
Pascal Quantin 1089211c0b SNMP: duplicate dynamic members of snmp_ue_assoc_t structure in localize_ue()
Otherwise you can end up freeing twice the same memory blocks
(from localized_ues and unlocalized_ues lists)

Bug: 13420
Change-Id: I7e6f1f8d740b0e5ffca851f3f5b1928a7686c069
Reviewed-on: https://code.wireshark.org/review/20190
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-02-20 13:19:47 +00:00
Peter Wu 6b84ddee83 Make Libgcrypt a mandatory dependency
Removed all guards for HAVE_LIBGCRYPT, change autotools and CMake to
error out if it is not available. Update release notes, developer
documentation and README with the new status. Clarify relation with
GnuTLS in macosx-setup.sh. Install Libgcrypt via brew script.

Motivation for this change is that many dissectors depend on Libgcrypt
and having it optional increases the maintenance burden (there have been
several compile issues in the past due to the optional status).
Furthermore, wsutil has crypto code that can be replaced by Libgcrypt.

Change-Id: Idf0021b8c4cd5db70b8766f7dcc2a8b3acbf042f
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20030
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-13 18:35:47 +00:00
Michael Mann d802b5b0ec Add format_text_wmem.
This allows for a wmem_allocator for users of format_text who want
it (dissectors for wmem_packet_scope()).  This lessens the role of
current format_text functionality in hopes that it will eventually
be replaced.

Change-Id: I970557a65e32aa79634a3fcc654ab641b871178e
Reviewed-on: https://code.wireshark.org/review/19855
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31 02:26:35 +00:00
Dario Lombardo 805ddd1add uat: add a reset callback.
This function will free the resources allocated by the caller.

Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4
Reviewed-on: https://code.wireshark.org/review/19375
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-12 12:39:15 +00:00
Gerald Combs cbf89c8ed8 Check preference titles and descriptions.
When registering preferences, make sure our titles and descriptions are
valid UTF-8. Make sure our titles are short and only contain printable
characters.

Fix problematic titles and descriptions.

Change-Id: I20d3f93438f2b3c30266f934297feb79897f2ee5
Reviewed-on: https://code.wireshark.org/review/18998
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-01 01:26:39 +00:00
Jaap Keuter db690aa444 Append Integer32 value to varbind also.
Integer32 is handled slightly different from other values, but
that doesn't mean its pi_value shouldn't be saved to add to the
varbind later on.

Bug: 13013
Change-Id: I6789a75ffd3bb95b7dd68f9cb356dbd85fc669d4
Reviewed-on: https://code.wireshark.org/review/18189
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2016-10-14 13:28:05 +00:00
Michael Mann 2eb7b05b8c Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".

More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.

Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
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-10-13 02:51:18 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Guy Harris a4c8ebc18b Don't do any Decode As stuff for dissector tables not used with Decode As.
Have all dissector tables have a "supports Decode As" flag, which
defaults to FALSE, and which is set to TRUE if a register_decode_as()
refers to it.

When adding a dissector to a dissector table with a given key, only add
it for Decode As if the dissector table supports it.

For non-FT_STRING dissector tables, always check for multiple entries
for the same protocol with different dissectors, and report an error if
we found them.

This means there's no need for the creator of a dissector table to
specify whether duplicates of that sort should be allowed - we always do
the check when registering something for "Decode As" (in a non-FT_STRING
dissector table), and just don't bother registering anything for "Decode
As" if the dissector table doesn't support "Decode As", so there's no
check done for those dissector tables.

Change-Id: I4a1fdea3bddc2af27a65cfbca23edc99b26c0eed
Reviewed-on: https://code.wireshark.org/review/17402
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31 00:08:01 +00:00
Pascal Quantin 53de2c2378 Convert more glib memory to wmem pinfo pool
Change-Id: I4cc23bc19a6bd8c6a8e0389eaf939dbb60fe0ca3
Reviewed-on: https://code.wireshark.org/review/16562
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-22 06:21:54 +00:00
Michael Mann a062c80236 ASN.1 dissectors - don't try to find yourself.
If an ASN.1 dissector is calling register_dissector for itself in its proto_register_xxx
function and then calling find_dissector for itself in its proto_reg_handoff_xxx
function then just create a static handle for that dissector and use the return
value of register_dissector, so the find isn't necessary.

Change-Id: I911bdadc2fb4259601c141b955e741a2369cc447
Reviewed-on: https://code.wireshark.org/review/16233
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>
2016-07-01 14:26:20 +00:00
Martin Kaiser 5b1d42c46a snmp: return -1 (not 0) if we need more data from TCP
Change-Id: I72bb68bb09a5b3d4501676594b76deff63faa0bf
Reviewed-on: https://code.wireshark.org/review/15211
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-05-04 19:47:41 +00:00
Michael Mann e37275bfde Associate dissector tables and heuristic subdissector lists with a protocol.
This will make it easier to determine protocol dependencies.

Some LLC OUI dissector tables didn't have an associated protocol, so they were left without one (-1 used)

Change-Id: I6339f16476510ef3f393d6fb5d8946419bfb4b7d
Reviewed-on: https://code.wireshark.org/review/14446
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-17 00:05:17 +00:00
João Valverde 54a520d4a1 Move /asn1 to /epan/dissectors
Change-Id: I1208fe3c2ba428995526f561e8f792b8d871e9a9
Reviewed-on: https://code.wireshark.org/review/14388
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-13 21:30:24 +00:00