Commit Graph

387 Commits

Author SHA1 Message Date
Martin Mathieson 793365d0e0 Fix some issues seen with cppcheck 2022-11-22 20:55:24 +00:00
Martin Mathieson 3ac86775dc Fix some spelling errors 2022-11-02 20:54:24 +00:00
Chuck Craft 8de2b2e860 addr_resolv: add support for static hostname entries
Ping #18075
2022-10-31 14:45:56 +00:00
João Valverde 4d2680cf75 DNS: Fix column info encoding errors
Return name from get_dns_name() is not UTF-8 and cannot be used
directly. Use "name_out" instead.

Fixes #18557.
2022-10-27 09:25:25 +00:00
João Valverde 56ee77d525 DNS: Do not truncate string arbitrarily
Truncating the decoded string to the encoded packet length is
the wrong thing to do.

Fixes #18535.
2022-10-26 00:37:37 +00:00
João Valverde 64bd646b2f DNS: Don't pass raw bytes to expert.h APIs 2022-10-20 12:03:52 +00:00
Jim Young a9bcbaf738 DNS: Note and dissect any extraneous payload bytes 2022-06-24 08:04:40 +00: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
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
Do not require a useless ENC_NA parameter for string encodings.
FT_STRING and FT_STRINGZ types don't have any ndianness.

Follow-up to 6ec429622c.
2022-02-15 11:38:16 +00:00
Gerald Combs 451e3cc4ef DNS: Check our NSEC3 hash length.
Add a next hashed owner field only if we have one. Use a wmem_strbuf.
Fixes #17912.
2022-01-28 14:02:15 -08:00
Michał Kępień d408ad5ba8 DNS: Base32-encode NSEC3 Next Hashed Owner Name
As the owner name of each NSEC3 record is Base32-encoded, the Next
Hashed Owner Name field in those records should also be displayed in
Base32-encoded form.  This enables the user to quickly tell what span of
hashed owner names is covered by a given NSEC3 record.
2022-01-26 07:48:45 +00:00
Martin Mathieson 89b7a1328b tools/check_typed_item_calls.py: improve detection of missing items 2022-01-25 11:43:32 +00:00
João Valverde dec5590b5b Fix errors found by fix-encoding-args.pl 2021-12-19 22:55:37 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
João Valverde 19dcb725b6 epan: Remove STR_ASCII and STR_UNICODE
These display bases work to replace unprintable characters so the
name is a misnomer. In addition they are the same option and this
display behaviour is not something that is configurable.

This does not affect encodings because all our internal text strings
need to be valid UTF-8 and the source encoding is specified using
ENC_*.

Remove the assertion for valid UTF-8 in proto.c because
tvb_get_*_string() must return a valid UTF-8 string, always, and we
don't need to assert that, it is expensive.
2021-12-03 04:35:56 +00:00
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
Nardi Ivan 1f28ac3ef5 DoQ: update to latest draft (-03)
See https://www.ietf.org/archive/id/draft-ietf-dprive-dnsoquic-03.txt
2021-08-25 19:23:20 +00:00
Uli Heilmeier 337bdf8eb3 DNS: Fix pointer for is_multiple_responses
As discussed in wireshark/wireshark!2497 there is no need
for a pointer to a pointer.
2021-03-23 12:32:42 +01:00
Uli Heilmeier 07fb47111e DNS: IXFR/AXFR queries with multiple responses
IXFR and AXFR queries can have multiple DNS responses. As all responses
belong to one transaction, they have the same transaction ID.

We shouldn't handle them as retransmits.

Fix: wireshark/wireshark#17293
2021-03-21 14:02:27 +00:00
Uli Heilmeier 984f3372c8 DNS: Ignore req/resp tracking when in_error_pkt
Don't handle request/response tracking when pinfo->flags.in_error_pkt
is set (DNS packets contained within ICMP/ICMPv6 error packets).

Fix: wireshark/wireshark#15036
2021-02-28 08:38:15 +00:00
Uli Heilmeier 156bc6ca91 DNS: Support for ZONEMD RR (RFC8976)
Adding support for RFC 8976 Message Digest for DNS Zones (ZONEMD RR)
2021-02-11 06:21:38 +00:00
Dario Lombardo 53651da5f7 dns: fix compiler warnings. 2021-01-07 13:50:17 +00:00
Valerii Zapodovnikov 3f825576d7 DNS: typo in word "minimum" 2020-12-29 16:01:58 +00:00
Nardi Ivan 8bd4162d84 QUIC/DNS: add support for DNS-over-QUIC
Reference: https://tools.ietf.org/html/draft-ietf-dprive-dnsoquic-01
2020-11-30 20:26:17 +00:00
Alexis La Goutte 32f89a492b dns: fix item length
reported by check_typed_proto_items.py
packet-dns.c:1688 proto_tree_add_item called for hf_dns_rr_len  -  item type is FT_UINT32 but call has len  2
packet-dns.c:1719 proto_tree_add_item called for hf_dns_rr_len  -  item type is FT_UINT32 but call has len  2
packet-dns.c:2493 proto_tree_add_item called for hf_dns_px_preference  -  item type is FT_UINT8 but call has len  2
2020-11-15 10:02:44 +00:00
Martin Mathieson d90f8da3d8 Fix some more item lengths. 2020-11-06 20:36:15 +00:00
Andre Luyer 6e35d38c2d DNS: change response time in statistics view to msec
Normal DNS response times are in the milli-seconds range, but are currently
listed as seconds.
It is more readable when msec unit is used instead.
Also the average display is hard coded (%.2f) so under normal conditions it
is currently shown as "0.00".
With this change the average value displayed is more useful and high response
times (retransmissions) stand out more clearly.
2020-10-25 13:22:24 +00:00
Uli Heilmeier ce47866a43 DNS: RFC8914 Extended DNS Errors
Add support for RFC8914 Extended DNS Errors
2020-10-24 21:56:32 +00:00
Peter Wu cad1785868 dns: detect DNS over UDP on non-standard ports using heuristics
While running a test suite of a DNS server, a lot of DNS messages on
non-standard ports were not recognized. Rather than manually discovering
and decoding every port using an iterative process of checking the
output of the `udp and not dns` filter, have some heuristics to detect
DNS messages automatically.

Enable these heuristics by default assuming that the checks are strong
enough, 8 bytes are essentially fixed to a low number of possibilities.
Should it cause issued, then the heuristics could be disabled (assuming
that non-standard DNS ports are uncommon) or strengthened.
2020-10-24 11:21:44 +00:00
Peter Wu 83f8767db9 dns: Improve SvcParam dissection, fix echconfig/odohconfig support
* Use parameter names from draft-ietf-dnsop-svcb-https-01 to match the
  presentation format. Use keyNNNNN for unknown names in the tree.
* Remove the SvcParams tree and directly display parameters under the
  resource record tree. Include the parameter value as well.
* Add odohconfig (draft-pauly-dprive-oblivious-doh-02) support.
* Use the presentation format (base64) for echconfig/odohconfig values.
2020-10-22 18:42:57 +00:00
Uli Heilmeier 2a1431abdc DNS: Add support for SVCB and HTTPS RR
Adding support for SVCB and HTTPS resource records as defined in
draft-ietf-dnsop-svcb-https-01

Bug: 16715
Change-Id: I631246e32f6cb2c89fc953cef761585adfbb056b
Reviewed-on: https://code.wireshark.org/review/37896
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-20 04:44:16 +00:00
Uli Heilmeier 9cd7629daf DNS: Add support for RFC8490 DNS Stateful Operations
Adding support for DNS Stateful Operations as defined in RFC8490

Change-Id: I8dc95b53bddef0c6a6cd5e5233d1097e930c473f
Reviewed-on: https://code.wireshark.org/review/37850
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-14 12:12:00 +00:00
Anders Broman cc039149a8 DNS: Try to fix Wpointer-sign warnings.
Change-Id: I8d585d66da894b359d47d16d9850ce709dedbcb7
Reviewed-on: https://code.wireshark.org/review/37853
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-14 11:02:04 +00:00
Anders Broman cd566f4a6a DNS: Try to squelch [-Wpointer-sign] warnings.
Change-Id: I0b857e4eb6686707d03520bf14b641f30d683db6
Reviewed-on: https://code.wireshark.org/review/37665
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-02 09:03:43 +00: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
Martin Mathieson d70a4a9321 Standardise IETF RFC and Draft URLs in dissectors.
Prefer:
- html (rather than txt)
- https

Also includes the script check_dissector_urls.py,
that can be used to find links in code and test them.

Change-Id: Iafd8bb8948674a38ad5232bf5b5432ffb2b1251b
Reviewed-on: https://code.wireshark.org/review/36821
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-04-13 14:58:48 +00:00
Peter Wu 1403c09105 DNS: Add DoT ALPN (RFC 7858)
This codepoint was not registered in RFC 7858, but requested later by
Jon Reed at 2019-12-12, in "[dns-privacy] ALPN protocol ID for DoT":

    Tne primary use case we have is supporting both DoT and DoH on port
    443, when port 853 is blocked between clients and the servers (this
    is by mutual agreement, as discussed in RFC 7858 § 3.1).

Change-Id: Ic993023eedf6f40565a208033703aa1575710c17
Reviewed-on: https://code.wireshark.org/review/36151
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-23 06:10:18 +00:00
Jeremiejig 18a7e64c85 get_dns_name: fixup some missing change introduced with c397adda8a
Following commit c397adda8a there was some missing change

* Some `cur_offset += name_len` instead of `cur_offset += used_bytes`
* Some missing format_text

I took a look at the code after observing a bug with RRSIG record.
The signature in RRSIG was dissecting with some strange offset.

You can easily generate some pcap with those commands

delv @1.1.1.1 A www.cloudflare.com
and/or
dig @1.1.1.1 +dnssec www.cloudflare.com

Change-Id: Ibd6a6248b7497b8409d7797dc320035c8c2d1ed8
Reviewed-on: https://code.wireshark.org/review/36080
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>
2020-02-15 21:19:09 +00:00
Guy Harris c6c3ee1d62 TTLs are unsigned; format them with unsigned_time_secs_to_str().
Change-Id: I489c981e02b2ed0331981003777a5de54ba8221f
Reviewed-on: https://code.wireshark.org/review/35367
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-08 22:53:13 +00:00
Stig Bjørlykke 803d47fd50 dns: Unify display of TTL with time_secs_to_str()
Use same format for "Time to live" as for other ttl values by
appending the time_secs_to_str() output to the number of seconds.

Ping-Bug: 16263
Change-Id: Ie55bbf27bf9c44554d391b395d23c478ad401d98
Reviewed-on: https://code.wireshark.org/review/35358
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-12-08 20:24:21 +00:00
Stig Bjørlykke 0820306494 dns: Bring back TTL formatted with time_secs_to_str()
Display time to live as formatted by unsigned_time_secs_to_str().

This was removed in g42c52d8612 but the commit message for that change
was "Add more filterable fields around EDNS(0)", with no indication
of this change.

Bug: 16263
Change-Id: Ic21f4a4b18d15efbd770c708e37d6e0c15eee6ce
Reviewed-on: https://code.wireshark.org/review/35355
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-08 18:58:52 +00:00
Guy Harris 8275036fda Make the TTL field unsigned, but keep warning if the high-order bit is set.
See RFC 2181, section 8 (and RFC 1035 erratum 2130, which notes that
section 3.2.1 says the TTL is signed but section 4.1.3 says it's
unsigned); RFC 2181 section 8 says "unsigned, but avoid sending values
that have the uppermost bit set, and treat values with the uppermost bit
set as a value of 0".  (STD 13 = RFC 1034, the "concepts and facilities"
DNS RFC, plus RFC 1035, the "implementation and specification" DNS RFC.)

Change-Id: I9be6ac4f190f62dafbc45d1923a95f8f21306a7d
Reviewed-on: https://code.wireshark.org/review/35343
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-07 23:22:04 +00:00
Pascal Quantin 32102247ce DNS: fix bytes highlight for name length and labels count
Those generated fields are linked to the dns.qry.name field, so highlight
the same bytes.

Bug: 15999
Change-Id: Ia989b79a9ec14140472b79fdf7acea6e67baee68
Reviewed-on: https://code.wireshark.org/review/34299
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-08-16 12:00:13 +00:00
Anders Broman 81d2de9252 Try to fix Wpointer-sign warnings.
Change-Id: I52d24560d4061c996c25b290ee347cc55404c216
Reviewed-on: https://code.wireshark.org/review/33914
Tested-by: Petri Dish Buildbot
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-08-14 20:10:45 +00:00
Jaap Keuter 48ac902807 DNS: Add few DNS type full names
Items as SSIG, NSEC and DNSKEY had no descriptive. Add these.

Bug: 15970
Change-Id: I95916e628505c227338346c7aca8ae2dd5050f95
Reviewed-on: https://code.wireshark.org/review/34256
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-08-12 23:52:16 +00:00
Anders Broman 121a6fa6ae Fix Wpointer-sign warnings.
Change-Id: Ia7893c4c78b1f5fc124a0bb56ae47ed6ab514f6b
Reviewed-on: https://code.wireshark.org/review/33897
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-11 13:30:09 +00:00
Guy Harris 0ac699d621 Strings in mDNS TXT records are UTF-8.
Change-Id: Iedde17155aae71e9bc7ad3cc5185ea33e34e209c
Reviewed-on: https://code.wireshark.org/review/33391
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-28 00:47:31 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
Convert our various PROTO_ITEM_ macros to inline functions and document
them.

Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c
Reviewed-on: https://code.wireshark.org/review/32706
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04 04:03:38 +00:00