Commit Graph

327 Commits

Author SHA1 Message Date
Peter Wu 5a560f3f6a dns: fix off-by-one buffer overflow (write)
"maxname" is the size of the buffer which also includes the "null
label" (represented by the NUL byte). Do not write this past the end.

Bug: 14955
Change-Id: I51e2237741807aded7ffb82c178d7d7ce5123f78
Fixes: v2.9.0rc0-1142-g53e04b621c ("DNS: fix in expand_dns_name")
Reviewed-on: https://code.wireshark.org/review/28657
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Erika Szelleová <szelleerika@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-08 21:23:47 +00:00
Erika Szelleova 53e04b621c DNS: fix in expand_dns_name
The function parsed the DNS name correctly, however, it did not indicate
that a given name is too long (more than MAX_DNAME_LEN bytes).

Bug: 14041
Change-Id: I4078db488a814ca2114c725d1a17e3ef757843c5
Reviewed-on: https://code.wireshark.org/review/28410
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-02 15:49:17 +00:00
Guy Harris 8304f69fd7 Add macros to initialize nstime_t values and use them.
This allows code to initialize them without having to know the details
of the structure; the initializes should, and will, be changed if the
members of the structure are changed.

Change-Id: I93e6ebfcde9ceca17df696fcba4e8410c5afb175
Reviewed-on: https://code.wireshark.org/review/28501
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-28 03:39:54 +00:00
Erika Szelleova 31c1cd95cf DNS: changed maximum length of dns names from 1025 to 255
According to RFC1035 there are limitations on the maximum length of DNS
names. The maximum length in the code was defined as 1025, this commit
changes it to 255. Also a new macro is introduced which holds the
minimum length of a DNS name.

Bug: 14041
Change-Id: Ic63b332b2a357e33728df183c05ab0e222faf13f
Reviewed-on: https://code.wireshark.org/review/28309
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-19 08:40:45 +00:00
Peter Wu 843735e0ef dns: fix null pointer deref for empty name in SRV record
Per RFC 2782, the name should follow the "_Service._Proto.Name" format.
If a malformed packet does not adhere to this and provides a zero-length
name, then wmem_strsplit returns NULL.

Bug: 14681
Change-Id: I7b9935238a9800a1526c8b694fd2c63d3b488d0b
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7416
Reviewed-on: https://code.wireshark.org/review/27499
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-14 08:14:26 +00:00
Peter Wu 9da25bc16f DNS: fix inverted condition for filtering error packets in stats
Change-Id: I9d867992e4f10c056c6070f0eb1aa0c8bb7cf117
Fixes: v2.5.2rc0-72-ga055e3c299 ("dns: skip stats if packet is within icmp.")
Reviewed-on: https://code.wireshark.org/review/27026
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-04-19 11:58:23 +00:00
Guy Harris c7970d9356 Add, and use, "fetch signed value" for lengths < 40 bits.
Add 8-bit, 16-bit, 24-bit, and 32-bit "fetch signed value" routines, and
use them rather than casting the result of the 8/16/24/32-bit "fetch
unsigned value" routines to a signed type (which, BTW, isn't sufficient
for 24-bit values, so this appears to fix a bug
in epan/dissectors/packet-zbee-zcl.c).

Use numbers rather than sizeof()s in various tvb_get_ routines.

Change-Id: I0e48a57fac9f70fe42de815c3fa915f1592548bd
Reviewed-on: https://code.wireshark.org/review/26844
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-10 14:55:45 +00:00
Dario Lombardo cef0decc57 dns: check if name is root before any other check.
Bug: 14574
Change-Id: Ibacb6955c227a21ab813c48aad463a666fe45c40
Reviewed-on: https://code.wireshark.org/review/26695
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Uli Heilmeier <openid@heilmeier.eu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-04 10:04:23 +00:00
Martin Kaiser a4fdbdd9f0 dns: make expand_dns_name() an internal function
The expand_dns_name() function is not used outside of the DNS dissector
(any more?). Remove the function declaration from the public header
file, make the function internal.

Change-Id: Ibba81fa68a0dfd195ca3bbfca3eca20c39cc01f4
Reviewed-on: https://code.wireshark.org/review/26698
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-02 21:43:49 +00:00
Dario Lombardo 5077890e0a dns: fix indentation.
Change-Id: I25894fd4e28002f75e43b7a6fd7bec58889e0590
Reviewed-on: https://code.wireshark.org/review/26538
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-03-22 06:19:11 +00:00
Dario Lombardo a055e3c299 dns: skip stats if packet is within icmp.
Change-Id: I0f1866361ce60713535b1875fc9b75fe049f1790
Reviewed-on: https://code.wireshark.org/review/26537
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-03-22 06:18:43 +00:00
Dario Lombardo 6cff9f0720 dns: add filters for retransmitted and unsolicited packets.
Change-Id: I1af293a9dc53869858dafc5921792aa3fbbfe766
Reviewed-on: https://code.wireshark.org/review/26536
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-03-22 06:18:21 +00:00
Dario Lombardo 9a864b6e64 dns: add service-level stats.
They include:
- request-response time
- unsolicited response count
- retransmissions count

Change-Id: I01398bf1a88a23fb7850715f256b178c66d933a4
Reviewed-on: https://code.wireshark.org/review/26535
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-03-22 06:17:53 +00:00
Guy Harris 03474c1303 Redo the way we choose N/S/E/W.
This should squelch a warning from Visual Studio Code Analyzer.

Change-Id: Ie66e45276458a6f880c9b020ff541b7d2a71433a
Reviewed-on: https://code.wireshark.org/review/26184
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 19:55:21 +00:00
Peter Wu be1c933600 DNS: add partial DOH (DNS Queries over HTTPS) support
Add support for POST requests, and GET and POST responses containing a
DNS (UDP) payload. GET requests are still unsupported.

(DOH is sent over HTTP2/TLS/TCP which means that a special check is
needed in dissect_dns to avoid matching DNS over TCP).

Change-Id: I82bfcda068baf6f06c5a0159d73e6d40d1d9a758
Ping-Bug: 14433
Reviewed-on: https://code.wireshark.org/review/25806
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-26 06:38:33 +00:00
Guy Harris 4fe475492c Use appropriate pointer types rather than guint8 *.
This means we don't lose alignment information that causes spurious
compiler warnings.

Change-Id: I721f180c137bcffbcf7edf88cf8caf52c33fa545
Reviewed-on: https://code.wireshark.org/review/25842
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-17 20:33:54 +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 8d5726dccc Add support to handle DNS retransmissions
Add a preference to the DNS dissector to specify how many seconds can
elapse before a DNS query is considered a retransmission because the
transaction ID is shared with a previous request.

If retransmission is found, add expert info and hf_ field linking to
the original request.
If a retransmission of a response is found, add expert info and hf_ field
linking to the original response.

Bug: 14178
Bug: 13313
Change-Id: Idd77ab7f7638f5056d5690633c787a4d52285aee
Reviewed-on: https://code.wireshark.org/review/24525
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-22 09:07:30 +00:00
Guy Harris 458c3c026e Add a ws_in6_addr typedef for struct e_in6_addr.
That allows a parallel typedef of ws_in4_addr for guint32.

Change-Id: I03b230247065e0e3840eb87635315a8e523ef562
Reviewed-on: https://code.wireshark.org/review/24073
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 08:50:34 +00:00
Pascal Quantin 85d742ef26 DNS: replace g_strsplit by wmem_strsplit
It avoids leaking memory in case an exception is thrown during
dissection

Change-Id: Iab72bcb4cc1ac56e7ce5ff2693e3111aead03e7d
Reviewed-on: https://code.wireshark.org/review/23464
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-10 18:11:12 +00:00
Alexis La Goutte 300be929de dns: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I1bb25125d9bd7b62b5784bd43d933dc5ff13987c
Reviewed-on: https://code.wireshark.org/review/23005
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-07 23:23:56 +00:00
Alexis La Goutte 24f0e6fe8a dns: remove extra semicolon
Change-Id: I710d9c519ccf012d3e74e7c2087d0f9fc5cfca12
Reviewed-on: https://code.wireshark.org/review/23004
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-07 23:23:47 +00:00
Alexis La Goutte f5332121ef XFP: use switch for adress_family
Change-Id: Id0f9fd6d49669f5d4606448788658e5a8ed89f8d
Reviewed-on: https://code.wireshark.org/review/23003
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-07 23:23:26 +00:00
Martin Mathieson 64b5a38bd9 dns: add missing break
Change-Id: Iec47e262beb9600fc6596242c4ce0d56162be74f
Reviewed-on: https://code.wireshark.org/review/22881
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2017-07-30 22:52:06 +00:00
Arjen Zonneveld 5d3d965645 DNS dissector support for draft-bellis-dnsop-xpf
Add support for draft-bellis-dnsop-xpf to the DNS dissector:
- Parse the XPF additional RR (currently using a temp value of 65422)

Bug: 13928
Change-Id: I2d4fa23a8d3828db483bc41fafe6cbd8885514dc
Reviewed-on: https://code.wireshark.org/review/22803
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>
2017-07-30 06:30:45 +00:00
Jaap Keuter c50945989d DNS: Apply LOC record angle cap
The LOC records LATITUDE and LONGITUDE angle values may become too
large. Find these and stop conversion into invalid values.

Bug: 13914
Change-Id: Ia01ac1ecf5080350454f06536c9be1cf758d6f3c
Reviewed-on: https://code.wireshark.org/review/22847
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: Michael Mann <mmann78@netscape.net>
2017-07-30 00:30:01 +00:00
Jaap Keuter f461a3a743 DNS: Fix APL record IPv4 address presentation
When getting the (partial) IPv4 address make sure to pass the full
32 bits of the address when adding the proto tree item.

Bug: 13923
Change-Id: I5b849705e723efd1269a64ee28b8d93724ab769a
Reviewed-on: https://code.wireshark.org/review/22838
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-29 14:17:06 +00:00
Stig Bjørlykke 23c7d5f4e7 dns: Put request/response tracking last in the tree
Change-Id: I56b99941db63ca87cd233112967592c948d2a390
Reviewed-on: https://code.wireshark.org/review/22361
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-22 21:07:21 +00:00
Jeff Morriss b988d8b392 Fix up dissector tables' UI names.
This was inspired by using the Decode-As UI to decode Field "SSL TCP Dissector"
Value (port) XXX as YYY.  "SSL Port" makes more sense as the UI name.

Change-Id: Id6398a5dc79e32bddc4f1bfcf0a468ae1364808f
Reviewed-on: https://code.wireshark.org/review/19573
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-29 16:12:35 +00:00
Peter Wu 129bdb5a16 dns: improve loop detection in label decompression
Previously the number of allowed pointers within a message is equal to
the data in a tvb (16575 in one example). This is still expensive, so
implement an alternative detection mechanism that looks for a direct
self-loop and limits the total pointers to about 256.

Bug: 13633
Change-Id: I803873e24ab170c7ef0b881d3bdc9dfd4014de97
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1206
Reviewed-on: https://code.wireshark.org/review/21507
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-05-11 14:52:44 +00:00
Alexis La Goutte 8344f5a691 dns: fix this statement may fall through [-Werror=implicit-fallthrough] found by gcc7
and add also a missing (optional) break after default

Change-Id: I03d594db4702ccb4ebab3fca6b071d323e7f8d39
Reviewed-on: https://code.wireshark.org/review/20994
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-04-10 11:13:42 +00:00
Guy Harris 2a8bcfe86c White space and style cleanups.
Get rid of extra blank lines.

Clean up indentation.

Use the same style for switch statements inside cases for the main
switch statement in dissect_dns_answer() that's used for the main switch
statement.

Change-Id: I77da88a9ffcbf176d27e16222e75c778202c651b
Reviewed-on: https://code.wireshark.org/review/20907
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-04 18:05:59 +00:00
Pascal Quantin bc48169614 DNS: add an expert info if buffer is too short to compute a key id
Bug: 13548
Change-Id: I4c018ae7a46ebb3e667004293b3f6e180f9d693f
Reviewed-on: https://code.wireshark.org/review/20855
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-04-02 18:00:59 +00:00
Peter Wu 93cf5909ec dns: prevent repeatedly overwriting resolved entries
When a packet contains multiple conflicting names for the same address,
it would result in modification of the resolved name every time this DNS
packet is selected. In Qt, this causes a periodic (one second)
redissection of the current (DNS!) packet which interferes with user
interaction. To avoid this, only add the address on the first visit.

Bug: 13533
Change-Id: Ic71515131da4d666bfd589df9ff90a866a30778c
Reviewed-on: https://code.wireshark.org/review/20800
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-31 05:14:05 +00:00
Guy Harris 8f515b1a99 Fix up time encodings.
Add some new encodings for absolute time stamps, and use them as
appropriate; this fixes some cases where the time stamps in question
were being dissected incorrectly.

For the encodings with seconds and 1/2^32s of a second, don't
arbitrarily give only microsecond resolution; 2^32 is greater than 1
million, and, in fact, at least some NTP RFCs explicitly talk about time
resolution greater than 1 microsecond.

Update references in the RELOAD dissector to reflect the documents in
question having been updated and published as RFCs.

Change-Id: Icbe0b696d65eb622978eb71e99ddf699b84e4fca
Reviewed-on: https://code.wireshark.org/review/20759
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-28 10:18:36 +00:00
Alexis La Goutte c2589891e3 DNS: Add Edwards-Curve Digital Security Algorithm (EdDSA) for DNSSEC (RFC 8080)
Change-Id: I39a8c6639174e73f90bc4c3d8bccf628c3a477c3
Reviewed-on: https://code.wireshark.org/review/20179
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-21 05:47:17 +00:00
Alexis La Goutte 29733ad874 DNS: Don't display DNSSEC Protocol and Algo in flag tree
Change-Id: Ifbee604f25c27076750f41ada9dfef6157ac7819
Reviewed-on: https://code.wireshark.org/review/20180
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-19 21:22:18 +00:00
Michael Mann 51a3014225 format_text_wmem -> format_text
All cases of the "original" format_text have been handled to add the
proper wmem allocator scope.  Remove the "original" format_text
and replace it with one that has a wmem allocator as a parameter.

Change-Id: I278b93bcb4a17ff396413b75cd332f5fc2666719
Reviewed-on: https://code.wireshark.org/review/19884
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31 17:08: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
Alexis La Goutte 308e1de5eb DNS: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: Ib376127546aa15806ed37a7c26fe29b0fa80225c
Reviewed-on: https://code.wireshark.org/review/19722
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-22 20:47:39 +00:00
Pascal Quantin 7722003908 DNS: use formatted text in add_rr_to_tree() and add_opt_rr_to_tree
Since the fix for bug 13289, an empty string can be returned by get_dns_name.
Ensure that:
- a malformed encoding with no characters and a length > 1 triggers an exception
- the formatted version is used to add info in tree.

Bug: 13339
Change-Id: I88125a351904eabb5cededfbfe1d5ef14ea61ecc
Reviewed-on: https://code.wireshark.org/review/19714
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>
2017-01-22 08:13:25 +00:00
Pascal Quantin 132cd6dbac DNS: update name_len variable when replacing name string
Bug: 13334
Change-Id: I07248747f678d4f89bbde33280b4d596462a4429
Reviewed-on: https://code.wireshark.org/review/19688
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-01-20 10:12:25 +00:00
Dario Lombardo c397adda8a dns: change get_dns_name to return consumed bytes + actual name len.
Because of the DNS name encoding, the consumed bytes in the tvb and
the length of the string of the dns name can be different. We need
to handle them separately for the purpose they are. Moreover the
name string can contain null bytes, then we can't rely on strlen()
but we need the actual length.

Subsequent calls to proto_tree_add_string() will require to pass
the string to format_text() in order have non-printable characters
printed.

Bug: 13289
Change-Id: I6d0b295867ece265f8995f82da2c629992aeb703
Reviewed-on: https://code.wireshark.org/review/19539
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-01-19 09:31:37 +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
Martin Kaiser 4562a702b3 dns: remove a bunch of unnecessary NULL checks
Change-Id: Ia4066ae3fc31fb43d4cc63cfb739f22738581831
Reviewed-on: https://code.wireshark.org/review/16256
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-07-03 10:57:34 +00:00
Michael Mann 2ab4155794 tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls.

Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914
Reviewed-on: https://code.wireshark.org/review/16158
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-27 15:20:06 +00:00
Victor Barratault d3bb3a03b8 Typing error line 4928 of packet-dns.c
Change-Id: I1a6409262614a87c159236375223707c85114650
Reviewed-on: https://code.wireshark.org/review/15972
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-06-16 15:12:34 +00:00
Dario Lombardo 38d08e0b6e dns_stats: generate stats just for pure dns (not mDNS, not LLMR).
The stats for mDNS and llmnr are pending. The change just resolves a bug
in the stats that are wrongly generated when the traffic is mDNS or LLMR.

Bug: 12492
Change-Id: Ie772e204d0ddea997dd8cbf609725605c8a507c8
Reviewed-on: https://code.wireshark.org/review/15897
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-06-14 23:06:09 +00:00