2 * Routines for DNS packet disassembly
3 * Copyright 2004, Nicolas DICHTEL - 6WIND - <nicolas.dichtel@6wind.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 * RFC 2136 for dynamic DNS
15 * https://datatracker.ietf.org/doc/draft-cheshire-dnsext-multicastdns/
17 * RFC 4795 for link-local multicast name resolution (LLMNR)
19 * For the TTL field, see also:
21 * RFC 1035 erratum 2130:
23 * https://www.rfc-editor.org/errata/eid2130
25 * RFC 2181, section 8:
27 * https://tools.ietf.org/html/rfc2181#section-8
29 * RFC 1035 said, in section 3.2.1, that the TTL is "a 32 bit signed
30 * integer" but said, in section 4.1.3, that it's "a 32 bit unsigned
31 * integer"; the erratum notes this
33 * RFC 2181 says of this:
35 * The definition of values appropriate to the TTL field in STD 13 is
36 * not as clear as it could be, with respect to how many significant
37 * bits exist, and whether the value is signed or unsigned. It is
38 * hereby specified that a TTL value is an unsigned number, with a
39 * minimum value of 0, and a maximum value of 2147483647. That is, a
40 * maximum of 2^31 - 1. When transmitted, this value shall be encoded
41 * in the less significant 31 bits of the 32 bit TTL field, with the
42 * most significant, or sign, bit set to zero.
44 * Implementations should treat TTL values received with the most
45 * significant bit set as if the entire value received was zero.
47 * Implementations are always free to place an upper bound on any TTL
48 * received, and treat any larger values as if they were that upper
49 * bound. The TTL specifies a maximum time to live, not a mandatory
52 * so its resolution is 1) it's unsigned but 2) don't use the uppermost
53 * bit, presumably to avoid problems with implementations that were based
54 * on section 3.2.1 of RFC 1035 rather than on section 4.1.3 of RFC 1035.
60 #include <epan/packet.h>
61 #include <epan/exceptions.h>
62 #include <epan/ipproto.h>
63 #include <epan/addr_resolv.h>
64 #include "packet-dns.h"
65 #include "packet-tcp.h"
66 #include "packet-ip.h"
67 #include <epan/prefs.h>
68 #include <epan/prefs-int.h>
69 #include <epan/strutil.h>
70 #include <epan/expert.h>
73 #include <epan/stats_tree.h>
75 #include "packet-tls.h"
76 #include "packet-dtls.h"
77 #include "packet-http2.h"
79 // parent knob to turn on-off the entire query-response statistics (at runtime)
80 // qr = Query-Response
81 static bool dns_qr_statistics_enabled
= true;
83 // knob to turn on-off the display of query record name (at runtime)
84 // qrn = Query-Record-Name
85 static bool dns_qr_qrn_statistics_enabled
;
87 // knob to turn on-off the display of query-record-name for answers, authorities
88 // and additionals with zero values (at runtime)
89 // aud = Answers-aUthorities-aDdtionals; zv = Zero-Value
90 static bool dns_qr_qrn_aud_zv_statistics_enabled
;
92 // support for above knobs
93 static pref_t
* perf_qr_enable_statistics
;
94 static pref_t
* perf_qr_qrn_enable_statistics
;
95 static pref_t
* perf_qr_qrn_aud_zv_enable_statistics
;
97 // strings required for statistical nodes
98 static const char* st_str_qr_t_packets
= "Total";
99 static const char* st_str_qr_q_packets
= "Query";
100 static const char* st_str_qr_qf_packets
= "From";
101 static const char* st_str_qr_qo_packets
= "Opcodes";
102 static const char* st_str_qr_qk_packets
= "Kind";
103 static const char* st_str_qr_qt_packets
= "Types";
104 static const char* st_str_qr_ql_packets
= "Labels";
105 static const char* st_str_qr_qp_packets
= "Payload";
106 static const char* st_str_qr_qs_packets
= "Servicing";
107 static const char* st_str_qr_qs_a_packets
= "Answered (ms)";
108 static const char* st_str_qr_qs_u_packets
= "Unanswered";
109 static const char* st_str_qr_qs_r_packets
= "Retransmissions";
110 static const char* st_str_qr_r_packets
= "Response";
111 static const char* st_str_qr_rf_packets
= "From";
112 static const char* st_str_qr_rc_packets
= "Rcodes";
113 static const char* st_str_qr_rk_packets
= "Kind";
114 static const char* st_str_qr_ra_packets
= "Answers";
115 static const char* st_str_qr_ru_packets
= "Authorities";
116 static const char* st_str_qr_rd_packets
= "Additionals";
117 static const char* st_str_qr_rp_packets
= "Payload";
118 static const char* st_str_qr_rt_packets
= "TTL";
119 static const char* st_str_qr_rt_a_packets
= "Answers";
120 static const char* st_str_qr_rt_u_packets
= "Authorities";
121 static const char* st_str_qr_rt_d_packets
= "Additionals";
122 static const char* st_str_qr_rs_packets
= "Servicing";
123 static const char* st_str_qr_rs_a_packets
= "Answered (ms)";
124 static const char* st_str_qr_rs_u_packets
= "Unsolicited";
125 static const char* st_str_qr_rs_r_packets
= "Retransmissions";
127 // nodes required for housing statistics
128 static int st_node_qr_t_packets
= -1; // t = Total
129 static int st_node_qr_q_packets
= -1; // q = Query
130 static int st_node_qr_qf_packets
= -1; // qf = Query-From
131 static int st_node_qr_qo_packets
= -1; // qo = Query-Opcode
132 static int st_node_qr_qk_packets
= -1; // qk = Query-Kind
133 static int st_node_qr_qt_packets
= -1; // qt = Query-Type
134 static int st_node_qr_ql_packets
= -1; // ql = Query-Label
135 static int st_node_qr_qp_packets
= -1; // qp = Query-Payload
136 static int st_node_qr_qs_packets
= -1; // qs = Query-Servicing
137 static int st_node_qr_qs_a_packets
= -1; // a = Answered (ms)
138 static int st_node_qr_qs_u_packets
= -1; // u = Unanswered
139 static int st_node_qr_qs_r_packets
= -1; // r = Retransmission
140 static int st_node_qr_r_packets
= -1; // r = Response
141 static int st_node_qr_rf_packets
= -1; // rf = Response-From
142 static int st_node_qr_rc_packets
= -1; // rc = Response-Code
143 static int st_node_qr_rk_packets
= -1; // rk = Response-Kind
144 static int st_node_qr_ra_packets
= -1; // ra = Response-Answer
145 static int st_node_qr_ru_packets
= -1; // ru = Response-aUthority
146 static int st_node_qr_rd_packets
= -1; // rd = Response-aDditional
147 static int st_node_qr_rp_packets
= -1; // rp = Response-Payload
148 static int st_node_qr_rs_packets
= -1; // rs = Response-Servicing
149 static int st_node_qr_rs_a_packets
= -1; // a = Answered (ms)
150 static int st_node_qr_rs_u_packets
= -1; // u = Unsolicited
151 static int st_node_qr_rs_r_packets
= -1; // r = Retransmission
152 static int st_node_qr_rt_packets
= -1; // rt = Response-TTL
153 static int st_node_qr_rt_a_packets
= -1; // a = Answer
154 static int st_node_qr_rt_u_packets
= -1; // u = aUthority
155 static int st_node_qr_rt_d_packets
= -1; // d = aDditional
157 // individual knobs that turn on-off particular statistics (at runtime)
158 // note: currently not configured as preferences
159 static bool dns_qr_t_statistics_enabled
= true; // t = Total
160 static bool dns_qr_q_statistics_enabled
= true; // q = Query
161 static bool dns_qr_qf_statistics_enabled
= true; // qf = Query-From
162 static bool dns_qr_qo_statistics_enabled
= true; // qo = Query-Opcode
163 static bool dns_qr_qk_statistics_enabled
= true; // qk = Query-Kind
164 static bool dns_qr_qt_statistics_enabled
= true; // qt = Query-Type
165 static bool dns_qr_ql_statistics_enabled
= true; // ql = Query-Label
166 static bool dns_qr_qp_statistics_enabled
= true; // qp = Query-Payload
167 static bool dns_qr_qs_statistics_enabled
= true; // qs = Query-Servicing
168 static bool dns_qr_qs_a_statistics_enabled
= true; // a = Answered (ms)
169 static bool dns_qr_qs_u_statistics_enabled
= true; // u = Unanswered
170 static bool dns_qr_qs_r_statistics_enabled
= true; // r = Retransmission
171 static bool dns_qr_r_statistics_enabled
= true; // r = Response
172 static bool dns_qr_rf_statistics_enabled
= true; // rf = Response-From
173 static bool dns_qr_rc_statistics_enabled
= true; // rc = Response-Code
174 static bool dns_qr_rk_statistics_enabled
= true; // rk = Response-Kind
175 static bool dns_qr_ra_statistics_enabled
= true; // ra = Response-Answer
176 static bool dns_qr_ru_statistics_enabled
= true; // ru = Response-aUthority
177 static bool dns_qr_rd_statistics_enabled
= true; // rd = Response-aDditional
178 static bool dns_qr_rp_statistics_enabled
= true; // rp = Response-Payload
179 static bool dns_qr_rs_statistics_enabled
= true; // rs = Response-Servicing
180 static bool dns_qr_rs_a_statistics_enabled
= true; // a = Answered (ms)
181 static bool dns_qr_rs_u_statistics_enabled
= true; // u = Unsolicited
182 static bool dns_qr_rs_r_statistics_enabled
= true; // r = Retransmission
183 static bool dns_qr_rt_statistics_enabled
= true; // rt = Response-TTL
184 static bool dns_qr_rt_a_statistics_enabled
= true; // a = Answer
185 static bool dns_qr_rt_u_statistics_enabled
= true; // u = aUthority
186 static bool dns_qr_rt_d_statistics_enabled
= true; // d = aDditional
188 // storage to store ttls of each answer-authority-additional record and is
189 // overwritten for each response
190 #define TTL_MAXIMUM_ELEMENTS 4096
191 static unsigned dns_qr_r_ra_ttls
[TTL_MAXIMUM_ELEMENTS
]; // ra = Answer array
192 static unsigned dns_qr_r_ru_ttls
[TTL_MAXIMUM_ELEMENTS
]; // ru = aUthority array
193 static unsigned dns_qr_r_rd_ttls
[TTL_MAXIMUM_ELEMENTS
]; // rd = aDditional array
194 static unsigned dns_qr_r_ra_ttl_index
; // ra = Answer index
195 static unsigned dns_qr_r_ru_ttl_index
; // ru = aUthority index
196 static unsigned dns_qr_r_rd_ttl_index
; // rd = aDditional index
198 // pointers that point and index into context arrays, i.e., points to answer
199 // array when processing an answer, points to authority array when processing an
200 // authority and points to additional array when processing an additional
201 static unsigned* p_dns_qr_r_rx_ttls
;
202 static unsigned* p_dns_qr_r_rx_ttl_index
;
204 // forward declaration (definitions are called at each launch of statistics)
205 static void qname_host_and_domain(char* name
, int name_len
, char* host
, char* domain
);
206 static void dns_qr_stats_tree_init(stats_tree
* st
);
207 static tap_packet_status
dns_qr_stats_tree_packet(stats_tree
* st
, packet_info
* pinfo _U_
, epan_dissect_t
* edt _U_
, const void* p
, tap_flags_t flags _U_
);
208 static void dns_qr_stats_tree_cleanup(stats_tree
* st
);
210 void proto_register_dns(void);
211 void proto_reg_handoff_dns(void);
215 unsigned packet_qtype
;
217 unsigned packet_rcode
;
218 unsigned packet_opcode
;
219 unsigned payload_size
;
221 unsigned qname_labels
;
225 unsigned nauthorities
;
226 unsigned nadditionals
;
230 wmem_list_t
*rr_types
;
232 char qhost
[256]; // host or left-most part of query name
233 char qdomain
[256]; // domain or remaining part of query name
239 static const char* st_str_packets
= "Total Packets";
240 static const char* st_str_packet_qr
= "Query/Response";
241 static const char* st_str_packet_qtypes
= "Query Type";
242 static const char* st_str_packet_qnames
= "Query Name";
243 static const char* st_str_packet_qclasses
= "Class";
244 static const char* st_str_packet_rcodes
= "rcode";
245 static const char* st_str_packet_opcodes
= "opcodes";
246 static const char* st_str_packets_avg_size
= "Payload size";
247 static const char* st_str_query_stats
= "Query Stats";
248 static const char* st_str_query_qname_len
= "Qname Len";
249 static const char* st_str_query_domains
= "Label Stats";
250 static const char* st_str_query_domains_l1
= "1st Level";
251 static const char* st_str_query_domains_l2
= "2nd Level";
252 static const char* st_str_query_domains_l3
= "3rd Level";
253 static const char* st_str_query_domains_lmore
= "4th Level or more";
254 static const char* st_str_response_stats
= "Response Stats";
255 static const char* st_str_rr_types
= "Answer Type";
256 static const char* st_str_response_nquestions
= "no. of questions";
257 static const char* st_str_response_nanswers
= "no. of answers";
258 static const char* st_str_response_nauthorities
= "no. of authorities";
259 static const char* st_str_response_nadditionals
= "no. of additionals";
260 static const char* st_str_service_stats
= "Service Stats";
261 static const char* st_str_service_unsolicited
= "no. of unsolicited responses";
262 static const char* st_str_service_retransmission
= "no. of retransmissions";
263 static const char* st_str_service_rrt
= "request-response time (msec)";
265 static int st_node_packet_qr
= -1;
266 static int st_node_packet_qtypes
= -1;
267 static int st_node_packet_qnames
= -1;
268 static int st_node_packet_qclasses
= -1;
269 static int st_node_packet_rcodes
= -1;
270 static int st_node_packet_opcodes
= -1;
271 static int st_node_packets_avg_size
= -1;
272 static int st_node_query_stats
= -1;
273 static int st_node_query_qname_len
= -1;
274 static int st_node_query_domains
= -1;
275 static int st_node_query_domains_l1
= -1;
276 static int st_node_query_domains_l2
= -1;
277 static int st_node_query_domains_l3
= -1;
278 static int st_node_query_domains_lmore
= -1;
279 static int st_node_response_stats
= -1;
280 static int st_node_rr_types
= -1;
281 static int st_node_response_nquestions
= -1;
282 static int st_node_response_nanswers
= -1;
283 static int st_node_response_nauthorities
= -1;
284 static int st_node_response_nadditionals
= -1;
285 static int st_node_service_stats
= -1;
286 static int st_node_service_unsolicited
= -1;
287 static int st_node_service_retransmission
= -1;
288 static int st_node_service_rrt
= -1;
290 static int proto_dns
;
291 static int proto_mdns
;
292 static int proto_llmnr
;
293 static int hf_dns_length
;
294 static int hf_dns_flags
;
295 static int hf_dns_flags_response
;
296 static int hf_dns_flags_opcode
;
297 static int hf_dns_flags_authoritative
;
298 static int hf_dns_flags_conflict_query
;
299 static int hf_dns_flags_conflict_response
;
300 static int hf_dns_flags_truncated
;
301 static int hf_dns_flags_recdesired
;
302 static int hf_dns_flags_tentative
;
303 static int hf_dns_flags_recavail
;
304 static int hf_dns_flags_z
;
305 static int hf_dns_flags_authenticated
;
306 static int hf_dns_flags_ad
;
307 static int hf_dns_flags_checkdisable
;
308 static int hf_dns_flags_rcode
;
309 static int hf_dns_transaction_id
;
310 static int hf_dns_count_questions
;
311 static int hf_dns_count_zones
;
312 static int hf_dns_count_answers
;
313 static int hf_dns_count_prerequisites
;
314 static int hf_dns_count_updates
;
315 static int hf_dns_count_auth_rr
;
316 static int hf_dns_count_add_rr
;
317 static int hf_dns_qry_name
;
318 static int hf_dns_qry_name_len
;
319 static int hf_dns_count_labels
;
320 static int hf_dns_qry_type
;
321 static int hf_dns_qry_class
;
322 static int hf_dns_qry_class_mdns
;
323 static int hf_dns_qry_qu
;
324 static int hf_dns_srv_instance
;
325 static int hf_dns_srv_service
;
326 static int hf_dns_srv_proto
;
327 static int hf_dns_srv_name
;
328 static int hf_dns_srv_priority
;
329 static int hf_dns_srv_weight
;
330 static int hf_dns_srv_port
;
331 static int hf_dns_srv_target
;
332 static int hf_dns_naptr_order
;
333 static int hf_dns_naptr_preference
;
334 static int hf_dns_naptr_flags_length
;
335 static int hf_dns_naptr_flags
;
336 static int hf_dns_naptr_service_length
;
337 static int hf_dns_naptr_service
;
338 static int hf_dns_naptr_regex_length
;
339 static int hf_dns_naptr_regex
;
340 static int hf_dns_naptr_replacement_length
;
341 static int hf_dns_naptr_replacement
;
342 static int hf_dns_rr_name
;
343 static int hf_dns_rr_type
;
344 static int hf_dns_rr_class
;
345 static int hf_dns_rr_class_mdns
;
346 static int hf_dns_rr_cache_flush
;
347 static int hf_dns_rr_ext_rcode
;
348 static int hf_dns_rr_edns0_version
;
349 static int hf_dns_rr_z
;
350 static int hf_dns_rr_z_do
;
351 static int hf_dns_rr_z_reserved
;
352 static int hf_dns_rr_ttl
;
353 static int hf_dns_rr_len
;
355 static int hf_dns_a_ch_domain
;
356 static int hf_dns_a_ch_addr
;
357 static int hf_dns_md
;
358 static int hf_dns_mf
;
359 static int hf_dns_mb
;
360 static int hf_dns_mg
;
361 static int hf_dns_mr
;
362 static int hf_dns_null
;
363 static int hf_dns_aaaa
;
364 static int hf_dns_cname
;
365 static int hf_dns_rr_udp_payload_size
;
366 static int hf_dns_rr_udp_payload_size_mdns
;
367 static int hf_dns_soa_mname
;
368 static int hf_dns_soa_rname
;
369 static int hf_dns_soa_serial_number
;
370 static int hf_dns_soa_refresh_interval
;
371 static int hf_dns_soa_retry_interval
;
372 static int hf_dns_soa_expire_limit
;
373 static int hf_dns_soa_minimum_ttl
;
374 static int hf_dns_ptr_domain_name
;
375 static int hf_dns_wks_address
;
376 static int hf_dns_wks_protocol
;
377 static int hf_dns_wks_bits
;
378 static int hf_dns_hinfo_cpu_length
;
379 static int hf_dns_hinfo_cpu
;
380 static int hf_dns_hinfo_os_length
;
381 static int hf_dns_hinfo_os
;
382 static int hf_dns_minfo_r_mailbox
;
383 static int hf_dns_minfo_e_mailbox
;
384 static int hf_dns_mx_preference
;
385 static int hf_dns_mx_mail_exchange
;
386 static int hf_dns_txt_length
;
387 static int hf_dns_txt
;
388 static int hf_dns_csync_soa
;
389 static int hf_dns_csync_flags
;
390 static int hf_dns_csync_flags_immediate
;
391 static int hf_dns_csync_flags_soaminimum
;
392 static int hf_dns_csync_type_bitmap
;
393 static int hf_dns_zonemd_serial
;
394 static int hf_dns_zonemd_scheme
;
395 static int hf_dns_zonemd_hash_algo
;
396 static int hf_dns_zonemd_digest
;
397 static int hf_dns_svcb_priority
;
398 static int hf_dns_svcb_target
;
399 static int hf_dns_svcb_param_key
;
400 static int hf_dns_svcb_param_length
;
401 static int hf_dns_svcb_param_value
;
402 static int hf_dns_svcb_param
;
403 static int hf_dns_svcb_param_mandatory_key
;
404 static int hf_dns_svcb_param_alpn_length
;
405 static int hf_dns_svcb_param_alpn
;
406 static int hf_dns_svcb_param_port
;
407 static int hf_dns_svcb_param_ipv4hint_ip
;
408 static int hf_dns_svcb_param_ipv6hint_ip
;
409 static int hf_dns_svcb_param_dohpath
;
410 static int hf_dns_svcb_param_odohconfig
;
411 static int hf_dns_openpgpkey
;
412 static int hf_dns_spf_length
;
413 static int hf_dns_spf
;
414 static int hf_dns_ilnp_nodeid_preference
;
415 static int hf_dns_ilnp_nodeid
;
416 static int hf_dns_ilnp_locator32_preference
;
417 static int hf_dns_ilnp_locator32
;
418 static int hf_dns_ilnp_locator64_preference
;
419 static int hf_dns_ilnp_locator64
;
420 static int hf_dns_ilnp_locatorfqdn_preference
;
421 static int hf_dns_ilnp_locatorfqdn
;
422 static int hf_dns_eui48
;
423 static int hf_dns_eui64
;
424 static int hf_dns_rrsig_type_covered
;
425 static int hf_dns_rrsig_algorithm
;
426 static int hf_dns_rrsig_labels
;
427 static int hf_dns_rrsig_original_ttl
;
428 static int hf_dns_rrsig_signature_expiration
;
429 static int hf_dns_rrsig_signature_inception
;
430 static int hf_dns_rrsig_key_tag
;
431 static int hf_dns_rrsig_signers_name
;
432 static int hf_dns_rrsig_signature
;
433 static int hf_dns_dnskey_flags
;
434 static int hf_dns_dnskey_flags_zone_key
;
435 static int hf_dns_dnskey_flags_key_revoked
;
436 static int hf_dns_dnskey_flags_secure_entry_point
;
437 static int hf_dns_dnskey_flags_reserved
;
438 static int hf_dns_dnskey_protocol
;
439 static int hf_dns_dnskey_algorithm
;
440 static int hf_dns_dnskey_key_id
;
441 static int hf_dns_dnskey_public_key
;
442 static int hf_dns_key_flags
;
443 static int hf_dns_key_flags_authentication
;
444 static int hf_dns_key_flags_confidentiality
;
445 static int hf_dns_key_flags_key_required
;
446 static int hf_dns_key_flags_associated_user
;
447 static int hf_dns_key_flags_associated_named_entity
;
448 static int hf_dns_key_flags_ipsec
;
449 static int hf_dns_key_flags_mime
;
450 static int hf_dns_key_flags_signatory
;
451 static int hf_dns_key_protocol
;
452 static int hf_dns_key_algorithm
;
453 static int hf_dns_key_key_id
;
454 static int hf_dns_key_public_key
;
455 static int hf_dns_px_preference
;
456 static int hf_dns_px_map822
;
457 static int hf_dns_px_mapx400
;
458 static int hf_dns_tkey_algo_name
;
459 static int hf_dns_tkey_signature_expiration
;
460 static int hf_dns_tkey_signature_inception
;
461 static int hf_dns_tkey_mode
;
462 static int hf_dns_tkey_error
;
463 static int hf_dns_tkey_key_size
;
464 static int hf_dns_tkey_key_data
;
465 static int hf_dns_tkey_other_size
;
466 static int hf_dns_tkey_other_data
;
467 static int hf_dns_ipseckey_gateway_precedence
;
468 static int hf_dns_ipseckey_gateway_type
;
469 static int hf_dns_ipseckey_gateway_algorithm
;
470 static int hf_dns_ipseckey_gateway_ipv4
;
471 static int hf_dns_ipseckey_gateway_ipv6
;
472 static int hf_dns_ipseckey_gateway_dns
;
473 static int hf_dns_ipseckey_public_key
;
474 static int hf_dns_xpf_ip_version
;
475 static int hf_dns_xpf_protocol
;
476 static int hf_dns_xpf_source_ipv4
;
477 static int hf_dns_xpf_destination_ipv4
;
478 static int hf_dns_xpf_source_ipv6
;
479 static int hf_dns_xpf_destination_ipv6
;
480 static int hf_dns_xpf_sport
;
481 static int hf_dns_xpf_dport
;
482 static int hf_dns_a6_prefix_len
;
483 static int hf_dns_a6_address_suffix
;
484 static int hf_dns_a6_prefix_name
;
485 static int hf_dns_dname
;
486 static int hf_dns_loc_version
;
487 static int hf_dns_loc_size
;
488 static int hf_dns_loc_horizontal_precision
;
489 static int hf_dns_loc_vertical_precision
;
490 static int hf_dns_loc_latitude
;
491 static int hf_dns_loc_longitude
;
492 static int hf_dns_loc_altitude
;
493 static int hf_dns_loc_unknown_data
;
494 static int hf_dns_nxt_next_domain_name
;
495 static int hf_dns_kx_preference
;
496 static int hf_dns_kx_key_exchange
;
497 static int hf_dns_cert_type
;
498 static int hf_dns_cert_key_tag
;
499 static int hf_dns_cert_algorithm
;
500 static int hf_dns_cert_certificate
;
501 static int hf_dns_nsec_next_domain_name
;
502 static int hf_dns_ns
;
503 static int hf_dns_opt
;
504 static int hf_dns_opt_code
;
505 static int hf_dns_opt_len
;
506 static int hf_dns_opt_data
;
507 static int hf_dns_opt_dau
;
508 static int hf_dns_opt_dhu
;
509 static int hf_dns_opt_n3u
;
510 static int hf_dns_opt_client_family
;
511 static int hf_dns_opt_client_netmask
;
512 static int hf_dns_opt_client_scope
;
513 static int hf_dns_opt_client_addr
;
514 static int hf_dns_opt_client_addr4
;
515 static int hf_dns_opt_client_addr6
;
516 static int hf_dns_opt_cookie_client
;
517 static int hf_dns_opt_cookie_server
;
518 static int hf_dns_opt_edns_tcp_keepalive_timeout
;
519 static int hf_dns_opt_padding
;
520 static int hf_dns_opt_chain_fqdn
;
521 static int hf_dns_opt_ext_error_info_code
;
522 static int hf_dns_opt_ext_error_extra_text
;
523 static int hf_dns_opt_agent_domain
;
524 static int hf_dns_opt_zoneversion_labelcount
;
525 static int hf_dns_opt_zoneversion_type
;
526 static int hf_dns_opt_zoneversion_soa
;
527 static int hf_dns_opt_zoneversion_version
;
528 static int hf_dns_nsec3_algo
;
529 static int hf_dns_nsec3_flags
;
530 static int hf_dns_nsec3_flag_optout
;
531 static int hf_dns_nsec3_iterations
;
532 static int hf_dns_nsec3_salt_length
;
533 static int hf_dns_nsec3_salt_value
;
534 static int hf_dns_nsec3_hash_length
;
535 static int hf_dns_nsec3_hash_value
;
536 static int hf_dns_tlsa_certificate_usage
;
537 static int hf_dns_tlsa_selector
;
538 static int hf_dns_tlsa_matching_type
;
539 static int hf_dns_tlsa_certificate_association_data
;
540 static int hf_dns_tsig_algorithm_name
;
541 static int hf_dns_tsig_time_signed
;
542 static int hf_dns_tsig_error
;
543 static int hf_dns_tsig_fudge
;
544 static int hf_dns_tsig_mac_size
;
545 static int hf_dns_tsig_mac
;
546 static int hf_dns_tsig_original_id
;
547 static int hf_dns_tsig_other_len
;
548 static int hf_dns_tsig_other_data
;
549 static int hf_dns_response_in
;
550 static int hf_dns_response_to
;
551 static int hf_dns_retransmission
;
552 static int hf_dns_retransmit_request_in
;
553 static int hf_dns_retransmit_response_in
;
554 static int hf_dns_time
;
555 static int hf_dns_unsolicited
;
556 static int hf_dns_sshfp_algorithm
;
557 static int hf_dns_sshfp_fingerprint_type
;
558 static int hf_dns_sshfp_fingerprint
;
559 static int hf_dns_hip_hit_length
;
560 static int hf_dns_hip_pk_algo
;
561 static int hf_dns_hip_pk_length
;
562 static int hf_dns_hip_hit
;
563 static int hf_dns_hip_pk
;
564 static int hf_dns_hip_rendezvous_server
;
565 static int hf_dns_dhcid_rdata
;
566 static int hf_dns_ds_key_id
;
567 static int hf_dns_ds_algorithm
;
568 static int hf_dns_apl_coded_prefix
;
569 static int hf_dns_ds_digest_type
;
570 static int hf_dns_ds_digest
;
571 static int hf_dns_apl_address_family
;
572 static int hf_dns_apl_negation
;
573 static int hf_dns_apl_afdlength
;
574 static int hf_dns_apl_afdpart_ipv4
;
575 static int hf_dns_apl_afdpart_ipv6
;
576 static int hf_dns_apl_afdpart_data
;
577 static int hf_dns_gpos_longitude_length
;
578 static int hf_dns_gpos_longitude
;
579 static int hf_dns_gpos_latitude_length
;
580 static int hf_dns_gpos_latitude
;
581 static int hf_dns_gpos_altitude_length
;
582 static int hf_dns_gpos_altitude
;
583 static int hf_dns_rp_mailbox
;
584 static int hf_dns_rp_txt_rr
;
585 static int hf_dns_afsdb_subtype
;
586 static int hf_dns_afsdb_hostname
;
587 static int hf_dns_x25_length
;
588 static int hf_dns_x25_psdn_address
;
589 static int hf_dns_isdn_length
;
590 static int hf_dns_isdn_address
;
591 static int hf_dns_isdn_sa_length
;
592 static int hf_dns_isdn_sa
;
593 static int hf_dns_rt_preference
;
594 static int hf_dns_rt_intermediate_host
;
595 static int hf_dns_nsap_rdata
;
596 static int hf_dns_nsap_ptr_owner
;
597 static int hf_dns_caa_flags
;
598 static int hf_dns_caa_flag_issuer_critical
;
599 static int hf_dns_caa_issue
;
600 static int hf_dns_caa_issuewild
;
601 static int hf_dns_caa_iodef
;
602 static int hf_dns_caa_unknown
;
603 static int hf_dns_caa_tag_length
;
604 static int hf_dns_caa_tag
;
605 static int hf_dns_caa_value
;
606 static int hf_dns_extraneous_data
;
607 static int hf_dns_extraneous_length
;
609 static int hf_dns_wins_local_flag
;
610 static int hf_dns_wins_lookup_timeout
;
611 static int hf_dns_wins_cache_timeout
;
612 static int hf_dns_wins_nb_wins_servers
;
613 static int hf_dns_wins_server
;
615 static int hf_dns_winsr_local_flag
;
616 static int hf_dns_winsr_lookup_timeout
;
617 static int hf_dns_winsr_cache_timeout
;
618 static int hf_dns_winsr_name_result_domain
;
620 static int hf_dns_data
;
622 static int hf_dns_dso
;
623 static int hf_dns_dso_tlv
;
624 static int hf_dns_dso_tlv_type
;
625 static int hf_dns_dso_tlv_length
;
626 static int hf_dns_dso_tlv_data
;
627 static int hf_dns_dso_tlv_keepalive_inactivity
;
628 static int hf_dns_dso_tlv_keepalive_interval
;
629 static int hf_dns_dso_tlv_retrydelay_retrydelay
;
630 static int hf_dns_dso_tlv_encpad_padding
;
632 static int hf_dns_dnscrypt
;
633 static int hf_dns_dnscrypt_magic
;
634 static int hf_dns_dnscrypt_esversion
;
635 static int hf_dns_dnscrypt_protocol_version
;
636 static int hf_dns_dnscrypt_signature
;
637 static int hf_dns_dnscrypt_resolver_pk
;
638 static int hf_dns_dnscrypt_client_magic
;
639 static int hf_dns_dnscrypt_serial_number
;
640 static int hf_dns_dnscrypt_ts_start
;
641 static int hf_dns_dnscrypt_ts_end
;
644 static int ett_dns_qd
;
645 static int ett_dns_rr
;
646 static int ett_dns_qry
;
647 static int ett_dns_ans
;
648 static int ett_dns_flags
;
649 static int ett_dns_opts
;
650 static int ett_nsec3_flags
;
651 static int ett_key_flags
;
652 static int ett_t_key
;
653 static int ett_dns_mac
;
654 static int ett_caa_flags
;
655 static int ett_caa_data
;
656 static int ett_dns_csdync_flags
;
657 static int ett_dns_dso
;
658 static int ett_dns_dso_tlv
;
659 static int ett_dns_svcb
;
660 static int ett_dns_extraneous
;
661 static int ett_dns_dnscrypt
;
663 static expert_field ei_dns_a_class_undecoded
;
664 static expert_field ei_dns_opt_bad_length
;
665 static expert_field ei_dns_depr_opc
;
666 static expert_field ei_ttl_high_bit_set
;
667 static expert_field ei_dns_tsig_alg
;
668 static expert_field ei_dns_undecoded_option
;
669 static expert_field ei_dns_key_id_buffer_too_short
;
670 static expert_field ei_dns_retransmit_request
;
671 static expert_field ei_dns_retransmit_response
;
672 static expert_field ei_dns_extraneous_data
;
673 static expert_field ei_dns_response_missing
;
675 static dissector_table_t dns_tsig_dissector_table
;
677 static dissector_handle_t dns_handle
;
678 static dissector_handle_t mdns_udp_handle
;
679 static dissector_handle_t llmnr_udp_handle
;
680 static dissector_handle_t doq_handle
;
683 /* desegmentation of DNS over TCP */
684 static bool dns_desegment
= true;
686 static bool dns_qname_stats
;
688 /* Maximum number of elapsed seconds between messages with the same
689 * transaction ID to be considered as a retransmission
691 static uint32_t retransmission_timer
= 5;
693 /* Dissector handle for GSSAPI */
694 static dissector_handle_t gssapi_handle
;
695 static dissector_handle_t ntlmssp_handle
;
697 /* Dissector handle for TLS ECHConfig message */
698 static dissector_handle_t tls_echconfig_handle
;
700 /* Transport protocol for DNS. */
702 DNS_TRANSPORT_UDP
, /* includes compatible transports like SCTP */
708 /* Structure containing transaction specific information */
709 typedef struct _dns_transaction_t
{
714 bool multiple_responds
;
717 /* Structure containing conversation specific information */
718 typedef struct _dns_conv_info_t
{
722 /* DNS structs and definitions */
724 /* Ports used for DNS. */
725 #define DEFAULT_DNS_PORT_RANGE "53"
726 #define DEFAULT_DNS_TCP_PORT_RANGE "53,5353" /* Includes mDNS */
727 #define SCTP_PORT_DNS 53
728 #define UDP_PORT_MDNS 5353
729 #define UDP_PORT_LLMNR 5355
730 #define TCP_PORT_DNS_TLS 853
731 #define UDP_PORT_DNS_DTLS 853
733 /* PPID used for DNS/SCTP (will be changed when IANA assigned) */
734 #define DNS_PAYLOAD_PROTOCOL_ID 1000
737 /* Offsets of fields in the DNS header. */
745 /* Length of DNS header. */
746 #define DNS_HDRLEN 12
749 #define T_A 1 /* host address */
750 #define T_NS 2 /* authoritative name server */
751 #define T_MD 3 /* mail destination (obsolete) */
752 #define T_MF 4 /* mail forwarder (obsolete) */
753 #define T_CNAME 5 /* canonical name */
754 #define T_SOA 6 /* start of authority zone */
755 #define T_MB 7 /* mailbox domain name (experimental) */
756 #define T_MG 8 /* mail group member (experimental) */
757 #define T_MR 9 /* mail rename domain name (experimental) */
758 #define T_NULL 10 /* null RR (experimental) */
759 #define T_WKS 11 /* well known service */
760 #define T_PTR 12 /* domain name pointer */
761 #define T_HINFO 13 /* host information */
762 #define T_MINFO 14 /* mailbox or mail list information */
763 #define T_MX 15 /* mail routing information */
764 #define T_TXT 16 /* text strings */
765 #define T_RP 17 /* responsible person (RFC 1183) */
766 #define T_AFSDB 18 /* AFS data base location (RFC 1183) */
767 #define T_X25 19 /* X.25 address (RFC 1183) */
768 #define T_ISDN 20 /* ISDN address (RFC 1183) */
769 #define T_RT 21 /* route-through (RFC 1183) */
770 #define T_NSAP 22 /* OSI NSAP (RFC 1706) */
771 #define T_NSAP_PTR 23 /* PTR equivalent for OSI NSAP (RFC 1348 - obsolete) */
772 #define T_SIG 24 /* digital signature (RFC 2535) */
773 #define T_KEY 25 /* public key (RFC 2535) */
774 #define T_PX 26 /* pointer to X.400/RFC822 mapping info (RFC 1664) */
775 #define T_GPOS 27 /* geographical position (RFC 1712) */
776 #define T_AAAA 28 /* IPv6 address (RFC 1886) */
777 #define T_LOC 29 /* geographical location (RFC 1876) */
778 #define T_NXT 30 /* "next" name (RFC 2535) */
779 #define T_EID 31 /* Endpoint Identifier */
780 #define T_NIMLOC 32 /* Nimrod Locator */
781 #define T_SRV 33 /* service location (RFC 2052) */
782 #define T_ATMA 34 /* ATM Address */
783 #define T_NAPTR 35 /* naming authority pointer (RFC 3403) */
784 #define T_KX 36 /* Key Exchange (RFC 2230) */
785 #define T_CERT 37 /* Certificate (RFC 4398) */
786 #define T_A6 38 /* IPv6 address with indirection (RFC 2874 - obsolete) */
787 #define T_DNAME 39 /* Non-terminal DNS name redirection (RFC 2672) */
788 #define T_SINK 40 /* SINK */
789 #define T_OPT 41 /* OPT pseudo-RR (RFC 2671) */
790 #define T_APL 42 /* Lists of Address Prefixes (APL RR) (RFC 3123) */
791 #define T_DS 43 /* Delegation Signer (RFC 4034) */
792 #define T_SSHFP 44 /* Using DNS to Securely Publish SSH Key Fingerprints (RFC 4255) */
793 #define T_IPSECKEY 45 /* RFC 4025 */
794 #define T_RRSIG 46 /* RFC 4034 */
795 #define T_NSEC 47 /* RFC 4034 */
796 #define T_DNSKEY 48 /* RFC 4034 */
797 #define T_DHCID 49 /* DHCID RR (RFC 4701) */
798 #define T_NSEC3 50 /* Next secure hash (RFC 5155) */
799 #define T_NSEC3PARAM 51 /* NSEC3 parameters (RFC 5155) */
800 #define T_TLSA 52 /* TLSA (RFC 6698) */
801 #define T_HIP 55 /* Host Identity Protocol (HIP) RR (RFC 5205) */
802 #define T_NINFO 56 /* NINFO */
803 #define T_RKEY 57 /* RKEY */
804 #define T_TALINK 58 /* Trust Anchor LINK */
805 #define T_CDS 59 /* Child DS (RFC7344)*/
806 #define T_CDNSKEY 60 /* DNSKEY(s) the Child wants reflected in DS ( [RFC7344])*/
807 #define T_OPENPGPKEY 61 /* OPENPGPKEY draft-ietf-dane-openpgpkey-00 */
808 #define T_CSYNC 62 /* Child To Parent Synchronization (RFC7477) */
809 #define T_ZONEMD 63 /* Message Digest for DNS Zones (RFC8976) */
810 #define T_SVCB 64 /* draft-ietf-dnsop-svcb-https-01 */
811 #define T_HTTPS 65 /* draft-ietf-dnsop-svcb-https-01 */
812 #define T_SPF 99 /* SPF RR (RFC 4408) section 3 */
813 #define T_UINFO 100 /* [IANA-Reserved] */
814 #define T_UID 101 /* [IANA-Reserved] */
815 #define T_GID 102 /* [IANA-Reserved] */
816 #define T_UNSPEC 103 /* [IANA-Reserved] */
817 #define T_NID 104 /* ILNP [RFC6742] */
818 #define T_L32 105 /* ILNP [RFC6742] */
819 #define T_L64 106 /* ILNP [RFC6742] */
820 #define T_LP 107 /* ILNP [RFC6742] */
821 #define T_EUI48 108 /* EUI 48 Address (RFC7043) */
822 #define T_EUI64 109 /* EUI 64 Address (RFC7043) */
823 #define T_TKEY 249 /* Transaction Key (RFC 2930) */
824 #define T_TSIG 250 /* Transaction Signature (RFC 2845) */
825 #define T_IXFR 251 /* incremental transfer (RFC 1995) */
826 #define T_AXFR 252 /* transfer of an entire zone (RFC 5936) */
827 #define T_MAILB 253 /* mailbox-related RRs (MB, MG or MR) (RFC 1035) */
828 #define T_MAILA 254 /* mail agent RRs (OBSOLETE - see MX) (RFC 1035) */
829 #define T_ANY 255 /* A request for all records (RFC 1035) */
830 #define T_URI 256 /* URI */
831 #define T_CAA 257 /* Certification Authority Authorization (RFC 6844) */
832 #define T_AVC 258 /* Application Visibility and Control (Wolfgang_Riedel) */
833 #define T_DOA 259 /* Digital Object Architecture (draft-durand-doa-over-dns) */
834 #define T_AMTRELAY 260 /* Automatic Multicast Tunneling Relay (RFC8777) */
835 #define T_RESINFO 261 /* Resolver Information */
836 #define T_WALLET 262 /* Public wallet address */
837 #define T_TA 32768 /* DNSSEC Trust Authorities */
838 #define T_DLV 32769 /* DNSSEC Lookaside Validation (DLV) DNS Resource Record (RFC 4431) */
839 #define T_WINS 65281 /* Microsoft's WINS RR */
840 #define T_WINS_R 65282 /* Microsoft's WINS-R RR */
841 #define T_XPF 65422 /* XPF draft-bellis-dnsop-xpf */
844 #define C_IN 1 /* the Internet */
845 #define C_CS 2 /* CSNET (obsolete) */
846 #define C_CH 3 /* CHAOS */
847 #define C_HS 4 /* Hesiod */
848 #define C_NONE 254 /* none */
849 #define C_ANY 255 /* any */
851 #define C_QU (1<<15) /* High bit is set in queries for unicast queries */
852 #define C_FLUSH (1<<15) /* High bit is set for MDNS cache flush */
854 /* Bit fields in the flags */
855 #define F_RESPONSE (1<<15) /* packet is response */
856 #define F_OPCODE (0xF<<11) /* query opcode */
857 #define OPCODE_SHIFT 11
858 #define F_AUTHORITATIVE (1<<10) /* response is authoritative */
859 #define F_CONFLICT (1<<10) /* conflict detected */
860 #define F_TRUNCATED (1<<9) /* response is truncated */
861 #define F_RECDESIRED (1<<8) /* recursion desired */
862 #define F_TENTATIVE (1<<8) /* response is tentative */
863 #define F_RECAVAIL (1<<7) /* recursion available */
864 #define F_Z (1<<6) /* Z */
865 #define F_AUTHENTIC (1<<5) /* authentic data (RFC2535) */
866 #define F_CHECKDISABLE (1<<4) /* checking disabled (RFC2535) */
867 #define F_RCODE (0xF<<0) /* reply code */
869 /* Optcode values for EDNS0 options (RFC 2671) */
870 #define O_LLQ 1 /* Long-lived query (on-hold, draft-sekar-dns-llq) */
871 #define O_UL 2 /* Update lease (on-hold, draft-sekar-dns-ul) */
872 #define O_NSID 3 /* Name Server Identifier (RFC 5001) */
873 #define O_OWNER 4 /* Owner, reserved (draft-cheshire-edns0-owner-option) */
874 #define O_DAU 5 /* DNSSEC Algorithm Understood (RFC6975) */
875 #define O_DHU 6 /* DS Hash Understood (RFC6975) */
876 #define O_N3U 7 /* NSEC3 Hash Understood (RFC6975) */
877 #define O_CLIENT_SUBNET 8 /* Client subnet as assigned by IANA */
878 #define O_EDNS_EXPIRE 9 /* EDNS Expire (RFC7314) */
879 #define O_CLIENT_SUBNET_EXP 0x50fa /* Client subnet (placeholder value, draft-vandergaast-edns-client-subnet) */
880 #define O_COOKIE 10 /* Cookies (RFC7873) */
881 #define O_EDNS_TCP_KA 11 /* edns-tcp-keepalive EDNS0 Option (RFC7828) */
882 #define O_PADDING 12 /* EDNS(0) Padding Option (RFC7830) */
883 #define O_CHAIN 13 /* draft-ietf-dnsop-edns-chain-query */
884 #define O_EXT_ERROR 15 /* Extended DNS Errors (RFC8914) */
885 #define O_REPORT_CHANNEL 18 /* DNS Error Reporting (RFC9567) */
886 #define O_ZONEVERSION 19 /* DNS Zone Version (ZONEVERSION) Option (RFC9660) */
888 #define MIN_DNAME_LEN 2 /* minimum domain name length */
890 static const true_false_string tfs_flags_response
= {
891 "Message is a response",
895 static const true_false_string tfs_flags_authoritative
= {
896 "Server is an authority for domain",
897 "Server is not an authority for domain"
900 static const true_false_string tfs_flags_conflict_query
= {
901 "The sender received multiple responses",
905 static const true_false_string tfs_flags_conflict_response
= {
906 "The name is not considered unique",
907 "The name is considered unique"
910 static const true_false_string tfs_flags_truncated
= {
911 "Message is truncated",
912 "Message is not truncated"
915 static const true_false_string tfs_flags_recdesired
= {
916 "Do query recursively",
917 "Don't do query recursively"
920 static const true_false_string tfs_flags_tentative
= {
925 static const true_false_string tfs_flags_recavail
= {
926 "Server can do recursive queries",
927 "Server can't do recursive queries"
930 static const true_false_string tfs_flags_z
= {
931 "reserved - incorrect!",
935 static const true_false_string tfs_flags_authenticated
= {
936 "Answer/authority portion was authenticated by the server",
937 "Answer/authority portion was not authenticated by the server"
940 static const true_false_string tfs_flags_checkdisable
= {
945 static const true_false_string tfs_dns_rr_z_do
= {
946 "Accepts DNSSEC security RRs",
947 "Cannot handle DNSSEC security RRs"
951 #define OPCODE_QUERY 0 /* standard query */
952 #define OPCODE_IQUERY 1 /* inverse query */
953 #define OPCODE_STATUS 2 /* server status request */
954 #define OPCODE_NOTIFY 4 /* zone change notification */
955 #define OPCODE_UPDATE 5 /* dynamic update */
956 #define OPCODE_DSO 6 /* DNS stateful operations */
958 static const value_string opcode_vals
[] = {
959 { OPCODE_QUERY
, "Standard query" },
960 { OPCODE_IQUERY
, "Inverse query" },
961 { OPCODE_STATUS
, "Server status request" },
962 { OPCODE_NOTIFY
, "Zone change notification" },
963 { OPCODE_UPDATE
, "Dynamic update" },
964 { OPCODE_DSO
, "DNS Stateful operations (DSO)" },
968 #define RCODE_NOERROR 0
969 #define RCODE_FORMERR 1
970 #define RCODE_SERVFAIL 2
971 #define RCODE_NXDOMAIN 3
972 #define RCODE_NOTIMPL 4
973 #define RCODE_REFUSED 5
974 #define RCODE_YXDOMAIN 6
975 #define RCODE_YXRRSET 7
976 #define RCODE_NXRRSET 8
977 #define RCODE_NOTAUTH 9
978 #define RCODE_NOTZONE 10
979 #define RCODE_DSOTYPENI 11
982 #define RCODE_BADKEY 17
983 #define RCODE_BADTIME 18
984 #define RCODE_BADMODE 19
985 #define RCODE_BADNAME 20
986 #define RCODE_BADALG 21
987 #define RCODE_BADTRUNC 22
988 #define RCODE_BADCOOKIE 23
990 static const value_string rcode_vals
[] = {
991 { RCODE_NOERROR
, "No error" },
992 { RCODE_FORMERR
, "Format error" },
993 { RCODE_SERVFAIL
, "Server failure" },
994 { RCODE_NXDOMAIN
, "No such name" },
995 { RCODE_NOTIMPL
, "Not implemented" },
996 { RCODE_REFUSED
, "Refused" },
997 { RCODE_YXDOMAIN
, "Name exists" },
998 { RCODE_YXRRSET
, "RRset exists" },
999 { RCODE_NXRRSET
, "RRset does not exist" },
1000 { RCODE_NOTAUTH
, "Not authoritative" },
1001 { RCODE_NOTZONE
, "Name out of zone" },
1002 { RCODE_DSOTYPENI
, "DSO-Type not implemented" },
1003 /* 12-15 Unassigned */
1004 { RCODE_BAD
, "Bad OPT Version or TSIG Signature Failure" },
1005 { RCODE_BADKEY
, "Key not recognized" },
1006 { RCODE_BADTIME
, "Signature out of time window" },
1007 { RCODE_BADMODE
, "Bad TKEY Mode" },
1008 { RCODE_BADNAME
, "Duplicate key name" },
1009 { RCODE_BADALG
, "Algorithm not supported" },
1010 { RCODE_BADTRUNC
, "Bad Truncation" },
1011 { RCODE_BADCOOKIE
, "Bad/missing Server Cookie" },
1015 #define NSEC3_HASH_RESERVED 0
1016 #define NSEC3_HASH_SHA1 1
1018 #define NSEC3_FLAG_OPTOUT 1
1020 static const value_string hash_algorithms
[] = {
1021 { NSEC3_HASH_RESERVED
, "Reserved" },
1022 { NSEC3_HASH_SHA1
, "SHA-1" },
1025 static const true_false_string tfs_flags_nsec3_optout
= {
1026 "Additional insecure delegations allowed",
1027 "Additional insecure delegations forbidden"
1029 static const true_false_string tfs_required_experimental
= { "Experimental or optional", "Required" };
1031 #define TKEYMODE_SERVERASSIGNED (1)
1032 #define TKEYMODE_DIFFIEHELLMAN (2)
1033 #define TKEYMODE_GSSAPI (3)
1034 #define TKEYMODE_RESOLVERASSIGNED (4)
1035 #define TKEYMODE_DELETE (5)
1037 static const value_string tkey_mode_vals
[] = {
1038 { TKEYMODE_SERVERASSIGNED
, "Server assigned" },
1039 { TKEYMODE_DIFFIEHELLMAN
, "Diffie Hellman" },
1040 { TKEYMODE_GSSAPI
, "GSSAPI" },
1041 { TKEYMODE_RESOLVERASSIGNED
, "Resolver assigned" },
1042 { TKEYMODE_DELETE
, "Delete" },
1047 * SSHFP (RFC 4255) algorithm number and fingerprint types
1049 #define TSSHFP_ALGO_RESERVED (0)
1050 #define TSSHFP_ALGO_RSA (1)
1051 #define TSSHFP_ALGO_DSA (2)
1052 #define TSSHFP_ALGO_ECDSA (3)
1053 #define TSSHFP_ALGO_ED25519 (4)
1054 #define TSSHFP_ALGO_XMSS (5)
1056 #define TSSHFP_FTYPE_RESERVED (0)
1057 #define TSSHFP_FTYPE_SHA1 (1)
1058 #define TSSHFP_FTYPE_SHA256 (2)
1060 static const value_string sshfp_algo_vals
[] = {
1061 { TSSHFP_ALGO_RESERVED
, "Reserved" },
1062 { TSSHFP_ALGO_RSA
, "RSA" },
1063 { TSSHFP_ALGO_DSA
, "DSA" },
1064 { TSSHFP_ALGO_ECDSA
, "ECDSA" },
1065 { TSSHFP_ALGO_ED25519
, "Ed25519" },
1066 { TSSHFP_ALGO_XMSS
, "XMSS" },
1070 static const value_string sshfp_fingertype_vals
[] = {
1071 { TSSHFP_FTYPE_RESERVED
, "Reserved" },
1072 { TSSHFP_FTYPE_SHA1
, "SHA1" },
1073 { TSSHFP_FTYPE_SHA256
, "SHA256" },
1077 /* HIP PK ALGO RFC 5205 */
1078 #define THIP_ALGO_RESERVED (0)
1079 #define THIP_ALGO_DSA (1)
1080 #define THIP_ALGO_RSA (2)
1083 static const value_string hip_algo_vals
[] = {
1084 { THIP_ALGO_DSA
, "DSA" },
1085 { THIP_ALGO_RSA
, "RSA" },
1086 { THIP_ALGO_RESERVED
, "Reserved" },
1091 #define DNS_APL_NEGATION (1<<7)
1092 #define DNS_APL_AFDLENGTH (0x7F<<0)
1094 static const true_false_string tfs_dns_apl_negation
= {
1100 #define CAA_FLAG_ISSUER_CRITICAL (1<<7)
1102 /* See RFC 1035 for all RR types for which no RFC is listed, except for
1103 the ones with "???", and for the Microsoft WINS and WINS-R RRs, for
1104 which one should look at
1106 http://www.windows.com/windows2000/en/server/help/sag_DNS_imp_UsingWinsLookup.htm
1110 http://www.microsoft.com/windows2000/library/resources/reskit/samplechapters/cncf/cncf_imp_wwaw.asp
1112 which discuss them to some extent. */
1113 /* http://www.iana.org/assignments/dns-parameters (last updated 2015-07-26)*/
1115 static const value_string dns_qr_vals
[] = {
1120 static const value_string dns_types_vals
[] = {
1126 { T_CNAME
, "CNAME" },
1134 { T_HINFO
, "HINFO" },
1135 { T_MINFO
, "MINFO" },
1138 { T_RP
, "RP" }, /* RFC 1183 */
1139 { T_AFSDB
, "AFSDB" }, /* RFC 1183 */
1140 { T_X25
, "X25" }, /* RFC 1183 */
1141 { T_ISDN
, "ISDN" }, /* RFC 1183 */
1142 { T_RT
, "RT" }, /* RFC 1183 */
1143 { T_NSAP
, "NSAP" }, /* RFC 1706 */
1144 { T_NSAP_PTR
, "NSAP-PTR" }, /* RFC 1348 */
1145 { T_SIG
, "SIG" }, /* RFC 2535 */
1146 { T_KEY
, "KEY" }, /* RFC 2535 */
1147 { T_PX
, "PX" }, /* RFC 1664 */
1148 { T_GPOS
, "GPOS" }, /* RFC 1712 */
1149 { T_AAAA
, "AAAA" }, /* RFC 1886 */
1150 { T_LOC
, "LOC" }, /* RFC 1886 */
1151 { T_NXT
, "NXT" }, /* RFC 1876 */
1153 { T_NIMLOC
, "NIMLOC" },
1154 { T_SRV
, "SRV" }, /* RFC 2052 */
1156 { T_NAPTR
, "NAPTR" }, /* RFC 3403 */
1157 { T_KX
, "KX" }, /* RFC 2230 */
1158 { T_CERT
, "CERT" }, /* RFC 4398 */
1159 { T_A6
, "A6" }, /* RFC 2874 */
1160 { T_DNAME
, "DNAME" }, /* RFC 2672 */
1162 { T_OPT
, "OPT" }, /* RFC 2671 */
1163 { T_APL
, "APL" }, /* RFC 3123 */
1164 { T_DS
, "DS" }, /* RFC 4034 */
1165 { T_SSHFP
, "SSHFP" }, /* RFC 4255 */
1166 { T_IPSECKEY
, "IPSECKEY" }, /* RFC 4025 */
1167 { T_RRSIG
, "RRSIG" }, /* RFC 4034 */
1168 { T_NSEC
, "NSEC" }, /* RFC 4034 */
1169 { T_DNSKEY
, "DNSKEY" }, /* RFC 4034 */
1170 { T_DHCID
, "DHCID" }, /* RFC 4701 */
1171 { T_NSEC3
, "NSEC3" }, /* RFC 5155 */
1172 { T_NSEC3PARAM
, "NSEC3PARAM" }, /* RFC 5155 */
1174 { T_HIP
, "HIP" }, /* RFC 5205 */
1176 { T_TALINK
, "TALINK" },
1177 { T_CDS
, "CDS" }, /* RFC 7344 */
1178 { T_CDNSKEY
, "CDNSKEY" }, /* RFC 7344*/
1179 { T_OPENPGPKEY
, "OPENPGPKEY" }, /* draft-ietf-dane-openpgpkey */
1180 { T_CSYNC
, "CSYNC" }, /* RFC 7477 */
1181 { T_ZONEMD
, "ZONEMD" }, /* RFC 8976 */
1182 { T_SVCB
, "SVCB" }, /* draft-ietf-dnsop-svcb-https-01 */
1183 { T_HTTPS
, "HTTPS" }, /* draft-ietf-dnsop-svcb-https-01 */
1184 { T_SPF
, "SPF" }, /* RFC 4408 */
1185 { T_UINFO
, "UINFO" }, /* IANA reserved */
1186 { T_UID
, "UID" }, /* IANA reserved */
1187 { T_GID
, "GID" }, /* IANA reserved */
1188 { T_UNSPEC
, "UNSPEC" }, /* IANA reserved */
1189 { T_NID
, "NID" }, /* RFC 6742 */
1190 { T_L32
, "L32" }, /* RFC 6742 */
1191 { T_L64
, "L64" }, /* RFC 6742 */
1192 { T_LP
, "LP" }, /* RFC 6742 */
1193 { T_EUI48
, "EUI48" }, /* RFC 7043 */
1194 { T_EUI64
, "EUI64" }, /* RFC 7043 */
1199 { T_MAILB
, "MAILB" },
1200 { T_MAILA
, "MAILA" },
1203 { T_CAA
, "CAA" }, /* RFC 6844 */
1205 { T_DOA
, "DOA" }, /* (draft-durand-doa-over-dns) */
1206 { T_AMTRELAY
, "AMTRELAY" }, /* RFC8777 */
1207 { T_RESINFO
, "RESINFO" },
1208 { T_WALLET
, "WALLET" },
1210 { T_DLV
, "DLV" }, /* RFC 4431 */
1213 { T_WINS_R
, "WINS-R" },
1214 { T_XPF
, "XPF" }, /* draft-bellis-dnsop-xpf */
1219 static value_string_ext dns_types_vals_ext
= VALUE_STRING_EXT_INIT(dns_types_vals
);
1221 static const value_string dns_types_description_vals
[] = {
1223 { T_A
, "(Host Address)" },
1224 { T_NS
, "(authoritative Name Server)" },
1225 { T_MD
, "(Mail Destination)" },
1226 { T_MF
, "(Mail Forwarder)" },
1227 { T_CNAME
, "(Canonical NAME for an alias)" },
1228 { T_SOA
, "(Start Of a zone of Authority)" },
1229 { T_MB
, "(MailBox domain name)"},
1230 { T_MG
, "(Mail Group member)" },
1231 { T_MR
, "(Mail Rename domain)" },
1233 { T_WKS
, "(Well Known Service)" },
1234 { T_PTR
, "(domain name PoinTeR)" },
1235 { T_HINFO
, "(host information)" },
1236 { T_MINFO
, "(Mailbox or mail list information)" },
1237 { T_MX
, "(Mail eXchange)" },
1238 { T_TXT
, "(Text strings)" },
1239 { T_RP
, "(Responsible Person)" }, /* RFC 1183 */
1240 { T_AFSDB
, "(AFS Data Base location)" }, /* RFC 1183 */
1241 { T_X25
, "(XX.25 PSDN address)" }, /* RFC 1183 */
1242 { T_ISDN
, "(ISDN address)" }, /* RFC 1183 */
1243 { T_RT
, "(Route Through)" }, /* RFC 1183 */
1244 { T_NSAP
, "(NSAP address)" },
1245 { T_NSAP_PTR
, "(NSAP domain name pointer)" },
1246 { T_SIG
, "(security signature)" },
1247 { T_KEY
, "(security key)" },
1248 { T_PX
, "(X.400 mail mapping information)" },
1249 { T_GPOS
, "(Geographical Position)" },
1250 { T_AAAA
, "(IP6 Address)" },
1251 { T_LOC
, "(Location Information)" },
1252 { T_NXT
, "(Next Domain)" },
1253 { T_EID
, "(Endpoint Identifier)" },
1254 { T_NIMLOC
, "(Nimrod Locator)" },
1255 { T_SRV
, "(Server Selection)" },
1256 { T_ATMA
, "(ATM Address)" },
1257 { T_NAPTR
, "(Naming Authority Pointer)" },
1258 { T_KX
, "(Key Exchanger)" },
1260 { T_A6
, "(OBSOLETE - use AAAA)" },
1265 { T_DS
, "(Delegation Signer)" },
1266 { T_SSHFP
, "(SSH Key Fingerprint)" },
1268 { T_RRSIG
, "(Resource Record Signature)" },
1269 { T_NSEC
, "(Next Secure)" },
1270 { T_DNSKEY
, "(DNS Public Key)" },
1273 { T_NSEC3PARAM
, "" },
1275 { T_HIP
, "(Host Identity Protocol)" }, /* RFC 5205 */
1277 { T_TALINK
, "(Trust Anchor LINK)" },
1278 { T_CDS
, "(Child DS)" }, /* RFC 7344 */
1279 { T_CDNSKEY
, "(DNSKEY(s) the Child wants reflected in DS)" }, /* RFC 7344 */
1280 { T_OPENPGPKEY
, "(OpenPGP Key)" }, /* draft-ietf-dane-openpgpkey */
1281 { T_CSYNC
, "(Child-to-Parent Synchronization)" }, /* RFC 7477 */
1282 { T_ZONEMD
, "" }, /* RFC 8976 */
1283 { T_SVCB
, "(General Purpose Service Endpoints)" }, /* draft-ietf-dnsop-svcb-https*/
1284 { T_HTTPS
, "(HTTPS Specific Service Endpoints)" }, /* draft-ietf-dnsop-svcb-https*/
1285 { T_SPF
, "" }, /* RFC 4408 */
1286 { T_UINFO
, "" }, /* IANA reserved */
1287 { T_UID
, "" }, /* IANA reserved */
1288 { T_GID
, "" }, /* IANA reserved */
1289 { T_UNSPEC
, "" }, /* IANA reserved */
1290 { T_NID
, "(NodeID)" },
1291 { T_L32
, "(Locator32)" },
1292 { T_L64
, "(Locator64)" },
1293 { T_LP
, "(Locator FQDN)" },
1296 { T_TKEY
, "(Transaction Key)" },
1297 { T_TSIG
, "(Transaction Signature)" },
1298 { T_IXFR
, "(incremental transfer)" },
1299 { T_AXFR
, "(transfer of an entire zone)" },
1300 { T_MAILB
, "(mailbox-related RRs)" },
1301 { T_MAILA
, "(mail agent RRs)" },
1302 { T_ANY
, "(A request for all records the server/cache has available)" },
1304 { T_CAA
, "(Certification Authority Restriction)" }, /* RFC 6844 */
1305 { T_AVC
, "(Application Visibility and Control)" },
1306 { T_DOA
, "(Digital Object Architecture)" }, /* (draft-durand-doa-over-dns) */
1307 { T_AMTRELAY
, "(Automatic Multicast Tunneling Relay)" }, /* RFC8777 */
1308 { T_RESINFO
, "(Resolver Information) " },
1309 { T_WALLET
, "(Public Wallet Address) " },
1310 { T_TA
, "(DNSSEC Trust Authorities)" },
1311 { T_DLV
, "(DNSSEC Lookaside Validation)" }, /* RFC 4431 */
1314 { T_XPF
, "" }, /* draft-bellis-dnsop-xpf */
1318 static value_string_ext dns_types_description_vals_ext
= VALUE_STRING_EXT_INIT(dns_types_description_vals
);
1320 static const value_string edns0_opt_code_vals
[] = {
1322 {O_LLQ
, "LLQ - Long-lived query"},
1323 {O_UL
, "UL - Update lease"},
1324 {O_NSID
, "NSID - Name Server Identifier"},
1325 {O_OWNER
, "Owner (reserved)"},
1326 {O_DAU
, "DAU - DNSSEC Algorithm Understood (RFC6975)"},
1327 {O_DHU
, "DHU - DS Hash Understood (RFC6975)"},
1328 {O_N3U
, "N3U - NSEC3 Hash Understood (RFC6975)"},
1329 {O_CLIENT_SUBNET_EXP
, "Experimental - CSUBNET - Client subnet" },
1330 {O_CLIENT_SUBNET
, "CSUBNET - Client subnet" },
1331 {O_EDNS_EXPIRE
, "EDNS EXPIRE (RFC7314)"},
1332 {O_COOKIE
, "COOKIE"},
1333 {O_EDNS_TCP_KA
, "EDNS TCP Keepalive"},
1334 {O_PADDING
, "PADDING"},
1336 {O_EXT_ERROR
, "Extended DNS Error"},
1337 {O_REPORT_CHANNEL
, "Report-Channel"},
1338 {O_ZONEVERSION
, "Zone Version"},
1341 /* DNS-Based Authentication of Named Entities (DANE) Parameters
1342 http://www.iana.org/assignments/dane-parameters (last updated 2014-04-23)
1344 /* TLSA Certificate Usages */
1345 #define TLSA_CU_PKIX_TA 0
1346 #define TLSA_CU_PKIX_EE 1
1347 #define TLSA_CU_DANE_TA 2
1348 #define TLSA_CU_DANE_EE 3
1350 static const value_string tlsa_certificate_usage_vals
[] = {
1351 {TLSA_CU_PKIX_TA
, "CA constraint (PKIX-TA)"},
1352 {TLSA_CU_PKIX_EE
, "Service certificate constraint (PKIX-EE)"},
1353 {TLSA_CU_DANE_TA
, "Trust anchor assertion (DANE-TA)"},
1354 {TLSA_CU_DANE_EE
, "Domain-issued certificate (DANE-EE)"},
1358 /* TLSA Selectors */
1359 #define TLSA_S_CERT 0
1360 #define TLSA_S_SPKI 1
1362 static const value_string tlsa_selector_vals
[] = {
1363 {TLSA_S_CERT
, "Full certificate (Cert)"},
1364 {TLSA_S_SPKI
, "SubjectPublicKeyInfo (SPKI)"},
1368 /* TLSA Matching Types */
1369 #define TLSA_MT_FULL 0
1370 #define TLSA_MT_SHA_256 1
1371 #define TLSA_MT_SHA_512 2
1373 static const value_string tlsa_matching_type_vals
[] = {
1374 {TLSA_MT_FULL
, "No Hash Used (Full)"},
1375 {TLSA_MT_SHA_256
, "256 bit hash by SHA2 (SHA2-256)"},
1376 {TLSA_MT_SHA_512
, "512 bit hash by SHA2 (SHA2-512)"},
1380 /* IPSECKEY RFC4025 */
1381 /* IPSECKEY RFC8005 */
1382 /* IPSECKEY RFC9373 */
1383 static const value_string gw_algo_vals
[] = {
1391 static const value_string gw_type_vals
[] = {
1392 { 0, "No Gateway" },
1393 { 1, "IPv4 Gateway" },
1394 { 2, "IPv6 Gateway" },
1395 { 3, "DNS Gateway" },
1399 const value_string dns_classes
[] = {
1409 /* DSO Type Opcodes RFC8490 */
1410 #define DSO_TYPE_RES 0x0000 /* RFC8490 */
1411 #define DSO_TYPE_KEEPALIVE 0x0001 /* RFC8490 */
1412 #define DSO_TYPE_RETRYDELAY 0x0002 /* RFC8490 */
1413 #define DSO_TYPE_ENCPAD 0x0003 /* RFC8490 */
1414 #define DSO_TYPE_SUBSCRIBE 0x0040 /* RF8765 */
1415 #define DSO_TYPE_PUSH 0x0041 /* RF8765 */
1416 #define DSO_TYPE_UNSUBSCRIBE 0x0042 /* RF8765 */
1417 #define DSO_TYPE_RECONFIRM 0x0043 /* RF8765 */
1419 static const range_string dns_dso_type_rvals
[] = {
1420 { DSO_TYPE_RES
, DSO_TYPE_RES
, "Reserved" },
1421 { DSO_TYPE_KEEPALIVE
, DSO_TYPE_KEEPALIVE
, "Keep Alive" },
1422 { DSO_TYPE_RETRYDELAY
, DSO_TYPE_RETRYDELAY
, "Retry Delay" },
1423 { DSO_TYPE_ENCPAD
, DSO_TYPE_ENCPAD
, "Encryption Padding" },
1424 { 0x0004, 0x003F, "Unassigned, reserved for DSO session-management TLVs" },
1425 { DSO_TYPE_SUBSCRIBE
, DSO_TYPE_SUBSCRIBE
, "Subscribe" },
1426 { DSO_TYPE_PUSH
, DSO_TYPE_PUSH
, "Push" },
1427 { DSO_TYPE_UNSUBSCRIBE
, DSO_TYPE_UNSUBSCRIBE
, "Unsubscribe" },
1428 { DSO_TYPE_RECONFIRM
, DSO_TYPE_RECONFIRM
, "Reconfirm" },
1429 { 0x0044, 0xF7FF, "Unassigned" },
1430 { 0xF800, 0xFBFF, "Reserved for Experimental/Local Use" },
1431 { 0xFC00, 0xFFFF, "Reserved for future expansion" },
1435 #define DNS_SVCB_KEY_MANDATORY 0
1436 #define DNS_SVCB_KEY_ALPN 1
1437 #define DNS_SVCB_KEY_NOALPN 2
1438 #define DNS_SVCB_KEY_PORT 3
1439 #define DNS_SVCB_KEY_IPV4HINT 4
1440 #define DNS_SVCB_KEY_ECH 5 /* draft-ietf-tls-svcb-ech-00 */
1441 #define DNS_SVCB_KEY_IPV6HINT 6
1442 #define DNS_SVCB_KEY_DOHPATH 7 /* draft-ietf-add-svcb-dns-08 */
1443 #define DNS_SVCB_KEY_ODOHCONFIG 32769 /* draft-pauly-dprive-oblivious-doh-02 */
1444 #define DNS_SVCB_KEY_RESERVED 65535
1447 * Service Binding (SVCB) Parameter Registry.
1448 * https://tools.ietf.org/html/draft-ietf-dnsop-svcb-https-12#section-14.3.2
1450 static const value_string dns_svcb_param_key_vals
[] = {
1451 { DNS_SVCB_KEY_MANDATORY
, "mandatory" },
1452 { DNS_SVCB_KEY_ALPN
, "alpn" },
1453 { DNS_SVCB_KEY_NOALPN
, "no-default-alpn" },
1454 { DNS_SVCB_KEY_PORT
, "port" },
1455 { DNS_SVCB_KEY_IPV4HINT
, "ipv4hint" },
1456 { DNS_SVCB_KEY_ECH
, "ech" },
1457 { DNS_SVCB_KEY_IPV6HINT
, "ipv6hint" },
1458 { DNS_SVCB_KEY_DOHPATH
, "dohpath" },
1459 { DNS_SVCB_KEY_ODOHCONFIG
, "odohconfig" },
1460 { DNS_SVCB_KEY_RESERVED
, "key65535" },
1464 static int * const dns_csync_flags
[] = {
1465 &hf_dns_csync_flags_immediate
,
1466 &hf_dns_csync_flags_soaminimum
,
1470 #define DNS_ZONEMD_SCHEME_SIMPLE 1
1472 static const range_string dns_zonemd_scheme
[] = {
1473 { 0, 0, "Reserved" },
1474 { DNS_ZONEMD_SCHEME_SIMPLE
, DNS_ZONEMD_SCHEME_SIMPLE
, "SIMPLE" },
1475 { 2, 239, "Unassigned" },
1476 { 240, 254, "Private Use" },
1477 { 255, 255, "Reserved" },
1480 #define DNS_ZONEMD_HASH_SHA384 1
1481 #define DNS_ZONEMD_HASH_SHA512 2
1483 static const range_string dns_zonemd_hash_algo
[] = {
1484 { 0, 0, "Reserved" },
1485 { DNS_ZONEMD_HASH_SHA384
, DNS_ZONEMD_HASH_SHA384
, "SHA-384" },
1486 { DNS_ZONEMD_HASH_SHA512
, DNS_ZONEMD_HASH_SHA512
, "SHA-512" },
1487 { 3, 239, "Unassigned" },
1488 { 240, 254, "Private Use" },
1489 { 255, 255, "Reserved" },
1492 static const range_string dns_ext_err_info_code
[] = {
1493 { 0, 0, "Other Error" },
1494 { 1, 1, "Unsupported DNSKEY Algorithm" },
1495 { 2, 2, "Unsupported DS Digest Type" },
1496 { 3, 3, "Stale Answer" },
1497 { 4, 4, "Forged Answer" },
1498 { 5, 5, "DNSSEC Indeterminate" },
1499 { 6, 6, "DNSSEC Bogus" },
1500 { 7, 7, "Signature Expired" },
1501 { 8, 8, "Signature Not Yet Valid" },
1502 { 9, 9, "DNSKEY Missing" },
1503 { 10, 10, "RRSIGs Missing" },
1504 { 11, 11, "No Zone Key Bit Set" },
1505 { 12, 12, "NSEC Missing" },
1506 { 13, 13, "Cached Error" },
1507 { 14, 14, "Not Ready" },
1508 { 15, 15, "Blocked" },
1509 { 16, 16, "Censored" },
1510 { 17, 17, "Filtered" },
1511 { 18, 18, "Prohibited" },
1512 { 19, 19, "Stale NXDomain Answer" },
1513 { 20, 20, "Not Authoritative" },
1514 { 21, 21, "Not Supported" },
1515 { 22, 22, "No Reachable Authority" },
1516 { 23, 23, "Network Error" },
1517 { 24, 24, "Invalid Data" },
1518 { 25, 25, "Signature Expired before Valid" },
1519 { 26, 26, "Too Early" },
1520 { 27, 27, "Unsupported NSEC3 Iterations Value" },
1521 { 28, 28, "Unable to conform to policy" },
1522 { 29, 29, "Synthesized" },
1523 { 30, 49151, "Unassigned" },
1524 { 49152, 65535, "Reserved for Private Use" },
1527 #define DNS_ZONEVERSION_TYPE_SOA_SERIAL 0
1528 static const range_string dns_zoneversion_type
[] = {
1529 { DNS_ZONEVERSION_TYPE_SOA_SERIAL
, DNS_ZONEVERSION_TYPE_SOA_SERIAL
, "SOA-SERIAL" },
1530 { 1, 245, "Unassigned" },
1531 { 246, 254, "Private Use" },
1532 { 255, 255, "Reserved" },
1535 static void qname_host_and_domain(char* name
, int name_len
, char* host
, char* domain
)
1539 for (i
= 0; i
< name_len
; i
++) {
1540 if (name
[i
] == '.') {
1543 ws_label_strcpy(domain
, 256, 0, &name
[i
+ 1], 0);
1553 /* This function counts how many '.' are in the string, plus 1, in order to count the number
1557 qname_labels_count(const char* name
, int name_len
)
1559 unsigned labels
= 0;
1563 /* it was not a Zero-length name */
1564 for (i
= 0; i
< name_len
; i
++) {
1573 /* This function returns the number of bytes consumed and the expanded string
1575 * The string is allocated with wmem_packet_scope scope and does not need to be freed.
1576 * it will be automatically freed when the packet has been dissected.
1579 expand_dns_name(tvbuff_t
*tvb
, int offset
, int max_len
, int dns_data_offset
,
1580 const char **name
, int* name_len
)
1582 int start_offset
= offset
;
1585 int pointers_count
= 0;
1590 const int min_len
= 1; /* Minimum length of encoded name (for root) */
1591 /* If we're about to return a value (probably negative) which is less
1592 * than the minimum length, we're looking at bad data and we're liable
1593 * to put the dissector into a loop. Instead we throw an exception */
1595 maxname
= MAX_DNAME_LEN
;
1596 np
=(char *)wmem_alloc(wmem_packet_scope(), maxname
);
1601 if (max_len
&& offset
- start_offset
> max_len
- 1) {
1604 component_len
= tvb_get_uint8(tvb
, offset
);
1606 if (component_len
== 0) {
1609 switch (component_len
& 0xc0) {
1614 /* Not the first component - put in a '.'. */
1624 while (component_len
> 0) {
1625 if (max_len
&& offset
- start_offset
> max_len
- 1) {
1626 THROW(ReportedBoundsError
);
1629 *np
++ = tvb_get_uint8(tvb
, offset
);
1639 /* Extended label (RFC 2673) */
1640 switch (component_len
& 0x3f) {
1643 /* Bitstring label */
1649 bit_count
= tvb_get_uint8(tvb
, offset
);
1651 label_len
= (bit_count
- 1) / 8 + 1;
1654 print_len
= snprintf(np
, maxname
, "\\[x");
1655 if (print_len
<= maxname
) {
1657 maxname
-= print_len
;
1659 /* Nothing printed, as there's no room.
1660 Suppress all subsequent printing. */
1664 while (label_len
--) {
1666 print_len
= snprintf(np
, maxname
, "%02x",
1667 tvb_get_uint8(tvb
, offset
));
1668 if (print_len
<= maxname
) {
1670 maxname
-= print_len
;
1672 /* Nothing printed, as there's no room.
1673 Suppress all subsequent printing. */
1680 print_len
= snprintf(np
, maxname
, "/%d]", bit_count
);
1681 if (print_len
<= maxname
) {
1683 maxname
-= print_len
;
1685 /* Nothing printed, as there's no room.
1686 Suppress all subsequent printing. */
1694 *name
="<Unknown extended label>";
1695 *name_len
= (unsigned)strlen(*name
);
1696 /* Parsing will probably fail from here on, since the */
1697 /* label length is unknown... */
1698 len
= offset
- start_offset
;
1699 if (len
< min_len
) {
1700 THROW(ReportedBoundsError
);
1707 THROW(ReportedBoundsError
);
1712 indir_offset
= dns_data_offset
+
1713 (((component_len
& ~0xc0) << 8) | tvb_get_uint8(tvb
, offset
));
1717 /* If "len" is negative, we are still working on the original name,
1718 not something pointed to by a pointer, and so we should set "len"
1719 to the length of the original name. */
1721 len
= offset
- start_offset
;
1724 * If we find a pointer to itself, it is a trivial loop. Otherwise if we
1725 * processed a large number of pointers, assume an indirect loop.
1727 if (indir_offset
== offset
+ 2 || pointers_count
> MAX_DNAME_LEN
) {
1728 *name
="<Name contains a pointer that loops>";
1729 *name_len
= (unsigned)strlen(*name
);
1730 if (len
< min_len
) {
1731 THROW(ReportedBoundsError
);
1736 offset
= indir_offset
;
1737 break; /* now continue processing from there */
1741 // Do we have space for the terminating 0?
1746 *name
="<Name too long>";
1747 *name_len
= (unsigned)strlen(*name
);
1750 /* If "len" is negative, we haven't seen a pointer, and thus haven't
1751 set the length, so set it. */
1753 len
= offset
- start_offset
;
1759 /* return the bytes in the tvb consumed by the function. The converted string (that
1760 can contain null bytes, is written in name and its length in name_len. */
1762 get_dns_name(tvbuff_t
*tvb
, int offset
, int max_len
, int dns_data_offset
,
1763 const char **name
, int* name_len
)
1767 len
= expand_dns_name(tvb
, offset
, max_len
, dns_data_offset
, name
, name_len
);
1769 /* Zero-length name means "root server" */
1770 if (**name
== '\0' && len
<= MIN_DNAME_LEN
) {
1772 *name_len
= (int)strlen(*name
);
1776 if ((len
< MIN_DNAME_LEN
) || (len
> MIN_DNAME_LEN
&& *name_len
== 0)) {
1777 THROW(ReportedBoundsError
);
1784 get_dns_name_type_class(tvbuff_t
*tvb
, int offset
, int dns_data_offset
,
1785 const char **name
, int *name_len
, uint16_t *type
, uint16_t *dns_class
)
1787 int start_offset
= offset
;
1789 offset
+= get_dns_name(tvb
, offset
, 0, dns_data_offset
, name
, name_len
);
1791 *type
= tvb_get_ntohs(tvb
, offset
);
1794 *dns_class
= tvb_get_ntohs(tvb
, offset
);
1797 return offset
- start_offset
;
1801 rfc1867_size(tvbuff_t
*tvb
, int offset
)
1807 val
= tvb_get_uint8(tvb
, offset
);
1808 size
= (val
& 0xF0) >> 4;
1809 exponent
= (val
& 0x0F);
1810 while (exponent
!= 0) {
1814 return size
/ 100; /* return size in meters, not cm */
1818 rfc1867_angle(tvbuff_t
*tvb
, int offset
, bool longitude
)
1822 uint32_t degrees
, minutes
, secs
, tsecs
;
1823 /* "%u deg %u min %u.%03u sec %c" */
1824 static char buf
[10+1+3+1 + 2+1+3+1 + 2+1+3+1+3+1 + 1 + 1];
1826 angle
= tvb_get_ntohl(tvb
, offset
);
1828 if (angle
< 0x80000000U
) {
1829 angle
= 0x80000000U
- angle
;
1830 direction
= longitude
? 'W' : 'S';
1832 angle
= angle
- 0x80000000U
;
1833 direction
= longitude
? 'E' : 'N';
1836 if (longitude
? (angle
> 648000000) : (angle
> 324000000))
1838 snprintf(buf
, sizeof(buf
), "Value out of range");
1842 tsecs
= angle
% 1000;
1843 angle
= angle
/ 1000;
1846 minutes
= angle
% 60;
1847 degrees
= angle
/ 60;
1849 snprintf(buf
, sizeof(buf
), "%u deg %u min %u.%03u sec %c", degrees
, minutes
, secs
,
1855 dissect_dns_query(tvbuff_t
*tvb
, int offset
, int dns_data_offset
,
1856 packet_info
*pinfo
, proto_tree
*dns_tree
, bool is_mdns
,
1857 bool *is_multiple_responds
)
1866 const char *type_name
;
1873 data_start
= offset
;
1875 used_bytes
= get_dns_name_type_class(tvb
, offset
, dns_data_offset
, &name
, &name_len
,
1879 /* Split the QU flag and the class */
1880 qu
= dns_class
& C_QU
;
1886 if (type
== T_AXFR
|| type
== T_IXFR
) {
1887 *is_multiple_responds
= true;
1890 type_name
= val_to_str_ext(type
, &dns_types_vals_ext
, "Unknown (%u)");
1893 * The name might contain octets that aren't printable characters,
1894 * format it for display.
1896 name_out
= format_text(pinfo
->pool
, (const unsigned char *)name
, name_len
);
1898 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s %s", type_name
, name_out
);
1900 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", \"%s\" question", qu
? "QU" : "QM");
1902 if (dns_tree
!= NULL
) {
1903 q_tree
= proto_tree_add_subtree_format(dns_tree
, tvb
, offset
, used_bytes
, ett_dns_qd
, &tq
, "%s: type %s, class %s",
1904 name_out
, type_name
, val_to_str_const(dns_class
, dns_classes
, "Unknown"));
1906 proto_item_append_text(tq
, ", \"%s\" question", qu
? "QU" : "QM");
1909 /* The number of used bytes for qname is the total used bytes minus 2 bytes for qtype and 2 bytes for qclass */
1910 proto_tree_add_string(q_tree
, hf_dns_qry_name
, tvb
, offset
, used_bytes
- 4, name_out
);
1912 tq
= proto_tree_add_uint(q_tree
, hf_dns_qry_name_len
, tvb
, offset
, used_bytes
- 4, name_len
> 1 ? name_len
: 0);
1913 proto_item_set_generated(tq
);
1915 labels
= qname_labels_count(name
, name_len
);
1916 tq
= proto_tree_add_uint(q_tree
, hf_dns_count_labels
, tvb
, offset
, used_bytes
- 4, labels
);
1917 proto_item_set_generated(tq
);
1919 offset
+= used_bytes
- 4;
1921 ti
= proto_tree_add_item(q_tree
, hf_dns_qry_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1922 proto_item_append_text(ti
, " %s", val_to_str_ext(type
, &dns_types_description_vals_ext
, "Unknown (%d)"));
1926 proto_tree_add_uint(q_tree
, hf_dns_qry_class_mdns
, tvb
, offset
, 2, dns_class
);
1927 proto_tree_add_boolean(q_tree
, hf_dns_qry_qu
, tvb
, offset
, 2, qu
);
1929 proto_tree_add_uint(q_tree
, hf_dns_qry_class
, tvb
, offset
, 2, dns_class
);
1935 if (data_start
+ used_bytes
!= offset
) {
1936 /* Add expert info ? (about incorrect len...)*/
1943 add_rr_to_tree(proto_tree
*rr_tree
, tvbuff_t
*tvb
, int offset
,
1944 const char *name
, int namelen
, int type
,
1945 packet_info
*pinfo
, bool is_mdns
)
1948 proto_item
*ttl_item
;
1952 if (type
== T_SRV
&& name
[0]) {
1953 srv_rr_info
= wmem_strsplit(pinfo
->pool
, name
, ".", 4);
1955 // If there are >=3 labels and the third label starts with an underscore,
1956 // then likely a DNS-SD instance name is present [RFC 6763 sect 4.1], as in
1957 // instance._service._proto.example.com
1958 if (g_strv_length(srv_rr_info
) >= 3 && srv_rr_info
[2][0] == '_') {
1959 proto_tree_add_string(rr_tree
, hf_dns_srv_instance
, tvb
, offset
, namelen
, srv_rr_info
[0]);
1960 proto_tree_add_string(rr_tree
, hf_dns_srv_service
, tvb
, offset
, namelen
, srv_rr_info
[1]);
1961 proto_tree_add_string(rr_tree
, hf_dns_srv_proto
, tvb
, offset
, namelen
, srv_rr_info
[2]);
1962 if (srv_rr_info
[3]) {
1963 proto_tree_add_string(rr_tree
, hf_dns_srv_name
, tvb
, offset
, namelen
, srv_rr_info
[3]);
1966 // Else this is a normal SRV record like _service._proto.example.com
1968 proto_tree_add_string(rr_tree
, hf_dns_srv_service
, tvb
, offset
, namelen
, srv_rr_info
[0]);
1970 if (srv_rr_info
[1]) {
1971 proto_tree_add_string(rr_tree
, hf_dns_srv_proto
, tvb
, offset
, namelen
, srv_rr_info
[1]);
1973 if (srv_rr_info
[2]) {
1974 // If the name happens to only have 3 labels like "_service._proto.example",
1975 // then we can just use srv_rr_info[2] as the name; but otherwise,
1976 // the wmem_split above will turn "_service._proto.one.two.example.com"
1977 // into ["_service", "_proto", "one", "two.example.com"]
1978 // and we need to concatenate "one" + "." + "two.example.com" first
1979 if (srv_rr_info
[3]) {
1980 const char* domain_name
= wmem_strjoin(pinfo
->pool
, ".", srv_rr_info
[2], srv_rr_info
[3], NULL
);
1981 proto_tree_add_string(rr_tree
, hf_dns_srv_name
, tvb
, offset
, namelen
, domain_name
);
1983 proto_tree_add_string(rr_tree
, hf_dns_srv_name
, tvb
, offset
, namelen
, srv_rr_info
[2]);
1989 proto_tree_add_string(rr_tree
, hf_dns_rr_name
, tvb
, offset
, namelen
, name
);
1994 ti
= proto_tree_add_item(rr_tree
, hf_dns_rr_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1995 proto_item_append_text(ti
, " %s", val_to_str_ext(type
, &dns_types_description_vals_ext
, "Unknown (%d)"));
1998 proto_tree_add_item(rr_tree
, hf_dns_rr_class_mdns
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1999 proto_tree_add_item(rr_tree
, hf_dns_rr_cache_flush
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2001 proto_tree_add_item(rr_tree
, hf_dns_rr_class
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2004 ttl_item
= proto_tree_add_item_ret_uint(rr_tree
, hf_dns_rr_ttl
, tvb
, offset
, 4, ENC_BIG_ENDIAN
, &ttl_value
);
2005 // storing ttl in the context-specific array and then increments its array's
2006 // index for storing ttl of the next record
2007 if (dns_qr_statistics_enabled
) {
2008 // cap (or limit check) has been put in-place to avoid overflow
2009 // check https://gitlab.com/wireshark/wireshark/-/issues/19700
2010 if (*p_dns_qr_r_rx_ttl_index
< TTL_MAXIMUM_ELEMENTS
) {
2011 p_dns_qr_r_rx_ttls
[(*p_dns_qr_r_rx_ttl_index
)++] = ttl_value
;
2014 ws_debug("index(%u) >= (%u)TTL_MAXIMUM_ELEMENTS", *p_dns_qr_r_rx_ttl_index
, TTL_MAXIMUM_ELEMENTS
);
2017 proto_item_append_text(ttl_item
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, ttl_value
));
2018 if (ttl_value
& 0x80000000) {
2019 expert_add_info(pinfo
, ttl_item
, &ei_ttl_high_bit_set
);
2023 proto_tree_add_item(rr_tree
, hf_dns_rr_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2028 add_opt_rr_to_tree(proto_tree
*rr_tree
, tvbuff_t
*tvb
, int offset
,
2029 const char *name
, int namelen
, bool is_mdns
)
2036 proto_tree_add_string(rr_tree
, hf_dns_rr_name
, tvb
, offset
, namelen
, name
);
2038 ti
= proto_tree_add_item_ret_uint(rr_tree
, hf_dns_rr_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &type
);
2039 proto_item_append_text(ti
, " %s", val_to_str_ext(type
, &dns_types_description_vals_ext
, "Unknown (%d)"));
2042 proto_tree_add_item(rr_tree
, hf_dns_rr_udp_payload_size_mdns
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2043 proto_tree_add_item(rr_tree
, hf_dns_rr_cache_flush
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2045 proto_tree_add_item(rr_tree
, hf_dns_rr_udp_payload_size
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2048 proto_tree_add_item(rr_tree
, hf_dns_rr_ext_rcode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2050 proto_tree_add_item(rr_tree
, hf_dns_rr_edns0_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2052 Z_item
= proto_tree_add_item(rr_tree
, hf_dns_rr_z
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2053 Z_tree
= proto_item_add_subtree(Z_item
, ett_dns_rr
);
2054 proto_tree_add_item(Z_tree
, hf_dns_rr_z_do
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2055 proto_tree_add_item(Z_tree
, hf_dns_rr_z_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2057 proto_tree_add_item(rr_tree
, hf_dns_rr_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2061 dissect_type_bitmap(proto_tree
*rr_tree
, tvbuff_t
*tvb
, int cur_offset
, int rr_len
)
2063 int mask
, blockbase
, blocksize
;
2064 int i
, initial_offset
, rr_type
;
2067 initial_offset
= cur_offset
;
2068 while (rr_len
!= 0) {
2069 blockbase
= tvb_get_uint8(tvb
, cur_offset
);
2070 blocksize
= tvb_get_uint8(tvb
, cur_offset
+ 1);
2073 rr_type
= blockbase
* 256;
2074 for( ; blocksize
; blocksize
-- ) {
2075 bits
= tvb_get_uint8(tvb
, cur_offset
);
2077 for (i
= 0; i
< 8; i
++) {
2079 proto_tree_add_uint_format(rr_tree
, hf_dns_rr_type
, tvb
, cur_offset
, 1, rr_type
,
2080 "RR type in bit map: %s %s",
2081 val_to_str_ext_const(rr_type
, &dns_types_vals_ext
, " "),
2082 val_to_str_ext(rr_type
, &dns_types_description_vals_ext
, "Unknown (%d)")
2092 return initial_offset
- cur_offset
;
2096 dissect_type_bitmap_nxt(proto_tree
*rr_tree
, tvbuff_t
*tvb
, int cur_offset
, int rr_len
)
2099 int i
, initial_offset
, rr_type
;
2102 initial_offset
= cur_offset
;
2104 while (rr_len
!= 0) {
2105 bits
= tvb_get_uint8(tvb
, cur_offset
);
2107 for (i
= 0; i
< 8; i
++) {
2109 proto_tree_add_uint_format(rr_tree
, hf_dns_rr_type
, tvb
, cur_offset
, 1, rr_type
,
2110 "RR type in bit map: %s %s",
2111 val_to_str_ext_const(rr_type
, &dns_types_vals_ext
, " "),
2112 val_to_str_ext(rr_type
, &dns_types_description_vals_ext
, "Unknown (%d)"));
2121 return initial_offset
- cur_offset
;
2125 * SIG, KEY, and CERT RR algorithms.
2126 * http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.txt (last updated 2017-01-09)
2128 #define DNS_ALGO_RSAMD5 1 /* RSA/MD5 */
2129 #define DNS_ALGO_DH 2 /* Diffie-Hellman */
2130 #define DNS_ALGO_DSA 3 /* DSA */
2131 #define DNS_ALGO_ECC 4 /* Elliptic curve crypto */
2132 #define DNS_ALGO_RSASHA1 5 /* RSA/SHA1 */
2133 #define DNS_ALGO_DSA_NSEC3_SHA1 6 /* DSA + NSEC3/SHA1 */
2134 #define DNS_ALGO_RSASHA1_NSEC3_SHA1 7 /* RSA/SHA1 + NSEC3/SHA1 */
2135 #define DNS_ALGO_RSASHA256 8 /* RSA/SHA-256 */
2136 #define DNS_ALGO_RSASHA512 10 /* RSA/SHA-512 */
2137 #define DNS_ALGO_ECCGOST 12 /* GOST R 34.10-2001 */
2138 #define DNS_ALGO_ECDSAP256SHA256 13 /* ECDSA Curve P-256 with SHA-256 */
2139 #define DNS_ALGO_ECDSAP384SHA384 14 /* ECDSA Curve P-384 with SHA-384 */
2140 #define DNS_ALGO_ED25519 15 /* Ed25519 */
2141 #define DNS_ALGO_ED448 16 /* Ed448 */
2142 #define DNS_ALGO_HMACMD5 157 /* HMAC/MD5 */
2143 #define DNS_ALGO_INDIRECT 252 /* Indirect key */
2144 #define DNS_ALGO_PRIVATEDNS 253 /* Private, domain name */
2145 #define DNS_ALGO_PRIVATEOID 254 /* Private, OID */
2147 static const value_string dnssec_algo_vals
[] = {
2148 { DNS_ALGO_RSAMD5
, "RSA/MD5" },
2149 { DNS_ALGO_DH
, "Diffie-Hellman" },
2150 { DNS_ALGO_DSA
, "DSA" },
2151 { DNS_ALGO_ECC
, "Elliptic curve crypto" },
2152 { DNS_ALGO_RSASHA1
, "RSA/SHA1" },
2153 { DNS_ALGO_DSA_NSEC3_SHA1
, "DSA + NSEC3/SHA1" },
2154 { DNS_ALGO_RSASHA1_NSEC3_SHA1
,"RSA/SHA1 + NSEC3/SHA1" },
2155 { DNS_ALGO_RSASHA256
, "RSA/SHA-256" },
2156 { DNS_ALGO_RSASHA512
, "RSA/SHA-512" },
2157 { DNS_ALGO_ECCGOST
, "GOST R 34.10-2001" },
2158 { DNS_ALGO_ECDSAP256SHA256
, "ECDSA Curve P-256 with SHA-256" },
2159 { DNS_ALGO_ECDSAP384SHA384
, "ECDSA Curve P-384 with SHA-384" },
2160 { DNS_ALGO_ED25519
, "Ed25519" },
2161 { DNS_ALGO_ED448
, "Ed448" },
2162 { DNS_ALGO_HMACMD5
, "HMAC/MD5" },
2163 { DNS_ALGO_INDIRECT
, "Indirect key" },
2164 { DNS_ALGO_PRIVATEDNS
, "Private, domain name" },
2165 { DNS_ALGO_PRIVATEOID
, "Private, OID" },
2170 Delegation Signer (DS) Resource Record (RR) Type Digest Algorithms
2171 https://www.iana.org/assignments/ds-rr-types/ds-rr-types.txt (last-updated 2012-04-13)
2173 #define DS_DIGEST_RESERVED 0
2174 #define DS_DIGEST_SHA1 1 /* MANDATORY [RFC3658] */
2175 #define DS_DIGEST_SHA256 2 /* MANDATORY [RFC4509] */
2176 #define DS_DIGEST_GOST 3 /* OPTIONAL [RFC5933] */
2177 #define DS_DIGEST_SHA384 4 /*OPTIONAL [RFC6605] */
2179 static const value_string dns_ds_digest_vals
[] = {
2180 { DS_DIGEST_RESERVED
, "Reserved digest" },
2181 { DS_DIGEST_SHA1
, "SHA-1" },
2182 { DS_DIGEST_SHA256
, "SHA-256" },
2183 { DS_DIGEST_GOST
, "GOST R 34.11-94" },
2184 { DS_DIGEST_SHA384
, "SHA-384" },
2187 /* DNSKEY : RFC4034 */
2188 #define DNSKEY_FLAGS_ZK 0x0100
2189 #define DNSKEY_FLAGS_KR 0x0080
2190 #define DNSKEY_FLAGS_SEP 0x0001
2191 #define DNSKEY_FLAGS_RSV 0xFE7E
2193 static const true_false_string dns_dnskey_zone_key_tfs
= { "This is the zone key for specified zone", "This it not a zone key" };
2196 #define DNS_CERT_PKIX 1 /* X509 certificate */
2197 #define DNS_CERT_SPKI 2 /* Simple public key certificate */
2198 #define DNS_CERT_PGP 3 /* OpenPGP packet */
2199 #define DNS_CERT_IPKIX 4 /* Indirect PKIX */
2200 #define DNS_CERT_ISPKI 5 /* Indirect SPKI */
2201 #define DNS_CERT_IPGP 6 /* Indirect PGP */
2202 #define DNS_CERT_ACPKIX 7 /* Attribute certificate */
2203 #define DNS_CERT_IACPKIX 8 /* Indirect ACPKIX */
2204 #define DNS_CERT_PRIVATEURI 253 /* Private, URI */
2205 #define DNS_CERT_PRIVATEOID 254 /* Private, OID */
2207 static const value_string dns_cert_type_vals
[] = {
2208 { DNS_CERT_PKIX
, "PKIX" },
2209 { DNS_CERT_SPKI
, "SPKI" },
2210 { DNS_CERT_PGP
, "PGP" },
2211 { DNS_CERT_IPKIX
, "IPKIX" },
2212 { DNS_CERT_ISPKI
, "ISPKI" },
2213 { DNS_CERT_IPGP
, "IPGP" },
2214 { DNS_CERT_ACPKIX
, "ACPKIX" },
2215 { DNS_CERT_IACPKIX
, "IACPKIX" },
2216 { DNS_CERT_PRIVATEURI
, "Private, URI" },
2217 { DNS_CERT_PRIVATEOID
, "Private, OID" },
2221 #define XSALSA20_POLY1305 0x0001
2222 #define XCHACHA20_POLY1305 0x0002
2224 static const value_string esversions
[] = {
2225 { XSALSA20_POLY1305
, "XSalsa20Poly1305" },
2226 { XCHACHA20_POLY1305
, "XChacha20Poly1305" },
2231 * Compute the key id of a KEY RR depending of the algorithm used.
2234 compute_key_id(proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
, int size
, uint8_t algo
, uint16_t *key_id
)
2242 item
= proto_tree_add_expert(tree
, pinfo
, &ei_dns_key_id_buffer_too_short
, tvb
, offset
, size
);
2243 proto_item_set_generated(item
);
2248 case DNS_ALGO_RSAMD5
:
2249 *key_id
= (uint16_t)(tvb_get_uint8(tvb
, offset
+ size
- 3) << 8) + tvb_get_uint8( tvb
, offset
+ size
- 2 );
2252 for (ac
= 0; size
> 1; size
-= 2, offset
+= 2) {
2253 c1
= tvb_get_uint8( tvb
, offset
);
2254 c2
= tvb_get_uint8( tvb
, offset
+ 1 );
2255 ac
+= (c1
<< 8) + c2
;
2258 c1
= tvb_get_uint8( tvb
, offset
);
2261 ac
+= (ac
>> 16) & 0xffff;
2262 *key_id
= (uint16_t)(ac
& 0xffff);
2268 /* Dissect a SvbParam where the presentation format of the value is base64. */
2270 dissect_dns_svcparam_base64(proto_tree
*param_tree
, proto_item
*param_item
, int hf_id
, tvbuff_t
*tvb
, int offset
, unsigned length
)
2272 char *str
= g_base64_encode((uint8_t *)tvb_memdup(wmem_packet_scope(), tvb
, offset
, length
), length
);
2273 proto_tree_add_bytes_format_value(param_tree
, hf_id
, tvb
, offset
, length
, NULL
, "%s", str
);
2274 proto_item_append_text(param_item
, "=%s", str
);
2279 add_timestamp(proto_tree
*tree
, int hf_id
, tvbuff_t
*tvb
, int offset
)
2281 time_t date
= tvb_get_ntohl(tvb
, offset
);
2282 nstime_t tv
= {0, 0};
2283 tv
.secs
= (time_t)(date
);
2284 proto_tree_add_time(tree
, hf_id
, tvb
, offset
, 4, &tv
);
2287 /* The client begins a DNSCrypt session by sending a regular unencrypted
2288 TXT DNS query to the resolver IP address
2289 https://dnscrypt.info/protocol/
2290 https://www.ietf.org/archive/id/draft-denis-dprive-dnscrypt-01.html
2291 https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/dnscrypt_certs.go
2294 dissect_dnscrypt(proto_tree
*tree
, tvbuff_t
*tvb
, int offset
, unsigned length
)
2296 proto_item
*sub_item
;
2297 proto_tree
*sub_tree
;
2299 sub_item
= proto_tree_add_item(tree
, hf_dns_dnscrypt
, tvb
, offset
, length
, ENC_NA
);
2300 sub_tree
= proto_item_add_subtree(sub_item
, ett_dns_dnscrypt
);
2302 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_magic
, tvb
, offset
, 4, ENC_ASCII
);
2305 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_esversion
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2308 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_protocol_version
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2311 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_signature
, tvb
, offset
, 64, ENC_NA
);
2314 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_resolver_pk
, tvb
, offset
, 32, ENC_NA
);
2317 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_client_magic
, tvb
, offset
, 8, ENC_NA
);
2320 proto_tree_add_item(sub_tree
, hf_dns_dnscrypt_serial_number
, tvb
, offset
, 4, ENC_NA
);
2323 add_timestamp(sub_tree
, hf_dns_dnscrypt_ts_start
, tvb
, offset
);
2326 add_timestamp(sub_tree
, hf_dns_dnscrypt_ts_end
, tvb
, offset
);
2333 dissect_dns_answer(tvbuff_t
*tvb
, int offsetx
, int dns_data_offset
,
2334 proto_tree
*dns_tree
, packet_info
*pinfo
,
2335 bool is_mdns
, wmem_list_t
*dns_type_list
)
2343 const char *class_name
;
2344 const char *type_name
;
2349 proto_tree
*rr_tree
= NULL
;
2350 proto_item
*trr
= NULL
;
2351 unsigned used_bytes
;
2353 data_start
= data_offset
= offsetx
;
2354 cur_offset
= offsetx
;
2356 used_bytes
= get_dns_name_type_class(tvb
, offsetx
, dns_data_offset
, &name
, &name_len
,
2357 &dns_type
, &dns_class
);
2359 /* The offset if the total used bytes minus 2 bytes for qtype and 2 bytes for qclass */
2360 data_offset
+= used_bytes
;
2361 cur_offset
+= used_bytes
;
2363 /* Split the FLUSH flag and the class */
2364 flush
= dns_class
& C_FLUSH
;
2365 dns_class
&= ~C_FLUSH
;
2369 type_name
= val_to_str_ext(dns_type
, &dns_types_vals_ext
, "Unknown (%d)");
2370 class_name
= val_to_str_const(dns_class
, dns_classes
, "Unknown");
2375 data_len
= tvb_get_ntohs(tvb
, data_offset
);
2380 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", type_name
);
2381 if (is_mdns
&& flush
) {
2382 col_append_str(pinfo
->cinfo
, COL_INFO
, ", cache flush");
2385 wmem_list_append(dns_type_list
, GINT_TO_POINTER(dns_type
));
2388 * The name might contain octets that aren't printable characters,
2389 * format it for display.
2391 name_out
= format_text(pinfo
->pool
, (const unsigned char*)name
, name_len
);
2392 if (dns_type
!= T_OPT
) {
2393 rr_tree
= proto_tree_add_subtree_format(dns_tree
, tvb
, offsetx
,
2394 (data_offset
- data_start
) + data_len
,
2395 ett_dns_rr
, &trr
, "%s: type %s, class %s",
2396 name_out
, type_name
, class_name
);
2397 add_rr_to_tree(rr_tree
, tvb
, offsetx
, name_out
, used_bytes
- 4,
2398 dns_type
, pinfo
, is_mdns
);
2400 rr_tree
= proto_tree_add_subtree_format(dns_tree
, tvb
, offsetx
,
2401 (data_offset
- data_start
) + data_len
,
2402 ett_dns_rr
, &trr
, "%s: type %s", name_out
, type_name
);
2403 add_opt_rr_to_tree(rr_tree
, tvb
, offsetx
, name_out
, used_bytes
- 4, is_mdns
);
2405 if (is_mdns
&& flush
) {
2406 proto_item_append_text(trr
, ", cache flush");
2409 if (data_len
== 0) {
2410 return data_offset
- data_start
;
2415 case T_A
: /* a host Address (1) */
2417 switch (dns_class
) {
2418 /* RFC 1034 Section 3.6
2420 * A For the IN class, a 32 bit IP address
2422 * For the CH class, a domain name followed
2423 * by a 16 bit octal Chaos address.
2429 addr
= tvb_ip_to_str(pinfo
->pool
, tvb
, cur_offset
);
2430 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", addr
);
2432 proto_item_append_text(trr
, ", addr %s", addr
);
2433 proto_tree_add_item(rr_tree
, hf_dns_a
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2435 if (gbl_resolv_flags
.dns_pkt_addr_resolution
&& dns_class
== C_IN
&&
2436 !PINFO_FD_VISITED(pinfo
)) {
2438 tvb_memcpy(tvb
, &addr_int
, cur_offset
, sizeof(addr_int
));
2439 add_ipv4_name(addr_int
, name
, false);
2446 const char *domain_name
;
2447 int domain_name_len
;
2450 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &domain_name
, &domain_name_len
);
2451 name_out
= format_text(pinfo
->pool
, (const unsigned char*)domain_name
, domain_name_len
);
2452 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2453 proto_item_append_text(trr
, ", domain/addr %s", name_out
);
2454 proto_tree_add_string(rr_tree
, hf_dns_a_ch_domain
, tvb
, cur_offset
, used_bytes
, name_out
);
2456 proto_tree_add_item_ret_uint(rr_tree
, hf_dns_a_ch_addr
, tvb
, cur_offset
+ used_bytes
, 2, ENC_BIG_ENDIAN
, &ch_addr
);
2457 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "/0%o", ch_addr
);
2458 proto_item_append_text(trr
, "/0%o", ch_addr
);
2464 expert_add_info_format(pinfo
, trr
, &ei_dns_a_class_undecoded
,
2465 "A record dissection for class (%d)"
2466 " code not implemented, Contact Wireshark developers"
2467 " if you want this supported", dns_class
);
2468 proto_tree_add_item(rr_tree
, hf_dns_data
, tvb
, cur_offset
, data_len
, ENC_NA
);
2475 case T_NS
: /* an authoritative Name Server (2) */
2477 const char *ns_name
;
2480 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &ns_name
, &ns_name_len
);
2481 name_out
= format_text(pinfo
->pool
, (const unsigned char*)ns_name
, ns_name_len
);
2482 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2483 proto_item_append_text(trr
, ", ns %s", name_out
);
2484 proto_tree_add_string(rr_tree
, hf_dns_ns
, tvb
, cur_offset
, used_bytes
, name_out
);
2489 case T_MD
: /* Mail Destination (3) */
2492 const char *hostname_str
;
2494 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2496 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &hostname_str
, &hostname_len
);
2497 name_out
= format_text(pinfo
->pool
, (const unsigned char*)hostname_str
, hostname_len
);
2498 proto_tree_add_string(rr_tree
, hf_dns_md
, tvb
, cur_offset
, used_bytes
, name_out
);
2502 case T_MF
: /* Mail Forwarder (4) */
2505 const char *hostname_str
;
2507 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2509 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &hostname_str
, &hostname_len
);
2510 name_out
= format_text(pinfo
->pool
, (const unsigned char*)hostname_str
, hostname_len
);
2511 proto_tree_add_string(rr_tree
, hf_dns_mf
, tvb
, cur_offset
, used_bytes
, name_out
);
2515 case T_CNAME
: /* the Canonical NAME for an alias (5) */
2520 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &cname
, &cname_len
);
2521 name_out
= format_text(pinfo
->pool
, (const unsigned char*)cname
, cname_len
);
2522 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2523 proto_item_append_text(trr
, ", cname %s", name_out
);
2524 proto_tree_add_string(rr_tree
, hf_dns_cname
, tvb
, cur_offset
, used_bytes
, name_out
);
2529 case T_SOA
: /* Start Of Authority zone (6) */
2537 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &mname
, &mname_len
);
2538 name_out
= format_text(pinfo
->pool
, (const unsigned char*)mname
, mname_len
);
2539 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2540 proto_item_append_text(trr
, ", mname %s", name_out
);
2541 proto_tree_add_string(rr_tree
, hf_dns_soa_mname
, tvb
, cur_offset
, used_bytes
, name_out
);
2542 cur_offset
+= used_bytes
;
2544 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &rname
, &rname_len
);
2545 name_out
= format_text(pinfo
->pool
, (const unsigned char*)rname
, rname_len
);
2546 proto_tree_add_string(rr_tree
, hf_dns_soa_rname
, tvb
, cur_offset
, used_bytes
, name_out
);
2547 cur_offset
+= used_bytes
;
2549 proto_tree_add_item(rr_tree
, hf_dns_soa_serial_number
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2552 ti_soa
= proto_tree_add_item(rr_tree
, hf_dns_soa_refresh_interval
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2553 proto_item_append_text(ti_soa
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, tvb_get_ntohl(tvb
, cur_offset
)));
2556 ti_soa
= proto_tree_add_item(rr_tree
, hf_dns_soa_retry_interval
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2557 proto_item_append_text(ti_soa
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, tvb_get_ntohl(tvb
, cur_offset
)));
2560 ti_soa
= proto_tree_add_item(rr_tree
, hf_dns_soa_expire_limit
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2561 proto_item_append_text(ti_soa
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, tvb_get_ntohl(tvb
, cur_offset
)));
2564 ti_soa
= proto_tree_add_item(rr_tree
, hf_dns_soa_minimum_ttl
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2565 proto_item_append_text(ti_soa
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, tvb_get_ntohl(tvb
, cur_offset
)));
2569 case T_MB
: /* MailBox domain (7) */
2572 const char *hostname_str
;
2574 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2576 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &hostname_str
, &hostname_len
);
2577 name_out
= format_text(pinfo
->pool
, (const unsigned char*)hostname_str
, hostname_len
);
2578 proto_tree_add_string(rr_tree
, hf_dns_mb
, tvb
, cur_offset
, used_bytes
, name_out
);
2582 case T_MG
: /* Mail Group member (8) */
2585 const char *hostname_str
;
2587 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2589 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &hostname_str
, &hostname_len
);
2590 name_out
= format_text(pinfo
->pool
, (const unsigned char*)hostname_str
, hostname_len
);
2591 proto_tree_add_string(rr_tree
, hf_dns_mg
, tvb
, cur_offset
, used_bytes
, name_out
);
2595 case T_MR
: /* Mail Rename domain (9) */
2598 const char *hostname_str
;
2600 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2602 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &hostname_str
, &hostname_len
);
2603 name_out
= format_text(pinfo
->pool
, (const unsigned char*)hostname_str
, hostname_len
);
2604 proto_tree_add_string(rr_tree
, hf_dns_mr
, tvb
, cur_offset
, used_bytes
, name_out
);
2608 case T_NULL
: /* Null (10) */
2610 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2611 proto_tree_add_item(rr_tree
, hf_dns_null
, tvb
, cur_offset
, data_len
, ENC_NA
);
2615 case T_WKS
: /* Well Known Service (11) */
2617 int rr_len
= data_len
;
2618 const char *wks_addr
;
2625 wmem_strbuf_t
*bitnames
= wmem_strbuf_create(pinfo
->pool
);
2627 wks_addr
= tvb_ip_to_str(pinfo
->pool
, tvb
, cur_offset
);
2628 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", wks_addr
);
2629 proto_item_append_text(trr
, ", addr %s", wks_addr
);
2630 proto_tree_add_item(rr_tree
, hf_dns_wks_address
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
2634 proto_tree_add_item(rr_tree
, hf_dns_wks_protocol
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2635 protocol
= tvb_get_uint8(tvb
, cur_offset
);
2640 while (rr_len
!= 0) {
2641 bits
= tvb_get_uint8(tvb
, cur_offset
);
2644 wmem_strbuf_truncate(bitnames
, 0);
2645 for (i
= 0; i
< 8; i
++) {
2647 if (wmem_strbuf_get_len(bitnames
) > 0) {
2648 wmem_strbuf_append(bitnames
, ", ");
2653 wmem_strbuf_append(bitnames
, tcp_port_to_display(pinfo
->pool
, port_num
));
2657 wmem_strbuf_append(bitnames
, udp_port_to_display(pinfo
->pool
, port_num
));
2661 wmem_strbuf_append_printf(bitnames
, "%u", port_num
);
2669 ti_wks
= proto_tree_add_item(rr_tree
, hf_dns_wks_bits
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2670 proto_item_append_text(ti_wks
, " (%s)", wmem_strbuf_get_str(bitnames
));
2680 case T_PTR
: /* Domain Name Pointer (12) */
2685 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &pname
, &pname_len
);
2686 name_out
= format_text(pinfo
->pool
, (const unsigned char*)pname
, pname_len
);
2687 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2688 proto_item_append_text(trr
, ", %s", name_out
);
2689 proto_tree_add_string(rr_tree
, hf_dns_ptr_domain_name
, tvb
, cur_offset
, used_bytes
, name_out
);
2691 if (gbl_resolv_flags
.dns_pkt_addr_resolution
&& (dns_class
& 0x7f) == C_IN
&&
2692 !PINFO_FD_VISITED(pinfo
)) {
2696 name_tokens
= g_strsplit(name
, ".", 33);
2698 if (g_strv_length(name_tokens
) == 6) {
2699 if (g_ascii_strcasecmp(name_tokens
[4], "in-addr") == 0 &&
2700 g_ascii_strcasecmp(name_tokens
[5], "arpa") == 0) {
2701 char* addr_str
= g_strjoin(".", name_tokens
[3], name_tokens
[2], name_tokens
[1], name_tokens
[0], NULL
);
2702 if (ws_inet_pton4(addr_str
, &addr_int
)) {
2703 add_ipv4_name(addr_int
, name_out
, false);
2707 } else if (g_strv_length(name_tokens
) == 33) {
2708 if (g_ascii_strcasecmp(name_tokens
[32], "ip6.arpa") == 0) {
2709 ws_in6_addr address_ipv6
;
2711 wmem_strbuf_t
*address_buf
= wmem_strbuf_new_sized(pinfo
->pool
, 40);
2712 for (size_t i
= 31; i
> 0; i
--) {
2713 wmem_strbuf_append(address_buf
, name_tokens
[i
]);
2715 wmem_strbuf_append_c(address_buf
, ':');
2718 wmem_strbuf_append(address_buf
, name_tokens
[0]);
2719 if (ws_inet_pton6(wmem_strbuf_get_str(address_buf
), &address_ipv6
)) {
2720 add_ipv6_name(&address_ipv6
, name_out
, false);
2722 wmem_strbuf_destroy(address_buf
);
2725 g_strfreev(name_tokens
);
2730 case T_HINFO
: /* Host Information (13) */
2739 cpu_offset
= cur_offset
;
2740 cpu_len
= tvb_get_uint8(tvb
, cpu_offset
);
2741 cpu
= (const char* )tvb_get_string_enc(pinfo
->pool
, tvb
, cpu_offset
+ 1, cpu_len
, ENC_ASCII
|ENC_NA
);
2742 os_offset
= cpu_offset
+ 1 + cpu_len
;
2743 os_len
= tvb_get_uint8(tvb
, os_offset
);
2744 os
= (const char*)tvb_get_string_enc(pinfo
->pool
, tvb
, os_offset
+ 1, os_len
, ENC_ASCII
|ENC_NA
);
2745 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s %s", cpu
, os
);
2746 proto_item_append_text(trr
, ", CPU %s, OS %s", cpu
, os
);
2748 proto_tree_add_item(rr_tree
, hf_dns_hinfo_cpu_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2750 proto_tree_add_item(rr_tree
, hf_dns_hinfo_cpu
, tvb
, cur_offset
, cpu_len
, ENC_ASCII
);
2751 cur_offset
+= cpu_len
;
2753 proto_tree_add_item(rr_tree
, hf_dns_hinfo_os_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2755 proto_tree_add_item(rr_tree
, hf_dns_hinfo_os
, tvb
, cur_offset
, os_len
, ENC_ASCII
);
2756 /* cur_offset += os_len;*/
2760 case T_MINFO
: /* Mailbox or Mail list INFOrmation (14) */
2762 int rmailbx_len
, emailbx_len
;
2763 const char *rmailbx_str
, *emailbx_str
;
2765 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2767 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &rmailbx_str
, &rmailbx_len
);
2768 name_out
= format_text(pinfo
->pool
, (const unsigned char*)rmailbx_str
, rmailbx_len
);
2769 proto_tree_add_string(rr_tree
, hf_dns_minfo_r_mailbox
, tvb
, cur_offset
, used_bytes
, name_out
);
2770 cur_offset
+= used_bytes
;
2772 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &emailbx_str
, &emailbx_len
);
2773 name_out
= format_text(pinfo
->pool
, (const unsigned char*)emailbx_str
, emailbx_len
);
2774 proto_tree_add_string(rr_tree
, hf_dns_minfo_e_mailbox
, tvb
, cur_offset
, used_bytes
, name_out
);
2778 case T_MX
: /* Mail eXchange (15) */
2780 uint16_t preference
= 0;
2781 const char *mx_name
;
2784 preference
= tvb_get_ntohs(tvb
, cur_offset
);
2786 used_bytes
= get_dns_name(tvb
, cur_offset
+ 2, 0, dns_data_offset
, &mx_name
, &mx_name_len
);
2787 name_out
= format_text(pinfo
->pool
, (const unsigned char*)mx_name
, mx_name_len
);
2788 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %u %s", preference
, name_out
);
2789 proto_item_append_text(trr
, ", preference %u, mx %s",
2790 preference
, name_out
);
2791 proto_tree_add_item(rr_tree
, hf_dns_mx_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2793 proto_tree_add_string(rr_tree
, hf_dns_mx_mail_exchange
, tvb
, cur_offset
, used_bytes
, name_out
);
2794 /* cur_offset += used_bytes; */
2798 case T_TXT
: /* TeXT strings (16) */
2800 int rr_len
= data_len
;
2803 const bool is_dnscrypt_name
= (strstr(name
, "2.dnscrypt-cert.") != NULL
);
2804 #define DNSCRYPT_CERT_MAGIC 0x444E5343
2806 txt_offset
= cur_offset
;
2807 while (rr_len
!= 0) {
2808 txt_len
= tvb_get_uint8(tvb
, txt_offset
);
2809 proto_tree_add_item(rr_tree
, hf_dns_txt_length
, tvb
, txt_offset
, 1, ENC_BIG_ENDIAN
);
2812 if( is_dnscrypt_name
2814 && rr_len
>= txt_len
2815 && tvb_get_uint32(tvb
, txt_offset
, ENC_BIG_ENDIAN
) == DNSCRYPT_CERT_MAGIC
){
2816 dissect_dnscrypt(rr_tree
, tvb
, txt_offset
, txt_len
);
2818 proto_tree_add_item(rr_tree
, hf_dns_txt
, tvb
, txt_offset
, txt_len
, is_mdns
? ENC_UTF_8
|ENC_NA
: ENC_ASCII
|ENC_NA
);
2820 txt_offset
+= txt_len
;
2826 case T_RP
: /* Responsible Person (17) */
2828 int mbox_dname_len
, txt_dname_len
;
2829 const char *mbox_dname
, *txt_dname
;
2831 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2833 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &mbox_dname
, &mbox_dname_len
);
2834 name_out
= format_text(pinfo
->pool
, (const unsigned char*)mbox_dname
, mbox_dname_len
);
2835 proto_tree_add_string(rr_tree
, hf_dns_rp_mailbox
, tvb
, cur_offset
, used_bytes
, name_out
);
2836 cur_offset
+= used_bytes
;
2838 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &txt_dname
, &txt_dname_len
);
2839 name_out
= format_text(pinfo
->pool
, (const unsigned char*)txt_dname
, txt_dname_len
);
2840 proto_tree_add_string(rr_tree
, hf_dns_rp_txt_rr
, tvb
, cur_offset
, used_bytes
, name_out
);
2844 case T_AFSDB
: /* AFS data base location (18) */
2846 const char *host_name
;
2849 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2851 used_bytes
= get_dns_name(tvb
, cur_offset
+ 2, 0, dns_data_offset
, &host_name
, &host_name_len
);
2852 name_out
= format_text(pinfo
->pool
, (const unsigned char*)host_name
, host_name_len
);
2854 proto_tree_add_item(rr_tree
, hf_dns_afsdb_subtype
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2857 proto_tree_add_string(rr_tree
, hf_dns_afsdb_hostname
, tvb
, cur_offset
, used_bytes
, name_out
);
2861 case T_X25
: /* X.25 address (19) */
2865 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2867 proto_tree_add_item(rr_tree
, hf_dns_x25_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2868 x25_len
= tvb_get_uint8(tvb
, cur_offset
);
2871 proto_tree_add_item(rr_tree
, hf_dns_x25_psdn_address
, tvb
, cur_offset
, x25_len
, ENC_ASCII
);
2872 /*cur_offset += x25_len;*/
2876 case T_ISDN
: /* ISDN address (20) */
2878 uint8_t isdn_address_len
, isdn_sa_len
;
2879 int rr_len
= data_len
;
2881 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2883 proto_tree_add_item(rr_tree
, hf_dns_isdn_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2884 isdn_address_len
= tvb_get_uint8(tvb
, cur_offset
);
2888 proto_tree_add_item(rr_tree
, hf_dns_isdn_address
, tvb
, cur_offset
, isdn_address_len
, ENC_ASCII
);
2889 cur_offset
+= isdn_address_len
;
2890 rr_len
-= isdn_address_len
;
2892 if (rr_len
> 1) /* ISDN SA is optional */ {
2893 proto_tree_add_item(rr_tree
, hf_dns_isdn_sa_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2894 isdn_sa_len
= tvb_get_uint8(tvb
, cur_offset
);
2897 proto_tree_add_item(rr_tree
, hf_dns_isdn_sa
, tvb
, cur_offset
, isdn_sa_len
, ENC_ASCII
);
2902 case T_RT
: /* Route-Through (21) */
2904 const char *host_name
;
2907 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2909 used_bytes
= get_dns_name(tvb
, cur_offset
+ 2, 0, dns_data_offset
, &host_name
, &host_name_len
);
2910 name_out
= format_text(pinfo
->pool
, (const unsigned char*)host_name
, host_name_len
);
2912 proto_tree_add_item(rr_tree
, hf_dns_rt_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2915 proto_tree_add_string(rr_tree
, hf_dns_rt_intermediate_host
, tvb
, cur_offset
, used_bytes
, name_out
);
2919 case T_NSAP
: /* for NSAP address, NSAP style A record (22) */
2921 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2922 proto_tree_add_item(rr_tree
, hf_dns_nsap_rdata
, tvb
, cur_offset
, data_len
, ENC_NA
);
2926 case T_NSAP_PTR
: /* for domain name pointer, NSAP style (23) */
2928 int nsap_ptr_owner_len
;
2929 const char *nsap_ptr_owner
;
2931 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2933 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &nsap_ptr_owner
, &nsap_ptr_owner_len
);
2934 name_out
= format_text(pinfo
->pool
, (const unsigned char*)nsap_ptr_owner
, nsap_ptr_owner_len
);
2935 proto_tree_add_string(rr_tree
, hf_dns_nsap_ptr_owner
, tvb
, cur_offset
, used_bytes
, name_out
);
2940 case T_KEY
: /* Public Key (25) */
2942 int rr_len
= data_len
;
2944 proto_item
*tf
, *ti_gen
;
2945 proto_tree
*flags_tree
;
2949 tf
= proto_tree_add_item(rr_tree
, hf_dns_key_flags
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2950 flags_tree
= proto_item_add_subtree(tf
, ett_key_flags
);
2951 flags
= tvb_get_ntohs(tvb
, cur_offset
);
2953 proto_tree_add_item(flags_tree
, hf_dns_key_flags_authentication
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2954 proto_tree_add_item(flags_tree
, hf_dns_key_flags_confidentiality
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2955 if ((flags
& 0xC000) != 0xC000) {
2957 proto_tree_add_item(flags_tree
, hf_dns_key_flags_key_required
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2958 proto_tree_add_item(flags_tree
, hf_dns_key_flags_associated_user
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2959 proto_tree_add_item(flags_tree
, hf_dns_key_flags_associated_named_entity
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2960 proto_tree_add_item(flags_tree
, hf_dns_key_flags_ipsec
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2961 proto_tree_add_item(flags_tree
, hf_dns_key_flags_mime
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2962 proto_tree_add_item(flags_tree
, hf_dns_key_flags_signatory
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2967 proto_tree_add_item(rr_tree
, hf_dns_key_protocol
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2971 proto_tree_add_item(rr_tree
, hf_dns_key_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
2972 algo
= tvb_get_uint8(tvb
, cur_offset
);
2976 if (compute_key_id(rr_tree
, pinfo
, tvb
, cur_offset
-4, rr_len
+4, algo
, &key_id
)) {
2977 ti_gen
= proto_tree_add_uint(rr_tree
, hf_dns_key_key_id
, tvb
, 0, 0, key_id
);
2978 proto_item_set_generated(ti_gen
);
2982 proto_tree_add_item(rr_tree
, hf_dns_key_public_key
, tvb
, cur_offset
, rr_len
, ENC_NA
);
2987 case T_PX
: /* Pointer to X.400/RFC822 mapping info (26)*/
2989 int px_map822_len
, px_mapx400_len
;
2990 const char *px_map822_dnsname
, *px_mapx400_dnsname
;
2992 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
2993 proto_tree_add_item(rr_tree
, hf_dns_px_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
2996 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &px_map822_dnsname
, &px_map822_len
);
2997 name_out
= format_text(pinfo
->pool
, (const unsigned char*)px_map822_dnsname
, px_map822_len
);
2998 proto_tree_add_string(rr_tree
, hf_dns_px_map822
, tvb
, cur_offset
, used_bytes
, name_out
);
2999 cur_offset
+= used_bytes
;
3001 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &px_mapx400_dnsname
, &px_mapx400_len
);
3002 name_out
= format_text(pinfo
->pool
, (const unsigned char*)px_mapx400_dnsname
, px_mapx400_len
);
3003 proto_tree_add_string(rr_tree
, hf_dns_px_mapx400
, tvb
, cur_offset
, used_bytes
, name_out
);
3004 /*cur_offset += used_bytes;*/
3008 case T_GPOS
: /* Geographical POSition (27) */
3010 uint8_t long_len
, lat_len
, alt_len
;
3012 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3013 proto_tree_add_item(rr_tree
, hf_dns_gpos_longitude_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3014 long_len
= tvb_get_uint8(tvb
, cur_offset
);
3017 proto_tree_add_item(rr_tree
, hf_dns_gpos_longitude
, tvb
, cur_offset
, long_len
, ENC_ASCII
);
3018 cur_offset
+= long_len
;
3020 proto_tree_add_item(rr_tree
, hf_dns_gpos_latitude_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3021 lat_len
= tvb_get_uint8(tvb
, cur_offset
);
3024 proto_tree_add_item(rr_tree
, hf_dns_gpos_latitude
, tvb
, cur_offset
, lat_len
, ENC_ASCII
);
3025 cur_offset
+= lat_len
;
3027 proto_tree_add_item(rr_tree
, hf_dns_gpos_altitude_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3028 alt_len
= tvb_get_uint8(tvb
, cur_offset
);
3031 proto_tree_add_item(rr_tree
, hf_dns_gpos_altitude
, tvb
, cur_offset
, alt_len
, ENC_ASCII
);
3032 /*cur_offset += alt_len;*/
3036 case T_AAAA
: /* IPv6 Address (28) */
3040 addr6
= tvb_ip6_to_str(pinfo
->pool
, tvb
, cur_offset
);
3041 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", addr6
);
3043 proto_item_append_text(trr
, ", addr %s", addr6
);
3044 proto_tree_add_item(rr_tree
, hf_dns_aaaa
, tvb
, cur_offset
, 16, ENC_NA
);
3046 if (gbl_resolv_flags
.dns_pkt_addr_resolution
&& (dns_class
& 0x7f) == C_IN
&&
3047 !PINFO_FD_VISITED(pinfo
)) {
3048 ws_in6_addr addr_in6
;
3049 tvb_memcpy(tvb
, &addr_in6
, cur_offset
, sizeof(addr_in6
));
3050 add_ipv6_name(&addr_in6
, name
, false);
3055 case T_LOC
: /* Geographical Location (29) */
3060 version
= tvb_get_uint8(tvb
, cur_offset
);
3061 proto_tree_add_item(rr_tree
, hf_dns_loc_version
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3063 /* Version 0, the only version RFC 1876 discusses. */
3066 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_size
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3067 proto_item_append_text(ti
, " (%g m)", rfc1867_size(tvb
, cur_offset
));
3070 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_horizontal_precision
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3071 proto_item_append_text(ti
, " (%g m)", rfc1867_size(tvb
, cur_offset
));
3074 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_vertical_precision
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3075 proto_item_append_text(ti
, " (%g m)", rfc1867_size(tvb
, cur_offset
));
3078 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_latitude
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3079 proto_item_append_text(ti
, " (%s)", rfc1867_angle(tvb
, cur_offset
, false));
3082 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_longitude
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3083 proto_item_append_text(ti
, " (%s)", rfc1867_angle(tvb
, cur_offset
, true));
3086 ti
= proto_tree_add_item(rr_tree
, hf_dns_loc_altitude
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3087 proto_item_append_text(ti
, " (%g m)", (tvb_get_ntohil(tvb
, cur_offset
) - 10000000)/100.0);
3089 proto_tree_add_item(rr_tree
, hf_dns_loc_unknown_data
, tvb
, cur_offset
, data_len
, ENC_NA
);
3094 case T_NXT
: /* Next name (30) */
3096 int rr_len
= data_len
;
3097 const char *next_domain_name
;
3098 int next_domain_name_len
;
3100 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
,
3101 &next_domain_name
, &next_domain_name_len
);
3102 name_out
= format_text(pinfo
->pool
, (const unsigned char*)next_domain_name
, next_domain_name_len
);
3103 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3104 proto_item_append_text(trr
, ", next domain name %s", name_out
);
3105 proto_tree_add_string(rr_tree
, hf_dns_nxt_next_domain_name
, tvb
, cur_offset
, used_bytes
, name_out
);
3106 cur_offset
+= used_bytes
;
3107 rr_len
-= used_bytes
;
3108 dissect_type_bitmap_nxt(rr_tree
, tvb
, cur_offset
, rr_len
);
3112 case T_SRV
: /* Service Location (33) */
3114 uint16_t priority
= 0;
3115 uint16_t weight
= 0;
3120 proto_tree_add_item(rr_tree
, hf_dns_srv_priority
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3121 priority
= tvb_get_ntohs(tvb
, cur_offset
);
3124 proto_tree_add_item(rr_tree
, hf_dns_srv_weight
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3125 weight
= tvb_get_ntohs(tvb
, cur_offset
);
3128 proto_tree_add_item(rr_tree
, hf_dns_srv_port
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3129 port
= tvb_get_ntohs(tvb
, cur_offset
);
3132 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &target
, &target_len
);
3133 name_out
= format_text(pinfo
->pool
, (const unsigned char*)target
, target_len
);
3135 proto_tree_add_string(rr_tree
, hf_dns_srv_target
, tvb
, cur_offset
, used_bytes
, name_out
);
3137 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %u %u %u %s", priority
, weight
, port
, name_out
);
3138 proto_item_append_text(trr
,
3139 ", priority %u, weight %u, port %u, target %s",
3140 priority
, weight
, port
, name_out
);
3144 case T_NAPTR
: /* Naming Authority PoinTeR (35) */
3147 int offset
= cur_offset
;
3149 uint16_t preference
;
3150 const uint8_t *flags
;
3152 uint8_t service_len
;
3154 const char *replacement
;
3155 int replacement_len
;
3158 proto_tree_add_item(rr_tree
, hf_dns_naptr_order
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3159 order
= tvb_get_ntohs(tvb
, offset
);
3163 proto_tree_add_item(rr_tree
, hf_dns_naptr_preference
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3164 preference
= tvb_get_ntohs(tvb
, offset
);
3168 proto_tree_add_item(rr_tree
, hf_dns_naptr_flags_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
3169 flags_len
= tvb_get_uint8(tvb
, offset
);
3171 proto_tree_add_item_ret_string(rr_tree
, hf_dns_naptr_flags
, tvb
, offset
, flags_len
, ENC_ASCII
|ENC_NA
, pinfo
->pool
, &flags
);
3172 offset
+= flags_len
;
3175 proto_tree_add_item(rr_tree
, hf_dns_naptr_service_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
3176 service_len
= tvb_get_uint8(tvb
, offset
);
3178 proto_tree_add_item(rr_tree
, hf_dns_naptr_service
, tvb
, offset
, service_len
, ENC_ASCII
);
3179 offset
+= service_len
;
3182 proto_tree_add_item(rr_tree
, hf_dns_naptr_regex_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
3183 regex_len
= tvb_get_uint8(tvb
, offset
);
3185 proto_tree_add_item(rr_tree
, hf_dns_naptr_regex
, tvb
, offset
, regex_len
, ENC_ASCII
);
3186 offset
+= regex_len
;
3189 used_bytes
= get_dns_name(tvb
, offset
, 0, dns_data_offset
, &replacement
, &replacement_len
);
3190 name_out
= format_text(pinfo
->pool
, (const unsigned char*)replacement
, replacement_len
);
3191 ti_len
= proto_tree_add_uint(rr_tree
, hf_dns_naptr_replacement_length
, tvb
, offset
, 0, replacement_len
);
3192 proto_item_set_generated(ti_len
);
3194 proto_tree_add_string(rr_tree
, hf_dns_naptr_replacement
, tvb
, offset
, used_bytes
, name_out
);
3196 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %u %u %s", order
, preference
, flags
);
3198 proto_item_append_text(trr
, ", order %u, preference %u, flags %s",
3199 order
, preference
, flags
);
3203 case T_KX
: /* Key Exchange (36) */
3205 const char *kx_name
;
3208 used_bytes
= get_dns_name(tvb
, cur_offset
+ 2, 0, dns_data_offset
, &kx_name
, &kx_name_len
);
3209 name_out
= format_text(pinfo
->pool
, (const unsigned char*)kx_name
, kx_name_len
);
3210 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %u %s", tvb_get_ntohs(tvb
, cur_offset
), name_out
);
3211 proto_item_append_text(trr
, ", preference %u, kx %s",
3212 tvb_get_ntohs(tvb
, cur_offset
), name_out
);
3213 proto_tree_add_item(rr_tree
, hf_dns_kx_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3214 proto_tree_add_string(rr_tree
, hf_dns_kx_key_exchange
, tvb
, cur_offset
+ 2, used_bytes
, name_out
);
3218 case T_CERT
: /* Certificate (37) */
3220 int rr_len
= data_len
;
3222 proto_tree_add_item(rr_tree
, hf_dns_cert_type
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3226 proto_tree_add_item(rr_tree
, hf_dns_cert_key_tag
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3230 proto_tree_add_item(rr_tree
, hf_dns_cert_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3235 proto_tree_add_item(rr_tree
, hf_dns_cert_certificate
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3240 case T_A6
: /* IPv6 address with indirection (38) Obso */
3242 unsigned short pre_len
;
3243 unsigned short suf_len
;
3244 unsigned short suf_octet_count
;
3250 address suffix_addr
;
3252 a6_offset
= cur_offset
;
3253 pre_len
= tvb_get_uint8(tvb
, cur_offset
);
3255 suf_len
= 128 - pre_len
;
3256 suf_octet_count
= suf_len
? (suf_len
- 1) / 8 + 1 : 0;
3258 for (suf_offset
= 0; suf_offset
< 16 - suf_octet_count
; suf_offset
++) {
3259 suffix
.bytes
[suf_offset
] = 0;
3261 for (; suf_offset
< 16; suf_offset
++) {
3262 suffix
.bytes
[suf_offset
] = tvb_get_uint8(tvb
, cur_offset
);
3267 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
,
3268 &pname
, &pname_len
);
3273 name_out
= format_text(pinfo
->pool
, (const unsigned char*)pname
, pname_len
);
3275 set_address(&suffix_addr
, AT_IPv6
, 16, suffix
.bytes
);
3276 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %d %s %s",
3278 address_to_str(pinfo
->pool
, &suffix_addr
),
3281 proto_tree_add_item(rr_tree
, hf_dns_a6_prefix_len
,tvb
, a6_offset
, 1, ENC_BIG_ENDIAN
);
3284 proto_tree_add_ipv6(rr_tree
, hf_dns_a6_address_suffix
,tvb
, a6_offset
, suf_octet_count
, &suffix
);
3285 a6_offset
+= suf_octet_count
;
3288 proto_tree_add_string(rr_tree
, hf_dns_a6_prefix_name
, tvb
, a6_offset
, used_bytes
, name_out
);
3290 proto_item_append_text(trr
, ", addr %d %s %s",
3292 address_to_str(pinfo
->pool
, &suffix_addr
),
3297 case T_DNAME
: /* Non-terminal DNS name redirection (39) */
3302 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
,
3303 &dname
, &dname_len
);
3304 name_out
= format_text(pinfo
->pool
, (const unsigned char*)dname
, dname_len
);
3305 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3306 proto_item_append_text(trr
, ", dname %s", name_out
);
3307 proto_tree_add_string(rr_tree
, hf_dns_dname
, tvb
, cur_offset
, used_bytes
, name_out
);
3311 case T_OPT
: /* Option (41) */
3313 int rropt_len
= data_len
;
3314 uint16_t optcode
, optlen
;
3315 proto_item
*rropt
, *rroptlen
;
3316 proto_tree
*rropt_tree
;
3318 while (rropt_len
> 0) {
3319 optcode
= tvb_get_ntohs(tvb
, cur_offset
);
3322 optlen
= tvb_get_ntohs(tvb
, cur_offset
+ 2);
3325 rropt
= proto_tree_add_item(rr_tree
, hf_dns_opt
, tvb
, cur_offset
, 4 + optlen
, ENC_NA
);
3326 proto_item_append_text(rropt
, ": %s", val_to_str(optcode
, edns0_opt_code_vals
, "Unknown (%d)"));
3327 rropt_tree
= proto_item_add_subtree(rropt
, ett_dns_opts
);
3328 rropt
= proto_tree_add_item(rropt_tree
, hf_dns_opt_code
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3330 rroptlen
= proto_tree_add_item(rropt_tree
, hf_dns_opt_len
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3333 proto_tree_add_item(rropt_tree
, hf_dns_opt_data
, tvb
, cur_offset
, optlen
, ENC_NA
);
3336 case O_DAU
: /* DNSSEC Algorithm Understood (RFC6975) */
3338 while (optlen
!= 0) {
3339 proto_tree_add_item(rropt_tree
, hf_dns_opt_dau
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3347 case O_DHU
: /* DS Hash Understood (RFC6975) */
3349 while (optlen
!= 0) {
3350 proto_tree_add_item(rropt_tree
, hf_dns_opt_dhu
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3358 case O_N3U
: /* N3SEC Hash Understood (RFC6975) */
3360 while (optlen
!= 0) {
3361 proto_tree_add_item(rropt_tree
, hf_dns_opt_n3u
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3369 case O_CLIENT_SUBNET_EXP
: /* draft-vandergaast-edns-client-subnet */
3370 expert_add_info_format(pinfo
, rropt
, &ei_dns_depr_opc
,
3371 "Deprecated opcode. Client subnet OPT assigned as %d.", O_CLIENT_SUBNET
);
3372 /* Intentional fall-through */
3374 case O_CLIENT_SUBNET
:
3377 uint16_t addr_len
= optlen
- 4;
3383 family
= tvb_get_ntohs(tvb
, cur_offset
);
3384 proto_tree_add_item(rropt_tree
, hf_dns_opt_client_family
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3386 proto_tree_add_item(rropt_tree
, hf_dns_opt_client_netmask
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3388 proto_tree_add_item(rropt_tree
, hf_dns_opt_client_scope
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3391 if (addr_len
> 16) {
3392 expert_add_info(pinfo
, rroptlen
, &ei_dns_opt_bad_length
);
3393 /* Avoid stack-smashing which occurs otherwise with the
3394 * following tvb_memcpy. */
3397 tvb_memcpy(tvb
, ip_addr
.bytes
, cur_offset
, addr_len
);
3402 proto_tree_add_ipv4(rropt_tree
, hf_dns_opt_client_addr4
, tvb
,
3403 cur_offset
, addr_len
, ip_addr
.addr
);
3409 proto_tree_add_ipv6(rropt_tree
, hf_dns_opt_client_addr6
, tvb
,
3410 cur_offset
, addr_len
, (ws_in6_addr
*)&ip_addr
);
3416 proto_tree_add_item(rropt_tree
, hf_dns_opt_client_addr
, tvb
, cur_offset
, (optlen
- 4),
3421 cur_offset
+= (optlen
- 4);
3422 rropt_len
-= optlen
;
3428 proto_tree_add_item(rropt_tree
, hf_dns_opt_cookie_client
, tvb
, cur_offset
, 8, ENC_NA
);
3432 proto_tree_add_item(rropt_tree
, hf_dns_opt_cookie_server
, tvb
, cur_offset
, optlen
, ENC_NA
);
3433 cur_offset
+= optlen
;
3434 rropt_len
-= optlen
;
3441 proto_tree_add_item(rropt_tree
, hf_dns_opt_edns_tcp_keepalive_timeout
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3443 cur_offset
+= optlen
;
3444 rropt_len
-= optlen
;
3450 proto_tree_add_item(rropt_tree
, hf_dns_opt_padding
, tvb
, cur_offset
, optlen
, ENC_NA
);
3451 cur_offset
+= optlen
;
3452 rropt_len
-= optlen
;
3459 proto_tree_add_item(rropt_tree
, hf_dns_opt_chain_fqdn
, tvb
, cur_offset
, optlen
, ENC_ASCII
);
3461 cur_offset
+= optlen
;
3462 rropt_len
-= optlen
;
3469 proto_tree_add_item(rropt_tree
, hf_dns_opt_ext_error_info_code
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3473 proto_tree_add_item(rropt_tree
, hf_dns_opt_ext_error_extra_text
, tvb
, cur_offset
, optlen
- 2, ENC_UTF_8
);
3474 cur_offset
+= (optlen
- 2);
3475 rropt_len
-= (optlen
- 2);
3481 case O_REPORT_CHANNEL
:
3487 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
,
3488 &dname
, &dname_len
);
3489 name_out
= format_text(wmem_packet_scope(), (const unsigned char*)dname
, dname_len
);
3490 proto_tree_add_string(rropt_tree
, hf_dns_opt_agent_domain
, tvb
, cur_offset
, used_bytes
, name_out
);
3492 cur_offset
+= used_bytes
;
3493 rropt_len
-= used_bytes
;
3501 proto_tree_add_item(rropt_tree
, hf_dns_opt_zoneversion_labelcount
, tvb
, cur_offset
, 1, ENC_NA
);
3504 proto_tree_add_item_ret_uint(rropt_tree
, hf_dns_opt_zoneversion_type
, tvb
, cur_offset
, 1, ENC_NA
, &type
);
3509 case DNS_ZONEVERSION_TYPE_SOA_SERIAL
:
3510 proto_tree_add_item(rropt_tree
, hf_dns_opt_zoneversion_soa
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3515 proto_tree_add_item(rropt_tree
, hf_dns_opt_zoneversion_version
, tvb
, cur_offset
, optlen
- 2, ENC_NA
);
3516 cur_offset
+= (optlen
- 2);
3517 rropt_len
-= (optlen
- 2);
3525 cur_offset
+= optlen
;
3526 rropt_len
-= optlen
;
3534 case T_APL
: /* Lists of Address Prefixes (42) */
3536 int rr_len
= data_len
;
3538 uint8_t afdpart_len
;
3540 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3542 while (rr_len
> 1) {
3543 afamily
= tvb_get_ntohs(tvb
, cur_offset
);
3544 proto_tree_add_item(rr_tree
, hf_dns_apl_address_family
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3548 proto_tree_add_item(rr_tree
, hf_dns_apl_coded_prefix
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3552 afdpart_len
= tvb_get_uint8(tvb
, cur_offset
) & DNS_APL_AFDLENGTH
;
3553 proto_tree_add_item(rr_tree
, hf_dns_apl_negation
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3554 proto_tree_add_item(rr_tree
, hf_dns_apl_afdlength
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3558 if (afamily
== AFNUM_INET
&& afdpart_len
<= 4) {
3559 ws_in4_addr
*addr4_copy
;
3561 addr4_copy
= (ws_in4_addr
*)wmem_alloc0(pinfo
->pool
, 4);
3562 tvb_memcpy(tvb
, (void *)addr4_copy
, cur_offset
, afdpart_len
);
3563 proto_tree_add_ipv4(rr_tree
, hf_dns_apl_afdpart_ipv4
, tvb
, cur_offset
, afdpart_len
, *addr4_copy
);
3564 } else if (afamily
== AFNUM_INET6
&& afdpart_len
<= 16) {
3565 ws_in6_addr
*addr6_copy
;
3567 addr6_copy
= (ws_in6_addr
*)wmem_alloc0(pinfo
->pool
, 16);
3568 tvb_memcpy(tvb
, (void *)addr6_copy
, cur_offset
, afdpart_len
);
3569 proto_tree_add_ipv6(rr_tree
, hf_dns_apl_afdpart_ipv6
, tvb
, cur_offset
, afdpart_len
, addr6_copy
);
3570 } else { /* Other... */
3571 proto_tree_add_item(rr_tree
, hf_dns_apl_afdpart_data
, tvb
, cur_offset
, afdpart_len
, ENC_NA
);
3573 cur_offset
+= afdpart_len
;
3574 rr_len
-= afdpart_len
;
3579 case T_DS
: /* Delegation Signature (43) */
3580 case T_CDS
: /* Child DS (59) */
3583 int rr_len
= data_len
;
3585 proto_tree_add_item(rr_tree
, hf_dns_ds_key_id
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3589 proto_tree_add_item(rr_tree
, hf_dns_ds_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3593 proto_tree_add_item(rr_tree
, hf_dns_ds_digest_type
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3597 proto_tree_add_item(rr_tree
, hf_dns_ds_digest
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3601 case T_SSHFP
: /* Securely Publish SSH Key Fingerprints (44) */
3603 int rr_len
= data_len
;
3605 proto_tree_add_item(rr_tree
, hf_dns_sshfp_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3609 proto_tree_add_item(rr_tree
, hf_dns_sshfp_fingerprint_type
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3615 proto_tree_add_item(rr_tree
, hf_dns_sshfp_fingerprint
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3620 case T_IPSECKEY
: /* IPsec Key (45) */
3622 int rr_len
= data_len
;
3627 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_gateway_precedence
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3631 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_gateway_type
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3632 gw_type
= tvb_get_uint8(tvb
, cur_offset
);
3636 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_gateway_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3650 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_gateway_ipv4
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3658 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_gateway_ipv6
, tvb
, cur_offset
, 16, ENC_NA
);
3666 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &gw
, &gw_name_len
);
3667 name_out
= format_text(pinfo
->pool
, (const unsigned char*)gw
, gw_name_len
);
3668 proto_tree_add_string(rr_tree
, hf_dns_ipseckey_gateway_dns
, tvb
, cur_offset
, used_bytes
, name_out
);
3670 cur_offset
+= used_bytes
;
3671 rr_len
-= used_bytes
;
3679 proto_tree_add_item(rr_tree
, hf_dns_ipseckey_public_key
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3684 case T_RRSIG
: /* RRSIG (46) */
3685 case T_SIG
: /* Security SIgnature (24) */
3687 int rr_len
= data_len
;
3688 const char *signer_name
;
3689 int signer_name_len
;
3693 ti
= proto_tree_add_item_ret_uint(rr_tree
, hf_dns_rrsig_type_covered
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &type
);
3694 proto_item_append_text(ti
, " %s", val_to_str_ext(type
, &dns_types_description_vals_ext
, "Unknown (%d)"));
3698 proto_tree_add_item(rr_tree
, hf_dns_rrsig_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3702 proto_tree_add_item(rr_tree
, hf_dns_rrsig_labels
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3706 ti
= proto_tree_add_item(rr_tree
, hf_dns_rrsig_original_ttl
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3707 proto_item_append_text(ti
, " (%s)", unsigned_time_secs_to_str(pinfo
->pool
, tvb_get_ntohl(tvb
, cur_offset
)));
3711 proto_tree_add_item(rr_tree
, hf_dns_rrsig_signature_expiration
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3715 proto_tree_add_item(rr_tree
, hf_dns_rrsig_signature_inception
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3719 proto_tree_add_item(rr_tree
, hf_dns_rrsig_key_tag
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3723 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &signer_name
, &signer_name_len
);
3724 name_out
= format_text(pinfo
->pool
, (const unsigned char*)signer_name
, signer_name_len
);
3725 proto_tree_add_string(rr_tree
, hf_dns_rrsig_signers_name
, tvb
, cur_offset
, used_bytes
, name_out
);
3726 cur_offset
+= used_bytes
;
3727 rr_len
-= used_bytes
;
3730 proto_tree_add_item(rr_tree
, hf_dns_rrsig_signature
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3735 case T_NSEC
: /* NSEC (47) */
3737 int rr_len
= data_len
;
3738 const char *next_domain_name
;
3739 int next_domain_name_len
;
3741 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
,
3742 &next_domain_name
, &next_domain_name_len
);
3743 name_out
= format_text(pinfo
->pool
, (const unsigned char*)next_domain_name
, next_domain_name_len
);
3744 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3745 proto_item_append_text(trr
, ", next domain name %s", name_out
);
3746 proto_tree_add_string(rr_tree
, hf_dns_nsec_next_domain_name
, tvb
, cur_offset
, used_bytes
, name_out
);
3747 cur_offset
+= used_bytes
;
3748 rr_len
-= used_bytes
;
3750 dissect_type_bitmap(rr_tree
, tvb
, cur_offset
, rr_len
);
3754 case T_DNSKEY
: /* DNSKEY (48) */
3755 case T_CDNSKEY
: /* CDNSKEY (60) */
3757 int rr_len
= data_len
;
3758 proto_item
*tf
, *ti_gen
;
3759 proto_tree
*flags_tree
;
3763 tf
= proto_tree_add_item(rr_tree
, hf_dns_dnskey_flags
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3764 flags_tree
= proto_item_add_subtree(tf
, ett_key_flags
);
3765 proto_tree_add_item(flags_tree
, hf_dns_dnskey_flags_zone_key
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3766 proto_tree_add_item(flags_tree
, hf_dns_dnskey_flags_key_revoked
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3767 proto_tree_add_item(flags_tree
, hf_dns_dnskey_flags_secure_entry_point
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3768 proto_tree_add_item(flags_tree
, hf_dns_dnskey_flags_reserved
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3773 /* Must have value 3, Add check ? */
3774 proto_tree_add_item(rr_tree
, hf_dns_dnskey_protocol
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3778 proto_tree_add_item(rr_tree
, hf_dns_dnskey_algorithm
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3779 algo
= tvb_get_uint8(tvb
, cur_offset
);
3784 if (compute_key_id(rr_tree
, pinfo
, tvb
, cur_offset
-4, rr_len
+4, algo
, &key_id
)) {
3785 ti_gen
= proto_tree_add_uint(rr_tree
, hf_dns_dnskey_key_id
, tvb
, 0, 0, key_id
);
3786 proto_item_set_generated(ti_gen
);
3789 proto_tree_add_item(rr_tree
, hf_dns_dnskey_public_key
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3793 case T_DHCID
: /* DHCID (49) */
3795 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3796 proto_tree_add_item(rr_tree
, hf_dns_dhcid_rdata
, tvb
, cur_offset
, data_len
, ENC_NA
);
3800 case T_NSEC3
: /* NSEC3 (50) */
3802 int rr_len
, initial_offset
= cur_offset
;
3803 uint8_t salt_len
, hash_len
;
3804 proto_item
*flags_item
, *hash_item
;
3805 proto_tree
*flags_tree
;
3807 proto_tree_add_item(rr_tree
, hf_dns_nsec3_algo
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3810 flags_item
= proto_tree_add_item(rr_tree
, hf_dns_nsec3_flags
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3811 flags_tree
= proto_item_add_subtree(flags_item
, ett_nsec3_flags
);
3812 proto_tree_add_item(flags_tree
, hf_dns_nsec3_flag_optout
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3815 proto_tree_add_item(rr_tree
, hf_dns_nsec3_iterations
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3818 proto_tree_add_item(rr_tree
, hf_dns_nsec3_salt_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3819 salt_len
= tvb_get_uint8(tvb
, cur_offset
);
3822 proto_tree_add_item(rr_tree
, hf_dns_nsec3_salt_value
, tvb
, cur_offset
, salt_len
, ENC_NA
);
3823 cur_offset
+= salt_len
;
3825 proto_tree_add_item(rr_tree
, hf_dns_nsec3_hash_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3826 hash_len
= tvb_get_uint8(tvb
, cur_offset
);
3830 * The code below is optimized for simplicity as trailing padding
3831 * characters ("=") are not used in the NSEC3 specification (see RFC 5155
3835 /* Base 32 Encoding with Extended Hex Alphabet (see RFC 4648 section 7) */
3836 const char *base32hex
= "0123456789abcdefghijklmnopqrstuv";
3837 wmem_strbuf_t
*hash_value_base32hex
= wmem_strbuf_new(pinfo
->pool
, "");
3838 int group
, in_offset
, out_offset
;
3839 for (in_offset
= 0, out_offset
= 0;
3840 in_offset
/ 8 < hash_len
;
3841 in_offset
+= 5, out_offset
+= 1) {
3842 group
= tvb_get_bits8(tvb
, cur_offset
* 8 + in_offset
, 5);
3843 wmem_strbuf_append_c(hash_value_base32hex
, base32hex
[group
]);
3845 hash_item
= proto_tree_add_string(rr_tree
, hf_dns_nsec3_hash_value
, tvb
, cur_offset
, hash_len
, wmem_strbuf_finalize(hash_value_base32hex
));
3846 proto_item_set_generated(hash_item
);
3847 cur_offset
+= hash_len
;
3850 rr_len
= data_len
- (cur_offset
- initial_offset
);
3851 dissect_type_bitmap(rr_tree
, tvb
, cur_offset
, rr_len
);
3855 case T_NSEC3PARAM
: /* NSEC3PARAM (51) */
3858 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3860 proto_tree_add_item(rr_tree
, hf_dns_nsec3_algo
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3863 proto_tree_add_item(rr_tree
, hf_dns_nsec3_flags
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3866 proto_tree_add_item(rr_tree
, hf_dns_nsec3_iterations
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3869 proto_tree_add_item(rr_tree
, hf_dns_nsec3_salt_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3870 salt_len
= tvb_get_uint8(tvb
, cur_offset
);
3873 proto_tree_add_item(rr_tree
, hf_dns_nsec3_salt_value
, tvb
, cur_offset
, salt_len
, ENC_NA
);
3877 case T_TLSA
: /* DNS-Based Authentication of Named Entities (52) */
3879 int rr_len
= data_len
;
3880 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3882 proto_tree_add_item(rr_tree
, hf_dns_tlsa_certificate_usage
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3886 proto_tree_add_item(rr_tree
, hf_dns_tlsa_selector
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3890 proto_tree_add_item(rr_tree
, hf_dns_tlsa_matching_type
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3894 proto_tree_add_item(rr_tree
, hf_dns_tlsa_certificate_association_data
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3898 case T_HIP
: /* Host Identity Protocol (55) */
3902 int rr_len
= data_len
;
3904 const char *rend_server_dns_name
;
3906 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
3908 hit_len
= tvb_get_uint8(tvb
, cur_offset
);
3909 proto_tree_add_item(rr_tree
, hf_dns_hip_hit_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3913 proto_tree_add_item(rr_tree
, hf_dns_hip_pk_algo
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
3917 pk_len
= tvb_get_ntohs(tvb
, cur_offset
);
3918 proto_tree_add_item(rr_tree
, hf_dns_hip_pk_length
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
3922 proto_tree_add_item(rr_tree
, hf_dns_hip_hit
, tvb
, cur_offset
, hit_len
, ENC_NA
);
3923 cur_offset
+= hit_len
;
3926 proto_tree_add_item(rr_tree
, hf_dns_hip_pk
, tvb
, cur_offset
, pk_len
, ENC_NA
);
3927 cur_offset
+= pk_len
;
3930 while (rr_len
> 1) {
3931 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &rend_server_dns_name
, &rendezvous_len
);
3932 name_out
= format_text(pinfo
->pool
, (const unsigned char*)rend_server_dns_name
, rendezvous_len
);
3933 proto_tree_add_string(rr_tree
, hf_dns_hip_rendezvous_server
, tvb
, cur_offset
, used_bytes
, name_out
);
3934 cur_offset
+= used_bytes
;
3935 rr_len
-= used_bytes
;
3940 case T_OPENPGPKEY
: /* OpenPGP Key (61) */
3942 proto_tree_add_item(rr_tree
, hf_dns_openpgpkey
, tvb
, cur_offset
, data_len
, ENC_ASCII
);
3946 case T_CSYNC
: /* Child-to-Parent Synchronization (62) */
3948 int rr_len
, initial_offset
= cur_offset
;
3950 proto_tree_add_item(rr_tree
, hf_dns_csync_soa
, tvb
, cur_offset
, 4, ENC_ASCII
|ENC_NA
);
3953 proto_tree_add_bitmask_with_flags(rr_tree
, tvb
, cur_offset
,
3954 hf_dns_csync_flags
, ett_dns_csdync_flags
, dns_csync_flags
, ENC_BIG_ENDIAN
, BMT_NO_APPEND
);
3957 rr_len
= data_len
- (cur_offset
- initial_offset
);
3958 proto_tree_add_item(rr_tree
, hf_dns_csync_type_bitmap
, tvb
, cur_offset
, rr_len
, ENC_NA
);
3960 dissect_type_bitmap(rr_tree
, tvb
, cur_offset
, rr_len
);
3964 case T_ZONEMD
: /* Message Digest for DNS Zones (63) */
3966 proto_tree_add_item(rr_tree
, hf_dns_zonemd_serial
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
3968 proto_tree_add_item(rr_tree
, hf_dns_zonemd_scheme
, tvb
, cur_offset
, 1, ENC_NA
);
3970 proto_tree_add_item(rr_tree
, hf_dns_zonemd_hash_algo
, tvb
, cur_offset
, 1, ENC_NA
);
3972 proto_tree_add_item(rr_tree
, hf_dns_zonemd_digest
, tvb
, cur_offset
, data_len
- 6 , ENC_NA
);
3976 case T_SVCB
: /* Service binding and parameter specification (64) */
3977 case T_HTTPS
: /* Service binding and parameter specification (65) */
3979 uint32_t priority
= 0, value
;
3980 uint32_t svc_param_key
;
3981 uint32_t svc_param_offset
;
3982 uint32_t svc_param_length
;
3983 uint32_t svc_param_alpn_length
;
3986 const uint8_t *dohpath
;
3987 int start_offset
= cur_offset
;
3988 proto_item
*svcb_param_ti
;
3989 proto_tree
*svcb_param_tree
;
3991 proto_tree_add_item_ret_uint(rr_tree
, hf_dns_svcb_priority
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &priority
);
3994 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &target
, &target_len
);
3995 name_out
= format_text(pinfo
->pool
, (const unsigned char*)target
, target_len
);
3997 proto_tree_add_string(rr_tree
, hf_dns_svcb_target
, tvb
, cur_offset
, used_bytes
, name_out
);
3998 cur_offset
+= used_bytes
;
4000 if (data_len
> cur_offset
- start_offset
) {
4001 while (data_len
> cur_offset
- start_offset
) {
4002 svcb_param_ti
= proto_tree_add_item(rr_tree
, hf_dns_svcb_param
, tvb
, cur_offset
, -1, ENC_NA
);
4003 svcb_param_tree
= proto_item_add_subtree(svcb_param_ti
, ett_dns_svcb
);
4005 proto_tree_add_item_ret_uint(svcb_param_tree
, hf_dns_svcb_param_key
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &svc_param_key
);
4008 proto_tree_add_item_ret_uint(svcb_param_tree
, hf_dns_svcb_param_length
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &svc_param_length
);
4011 proto_item_append_text(svcb_param_ti
, ": %s", val_to_str(svc_param_key
, dns_svcb_param_key_vals
, "key%u"));
4012 proto_item_set_len(svcb_param_ti
, svc_param_length
+ 4);
4014 switch(svc_param_key
) {
4015 case DNS_SVCB_KEY_MANDATORY
:
4016 for (svc_param_offset
= 0; svc_param_offset
< svc_param_length
; svc_param_offset
+= 2) {
4018 proto_tree_add_item_ret_uint(svcb_param_tree
, hf_dns_svcb_param_mandatory_key
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &key
);
4019 proto_item_append_text(svcb_param_ti
, "%c%s", (svc_param_offset
== 0 ? '=' : ','), val_to_str(key
, dns_svcb_param_key_vals
, "key%u"));
4023 case DNS_SVCB_KEY_ALPN
:
4024 for (svc_param_offset
= 0; svc_param_offset
< svc_param_length
; ) {
4025 const uint8_t *alpn
;
4026 proto_tree_add_item_ret_uint(svcb_param_tree
, hf_dns_svcb_param_alpn_length
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
, &svc_param_alpn_length
);
4028 proto_tree_add_item_ret_string(svcb_param_tree
, hf_dns_svcb_param_alpn
, tvb
, cur_offset
, svc_param_alpn_length
, ENC_ASCII
|ENC_NA
, pinfo
->pool
, &alpn
);
4029 cur_offset
+= svc_param_alpn_length
;
4030 proto_item_append_text(svcb_param_ti
, "%c%s", (svc_param_offset
== 0 ? '=' : ','), alpn
);
4031 svc_param_offset
+= 1 + svc_param_alpn_length
;
4034 case DNS_SVCB_KEY_NOALPN
:
4036 case DNS_SVCB_KEY_PORT
:
4037 proto_tree_add_item_ret_uint(svcb_param_tree
, hf_dns_svcb_param_port
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
, &value
);
4038 proto_item_append_text(svcb_param_ti
, "=%u", value
);
4041 case DNS_SVCB_KEY_IPV4HINT
:
4042 for (svc_param_offset
= 0; svc_param_offset
< svc_param_length
; svc_param_offset
+= 4) {
4043 proto_tree_add_item(svcb_param_tree
, hf_dns_svcb_param_ipv4hint_ip
, tvb
, cur_offset
, 4, ENC_NA
);
4044 proto_item_append_text(svcb_param_ti
, "%c%s", (svc_param_offset
== 0 ? '=' : ','), tvb_ip_to_str(pinfo
->pool
, tvb
, cur_offset
));
4048 case DNS_SVCB_KEY_ECH
:
4050 tvbuff_t
*next_tvb
= tvb_new_subset_length(tvb
, cur_offset
, svc_param_length
);
4051 cur_offset
+= call_dissector(tls_echconfig_handle
, next_tvb
, pinfo
, svcb_param_tree
);
4054 case DNS_SVCB_KEY_IPV6HINT
:
4055 for (svc_param_offset
= 0; svc_param_offset
< svc_param_length
; svc_param_offset
+= 16) {
4056 proto_tree_add_item(svcb_param_tree
, hf_dns_svcb_param_ipv6hint_ip
, tvb
, cur_offset
, 16, ENC_NA
);
4057 proto_item_append_text(svcb_param_ti
, "%c%s", (svc_param_offset
== 0 ? '=' : ','), tvb_ip6_to_str(pinfo
->pool
, tvb
, cur_offset
));
4061 case DNS_SVCB_KEY_DOHPATH
:
4062 proto_tree_add_item_ret_string(svcb_param_tree
, hf_dns_svcb_param_dohpath
, tvb
, cur_offset
, svc_param_length
, ENC_UTF_8
|ENC_NA
, pinfo
->pool
, &dohpath
);
4063 cur_offset
+= svc_param_length
;
4064 proto_item_append_text(svcb_param_ti
, "=%s", dohpath
);
4066 case DNS_SVCB_KEY_ODOHCONFIG
:
4067 dissect_dns_svcparam_base64(svcb_param_tree
, svcb_param_ti
, hf_dns_svcb_param_odohconfig
, tvb
, cur_offset
, svc_param_length
);
4068 cur_offset
+= svc_param_length
;
4071 if (svc_param_length
> 0) {
4072 proto_tree_add_item(svcb_param_tree
, hf_dns_svcb_param_value
, tvb
, cur_offset
, svc_param_length
, ENC_NA
);
4073 proto_item_append_text(svcb_param_ti
, "=%s", tvb_format_text(pinfo
->pool
, tvb
, cur_offset
, svc_param_length
));
4074 cur_offset
+= svc_param_length
;
4083 case T_SPF
: /* Sender Policy Framework (99) */
4085 int rr_len
= data_len
;
4089 spf_offset
= cur_offset
;
4090 while (rr_len
!= 0) {
4091 spf_len
= tvb_get_uint8(tvb
, spf_offset
);
4092 proto_tree_add_item(rr_tree
, hf_dns_spf_length
, tvb
, spf_offset
, 1, ENC_BIG_ENDIAN
);
4095 proto_tree_add_item(rr_tree
, hf_dns_spf
, tvb
, spf_offset
, spf_len
, ENC_ASCII
);
4096 spf_offset
+= spf_len
;
4102 case T_NID
: /* NodeID (104) */
4104 proto_tree_add_item(rr_tree
, hf_dns_ilnp_nodeid_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4107 proto_tree_add_item(rr_tree
, hf_dns_ilnp_nodeid
, tvb
, cur_offset
, 8, ENC_NA
);
4108 /*cur_offset += 8;*/
4112 case T_L32
: /* Locator (105) */
4114 proto_tree_add_item(rr_tree
, hf_dns_ilnp_locator32_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4117 proto_tree_add_item(rr_tree
, hf_dns_ilnp_locator32
, tvb
, cur_offset
, 4, ENC_NA
);
4118 /*cur_offset += 4;*/
4122 case T_L64
: /* Locator64 (106) */
4124 proto_tree_add_item(rr_tree
, hf_dns_ilnp_locator64_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4127 proto_tree_add_item(rr_tree
, hf_dns_ilnp_locator64
, tvb
, cur_offset
, 8, ENC_NA
);
4128 /*cur_offset += 8;*/
4132 case T_LP
: /* Locator FQDN (107) */
4137 proto_tree_add_item(rr_tree
, hf_dns_ilnp_locatorfqdn_preference
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4140 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &lp_str
, &lp_len
);
4141 name_out
= format_text(pinfo
->pool
, (const unsigned char*)lp_str
, lp_len
);
4142 proto_tree_add_string(rr_tree
, hf_dns_ilnp_locatorfqdn
, tvb
, cur_offset
, used_bytes
, name_out
);
4143 /*cur_offset += used_bytes;*/
4147 case T_EUI48
: /* EUI48 (108) */
4149 proto_tree_add_item(rr_tree
, hf_dns_eui48
, tvb
, cur_offset
, 6, ENC_NA
);
4150 /*cur_offset += 6;*/
4154 case T_EUI64
: /* EUI64 (109) */
4156 proto_tree_add_item(rr_tree
, hf_dns_eui64
, tvb
, cur_offset
, 8, ENC_NA
);
4157 /*cur_offset += 8;*/
4161 case T_TKEY
: /* Transaction Key (249) */
4163 const char *tkey_algname
;
4164 int tkey_algname_len
;
4165 uint16_t tkey_mode
, tkey_keylen
, tkey_otherlen
;
4167 proto_tree
*key_tree
;
4168 proto_item
*key_item
;
4170 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &tkey_algname
, &tkey_algname_len
);
4171 name_out
= format_text(pinfo
->pool
, (const unsigned char*)tkey_algname
, tkey_algname_len
);
4172 proto_tree_add_string(rr_tree
, hf_dns_tkey_algo_name
, tvb
, cur_offset
, used_bytes
, name_out
);
4173 cur_offset
+= used_bytes
;
4175 proto_tree_add_item(rr_tree
, hf_dns_tkey_signature_inception
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4178 proto_tree_add_item(rr_tree
, hf_dns_tkey_signature_expiration
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4181 proto_tree_add_item(rr_tree
, hf_dns_tkey_mode
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4182 tkey_mode
= tvb_get_ntohs(tvb
, cur_offset
);
4185 proto_tree_add_item(rr_tree
, hf_dns_tkey_error
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4188 proto_tree_add_item(rr_tree
, hf_dns_tkey_key_size
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4189 tkey_keylen
= tvb_get_ntohs(tvb
, cur_offset
);
4192 if (tkey_keylen
!= 0) {
4193 key_item
= proto_tree_add_item(rr_tree
, hf_dns_tkey_key_data
, tvb
, cur_offset
, tkey_keylen
, ENC_NA
);
4195 key_tree
= proto_item_add_subtree(key_item
, ett_t_key
);
4198 case TKEYMODE_GSSAPI
:
4200 tvbuff_t
*gssapi_tvb
;
4203 * XXX - in at least one capture, this appears to
4204 * be an NTLMSSP blob, with no ASN.1 in it, in
4207 * See RFC 3645 which might indicate what's going
4208 * on here. (The key is an output_token from
4209 * GSS_Init_sec_context.)
4211 * How the heck do we know what method is being
4212 * used, so we know how to decode the key? Do we
4213 * have to look at the algorithm name, e.g.
4214 * "gss.microsoft.com"? We currently do as the
4215 * the SMB dissector does in some cases, and check
4216 * whether the security blob begins with "NTLMSSP".
4218 gssapi_tvb
= tvb_new_subset_length(tvb
, cur_offset
, tkey_keylen
);
4219 if (tvb_strneql(gssapi_tvb
, 0, "NTLMSSP", 7) == 0) {
4220 call_dissector(ntlmssp_handle
, gssapi_tvb
, pinfo
, key_tree
);
4222 call_dissector(gssapi_handle
, gssapi_tvb
, pinfo
, key_tree
);
4228 /* No dissector for this key mode */
4232 cur_offset
+= tkey_keylen
;
4235 proto_tree_add_item(rr_tree
, hf_dns_tkey_other_size
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4236 tkey_otherlen
= tvb_get_ntohs(tvb
, cur_offset
);
4239 if (tkey_otherlen
!= 0) {
4240 proto_tree_add_item(rr_tree
, hf_dns_tkey_other_data
, tvb
, cur_offset
, tkey_otherlen
, ENC_NA
);
4245 case T_TSIG
: /* Transaction Signature (250) */
4247 uint16_t tsig_siglen
, tsig_otherlen
;
4248 const char *tsig_algname
;
4249 int tsig_algname_len
;
4252 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &tsig_algname
, &tsig_algname_len
);
4253 name_out
= format_text(pinfo
->pool
, (const unsigned char*)tsig_algname
, tsig_algname_len
);
4254 proto_tree_add_string(rr_tree
, hf_dns_tsig_algorithm_name
, tvb
, cur_offset
, used_bytes
, name_out
);
4255 cur_offset
+= used_bytes
;
4257 ti
= proto_tree_add_item(rr_tree
, hf_dns_tsig_time_signed
,tvb
, cur_offset
, 6, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
4258 if(tvb_get_ntohs(tvb
, cur_offset
)) /* Time High */
4260 proto_item_append_text(ti
, " (high bits set)");
4264 proto_tree_add_item(rr_tree
, hf_dns_tsig_fudge
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4267 tsig_siglen
= tvb_get_ntohs(tvb
, cur_offset
);
4268 proto_tree_add_item(rr_tree
, hf_dns_tsig_mac_size
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4271 if (tsig_siglen
!= 0) {
4272 proto_item
*mac_item
;
4273 proto_tree
*mac_tree
;
4276 mac_item
= proto_tree_add_item(rr_tree
, hf_dns_tsig_mac
, tvb
, cur_offset
, tsig_siglen
, ENC_NA
);
4277 mac_tree
= proto_item_add_subtree(mac_item
, ett_dns_mac
);
4279 sub_tvb
=tvb_new_subset_length(tvb
, cur_offset
, tsig_siglen
);
4281 if (!dissector_try_string(dns_tsig_dissector_table
, tsig_algname
, sub_tvb
, pinfo
, mac_tree
, NULL
)) {
4282 expert_add_info_format(pinfo
, mac_item
, &ei_dns_tsig_alg
,
4283 "No dissector for algorithm:%s", name_out
);
4286 cur_offset
+= tsig_siglen
;
4289 proto_tree_add_item(rr_tree
, hf_dns_tsig_original_id
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4292 proto_tree_add_item(rr_tree
, hf_dns_tsig_error
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4295 proto_tree_add_item(rr_tree
, hf_dns_tsig_other_len
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4296 tsig_otherlen
= tvb_get_ntohs(tvb
, cur_offset
);
4299 if (tsig_otherlen
!= 0) {
4300 proto_tree_add_item(rr_tree
, hf_dns_tsig_other_data
, tvb
, cur_offset
, tsig_otherlen
, ENC_NA
);
4305 case T_URI
: /* Uniform Resource Locator (256) */
4307 int rr_len
= data_len
;
4308 uint16_t priority
= 0;
4309 uint16_t weight
= 0;
4310 int target_len
= rr_len
- 4;
4313 proto_tree_add_item(rr_tree
, hf_dns_srv_priority
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4314 priority
= tvb_get_ntohs(tvb
, cur_offset
);
4317 proto_tree_add_item(rr_tree
, hf_dns_srv_weight
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4318 weight
= tvb_get_ntohs(tvb
, cur_offset
);
4321 target
= (const char*)tvb_get_string_enc(pinfo
->pool
, tvb
, cur_offset
, target_len
, ENC_ASCII
|ENC_NA
);
4323 proto_tree_add_string(rr_tree
, hf_dns_srv_target
, tvb
, cur_offset
, used_bytes
, target
);
4325 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %u %u %s", priority
, weight
, target
);
4326 proto_item_append_text(trr
,
4327 ", priority %u, weight %u, target %s",
4328 priority
, weight
, target
);
4333 case T_CAA
: /* Certification Authority Restriction (257) */
4335 proto_item
*caa_item
;
4336 proto_tree
*caa_tree
;
4340 const unsigned char *value
;
4343 caa_item
= proto_tree_add_item(rr_tree
, hf_dns_caa_flags
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
4344 caa_tree
= proto_item_add_subtree(caa_item
, ett_caa_flags
);
4345 proto_tree_add_item(caa_tree
, hf_dns_caa_flag_issuer_critical
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
4348 tag_len
= tvb_get_uint8(tvb
, cur_offset
);
4349 tag
= (const char*)tvb_get_string_enc(pinfo
->pool
, tvb
, cur_offset
+ 1, tag_len
, ENC_ASCII
|ENC_NA
);
4351 value_len
= data_len
- (tag_len
+ 2);
4352 value
= (unsigned char*)tvb_get_string_enc(pinfo
->pool
, tvb
, cur_offset
+ 1 + tag_len
, value_len
, ENC_ASCII
|ENC_NA
);
4354 value
= (unsigned char*)format_text(pinfo
->pool
, value
, value_len
);
4356 if (strncmp(tag
, "issue", tag_len
) == 0) {
4357 cur_hf
= hf_dns_caa_issue
;
4358 } else if (strncmp(tag
, "issuewild", tag_len
) == 0) {
4359 cur_hf
= hf_dns_caa_issuewild
;
4360 } else if (strncmp(tag
, "iodef", tag_len
) == 0) {
4361 cur_hf
= hf_dns_caa_iodef
;
4363 cur_hf
= hf_dns_caa_unknown
;
4366 caa_item
= proto_tree_add_string(rr_tree
, cur_hf
, tvb
, cur_offset
, 1 + tag_len
+ value_len
, (const char*)value
);
4367 caa_tree
= proto_item_add_subtree(caa_item
, ett_caa_data
);
4369 proto_tree_add_uint(caa_tree
, hf_dns_caa_tag_length
, tvb
, cur_offset
, 1, tag_len
);
4370 proto_tree_add_string(caa_tree
, hf_dns_caa_tag
, tvb
, cur_offset
+ 1, tag_len
, tag
);
4371 proto_tree_add_string(caa_tree
, hf_dns_caa_value
, tvb
, cur_offset
+ 1 + tag_len
, value_len
, (const char*)value
);
4375 case T_WINS
: /* Microsoft's WINS (65281)*/
4377 int rr_len
= data_len
;
4380 proto_tree_add_item(rr_tree
, hf_dns_wins_local_flag
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4384 proto_tree_add_item(rr_tree
, hf_dns_wins_lookup_timeout
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4388 proto_tree_add_item(rr_tree
, hf_dns_wins_cache_timeout
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4392 proto_tree_add_item(rr_tree
, hf_dns_wins_nb_wins_servers
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4393 nservers
= tvb_get_ntohl(tvb
, cur_offset
);
4397 while (rr_len
!= 0 && nservers
!= 0) {
4398 proto_tree_add_item(rr_tree
, hf_dns_wins_server
, tvb
, cur_offset
, 4, ENC_NA
);
4407 case T_WINS_R
: /* Microsoft's WINS-R (65282)*/
4412 proto_tree_add_item(rr_tree
, hf_dns_winsr_local_flag
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4415 proto_tree_add_item(rr_tree
, hf_dns_winsr_lookup_timeout
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4418 proto_tree_add_item(rr_tree
, hf_dns_winsr_cache_timeout
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4421 used_bytes
= get_dns_name(tvb
, cur_offset
, 0, dns_data_offset
, &dname
, &dname_len
);
4422 name_out
= format_text(pinfo
->pool
, (const unsigned char*)dname
, dname_len
);
4423 proto_tree_add_string(rr_tree
, hf_dns_winsr_name_result_domain
, tvb
, cur_offset
, used_bytes
, name_out
);
4424 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", name_out
);
4425 proto_item_append_text(trr
, ", name result domain %s", name_out
);
4429 case T_XPF
: /* XPF draft-bellis-dnsop-xpf */
4431 uint32_t address_family
;
4433 proto_tree_add_item_ret_uint(rr_tree
, hf_dns_xpf_ip_version
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
, &address_family
);
4436 switch (address_family
) {
4437 case IP_VERSION_NUM_INET
:
4438 proto_tree_add_item(rr_tree
, hf_dns_xpf_protocol
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
4440 proto_tree_add_item(rr_tree
, hf_dns_xpf_source_ipv4
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4442 proto_tree_add_item(rr_tree
, hf_dns_xpf_destination_ipv4
, tvb
, cur_offset
, 4, ENC_BIG_ENDIAN
);
4444 proto_tree_add_item(rr_tree
, hf_dns_xpf_sport
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4446 proto_tree_add_item(rr_tree
, hf_dns_xpf_dport
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4448 case IP_VERSION_NUM_INET6
:
4449 proto_tree_add_item(rr_tree
, hf_dns_xpf_protocol
, tvb
, cur_offset
, 1, ENC_BIG_ENDIAN
);
4451 proto_tree_add_item(rr_tree
, hf_dns_xpf_source_ipv6
, tvb
, cur_offset
, 16, ENC_NA
);
4453 proto_tree_add_item(rr_tree
, hf_dns_xpf_destination_ipv6
, tvb
, cur_offset
, 16, ENC_NA
);
4455 proto_tree_add_item(rr_tree
, hf_dns_xpf_sport
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4457 proto_tree_add_item(rr_tree
, hf_dns_xpf_dport
, tvb
, cur_offset
, 2, ENC_BIG_ENDIAN
);
4459 default: /* Add Expert info ? */
4467 /* TODO: parse more record types */
4470 expert_add_info_format(pinfo
, trr
, &ei_dns_undecoded_option
,
4471 "Dissector for DNS Type (%d)"
4472 " code not implemented, Contact Wireshark developers"
4473 " if you want this supported", dns_type
);
4474 proto_tree_add_item(rr_tree
, hf_dns_data
, tvb
, cur_offset
, data_len
, ENC_NA
);
4479 data_offset
+= data_len
;
4481 return data_offset
- data_start
;
4485 dissect_query_records(tvbuff_t
*tvb
, int cur_off
, int dns_data_offset
,
4486 int count
, packet_info
*pinfo
, proto_tree
*dns_tree
, bool isupdate
,
4487 bool is_mdns
, bool *is_multiple_responds
)
4489 int start_off
, add_off
;
4492 const char *s
= (isupdate
? "Zone" : "Queries");
4494 start_off
= cur_off
;
4496 qatree
= proto_tree_add_subtree(dns_tree
, tvb
, start_off
, -1, ett_dns_qry
, &ti
, s
);
4498 while (count
-- > 0) {
4499 add_off
= dissect_dns_query(tvb
, cur_off
, dns_data_offset
, pinfo
, qatree
,
4500 is_mdns
, is_multiple_responds
);
4503 proto_item_set_len(ti
, cur_off
- start_off
);
4504 return cur_off
- start_off
;
4508 dissect_answer_records(tvbuff_t
*tvb
, int cur_off
, int dns_data_offset
,
4509 int count
, proto_tree
*dns_tree
, const char *name
,
4510 packet_info
*pinfo
, bool is_mdns
, wmem_list_t
*answers
)
4512 int start_off
, add_off
;
4516 start_off
= cur_off
;
4517 qatree
= proto_tree_add_subtree(dns_tree
, tvb
, start_off
, -1, ett_dns_ans
, &ti
, name
);
4518 while (count
-- > 0) {
4519 add_off
= dissect_dns_answer(
4520 tvb
, cur_off
, dns_data_offset
, qatree
, pinfo
, is_mdns
, answers
);
4523 proto_item_set_len(ti
, cur_off
- start_off
);
4524 return cur_off
- start_off
;
4528 dissect_dso_data(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo _U_
, proto_tree
*dns_tree
)
4530 proto_tree
*dso_tree
;
4531 proto_tree
*dso_tlv_tree
;
4533 proto_item
*dso_tlv_ti
;
4534 uint16_t dso_tlv_length
;
4535 uint32_t dso_tlv_type
;
4538 start_offset
= offset
;
4539 dso_ti
= proto_tree_add_item(dns_tree
, hf_dns_dso
, tvb
, offset
, -1, ENC_NA
);
4540 dso_tree
= proto_item_add_subtree(dso_ti
, ett_dns_dso
);
4542 while(tvb_reported_length_remaining(tvb
, offset
) >= 4) {
4543 dso_tlv_length
= tvb_get_ntohs(tvb
, offset
+ 2);
4544 dso_tlv_ti
= proto_tree_add_item(dso_tree
, hf_dns_dso_tlv
, tvb
, offset
, dso_tlv_length
+ 4, ENC_NA
);
4545 dso_tlv_tree
= proto_item_add_subtree(dso_tlv_ti
, ett_dns_dso_tlv
);
4547 proto_tree_add_item_ret_uint(dso_tlv_tree
, hf_dns_dso_tlv_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &dso_tlv_type
);
4549 proto_item_append_text(dso_tlv_ti
, ": %s", rval_to_str_const(dso_tlv_type
, dns_dso_type_rvals
, "Unknown Type"));
4551 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
4554 switch(dso_tlv_type
) {
4555 case DSO_TYPE_KEEPALIVE
:
4556 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_keepalive_inactivity
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4558 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_keepalive_interval
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4561 case DSO_TYPE_RETRYDELAY
:
4562 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_retrydelay_retrydelay
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
4565 case DSO_TYPE_ENCPAD
:
4566 if (dso_tlv_length
> 0) {
4567 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_encpad_padding
, tvb
, offset
, dso_tlv_length
, ENC_NA
);
4568 offset
+= dso_tlv_length
;
4572 if (dso_tlv_length
> 0) {
4573 proto_tree_add_item(dso_tlv_tree
, hf_dns_dso_tlv_data
, tvb
, offset
, dso_tlv_length
, ENC_NA
);
4574 offset
+= dso_tlv_length
;
4580 proto_item_set_len(dso_ti
, offset
- start_offset
);
4581 return offset
- start_offset
;
4585 dissect_dns_common(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
4586 enum DnsTransport transport
, bool is_mdns
, bool is_llmnr
)
4588 int offset
= (transport
== DNS_TRANSPORT_TCP
|| transport
== DNS_TRANSPORT_QUIC
) ? 2 : 0;
4589 int dns_data_offset
;
4590 proto_tree
*dns_tree
, *field_tree
;
4591 proto_item
*ti
, *tf
, *transaction_item
;
4592 uint16_t flags
, opcode
, rcode
, quest
, ans
, auth
, add
;
4594 uint32_t reqresp_id
= 0;
4597 conversation_t
*conversation
;
4598 dns_conv_info_t
*dns_info
;
4599 dns_transaction_t
*dns_trans
= NULL
;
4600 wmem_tree_key_t key
[3];
4601 struct DnsTap
*dns_stats
;
4602 wmem_list_t
*rr_types
;
4604 uint16_t qclass
= 0;
4605 bool retransmission
= false;
4608 nstime_t delta
= NSTIME_INIT_ZERO
;
4609 bool is_multiple_responds
= false;
4611 dns_data_offset
= offset
;
4613 col_clear(pinfo
->cinfo
, COL_INFO
);
4615 /* To do: check for errs, etc. */
4616 id
= tvb_get_ntohs(tvb
, offset
+ DNS_ID
);
4617 flags
= tvb_get_ntohs(tvb
, offset
+ DNS_FLAGS
);
4618 opcode
= (uint16_t) ((flags
& F_OPCODE
) >> OPCODE_SHIFT
);
4619 rcode
= (uint16_t) (flags
& F_RCODE
);
4621 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, NULL
, "%s%s 0x%04x",
4622 val_to_str(opcode
, opcode_vals
, "Unknown operation (%u)"),
4623 (flags
&F_RESPONSE
)?" response":"", id
);
4625 if (flags
& F_RESPONSE
) {
4626 if (rcode
!= RCODE_NOERROR
) {
4627 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s",
4628 val_to_str(rcode
, rcode_vals
, "Unknown error (%u)"));
4632 if (opcode
== OPCODE_UPDATE
) {
4639 ti
= proto_tree_add_protocol_format(tree
, proto_llmnr
, tvb
, 0, -1,
4640 "Link-local Multicast Name Resolution (%s)", (flags
& F_RESPONSE
) ? "response" : "query");
4641 } else if (is_mdns
){
4642 ti
= proto_tree_add_protocol_format(tree
, proto_mdns
, tvb
, 0, -1,
4643 "Multicast Domain Name System (%s)", (flags
& F_RESPONSE
) ? "response" : "query");
4645 ti
= proto_tree_add_protocol_format(tree
, proto_dns
, tvb
, 0, -1,
4646 "Domain Name System (%s)", (flags
& F_RESPONSE
) ? "response" : "query");
4649 dns_tree
= proto_item_add_subtree(ti
, ett_dns
);
4652 * Do we have a conversation for this connection?
4654 conversation
= find_or_create_conversation(pinfo
);
4657 * DoH: Each DNS query-response pair is mapped into an HTTP exchange.
4658 * For other transports, just use the DNS transaction ID as usual.
4660 if (transport
== DNS_TRANSPORT_HTTP
) {
4661 /* For DoH using HTTP/2, use the Stream ID if available. For HTTP/1,
4662 * hopefully there is no pipelining or the DNS ID is unique enough. */
4663 reqresp_id
= http2_get_stream_id(pinfo
);
4665 if (reqresp_id
== 0) {
4670 * Do we already have a state structure for this conv
4672 dns_info
= (dns_conv_info_t
*)conversation_get_proto_data(conversation
, proto_dns
);
4674 /* No. Attach that information to the conversation, and add
4675 * it to the list of information structures.
4677 dns_info
= wmem_new(wmem_file_scope(), dns_conv_info_t
);
4678 dns_info
->pdus
=wmem_tree_new(wmem_file_scope());
4679 conversation_add_proto_data(conversation
, proto_dns
, dns_info
);
4683 key
[0].key
= &reqresp_id
;
4685 key
[1].key
= &pinfo
->num
;
4689 if (!pinfo
->flags
.in_error_pkt
) {
4690 if (!pinfo
->fd
->visited
) {
4691 if (!(flags
&F_RESPONSE
)) {
4692 /* This is a request */
4693 bool new_transaction
= false;
4695 /* Check if we've seen this transaction before */
4696 dns_trans
=(dns_transaction_t
*)wmem_tree_lookup32_array_le(dns_info
->pdus
, key
);
4697 if ((dns_trans
== NULL
) || (dns_trans
->id
!= reqresp_id
) || (dns_trans
->rep_frame
> 0)) {
4698 new_transaction
= true;
4700 nstime_t request_delta
;
4702 /* Has not enough time elapsed that we consider this request a retransmission? */
4703 nstime_delta(&request_delta
, &pinfo
->abs_ts
, &dns_trans
->req_time
);
4704 if (nstime_to_sec(&request_delta
) < (double)retransmission_timer
) {
4705 retransmission
= true;
4707 new_transaction
= true;
4711 if (new_transaction
) {
4712 dns_trans
=wmem_new(wmem_file_scope(), dns_transaction_t
);
4713 dns_trans
->req_frame
=pinfo
->num
;
4714 dns_trans
->rep_frame
=0;
4715 dns_trans
->req_time
=pinfo
->abs_ts
;
4716 dns_trans
->id
= reqresp_id
;
4717 dns_trans
->multiple_responds
=false;
4718 wmem_tree_insert32_array(dns_info
->pdus
, key
, (void *)dns_trans
);
4721 dns_trans
=(dns_transaction_t
*)wmem_tree_lookup32_array_le(dns_info
->pdus
, key
);
4723 if (dns_trans
->id
!= reqresp_id
) {
4725 } else if (dns_trans
->rep_frame
== 0) {
4726 dns_trans
->rep_frame
=pinfo
->num
;
4727 } else if (!dns_trans
->multiple_responds
) {
4728 retransmission
= true;
4733 dns_trans
=(dns_transaction_t
*)wmem_tree_lookup32_array_le(dns_info
->pdus
, key
);
4735 if (dns_trans
->id
!= reqresp_id
) {
4737 } else if ((!(flags
& F_RESPONSE
)) && (dns_trans
->req_frame
!= pinfo
->num
)) {
4738 /* This is a request retransmission, create a "fake" dns_trans structure*/
4739 dns_transaction_t
*retrans_dns
= wmem_new(pinfo
->pool
, dns_transaction_t
);
4740 retrans_dns
->req_frame
=dns_trans
->req_frame
;
4741 retrans_dns
->rep_frame
=0;
4742 retrans_dns
->req_time
=pinfo
->abs_ts
;
4743 dns_trans
= retrans_dns
;
4745 retransmission
= true;
4746 } else if ((flags
& F_RESPONSE
) && (dns_trans
->rep_frame
!= pinfo
->num
) && (!dns_trans
->multiple_responds
)) {
4747 retransmission
= true;
4753 /* create a "fake" dns_trans structure */
4754 dns_trans
=wmem_new(pinfo
->pool
, dns_transaction_t
);
4755 dns_trans
->req_frame
=0;
4756 dns_trans
->rep_frame
=0;
4757 dns_trans
->req_time
=pinfo
->abs_ts
;
4760 if (transport
== DNS_TRANSPORT_TCP
) {
4761 /* Put the length indication into the tree. */
4762 proto_tree_add_item(dns_tree
, hf_dns_length
, tvb
, offset
- 2, 2, ENC_BIG_ENDIAN
);
4765 transaction_item
= proto_tree_add_uint(dns_tree
, hf_dns_transaction_id
, tvb
,
4766 offset
+ DNS_ID
, 2, id
);
4768 tf
= proto_tree_add_item(dns_tree
, hf_dns_flags
, tvb
,
4769 offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4770 proto_item_append_text(tf
, " %s",
4771 val_to_str_const(opcode
, opcode_vals
, "Unknown operation"));
4772 if (flags
& F_RESPONSE
) {
4773 proto_item_append_text(tf
, " response, %s",
4774 val_to_str_const(rcode
, rcode_vals
, "Unknown error"));
4776 field_tree
= proto_item_add_subtree(tf
, ett_dns_flags
);
4777 proto_tree_add_item(field_tree
, hf_dns_flags_response
,
4778 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4779 proto_tree_add_item(field_tree
, hf_dns_flags_opcode
,
4780 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4782 if (flags
& F_RESPONSE
) {
4783 proto_tree_add_item(field_tree
, hf_dns_flags_conflict_response
,
4784 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4786 proto_tree_add_item(field_tree
, hf_dns_flags_conflict_query
,
4787 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4789 proto_tree_add_item(field_tree
, hf_dns_flags_truncated
,
4790 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4791 proto_tree_add_item(field_tree
, hf_dns_flags_tentative
,
4792 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4793 if (flags
& F_RESPONSE
) {
4794 proto_tree_add_item(field_tree
, hf_dns_flags_rcode
,
4795 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4798 if (flags
& F_RESPONSE
) {
4799 proto_tree_add_item(field_tree
, hf_dns_flags_authoritative
,
4800 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4802 proto_tree_add_item(field_tree
, hf_dns_flags_truncated
,
4803 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4804 proto_tree_add_item(field_tree
, hf_dns_flags_recdesired
,
4805 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4806 if (flags
& F_RESPONSE
) {
4807 proto_tree_add_item(field_tree
, hf_dns_flags_recavail
,
4808 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4810 proto_tree_add_item(field_tree
, hf_dns_flags_z
,
4811 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4812 if (flags
& F_RESPONSE
) {
4813 proto_tree_add_item(field_tree
, hf_dns_flags_authenticated
,
4814 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4815 } else if (flags
& F_AUTHENTIC
) {
4816 proto_tree_add_item(field_tree
, hf_dns_flags_ad
,
4817 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4819 proto_tree_add_item(field_tree
, hf_dns_flags_checkdisable
,
4820 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4821 if (flags
& F_RESPONSE
) {
4822 proto_tree_add_item(field_tree
, hf_dns_flags_rcode
,
4823 tvb
, offset
+ DNS_FLAGS
, 2, ENC_BIG_ENDIAN
);
4827 quest
= tvb_get_ntohs(tvb
, offset
+ DNS_QUEST
);
4829 proto_tree_add_uint(dns_tree
, hf_dns_count_zones
, tvb
,
4830 offset
+ DNS_QUEST
, 2, quest
);
4832 proto_tree_add_uint(dns_tree
, hf_dns_count_questions
, tvb
,
4833 offset
+ DNS_QUEST
, 2, quest
);
4835 ans
= tvb_get_ntohs(tvb
, offset
+ DNS_ANS
);
4837 proto_tree_add_uint(dns_tree
, hf_dns_count_prerequisites
, tvb
,
4838 offset
+ DNS_ANS
, 2, ans
);
4840 proto_tree_add_uint(dns_tree
, hf_dns_count_answers
, tvb
,
4841 offset
+ DNS_ANS
, 2, ans
);
4843 auth
= tvb_get_ntohs(tvb
, offset
+ DNS_AUTH
);
4845 proto_tree_add_uint(dns_tree
, hf_dns_count_updates
, tvb
,
4846 offset
+ DNS_AUTH
, 2, auth
);
4848 proto_tree_add_uint(dns_tree
, hf_dns_count_auth_rr
, tvb
,
4849 offset
+ DNS_AUTH
, 2, auth
);
4851 add
= tvb_get_ntohs(tvb
, offset
+ DNS_ADD
);
4852 proto_tree_add_uint(dns_tree
, hf_dns_count_add_rr
, tvb
,
4853 offset
+ DNS_ADD
, 2, add
);
4855 cur_off
= offset
+ DNS_HDRLEN
;
4857 if (opcode
== OPCODE_DSO
&& quest
== 0 && ans
== 0 && auth
== 0 && add
== 0) {
4858 /* DSO messages differs somewhat from the traditional DNS message format.
4859 the four count fields (QDCOUNT, ANCOUNT, NSCOUNT, ARCOUNT) are set to zero */
4860 cur_off
+= dissect_dso_data(tvb
, cur_off
, pinfo
, dns_tree
);
4863 rr_types
= wmem_list_new(pinfo
->pool
);
4866 /* If this is a response, don't add information about the queries
4867 to the summary, just add information about the answers. */
4868 cur_off
+= dissect_query_records(tvb
, cur_off
, dns_data_offset
, quest
, pinfo
,
4869 dns_tree
, isupdate
, is_mdns
, &is_multiple_responds
);
4870 dns_trans
->multiple_responds
= is_multiple_responds
;
4874 // set answer array and its index
4875 p_dns_qr_r_rx_ttls
= dns_qr_r_ra_ttls
;
4876 p_dns_qr_r_rx_ttl_index
= &dns_qr_r_ra_ttl_index
;
4877 /* If this is a request, don't add information about the answers
4878 to the summary, just add information about the queries. */
4879 cur_off
+= dissect_answer_records(tvb
, cur_off
, dns_data_offset
, ans
,
4881 (isupdate
? "Prerequisites" : "Answers"),
4882 pinfo
, is_mdns
, rr_types
);
4885 /* Don't add information about the authoritative name servers, or the
4886 additional records, to the summary. */
4888 // set authority array and its index
4889 p_dns_qr_r_rx_ttls
= dns_qr_r_ru_ttls
;
4890 p_dns_qr_r_rx_ttl_index
= &dns_qr_r_ru_ttl_index
;
4891 cur_off
+= dissect_answer_records(tvb
, cur_off
, dns_data_offset
, auth
, dns_tree
,
4892 (isupdate
? "Updates" :
4893 "Authoritative nameservers"),
4894 pinfo
, is_mdns
, rr_types
);
4898 // set additional array and its index
4899 p_dns_qr_r_rx_ttls
= dns_qr_r_rd_ttls
;
4900 p_dns_qr_r_rx_ttl_index
= &dns_qr_r_rd_ttl_index
;
4901 cur_off
+= dissect_answer_records(tvb
, cur_off
, dns_data_offset
, add
, dns_tree
, "Additional records",
4902 pinfo
, is_mdns
, rr_types
);
4904 col_set_fence(pinfo
->cinfo
, COL_INFO
);
4906 /* print state tracking in the tree */
4907 if (!(flags
&F_RESPONSE
)) {
4909 /* This is a request */
4910 if ((retransmission
) && (dns_trans
->req_frame
) && (!pinfo
->flags
.in_error_pkt
)) {
4911 expert_add_info_format(pinfo
, transaction_item
, &ei_dns_retransmit_request
, "DNS query retransmission. Original request in frame %d", dns_trans
->req_frame
);
4913 it
=proto_tree_add_uint(dns_tree
, hf_dns_retransmit_request_in
, tvb
, 0, 0, dns_trans
->req_frame
);
4914 proto_item_set_generated(it
);
4916 it
=proto_tree_add_boolean(dns_tree
, hf_dns_retransmission
, tvb
, 0, 0, true);
4917 proto_item_set_generated(it
);
4918 } else if (dns_trans
->rep_frame
) {
4920 it
=proto_tree_add_uint(dns_tree
, hf_dns_response_in
, tvb
, 0, 0, dns_trans
->rep_frame
);
4921 proto_item_set_generated(it
);
4922 } else if PINFO_FD_VISITED(pinfo
) {
4923 expert_add_info(pinfo
, transaction_item
, &ei_dns_response_missing
);
4926 /* This is a reply */
4928 if (dns_trans
->req_frame
) {
4929 if ((retransmission
) && (dns_trans
->rep_frame
) && (!pinfo
->flags
.in_error_pkt
)) {
4930 expert_add_info_format(pinfo
, transaction_item
, &ei_dns_retransmit_response
, "DNS response retransmission. Original response in frame %d", dns_trans
->rep_frame
);
4932 it
=proto_tree_add_uint(dns_tree
, hf_dns_retransmit_response_in
, tvb
, 0, 0, dns_trans
->rep_frame
);
4933 proto_item_set_generated(it
);
4935 it
=proto_tree_add_boolean(dns_tree
, hf_dns_retransmission
, tvb
, 0, 0, true);
4936 proto_item_set_generated(it
);
4938 it
=proto_tree_add_uint(dns_tree
, hf_dns_response_to
, tvb
, 0, 0, dns_trans
->req_frame
);
4939 proto_item_set_generated(it
);
4941 nstime_delta(&delta
, &pinfo
->abs_ts
, &dns_trans
->req_time
);
4942 it
=proto_tree_add_time(dns_tree
, hf_dns_time
, tvb
, 0, 0, &delta
);
4943 proto_item_set_generated(it
);
4946 if (!retransmission
) {
4947 it
=proto_tree_add_boolean(dns_tree
, hf_dns_unsolicited
, tvb
, 0, 0, true);
4948 proto_item_set_generated(it
);
4953 /* Do we have any extraneous data? */
4954 int extraneous_length
= tvb_reported_length_remaining(tvb
, cur_off
);
4955 if(extraneous_length
> 0) {
4956 proto_tree
*ext_tree
;
4959 ext_tree
= proto_tree_add_subtree_format(dns_tree
, tvb
, cur_off
, extraneous_length
,
4960 ett_dns_extraneous
, &it
, "Extraneous Data (%d bytes)", extraneous_length
);
4962 proto_tree_add_item(ext_tree
, hf_dns_extraneous_data
, tvb
, cur_off
, extraneous_length
, ENC_NA
);
4964 it
= proto_tree_add_int(ext_tree
, hf_dns_extraneous_length
, tvb
, 0, 0, extraneous_length
);
4965 proto_item_set_generated(it
);
4967 it
= proto_tree_add_expert(ext_tree
, pinfo
, &ei_dns_extraneous_data
, tvb
, cur_off
, extraneous_length
);
4968 proto_item_set_hidden(it
);
4972 if (pinfo
->flags
.in_error_pkt
) {
4977 } else if (is_llmnr
) {
4980 dns_stats
= wmem_new0(pinfo
->pool
, struct DnsTap
);
4981 dns_stats
->packet_rcode
= rcode
;
4982 dns_stats
->packet_opcode
= opcode
;
4983 dns_stats
->packet_qr
= flags
>> 15;
4985 get_dns_name_type_class(tvb
, offset
+ DNS_HDRLEN
, dns_data_offset
, &name
, &name_len
, &qtype
, &qclass
);
4986 dns_stats
->packet_qtype
= qtype
;
4987 dns_stats
->packet_qclass
= qclass
;
4989 dns_stats
->payload_size
= tvb_captured_length(tvb
);
4990 dns_stats
->nquestions
= quest
;
4991 dns_stats
->nanswers
= ans
;
4992 dns_stats
->nauthorities
= auth
;
4993 dns_stats
->nadditionals
= add
;
4995 dns_stats
->qname_len
= name_len
;
4996 dns_stats
->qname_labels
= qname_labels_count(name
, name_len
);
4997 dns_stats
->qname
= format_text(pinfo
->pool
, (const unsigned char *)name
, name_len
);
4998 // split into host and domain
4999 qname_host_and_domain(dns_stats
->qname
, name_len
, dns_stats
->qhost
, dns_stats
->qdomain
);
5000 // queries could also be retransmitted
5001 if (retransmission
) {
5002 dns_stats
->retransmission
= true;
5005 if (flags
& F_RESPONSE
) {
5006 if (dns_trans
->req_frame
== 0) {
5007 /* we don't have a request. This is an unsolicited response */
5008 dns_stats
->unsolicited
= true;
5011 dns_stats
->retransmission
= true;
5013 dns_stats
->rrt
= delta
;
5016 dns_stats
->rr_types
= rr_types
;
5017 // storing ip (for "from" category in query and response)
5018 if (pinfo
->src
.type
== AT_IPv4
) {
5019 ip_addr_to_str_buf(pinfo
->src
.data
, dns_stats
->source
, sizeof(dns_stats
->source
));
5021 else if (pinfo
->src
.type
== AT_IPv6
) {
5022 ip6_to_str_buf(pinfo
->src
.data
, dns_stats
->source
, sizeof(dns_stats
->source
));
5025 ws_label_strcpy(dns_stats
->source
, sizeof(dns_stats
->source
), 0, "n/a",0);
5027 // resetting to zero for the next response
5028 dns_qr_r_ra_ttl_index
= 0;
5029 dns_qr_r_ru_ttl_index
= 0;
5030 dns_qr_r_rd_ttl_index
= 0;
5031 tap_queue_packet(dns_tap
, pinfo
, dns_stats
);
5036 dissect_dns_udp_sctp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5038 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DNS");
5040 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_UDP
, false, false);
5041 return tvb_captured_length(tvb
);
5045 dissect_dns_doh(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5047 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DoH");
5049 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_HTTP
, false, false);
5050 return tvb_captured_length(tvb
);
5054 dissect_dns_doq(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5056 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DNS");
5058 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_QUIC
, false, false);
5059 return tvb_captured_length(tvb
);
5063 dissect_mdns_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5065 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "MDNS");
5067 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_UDP
, true, false);
5068 return tvb_captured_length(tvb
);
5072 dissect_llmnr_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5074 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "LLMNR");
5076 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_UDP
, false, true);
5077 return tvb_captured_length(tvb
);
5081 get_dns_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
5086 * Get the length of the DNS packet.
5088 plen
= tvb_get_ntohs(tvb
, offset
);
5091 * That length doesn't include the length field itself; add that in.
5097 dissect_dns_tcp_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
5099 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DNS");
5101 dissect_dns_common(tvb
, pinfo
, tree
, DNS_TRANSPORT_TCP
, false, false);
5102 return tvb_reported_length(tvb
);
5106 dissect_dns_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
5108 tcp_dissect_pdus(tvb
, pinfo
, tree
, dns_desegment
, 2, get_dns_pdu_len
,
5109 dissect_dns_tcp_pdu
, data
);
5110 return tvb_reported_length(tvb
);
5114 dissect_dns(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
5116 /* since draft-ietf-doh-dns-over-https-07 */
5117 bool is_doh
= !g_strcmp0(pinfo
->match_string
, "application/dns-message");
5120 return dissect_dns_doh(tvb
, pinfo
, tree
, data
);
5121 } else if (pinfo
->ptype
== PT_TCP
) {
5122 return dissect_dns_tcp(tvb
, pinfo
, tree
, data
);
5124 dissect_dns_udp_sctp(tvb
, pinfo
, tree
, data
);
5125 return tvb_captured_length(tvb
);
5130 dissect_dns_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
5133 * Try hard to match DNS messages while avoiding false positives. Look for:
5135 * - Non-empty DNS messages (more than just a header).
5136 * - Flags: QR bit (0-Query, 1-Response); Opcode bits: Standard Query (0000)
5137 * - Questions: 1 (for queries), or 0 or 1 (for responses like AXFR)
5138 * - Answer RRs: 0 (for queries) or a low number (for responses)
5139 * - Authority RRs: 0 (for queries) or a low number (for responses)
5140 * - Additional RRs: assume a low number.
5141 * - Require that the question and answer count cannot both be zero. Perhaps
5142 * some protocols have large sequences of zero bytes, this check reduces the
5143 * probability of matching such payloads.
5144 * - Check that the packet is long enough to carry the Questions and RRs.
5146 * Not implemented, but perhaps we could check for:
5147 * - Assume a valid QNAME in the question section. (Is there sufficient data
5148 * for a valid name?)
5149 * - Assume a common QTYPE and QCLASS (IN/CH).
5150 * - Potentially implement heuristics for TCP by checking the length prefix?
5153 uint16_t flags
, quest
, ans
, auth
, add
;
5155 * max_ans=10 was sufficient for recognizing the majority of DNS messages from
5156 * the rrdns test suite, but four "huge record" test cases have 100 answers.
5157 * The max_auth and max_add numbers were picked arbitrarily.
5159 const uint16_t max_ans
= 100;
5160 const uint16_t max_auth
= 10;
5161 const uint16_t max_add
= 10;
5163 if (tvb_reported_length(tvb
) <= DNS_HDRLEN
)
5166 flags
= tvb_get_ntohs(tvb
, offset
+ DNS_FLAGS
);
5167 if ((flags
& F_OPCODE
) != 0)
5170 quest
= tvb_get_ntohs(tvb
, offset
+ DNS_QUEST
);
5171 ans
= tvb_get_ntohs(tvb
, offset
+ DNS_ANS
);
5172 auth
= tvb_get_ntohs(tvb
, offset
+ DNS_AUTH
);
5173 if (!(flags
& F_RESPONSE
)) {
5174 if (quest
!= 1 || ans
!= 0 || auth
!= 0)
5177 if (quest
> 1 || ans
> max_ans
|| auth
> max_auth
)
5181 add
= tvb_get_ntohs(tvb
, offset
+ DNS_ADD
);
5185 if (quest
+ ans
== 0)
5188 /* Do we even have enough space left? */
5189 if ( (quest
* 6 + (ans
+ auth
+ add
) * 11) > tvb_reported_length_remaining(tvb
, offset
+ DNS_HDRLEN
))
5192 dissect_dns(tvb
, pinfo
, tree
, NULL
);
5196 static void dns_stats_tree_init(stats_tree
* st
)
5198 stats_tree_create_node(st
, st_str_packets
, 0, STAT_DT_INT
, true);
5199 stat_node_set_flags(st
, st_str_packets
, 0, false, ST_FLG_SORT_TOP
);
5200 st_node_packet_qr
= stats_tree_create_pivot(st
, st_str_packet_qr
, 0);
5201 st_node_packet_qtypes
= stats_tree_create_pivot(st
, st_str_packet_qtypes
, 0);
5202 st_node_rr_types
= stats_tree_create_pivot(st
, st_str_rr_types
, 0);
5203 st_node_packet_qnames
= stats_tree_create_pivot(st
, st_str_packet_qnames
, 0);
5204 st_node_packet_qclasses
= stats_tree_create_pivot(st
, st_str_packet_qclasses
, 0);
5205 st_node_packet_rcodes
= stats_tree_create_pivot(st
, st_str_packet_rcodes
, 0);
5206 st_node_packet_opcodes
= stats_tree_create_pivot(st
, st_str_packet_opcodes
, 0);
5207 st_node_packets_avg_size
= stats_tree_create_node(st
, st_str_packets_avg_size
, 0, STAT_DT_INT
, false);
5208 st_node_query_stats
= stats_tree_create_node(st
, st_str_query_stats
, 0, STAT_DT_INT
, true);
5209 st_node_query_qname_len
= stats_tree_create_node(st
, st_str_query_qname_len
, st_node_query_stats
, STAT_DT_INT
, false);
5210 st_node_query_domains
= stats_tree_create_node(st
, st_str_query_domains
, st_node_query_stats
, STAT_DT_INT
, true);
5211 st_node_query_domains_l1
= stats_tree_create_node(st
, st_str_query_domains_l1
, st_node_query_domains
, STAT_DT_INT
, false);
5212 st_node_query_domains_l2
= stats_tree_create_node(st
, st_str_query_domains_l2
, st_node_query_domains
, STAT_DT_INT
, false);
5213 st_node_query_domains_l3
= stats_tree_create_node(st
, st_str_query_domains_l3
, st_node_query_domains
, STAT_DT_INT
, false);
5214 st_node_query_domains_lmore
= stats_tree_create_node(st
, st_str_query_domains_lmore
, st_node_query_domains
, STAT_DT_INT
, false);
5215 st_node_response_stats
= stats_tree_create_node(st
, st_str_response_stats
, 0, STAT_DT_INT
, true);
5216 st_node_response_nquestions
= stats_tree_create_node(st
, st_str_response_nquestions
,
5217 st_node_response_stats
, STAT_DT_INT
, false);
5218 st_node_response_nanswers
= stats_tree_create_node(st
, st_str_response_nanswers
,
5219 st_node_response_stats
, STAT_DT_INT
, false);
5220 st_node_response_nauthorities
= stats_tree_create_node(st
, st_str_response_nauthorities
,
5221 st_node_response_stats
, STAT_DT_INT
, false);
5222 st_node_response_nadditionals
= stats_tree_create_node(st
, st_str_response_nadditionals
,
5223 st_node_response_stats
, STAT_DT_INT
, false);
5224 st_node_service_stats
= stats_tree_create_node(st
, st_str_service_stats
, 0, STAT_DT_INT
, true);
5225 st_node_service_unsolicited
= stats_tree_create_node(st
, st_str_service_unsolicited
, st_node_service_stats
, STAT_DT_INT
, false);
5226 st_node_service_retransmission
= stats_tree_create_node(st
, st_str_service_retransmission
, st_node_service_stats
, STAT_DT_INT
, false);
5227 st_node_service_rrt
= stats_tree_create_node(st
, st_str_service_rrt
, st_node_service_stats
, STAT_DT_FLOAT
, false);
5230 static tap_packet_status
dns_stats_tree_packet(stats_tree
* st
, packet_info
* pinfo _U_
, epan_dissect_t
* edt _U_
, const void* p
, tap_flags_t flags _U_
)
5232 const struct DnsTap
*pi
= (const struct DnsTap
*)p
;
5233 tick_stat_node(st
, st_str_packets
, 0, false);
5234 stats_tree_tick_pivot(st
, st_node_packet_qr
,
5235 val_to_str(pi
->packet_qr
, dns_qr_vals
, "Unknown qr (%d)"));
5236 stats_tree_tick_pivot(st
, st_node_packet_qtypes
,
5237 val_to_str(pi
->packet_qtype
, dns_types_vals
, "Unknown packet type (%d)"));
5238 if (dns_qname_stats
) {
5239 stats_tree_tick_pivot(st
, st_node_packet_qnames
, pi
->qname
);
5241 stats_tree_tick_pivot(st
, st_node_packet_qclasses
,
5242 val_to_str(pi
->packet_qclass
, dns_classes
, "Unknown class (%d)"));
5243 stats_tree_tick_pivot(st
, st_node_packet_rcodes
,
5244 val_to_str(pi
->packet_rcode
, rcode_vals
, "Unknown rcode (%d)"));
5245 stats_tree_tick_pivot(st
, st_node_packet_opcodes
,
5246 val_to_str(pi
->packet_opcode
, opcode_vals
, "Unknown opcode (%d)"));
5247 avg_stat_node_add_value_int(st
, st_str_packets_avg_size
, 0, false,
5250 /* split up stats for queries and responses */
5251 if (pi
->packet_qr
== 0) {
5252 avg_stat_node_add_value_int(st
, st_str_query_qname_len
, 0, false, pi
->qname_len
);
5253 switch(pi
->qname_labels
) {
5255 tick_stat_node(st
, st_str_query_domains_l1
, 0, false);
5258 tick_stat_node(st
, st_str_query_domains_l2
, 0, false);
5261 tick_stat_node(st
, st_str_query_domains_l3
, 0, false);
5264 tick_stat_node(st
, st_str_query_domains_lmore
, 0, false);
5268 avg_stat_node_add_value_int(st
, st_str_response_nquestions
, 0, false, pi
->nquestions
);
5269 avg_stat_node_add_value_int(st
, st_str_response_nanswers
, 0, false, pi
->nanswers
);
5270 avg_stat_node_add_value_int(st
, st_str_response_nauthorities
, 0, false, pi
->nauthorities
);
5271 avg_stat_node_add_value_int(st
, st_str_response_nadditionals
, 0, false, pi
->nadditionals
);
5273 /* add answer types to stats */
5274 for (wmem_list_frame_t
*type_entry
= wmem_list_head(pi
->rr_types
); type_entry
!= NULL
; type_entry
= wmem_list_frame_next(type_entry
)) {
5275 int qtype_val
= GPOINTER_TO_INT(wmem_list_frame_data(type_entry
));
5276 stats_tree_tick_pivot(st
, st_node_rr_types
,
5277 val_to_str(qtype_val
, dns_types_vals
, "Unknown packet type (%d)"));
5280 if (pi
->unsolicited
) {
5281 tick_stat_node(st
, st_str_service_unsolicited
, 0, false);
5283 avg_stat_node_add_value_int(st
, st_str_response_nquestions
, 0, false, pi
->nquestions
);
5284 avg_stat_node_add_value_int(st
, st_str_response_nanswers
, 0, false, pi
->nanswers
);
5285 avg_stat_node_add_value_int(st
, st_str_response_nauthorities
, 0, false, pi
->nauthorities
);
5286 avg_stat_node_add_value_int(st
, st_str_response_nadditionals
, 0, false, pi
->nadditionals
);
5287 if (pi
->unsolicited
) {
5288 tick_stat_node(st
, st_str_service_unsolicited
, 0, false);
5290 if (pi
->retransmission
)
5291 tick_stat_node(st
, st_str_service_retransmission
, 0, false);
5293 avg_stat_node_add_value_float(st
, st_str_service_rrt
, 0, false, (float)(pi
->rrt
.secs
*1000. + pi
->rrt
.nsecs
/1000000.0));
5297 return TAP_PACKET_REDRAW
;
5300 static void dns_qr_stats_tree_init(stats_tree
* st
)
5302 dns_qr_statistics_enabled
= prefs_get_bool_value(perf_qr_enable_statistics
, pref_current
);
5303 dns_qr_qrn_statistics_enabled
= prefs_get_bool_value(perf_qr_qrn_enable_statistics
, pref_current
);
5304 dns_qr_qrn_aud_zv_statistics_enabled
= prefs_get_bool_value(perf_qr_qrn_aud_zv_enable_statistics
, pref_current
);
5306 if (!dns_qr_statistics_enabled
) {
5311 if (dns_qr_t_statistics_enabled
) {
5312 st_node_qr_t_packets
= stats_tree_create_node(st
, st_str_qr_t_packets
, 0, STAT_DT_INT
, true);
5316 if (dns_qr_q_statistics_enabled
) {
5317 st_node_qr_q_packets
= stats_tree_create_node(st
, st_str_qr_q_packets
, 0, STAT_DT_INT
, true);
5320 if (dns_qr_qf_statistics_enabled
) {
5321 st_node_qr_qf_packets
= stats_tree_create_pivot(st
, st_str_qr_qf_packets
, st_node_qr_q_packets
);
5324 // qo = Query-Opcode
5325 if (dns_qr_qo_statistics_enabled
) {
5326 st_node_qr_qo_packets
= stats_tree_create_pivot(st
, st_str_qr_qo_packets
, st_node_qr_q_packets
);
5330 if (dns_qr_qk_statistics_enabled
) {
5331 st_node_qr_qk_packets
= stats_tree_create_pivot(st
, st_str_qr_qk_packets
, st_node_qr_q_packets
);
5335 if (dns_qr_qt_statistics_enabled
) {
5336 st_node_qr_qt_packets
= stats_tree_create_pivot(st
, st_str_qr_qt_packets
, st_node_qr_q_packets
);
5340 if (dns_qr_ql_statistics_enabled
) {
5341 st_node_qr_ql_packets
= stats_tree_create_pivot(st
, st_str_qr_ql_packets
, st_node_qr_q_packets
);
5344 // qp = Query-Payload
5345 if (dns_qr_qp_statistics_enabled
) {
5346 st_node_qr_qp_packets
= stats_tree_create_pivot(st
, st_str_qr_qp_packets
, st_node_qr_q_packets
);
5349 // qs = Query-Servicing
5350 if (dns_qr_qs_statistics_enabled
) {
5351 st_node_qr_qs_packets
= stats_tree_create_node(st
, st_str_qr_qs_packets
, st_node_qr_q_packets
, STAT_DT_INT
, true);
5353 // qs_a = Answered (ms)
5354 if (dns_qr_qs_a_statistics_enabled
) {
5355 st_node_qr_qs_a_packets
= stats_tree_create_node(st
, st_str_qr_qs_a_packets
, st_node_qr_qs_packets
, STAT_DT_FLOAT
, true);
5358 // qs_u = Unanswered
5359 if (dns_qr_qs_u_statistics_enabled
) {
5360 st_node_qr_qs_u_packets
= stats_tree_create_pivot(st
, st_str_qr_qs_u_packets
, st_node_qr_qs_packets
);
5363 // qs_r = Retransmission
5364 if (dns_qr_qs_r_statistics_enabled
) {
5365 st_node_qr_qs_r_packets
= stats_tree_create_pivot(st
, st_str_qr_qs_r_packets
, st_node_qr_qs_packets
);
5371 if (dns_qr_r_statistics_enabled
) {
5372 st_node_qr_r_packets
= stats_tree_create_node(st
, st_str_qr_r_packets
, 0, STAT_DT_INT
, true);
5374 // rf = Response-From
5375 if (dns_qr_rf_statistics_enabled
) {
5376 st_node_qr_rf_packets
= stats_tree_create_pivot(st
, st_str_qr_rf_packets
, st_node_qr_r_packets
);
5379 // rc = Response-Code
5380 if (dns_qr_rc_statistics_enabled
) {
5381 st_node_qr_rc_packets
= stats_tree_create_pivot(st
, st_str_qr_rc_packets
, st_node_qr_r_packets
);
5384 // rk = Response-Kind
5385 if (dns_qr_rk_statistics_enabled
) {
5386 st_node_qr_rk_packets
= stats_tree_create_pivot(st
, st_str_qr_rk_packets
, st_node_qr_r_packets
);
5389 // ra = Response-Answer
5390 if (dns_qr_ra_statistics_enabled
) {
5391 st_node_qr_ra_packets
= stats_tree_create_pivot(st
, st_str_qr_ra_packets
, st_node_qr_r_packets
);
5394 // ru = Response-aUthority
5395 if (dns_qr_ru_statistics_enabled
) {
5396 st_node_qr_ru_packets
= stats_tree_create_pivot(st
, st_str_qr_ru_packets
, st_node_qr_r_packets
);
5399 // ru = Response-aDditional
5400 if (dns_qr_rd_statistics_enabled
) {
5401 st_node_qr_rd_packets
= stats_tree_create_pivot(st
, st_str_qr_rd_packets
, st_node_qr_r_packets
);
5404 // rp = Response-Payload
5405 if (dns_qr_rp_statistics_enabled
) {
5406 st_node_qr_rp_packets
= stats_tree_create_pivot(st
, st_str_qr_rp_packets
, st_node_qr_r_packets
);
5409 // rs = Response-Servicing
5410 if (dns_qr_rs_statistics_enabled
) {
5411 st_node_qr_rs_packets
= stats_tree_create_node(st
, st_str_qr_rs_packets
, st_node_qr_r_packets
, STAT_DT_INT
, true);
5413 // rs_a = Answered (ms)
5414 if (dns_qr_rs_a_statistics_enabled
) {
5415 st_node_qr_rs_a_packets
= stats_tree_create_node(st
, st_str_qr_rs_a_packets
, st_node_qr_rs_packets
, STAT_DT_FLOAT
, true);
5418 // rs_n = Unsolicited
5419 if (dns_qr_rs_u_statistics_enabled
) {
5420 st_node_qr_rs_u_packets
= stats_tree_create_pivot(st
, st_str_qr_rs_u_packets
, st_node_qr_rs_packets
);
5423 // rs_r = Retransmission
5424 if (dns_qr_rs_r_statistics_enabled
) {
5425 st_node_qr_rs_r_packets
= stats_tree_create_pivot(st
, st_str_qr_rs_r_packets
, st_node_qr_rs_packets
);
5429 // rt = Response-TTL
5430 if (dns_qr_rt_statistics_enabled
) {
5431 st_node_qr_rt_packets
= stats_tree_create_pivot(st
, st_str_qr_rt_packets
, st_node_qr_r_packets
);
5434 if (dns_qr_rt_a_statistics_enabled
) {
5435 st_node_qr_rt_a_packets
= stats_tree_create_pivot(st
, st_str_qr_rt_a_packets
, st_node_qr_rt_packets
);
5439 if (dns_qr_rt_u_statistics_enabled
) {
5440 st_node_qr_rt_u_packets
= stats_tree_create_pivot(st
, st_str_qr_rt_u_packets
, st_node_qr_rt_packets
);
5443 // rt_d = aDditional
5444 if (dns_qr_rt_d_statistics_enabled
) {
5445 st_node_qr_rt_d_packets
= stats_tree_create_pivot(st
, st_str_qr_rt_d_packets
, st_node_qr_rt_packets
);
5451 static tap_packet_status
dns_qr_stats_tree_packet(stats_tree
* st
, packet_info
* pinfo _U_
, epan_dissect_t
* edt _U_
, const void* p
, tap_flags_t flags _U_
)
5454 ws_debug("total packets: %u\n", pinfo
->num
);
5456 if (!dns_qr_statistics_enabled
) {
5457 ws_debug("dns_qr_statistics_enabled = false\n");
5462 static int st_node
= 1;
5463 const struct DnsTap
* pi
= (const struct DnsTap
*)p
;
5466 if (dns_qr_t_statistics_enabled
) {
5467 ws_debug(" t = Total\n");
5468 stats_tree_tick_pivot(st
, st_node_qr_t_packets
, val_to_str(pi
->packet_qr
, dns_qr_vals
, "Unknown qr (%d)"));
5472 if (pi
->packet_qr
== 0) { // query
5475 if (!dns_qr_q_statistics_enabled
) {
5476 ws_debug("dns_qr_q_statistics_enabled = false\n");
5481 if (dns_qr_qf_statistics_enabled
) {
5482 ws_debug("qo = Query-From\n");
5483 tick_stat_node(st
, st_str_qr_qf_packets
, st_node_qr_q_packets
, true);
5485 if (pinfo
->src
.type
== AT_IPv4
) {
5486 ip_addr_to_str_buf(pinfo
->src
.data
, buf
, sizeof(buf
));
5488 else if (pinfo
->src
.type
== AT_IPv6
) {
5489 ip6_to_str_buf(pinfo
->src
.data
, buf
, sizeof(buf
));
5491 st_node
= tick_stat_node(st
, buf
, st_node_qr_qf_packets
, true);
5492 if (dns_qr_qrn_statistics_enabled
) {
5493 tick_stat_node(st
, pi
->qname
, st_node
, false);
5497 // qo = Query-Opcode
5498 if (dns_qr_qo_statistics_enabled
) {
5499 ws_debug("qo = Query-Opcode\n");
5500 tick_stat_node(st
, st_str_qr_qo_packets
, st_node_qr_q_packets
, true);
5501 st_node
= tick_stat_node(st
, val_to_str(pi
->packet_opcode
, opcode_vals
, "Unknown opcode (%d)"), st_node_qr_qo_packets
, true);
5502 if (dns_qr_qrn_statistics_enabled
) {
5503 tick_stat_node(st
, pi
->qname
, st_node
, false);
5508 if (dns_qr_qk_statistics_enabled
) {
5509 ws_debug("qk = Query-Kind\n");
5510 tick_stat_node(st
, st_str_qr_qk_packets
, st_node_qr_q_packets
, true);
5511 if (pi
->flags
& F_RECDESIRED
) {
5512 st_node
= tick_stat_node(st
, "Recursion Desired", st_node_qr_qk_packets
, true);
5515 st_node
= tick_stat_node(st
, "Iteration Desired", st_node_qr_qk_packets
, true);
5517 if (dns_qr_qrn_statistics_enabled
) {
5518 tick_stat_node(st
, pi
->qname
, st_node
, false);
5523 if (dns_qr_qt_statistics_enabled
) {
5524 ws_debug("qt = Query-Type\n");
5525 tick_stat_node(st
, st_str_qr_qt_packets
, st_node_qr_q_packets
, true);
5526 st_node
= tick_stat_node(st
, val_to_str(pi
->packet_qtype
, dns_types_vals
, "Unknown packet type (%d)"), st_node_qr_qt_packets
, true);
5527 if (dns_qr_qrn_statistics_enabled
) {
5528 tick_stat_node(st
, pi
->qname
, st_node
, false);
5533 if (dns_qr_ql_statistics_enabled
) {
5534 ws_debug("ql = Query-Label\n");
5535 tick_stat_node(st
, st_str_qr_ql_packets
, st_node_qr_q_packets
, true);
5536 switch (pi
->qname_labels
) {
5538 st_node
= tick_stat_node(st
, "1st Level", st_node_qr_ql_packets
, true);
5541 st_node
= tick_stat_node(st
, "2nd Level", st_node_qr_ql_packets
, true);
5544 st_node
= tick_stat_node(st
, "3rd Level", st_node_qr_ql_packets
, true);
5547 st_node
= tick_stat_node(st
, "4th Level", st_node_qr_ql_packets
, true);
5550 st_node
= tick_stat_node(st
, "5th Level", st_node_qr_ql_packets
, true);
5553 st_node
= tick_stat_node(st
, "6th Level", st_node_qr_ql_packets
, true);
5556 st_node
= tick_stat_node(st
, "7th Level", st_node_qr_ql_packets
, true);
5559 st_node
= tick_stat_node(st
, "8th Level", st_node_qr_ql_packets
, true);
5562 st_node
= tick_stat_node(st
, "9+ Level", st_node_qr_ql_packets
, true);
5565 if (dns_qr_qrn_statistics_enabled
) {
5566 st_node
= tick_stat_node(st
, pi
->qdomain
, st_node
, true);
5567 tick_stat_node(st
, pi
->qhost
, st_node
, false);
5571 // qp = Query-Payload
5572 if (dns_qr_qp_statistics_enabled
) {
5573 ws_debug("qp = Query-Payloadl\n");
5574 tick_stat_node(st
, st_str_qr_qp_packets
, st_node_qr_q_packets
, false);
5575 if (pi
->payload_size
== 0) {
5576 st_node
= tick_stat_node(st
, "zero", st_node_qr_qp_packets
, true);
5578 else if (pi
->payload_size
== 0x1) {
5579 st_node
= tick_stat_node(st
, "= 1B", st_node_qr_qp_packets
, true);
5581 else if (pi
->payload_size
== 0x2) {
5582 st_node
= tick_stat_node(st
, "= 2B", st_node_qr_qp_packets
, true);
5584 else if (pi
->payload_size
<= 0x4) {
5585 st_node
= tick_stat_node(st
, "<= 4B", st_node_qr_qp_packets
, true);
5587 else if (pi
->payload_size
< 0x8) {
5588 st_node
= tick_stat_node(st
, "<= 8B", st_node_qr_qp_packets
, true);
5590 else if (pi
->payload_size
< 0x10) {
5591 st_node
= tick_stat_node(st
, "<= 16B", st_node_qr_qp_packets
, true);
5593 else if (pi
->payload_size
< 0x20) {
5594 st_node
= tick_stat_node(st
, "<= 32B", st_node_qr_qp_packets
, true);
5596 else if (pi
->payload_size
< 0x40) {
5597 st_node
= tick_stat_node(st
, "<= 64B", st_node_qr_qp_packets
, true);
5599 else if (pi
->payload_size
< 0x80) {
5600 st_node
= tick_stat_node(st
, "<= 128B", st_node_qr_qp_packets
, true);
5602 else if (pi
->payload_size
< 0x100) {
5603 st_node
= tick_stat_node(st
, "<= 256B", st_node_qr_qp_packets
, true);
5605 else if (pi
->payload_size
< 0x200) {
5606 st_node
= tick_stat_node(st
, "<= 512B", st_node_qr_qp_packets
, true);
5608 else if (pi
->payload_size
< 0x400) {
5609 st_node
= tick_stat_node(st
, "<= 1KB", st_node_qr_qp_packets
, true);
5611 else if (pi
->payload_size
< 0x800) {
5612 st_node
= tick_stat_node(st
, "<= 2KB", st_node_qr_qp_packets
, true);
5614 else if (pi
->payload_size
< 0x1000) {
5615 st_node
= tick_stat_node(st
, "<= 4KB", st_node_qr_qp_packets
, true);
5617 else if (pi
->payload_size
< 0x2000) {
5618 st_node
= tick_stat_node(st
, "<= 8KB", st_node_qr_qp_packets
, true);
5620 else if (pi
->payload_size
< 0x4000) {
5621 st_node
= tick_stat_node(st
, "<= 16KB", st_node_qr_qp_packets
, true);
5623 else if (pi
->payload_size
< 0x8000) {
5624 st_node
= tick_stat_node(st
, "<= 32KB", st_node_qr_qp_packets
, true);
5626 else if (pi
->payload_size
< 0x10000) {
5627 st_node
= tick_stat_node(st
, "<= 64KB", st_node_qr_qp_packets
, true);
5630 st_node
= tick_stat_node(st
, "> 64KB", st_node_qr_qp_packets
, true);
5632 if (dns_qr_qrn_statistics_enabled
) {
5633 tick_stat_node(st
, pi
->qname
, st_node
, false);
5637 // qs = Query-Servicing
5638 if (dns_qr_qs_statistics_enabled
) {
5640 ws_debug("qs = Query-Servicing\n");
5641 tick_stat_node(st
, st_str_qr_qs_packets
, st_node_qr_q_packets
, true);
5643 // qs_a = Query-Service_Answered (ms)
5644 if (dns_qr_qs_a_statistics_enabled
) {
5645 ws_debug("qs_a = Query-Service_Answered (ms)\n");
5646 // data is populated from responses
5647 // check rs_a = Response-Servicing_Answered
5650 // qs_u = Query-Service_Unanswered
5651 if (dns_qr_qs_u_statistics_enabled
) {
5652 ws_debug("qs_u = Query-Service_Unanswered\n");
5653 if (!pi
->retransmission
) {
5654 if (dns_qr_qrn_statistics_enabled
) {
5655 stats_tree_tick_pivot(st
, st_node_qr_qs_u_packets
, pi
->qname
);
5658 tick_stat_node(st
, st_str_qr_qs_u_packets
, st_node_qr_qs_packets
, false);
5663 // qs_r = Query-Service_Retransmission
5664 if (dns_qr_qs_r_statistics_enabled
) {
5665 ws_debug("qs_r = Query-Service_Retransmission\n");
5666 if (pi
->retransmission
) {
5667 if (dns_qr_qrn_statistics_enabled
) {
5668 stats_tree_tick_pivot(st
, st_node_qr_qs_r_packets
, pi
->qname
);
5671 tick_stat_node(st
, st_str_qr_qs_r_packets
, st_node_qr_qs_packets
, false);
5682 if (!dns_qr_r_statistics_enabled
) {
5683 ws_debug("dns_qr_r_statistics_enabled = false\n");
5687 // rf = Response-From
5688 if (dns_qr_rf_statistics_enabled
) {
5689 ws_debug("rf = Response-From\n");
5690 tick_stat_node(st
, st_str_qr_rf_packets
, st_node_qr_r_packets
, true);
5692 if (pinfo
->src
.type
== AT_IPv4
) {
5693 ip_addr_to_str_buf(pinfo
->src
.data
, buf
, sizeof(buf
));
5695 else if (pinfo
->src
.type
== AT_IPv6
) {
5696 ip6_to_str_buf(pinfo
->src
.data
, buf
, sizeof(buf
));
5698 st_node
= tick_stat_node(st
, buf
, st_node_qr_rf_packets
, true);
5699 if (dns_qr_qrn_statistics_enabled
) {
5700 tick_stat_node(st
, pi
->qname
, st_node
, false);
5704 // rc = Response-Code
5705 if (dns_qr_rc_statistics_enabled
) {
5706 ws_debug("rc = Response-Code\n");
5707 tick_stat_node(st
, st_str_qr_rc_packets
, st_node_qr_r_packets
, true);
5708 st_node
= tick_stat_node(st
, val_to_str(pi
->packet_rcode
, rcode_vals
, "Unknown rcode (%d)"), st_node_qr_rc_packets
, true);
5709 if (dns_qr_qrn_statistics_enabled
) {
5710 tick_stat_node(st
, pi
->qname
, st_node
, false);
5714 // rk = Response-Kind
5715 if (dns_qr_rk_statistics_enabled
) {
5716 ws_debug("rk = Response-Kind\n");
5717 tick_stat_node(st
, st_str_qr_rk_packets
, st_node_qr_r_packets
, true);
5718 if (pi
->flags
& F_AUTHORITATIVE
) {
5719 st_node
= tick_stat_node(st
, "Authoritative", st_node_qr_rk_packets
, true);
5722 st_node
= tick_stat_node(st
, "Non-Authoritative", st_node_qr_rk_packets
, true);
5724 if (dns_qr_qrn_statistics_enabled
) {
5725 tick_stat_node(st
, pi
->qname
, st_node
, false);
5729 // ra = Response-Answer
5730 if (dns_qr_ra_statistics_enabled
) {
5731 ws_debug("ra = Response-Answer\n");
5732 tick_stat_node(st
, st_str_qr_ra_packets
, st_node_qr_r_packets
, true);
5733 if (pi
->nanswers
== 0) {
5734 st_node
= tick_stat_node(st
, "zero", st_node_qr_ra_packets
, true);
5736 else if (pi
->nanswers
== 0x1) {
5737 st_node
= tick_stat_node(st
, "= 1", st_node_qr_ra_packets
, true);
5739 else if (pi
->nanswers
== 0x2) {
5740 st_node
= tick_stat_node(st
, "= 2", st_node_qr_ra_packets
, true);
5742 else if (pi
->nanswers
<= 0x4) {
5743 st_node
= tick_stat_node(st
, "<= 4", st_node_qr_ra_packets
, true);
5745 else if (pi
->nanswers
<= 0x8) {
5746 st_node
= tick_stat_node(st
, "<= 8", st_node_qr_ra_packets
, true);
5748 else if (pi
->nanswers
<= 0x10) {
5749 st_node
= tick_stat_node(st
, "<= 16", st_node_qr_ra_packets
, true);
5751 else if (pi
->nanswers
<= 0x20) {
5752 st_node
= tick_stat_node(st
, "<= 32", st_node_qr_ra_packets
, true);
5754 else if (pi
->nanswers
<= 0x40) {
5755 st_node
= tick_stat_node(st
, "<= 64", st_node_qr_ra_packets
, true);
5757 else if (pi
->nanswers
<= 0x80) {
5758 st_node
= tick_stat_node(st
, "<= 128", st_node_qr_ra_packets
, true);
5760 else if (pi
->nanswers
<= 0x100) {
5761 st_node
= tick_stat_node(st
, "<= 256", st_node_qr_ra_packets
, true);
5763 else if (pi
->nanswers
<= 0x200) {
5764 st_node
= tick_stat_node(st
, "<= 512", st_node_qr_ra_packets
, true);
5766 else if (pi
->nanswers
<= 0x400) {
5767 st_node
= tick_stat_node(st
, "<= 1K", st_node_qr_ra_packets
, true);
5769 else if (pi
->nanswers
<= 0x800) {
5770 st_node
= tick_stat_node(st
, "<= 2K", st_node_qr_ra_packets
, true);
5772 else if (pi
->nanswers
<= 0x1000) {
5773 st_node
= tick_stat_node(st
, "<= 4K", st_node_qr_ra_packets
, true);
5776 st_node
= tick_stat_node(st
, "> 4K", st_node_qr_ra_packets
, true);
5778 if (dns_qr_qrn_statistics_enabled
) {
5779 if (pi
->nanswers
== 0) {
5780 if (dns_qr_qrn_aud_zv_statistics_enabled
) {
5781 tick_stat_node(st
, pi
->qname
, st_node
, false);
5785 tick_stat_node(st
, pi
->qname
, st_node
, false);
5790 // ru = Response-aUthority
5791 if (dns_qr_ru_statistics_enabled
) {
5792 ws_debug("ru = Response-aUthority\n");
5793 tick_stat_node(st
, st_str_qr_ru_packets
, st_node_qr_r_packets
, true);
5794 if (pi
->nauthorities
== 0) {
5795 st_node
= tick_stat_node(st
, "zero", st_node_qr_ru_packets
, true);
5797 else if (pi
->nauthorities
== 0x1) {
5798 st_node
= tick_stat_node(st
, "= 1", st_node_qr_ru_packets
, true);
5800 else if (pi
->nauthorities
== 0x2) {
5801 st_node
= tick_stat_node(st
, "= 2", st_node_qr_ru_packets
, true);
5803 else if (pi
->nauthorities
<= 0x4) {
5804 st_node
= tick_stat_node(st
, "<= 4", st_node_qr_ru_packets
, true);
5806 else if (pi
->nauthorities
<= 0x8) {
5807 st_node
= tick_stat_node(st
, "<= 8", st_node_qr_ru_packets
, true);
5809 else if (pi
->nauthorities
<= 0x10) {
5810 st_node
= tick_stat_node(st
, "<= 16", st_node_qr_ru_packets
, true);
5812 else if (pi
->nauthorities
<= 0x20) {
5813 st_node
= tick_stat_node(st
, "<= 32", st_node_qr_ru_packets
, true);
5815 else if (pi
->nauthorities
<= 0x40) {
5816 st_node
= tick_stat_node(st
, "<= 64", st_node_qr_ru_packets
, true);
5818 else if (pi
->nauthorities
<= 0x80) {
5819 st_node
= tick_stat_node(st
, "<= 128", st_node_qr_ru_packets
, true);
5821 else if (pi
->nauthorities
<= 0x100) {
5822 st_node
= tick_stat_node(st
, "<= 256", st_node_qr_ru_packets
, true);
5824 else if (pi
->nauthorities
<= 0x200) {
5825 st_node
= tick_stat_node(st
, "<= 512", st_node_qr_ru_packets
, true);
5827 else if (pi
->nauthorities
<= 0x400) {
5828 st_node
= tick_stat_node(st
, "<= 1K", st_node_qr_ru_packets
, true);
5830 else if (pi
->nauthorities
<= 0x800) {
5831 st_node
= tick_stat_node(st
, "<= 2K", st_node_qr_ru_packets
, true);
5833 else if (pi
->nauthorities
<= 0x1000) {
5834 st_node
= tick_stat_node(st
, "<= 4K", st_node_qr_ru_packets
, true);
5837 st_node
= tick_stat_node(st
, "> 4K", st_node_qr_ru_packets
, true);
5839 if (dns_qr_qrn_statistics_enabled
) {
5840 if (pi
->nauthorities
== 0) {
5841 if (dns_qr_qrn_aud_zv_statistics_enabled
) {
5842 tick_stat_node(st
, pi
->qname
, st_node
, false);
5846 tick_stat_node(st
, pi
->qname
, st_node
, false);
5851 // rd = Response-aDditional
5852 if (dns_qr_rd_statistics_enabled
) {
5853 ws_debug("rd = Response-aDditional\n");
5854 tick_stat_node(st
, st_str_qr_rd_packets
, st_node_qr_r_packets
, true);
5855 if (pi
->nadditionals
== 0) {
5856 st_node
= tick_stat_node(st
, "zero", st_node_qr_rd_packets
, true);
5858 else if (pi
->nadditionals
== 0x1) {
5859 st_node
= tick_stat_node(st
, "= 1", st_node_qr_rd_packets
, true);
5861 else if (pi
->nadditionals
== 0x2) {
5862 st_node
= tick_stat_node(st
, "= 2", st_node_qr_rd_packets
, true);
5864 else if (pi
->nadditionals
<= 0x4) {
5865 st_node
= tick_stat_node(st
, "<= 4", st_node_qr_rd_packets
, true);
5867 else if (pi
->nadditionals
<= 0x8) {
5868 st_node
= tick_stat_node(st
, "<= 8", st_node_qr_rd_packets
, true);
5870 else if (pi
->nadditionals
<= 0x10) {
5871 st_node
= tick_stat_node(st
, "<= 16", st_node_qr_rd_packets
, true);
5873 else if (pi
->nadditionals
<= 0x20) {
5874 st_node
= tick_stat_node(st
, "<= 32", st_node_qr_rd_packets
, true);
5876 else if (pi
->nadditionals
<= 0x40) {
5877 st_node
= tick_stat_node(st
, "<= 64", st_node_qr_rd_packets
, true);
5879 else if (pi
->nadditionals
<= 0x80) {
5880 st_node
= tick_stat_node(st
, "<= 128", st_node_qr_rd_packets
, true);
5882 else if (pi
->nadditionals
<= 0x100) {
5883 st_node
= tick_stat_node(st
, "<= 256", st_node_qr_rd_packets
, true);
5885 else if (pi
->nadditionals
<= 0x200) {
5886 st_node
= tick_stat_node(st
, "<= 512", st_node_qr_rd_packets
, true);
5888 else if (pi
->nadditionals
<= 0x400) {
5889 st_node
= tick_stat_node(st
, "<= 1K", st_node_qr_rd_packets
, true);
5891 else if (pi
->nadditionals
<= 0x800) {
5892 st_node
= tick_stat_node(st
, "<= 2K", st_node_qr_rd_packets
, true);
5894 else if (pi
->nadditionals
<= 0x1000) {
5895 st_node
= tick_stat_node(st
, "<= 4K", st_node_qr_rd_packets
, true);
5898 st_node
= tick_stat_node(st
, "> 4K", st_node_qr_rd_packets
, true);
5900 if (dns_qr_qrn_statistics_enabled
) {
5901 if (pi
->nadditionals
== 0) {
5902 if (dns_qr_qrn_aud_zv_statistics_enabled
) {
5903 tick_stat_node(st
, pi
->qname
, st_node
, false);
5907 tick_stat_node(st
, pi
->qname
, st_node
, false);
5912 // rp = Response-Payload
5913 if (dns_qr_rp_statistics_enabled
) {
5914 ws_debug("rp = Response-Payloadl\n");
5915 tick_stat_node(st
, st_str_qr_rp_packets
, st_node_qr_r_packets
, false);
5916 if (pi
->payload_size
== 0) {
5917 st_node
= tick_stat_node(st
, "zero", st_node_qr_rp_packets
, true);
5919 else if (pi
->payload_size
== 0x1) {
5920 st_node
= tick_stat_node(st
, "= 1B", st_node_qr_rp_packets
, true);
5922 else if (pi
->payload_size
== 0x2) {
5923 st_node
= tick_stat_node(st
, "= 2B", st_node_qr_rp_packets
, true);
5925 else if (pi
->payload_size
<= 0x4) {
5926 st_node
= tick_stat_node(st
, "<= 4B", st_node_qr_rp_packets
, true);
5928 else if (pi
->payload_size
<= 0x8) {
5929 st_node
= tick_stat_node(st
, "<= 8B", st_node_qr_rp_packets
, true);
5931 else if (pi
->payload_size
<= 0x10) {
5932 st_node
= tick_stat_node(st
, "<= 16B", st_node_qr_rp_packets
, true);
5934 else if (pi
->payload_size
<= 0x20) {
5935 st_node
= tick_stat_node(st
, "<= 32B", st_node_qr_rp_packets
, true);
5937 else if (pi
->payload_size
<= 0x40) {
5938 st_node
= tick_stat_node(st
, "<= 64B", st_node_qr_rp_packets
, true);
5940 else if (pi
->payload_size
<= 0x80) {
5941 st_node
= tick_stat_node(st
, "<= 128B", st_node_qr_rp_packets
, true);
5943 else if (pi
->payload_size
<= 0x100) {
5944 st_node
= tick_stat_node(st
, "<= 256B", st_node_qr_rp_packets
, true);
5946 else if (pi
->payload_size
<= 0x200) {
5947 st_node
= tick_stat_node(st
, "<= 512B", st_node_qr_rp_packets
, true);
5949 else if (pi
->payload_size
<= 0x400) {
5950 st_node
= tick_stat_node(st
, "<= 1KB", st_node_qr_rp_packets
, true);
5952 else if (pi
->payload_size
<= 0x800) {
5953 st_node
= tick_stat_node(st
, "<= 2KB", st_node_qr_rp_packets
, true);
5955 else if (pi
->payload_size
<= 0x1000) {
5956 st_node
= tick_stat_node(st
, "<= 4KB", st_node_qr_rp_packets
, true);
5958 else if (pi
->payload_size
<= 0x2000) {
5959 st_node
= tick_stat_node(st
, "<= 8KB", st_node_qr_rp_packets
, true);
5961 else if (pi
->payload_size
<= 0x4000) {
5962 st_node
= tick_stat_node(st
, "<= 16KB", st_node_qr_rp_packets
, true);
5964 else if (pi
->payload_size
<= 0x8000) {
5965 st_node
= tick_stat_node(st
, "<= 32KB", st_node_qr_rp_packets
, true);
5967 else if (pi
->payload_size
<= 0x10000) {
5968 st_node
= tick_stat_node(st
, "<= 64KB", st_node_qr_rp_packets
, true);
5971 st_node
= tick_stat_node(st
, "> 64KB", st_node_qr_rp_packets
, true);
5973 if (dns_qr_qrn_statistics_enabled
) {
5974 tick_stat_node(st
, pi
->qname
, st_node
, false);
5978 // rs = Response-Servicing
5979 if (dns_qr_rs_statistics_enabled
) {
5981 ws_debug("rs = Response-Servicing\n");
5982 tick_stat_node(st
, st_str_qr_rs_packets
, st_node_qr_r_packets
, true);
5984 // rs_a = Response-Service_Answered (ms)
5985 if (dns_qr_rs_a_statistics_enabled
) {
5986 ws_debug("rs_a = Response-Service_Answered (ms)\n");
5987 if (!pi
->retransmission
&& !pi
->unsolicited
) {
5988 st_node
= avg_stat_node_add_value_float(st
, st_str_qr_rs_a_packets
, st_node_qr_rs_packets
, true, (float)(pi
->rrt
.secs
* 1000. + pi
->rrt
.nsecs
/ 1000000.0));
5989 if (dns_qr_qrn_statistics_enabled
) {
5990 avg_stat_node_add_value_float(st
, pi
->qname
, st_node
, false, (float)(pi
->rrt
.secs
* 1000. + pi
->rrt
.nsecs
/ 1000000.0));
5992 // filling in qs_a = Answered (ms)
5993 if (dns_qr_qs_a_statistics_enabled
) {
5994 st_node
= avg_stat_node_add_value_float(st
, st_str_qr_qs_a_packets
, st_node_qr_qs_packets
, true, (float)(pi
->rrt
.secs
* 1000. + pi
->rrt
.nsecs
/ 1000000.0));
5995 if (dns_qr_qrn_statistics_enabled
) {
5996 avg_stat_node_add_value_float(st
, pi
->qname
, st_node
, false, (float)(pi
->rrt
.secs
* 1000. + pi
->rrt
.nsecs
/ 1000000.0));
5999 // decrementing qs_u = Unanswered
6000 if (dns_qr_qs_u_statistics_enabled
) {
6001 increase_stat_node(st
, st_str_qr_qs_u_packets
, st_node_qr_qs_packets
, false, -1);
6002 if (dns_qr_qrn_statistics_enabled
) {
6003 increase_stat_node(st
, pi
->qname
, st_node_qr_qs_u_packets
, false, -1);
6009 // rs_u = Response-Service_Unsolicited
6010 if (dns_qr_rs_u_statistics_enabled
) {
6011 ws_debug("rs_u = Response-Service_Unsolicited\n");
6012 // service statistics (total responses = unsolicited + retransmissions + non-retransmissions)
6013 if (pi
->unsolicited
) { // unsolicited = responses without queries being present in this capture
6014 if (dns_qr_qrn_statistics_enabled
) {
6015 stats_tree_tick_pivot(st
, st_node_qr_rs_u_packets
, pi
->qname
);
6018 tick_stat_node(st
, st_str_qr_rs_u_packets
, st_node_qr_rs_packets
, false);
6023 // rs_r = Response-Service_Retransmission
6024 if (dns_qr_rs_r_statistics_enabled
) {
6025 ws_debug("rs_r = Response-Service_Retransmission\n");
6026 if (pi
->retransmission
&& !pi
->unsolicited
) {
6027 if (dns_qr_qrn_statistics_enabled
) {
6028 stats_tree_tick_pivot(st
, st_node_qr_rs_r_packets
, pi
->qname
);
6031 tick_stat_node(st
, st_str_qr_rs_r_packets
, st_node_qr_rs_packets
, false);
6037 // rt = Response-TTL
6038 if (dns_qr_rt_statistics_enabled
) {
6039 ws_debug("rt = Response-TTL\n");
6041 // counting of ttl should stay disabled to avoid confusion with summation
6042 // of its child nodes and its count. for example, if there are only 2
6043 // responses, ttl count will be 2 but summation of answers, authorities
6044 // and additionals could be more as each response could contain multiple
6045 // answers, authorities and additionals. if ttl count is changed to
6046 // reflect summation, then it would standout withing its siblings like
6047 // rcode, payload etc.
6048 //tick_stat_node(st, st_str_qr_rt_packets, st_node_qr_r_packets, true);
6051 if (dns_qr_rt_a_statistics_enabled
) {
6052 ws_debug("rt_a = Response-TTL_Answers\n");
6053 unsigned ui_limit
= pi
->nanswers
;
6054 if (ui_limit
> TTL_MAXIMUM_ELEMENTS
) { // limit check to avoid overflow
6055 ws_debug("rt_a = Response-TTL_Answers (answers(%u) > (%u)TTL_MAXIMUM_ELEMENTS) (iterating upto TTL_MAXIMUM_ELEMENTS)\n", ui_limit
, TTL_MAXIMUM_ELEMENTS
);
6056 ui_limit
= TTL_MAXIMUM_ELEMENTS
;
6058 for (unsigned ui
= 0; ui
< ui_limit
; ui
++) {
6059 tick_stat_node(st
, st_str_qr_rt_a_packets
, st_node_qr_rt_packets
, true);
6060 if (dns_qr_r_ra_ttls
[ui
] == 0) {
6061 st_node
= tick_stat_node(st
, "zero", st_node_qr_rt_a_packets
, true);
6063 else if (dns_qr_r_ra_ttls
[ui
] <= 60) {
6064 st_node
= tick_stat_node(st
, "<= minute", st_node_qr_rt_a_packets
, true);
6066 else if (dns_qr_r_ra_ttls
[ui
] <= 3600) {
6067 st_node
= tick_stat_node(st
, "<= hour", st_node_qr_rt_a_packets
, true);
6069 else if (dns_qr_r_ra_ttls
[ui
] <= 86400) {
6070 st_node
= tick_stat_node(st
, "<= day", st_node_qr_rt_a_packets
, true);
6072 else if (dns_qr_r_ra_ttls
[ui
] <= 604800) {
6073 st_node
= tick_stat_node(st
, "<= week", st_node_qr_rt_a_packets
, true);
6075 else if (dns_qr_r_ra_ttls
[ui
] <= 2628000) {
6076 st_node
= tick_stat_node(st
, "<= month", st_node_qr_rt_a_packets
, true);
6078 else if (dns_qr_r_ra_ttls
[ui
] <= 31536000) {
6079 st_node
= tick_stat_node(st
, "<= year", st_node_qr_rt_a_packets
, true);
6082 st_node
= tick_stat_node(st
, "> year", st_node_qr_rt_a_packets
, true);
6084 if (dns_qr_qrn_statistics_enabled
) {
6085 tick_stat_node(st
, pi
->qname
, st_node
, false);
6091 if (dns_qr_rt_u_statistics_enabled
) {
6092 ws_debug("rt_u = Response-TTL_aUthority\n");
6093 unsigned ui_limit
= pi
->nauthorities
;
6094 if (ui_limit
> TTL_MAXIMUM_ELEMENTS
) { // limit check to avoid overflow
6095 ws_debug("rt_a = Response-TTL_Answers (authorities(%u) > (%u)TTL_MAXIMUM_ELEMENTS) (iterating upto TTL_MAXIMUM_ELEMENTS)\n", ui_limit
, TTL_MAXIMUM_ELEMENTS
);
6096 ui_limit
= TTL_MAXIMUM_ELEMENTS
;
6098 for (unsigned ui
= 0; ui
< ui_limit
; ui
++) {
6099 tick_stat_node(st
, st_str_qr_rt_u_packets
, st_node_qr_rt_packets
, true);
6100 if (dns_qr_r_ru_ttls
[ui
] == 0) {
6101 st_node
= tick_stat_node(st
, "zero", st_node_qr_rt_u_packets
, true);
6103 else if (dns_qr_r_ru_ttls
[ui
] <= 60) {
6104 st_node
= tick_stat_node(st
, "<= minute", st_node_qr_rt_u_packets
, true);
6106 else if (dns_qr_r_ru_ttls
[ui
] <= 3600) {
6107 st_node
= tick_stat_node(st
, "<= hour", st_node_qr_rt_u_packets
, true);
6109 else if (dns_qr_r_ru_ttls
[ui
] <= 86400) {
6110 st_node
= tick_stat_node(st
, "<= day", st_node_qr_rt_u_packets
, true);
6112 else if (dns_qr_r_ru_ttls
[ui
] <= 604800) {
6113 st_node
= tick_stat_node(st
, "<= week", st_node_qr_rt_u_packets
, true);
6115 else if (dns_qr_r_ru_ttls
[ui
] <= 2628000) {
6116 st_node
= tick_stat_node(st
, "<= month", st_node_qr_rt_u_packets
, true);
6118 else if (dns_qr_r_ru_ttls
[ui
] <= 31536000) {
6119 st_node
= tick_stat_node(st
, "<= year", st_node_qr_rt_u_packets
, true);
6122 st_node
= tick_stat_node(st
, "> year", st_node_qr_rt_u_packets
, true);
6124 if (dns_qr_qrn_statistics_enabled
) {
6125 tick_stat_node(st
, pi
->qname
, st_node
, false);
6130 // rt_d = aDditional
6131 if (dns_qr_rt_d_statistics_enabled
) {
6132 ws_debug("rt_d = Response-TTL_aDditional\n");
6133 unsigned ui_limit
= pi
->nadditionals
;
6134 if (ui_limit
> TTL_MAXIMUM_ELEMENTS
) { // limit check to avoid overflow
6135 ws_debug("rt_a = Response-TTL_Answers (additionals(%u) > (%u)TTL_MAXIMUM_ELEMENTS) (iterating upto TTL_MAXIMUM_ELEMENTS)\n", ui_limit
, TTL_MAXIMUM_ELEMENTS
);
6136 ui_limit
= TTL_MAXIMUM_ELEMENTS
;
6138 for (unsigned ui
= 0; ui
< ui_limit
; ui
++) {
6139 tick_stat_node(st
, st_str_qr_rt_d_packets
, st_node_qr_rt_packets
, true);
6140 if (dns_qr_r_rd_ttls
[ui
] == 0) {
6141 st_node
= tick_stat_node(st
, "zero", st_node_qr_rt_d_packets
, true);
6143 else if (dns_qr_r_rd_ttls
[ui
] <= 60) {
6144 st_node
= tick_stat_node(st
, "<= minute", st_node_qr_rt_d_packets
, true);
6146 else if (dns_qr_r_rd_ttls
[ui
] <= 3600) {
6147 st_node
= tick_stat_node(st
, "<= hour", st_node_qr_rt_d_packets
, true);
6149 else if (dns_qr_r_rd_ttls
[ui
] <= 86400) {
6150 st_node
= tick_stat_node(st
, "<= day", st_node_qr_rt_d_packets
, true);
6152 else if (dns_qr_r_rd_ttls
[ui
] <= 604800) {
6153 st_node
= tick_stat_node(st
, "<= week", st_node_qr_rt_d_packets
, true);
6155 else if (dns_qr_r_rd_ttls
[ui
] <= 2628000) {
6156 st_node
= tick_stat_node(st
, "<= month", st_node_qr_rt_d_packets
, true);
6158 else if (dns_qr_r_rd_ttls
[ui
] <= 31536000) {
6159 st_node
= tick_stat_node(st
, "<= year", st_node_qr_rt_d_packets
, true);
6162 st_node
= tick_stat_node(st
, "> year", st_node_qr_rt_d_packets
, true);
6164 if (dns_qr_qrn_statistics_enabled
) {
6165 tick_stat_node(st
, pi
->qname
, st_node
, false);
6172 return TAP_PACKET_REDRAW
;
6175 static void dns_qr_stats_tree_cleanup(stats_tree
* st
)
6177 ws_debug("cleanup with st=%p\n", st
);
6181 proto_reg_handoff_dns(void)
6183 dissector_add_uint_with_preference("udp.port", UDP_PORT_MDNS
, mdns_udp_handle
);
6184 dissector_add_uint_with_preference("udp.port", UDP_PORT_LLMNR
, llmnr_udp_handle
);
6185 dissector_add_uint("sctp.port", SCTP_PORT_DNS
, dns_handle
);
6187 dissector_add_uint("sctp.ppi", DNS_PAYLOAD_PROTOCOL_ID
, dns_handle
);
6189 stats_tree_cfg
*st_config
= stats_tree_register("dns", "dns", "DNS", 0, dns_stats_tree_packet
, dns_stats_tree_init
, NULL
);
6190 stats_tree_set_first_column_name(st_config
, "Packet Type");
6191 stats_tree_register("dns", "dns_qr", "DNS/Query-Response", 0, dns_qr_stats_tree_packet
, dns_qr_stats_tree_init
, dns_qr_stats_tree_cleanup
);
6192 gssapi_handle
= find_dissector_add_dependency("gssapi", proto_dns
);
6193 ntlmssp_handle
= find_dissector_add_dependency("ntlmssp", proto_dns
);
6194 tls_echconfig_handle
= find_dissector("tls-echconfig");
6195 ssl_dissector_add(TCP_PORT_DNS_TLS
, dns_handle
);
6196 // RFC 7858 - registration via https://mailarchive.ietf.org/arch/msg/dns-privacy/iZ2rDIhFB2ZWsGC3PcdBVLGa8Do
6197 dissector_add_string("tls.alpn", "dot", dns_handle
);
6198 dtls_dissector_add(UDP_PORT_DNS_DTLS
, dns_handle
);
6199 dissector_add_uint_range_with_preference("tcp.port", DEFAULT_DNS_TCP_PORT_RANGE
, dns_handle
);
6200 dissector_add_uint_range_with_preference("udp.port", DEFAULT_DNS_PORT_RANGE
, dns_handle
);
6201 dissector_add_string("media_type", "application/dns-message", dns_handle
); /* since draft-ietf-doh-dns-over-https-07 */
6202 dissector_add_string("quic.proto", "doq", doq_handle
); /* https://www.ietf.org/archive/id/draft-ietf-dprive-dnsoquic-03.txt */
6203 heur_dissector_add("udp", dissect_dns_heur
, "DNS over UDP", "dns_udp", proto_dns
, HEURISTIC_ENABLE
);
6207 proto_register_dns(void)
6209 static hf_register_info hf
[] = {
6211 { "Length", "dns.length",
6212 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6213 "Length of DNS-over-TCP request or response", HFILL
}},
6216 { "Flags", "dns.flags",
6217 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6220 { &hf_dns_flags_response
,
6221 { "Response", "dns.flags.response",
6222 FT_BOOLEAN
, 16, TFS(&tfs_flags_response
), F_RESPONSE
,
6223 "Is the message a response?", HFILL
}},
6225 { &hf_dns_flags_opcode
,
6226 { "Opcode", "dns.flags.opcode",
6227 FT_UINT16
, BASE_DEC
, VALS(opcode_vals
), F_OPCODE
,
6228 "Operation code", HFILL
}},
6230 { &hf_dns_flags_authoritative
,
6231 { "Authoritative", "dns.flags.authoritative",
6232 FT_BOOLEAN
, 16, TFS(&tfs_flags_authoritative
), F_AUTHORITATIVE
,
6233 "Is the server is an authority for the domain?", HFILL
}},
6235 { &hf_dns_flags_conflict_query
,
6236 { "Conflict", "dns.flags.conflict",
6237 FT_BOOLEAN
, 16, TFS(&tfs_flags_conflict_query
), F_CONFLICT
,
6238 "Did we receive multiple responses to a query?", HFILL
}},
6240 { &hf_dns_flags_conflict_response
,
6241 { "Conflict", "dns.flags.conflict",
6242 FT_BOOLEAN
, 16, TFS(&tfs_flags_conflict_response
), F_CONFLICT
,
6243 "Is the name considered unique?", HFILL
}},
6245 { &hf_dns_flags_truncated
,
6246 { "Truncated", "dns.flags.truncated",
6247 FT_BOOLEAN
, 16, TFS(&tfs_flags_truncated
), F_TRUNCATED
,
6248 "Is the message truncated?", HFILL
}},
6250 { &hf_dns_flags_recdesired
,
6251 { "Recursion desired", "dns.flags.recdesired",
6252 FT_BOOLEAN
, 16, TFS(&tfs_flags_recdesired
), F_RECDESIRED
,
6253 "Do query recursively?", HFILL
}},
6255 { &hf_dns_flags_tentative
,
6256 { "Tentative", "dns.flags.tentative",
6257 FT_BOOLEAN
, 16, TFS(&tfs_flags_tentative
), F_TENTATIVE
,
6258 "Is the responder authoritative for the name, but not yet verified the uniqueness?", HFILL
}},
6260 { &hf_dns_flags_recavail
,
6261 { "Recursion available", "dns.flags.recavail",
6262 FT_BOOLEAN
, 16, TFS(&tfs_flags_recavail
), F_RECAVAIL
,
6263 "Can the server do recursive queries?", HFILL
}},
6266 { "Z", "dns.flags.z",
6267 FT_BOOLEAN
, 16, TFS(&tfs_flags_z
), F_Z
,
6270 { &hf_dns_flags_authenticated
,
6271 { "Answer authenticated", "dns.flags.authenticated",
6272 FT_BOOLEAN
, 16, TFS(&tfs_flags_authenticated
), F_AUTHENTIC
,
6273 "Was the reply data authenticated by the server?", HFILL
}},
6276 { "AD bit", "dns.flags.ad",
6277 FT_BOOLEAN
, 16, TFS(&tfs_set_notset
), F_AUTHENTIC
,
6280 { &hf_dns_flags_checkdisable
,
6281 { "Non-authenticated data", "dns.flags.checkdisable",
6282 FT_BOOLEAN
, 16, TFS(&tfs_flags_checkdisable
), F_CHECKDISABLE
,
6283 "Is non-authenticated data acceptable?", HFILL
}},
6285 { &hf_dns_flags_rcode
,
6286 { "Reply code", "dns.flags.rcode",
6287 FT_UINT16
, BASE_DEC
, VALS(rcode_vals
), F_RCODE
,
6290 { &hf_dns_transaction_id
,
6291 { "Transaction ID", "dns.id",
6292 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6293 "Identification of transaction", HFILL
}},
6296 { "Type", "dns.qry.type",
6297 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &dns_types_vals_ext
, 0,
6298 "Query Type", HFILL
}},
6300 { &hf_dns_qry_class
,
6301 { "Class", "dns.qry.class",
6302 FT_UINT16
, BASE_HEX
, VALS(dns_classes
), 0x0,
6303 "Query Class", HFILL
}},
6305 { &hf_dns_qry_class_mdns
,
6306 { "Class", "dns.qry.class",
6307 FT_UINT16
, BASE_HEX
, VALS(dns_classes
), 0x7FFF,
6308 "Query Class", HFILL
}},
6311 { "\"QU\" question", "dns.qry.qu",
6312 FT_BOOLEAN
, 16, NULL
, C_QU
,
6313 "QU flag", HFILL
}},
6316 { "Name", "dns.qry.name",
6317 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6318 "Query Name", HFILL
}},
6320 { &hf_dns_qry_name_len
,
6321 { "Name Length", "dns.qry.name.len",
6322 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6323 "Query Name Len", HFILL
}},
6325 { &hf_dns_count_labels
,
6326 { "Label Count", "dns.count.labels",
6327 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6328 "Query Label Count", HFILL
}},
6331 { "Type", "dns.resp.type",
6332 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &dns_types_vals_ext
, 0x0,
6333 "Response Type", HFILL
}},
6336 { "Class", "dns.resp.class",
6337 FT_UINT16
, BASE_HEX
, VALS(dns_classes
), 0x0,
6338 "Response Class", HFILL
}},
6340 { &hf_dns_rr_class_mdns
,
6341 { "Class", "dns.resp.class",
6342 FT_UINT16
, BASE_HEX
, VALS(dns_classes
), 0x7FFF,
6343 "Response Class", HFILL
}},
6345 { &hf_dns_rr_cache_flush
,
6346 { "Cache flush", "dns.resp.cache_flush",
6347 FT_BOOLEAN
, 16, NULL
, C_FLUSH
,
6348 "Cache flush flag", HFILL
}},
6350 { &hf_dns_rr_ext_rcode
,
6351 { "Higher bits in extended RCODE", "dns.resp.ext_rcode",
6352 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
6355 { &hf_dns_rr_edns0_version
,
6356 { "EDNS0 version", "dns.resp.edns0_version",
6357 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6361 { "Z", "dns.resp.z",
6362 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6366 { "DO bit", "dns.resp.z.do",
6367 FT_BOOLEAN
, 16, TFS(&tfs_dns_rr_z_do
), 0x8000,
6368 "DNSSEC OK", HFILL
}},
6370 { &hf_dns_rr_z_reserved
,
6371 { "Reserved", "dns.resp.z.reserved",
6372 FT_UINT16
, BASE_HEX
, NULL
, 0x7FFF,
6375 { &hf_dns_srv_instance
,
6376 { "Instance", "dns.srv.instance",
6377 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6378 "Desired service instance", HFILL
}},
6380 { &hf_dns_srv_service
,
6381 { "Service", "dns.srv.service",
6382 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6383 "Desired service", HFILL
}},
6385 { &hf_dns_srv_proto
,
6386 { "Protocol", "dns.srv.proto",
6387 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6388 "Desired protocol", HFILL
}},
6391 { "Name", "dns.srv.name",
6392 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6393 "Domain this resource record refers to", HFILL
}},
6395 { &hf_dns_srv_priority
,
6396 { "Priority", "dns.srv.priority",
6397 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6400 { &hf_dns_srv_weight
,
6401 { "Weight", "dns.srv.weight",
6402 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6406 { "Port", "dns.srv.port",
6407 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6410 { &hf_dns_srv_target
,
6411 { "Target", "dns.srv.target",
6412 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6415 { &hf_dns_naptr_order
,
6416 { "Order", "dns.naptr.order",
6417 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6420 { &hf_dns_naptr_preference
,
6421 { "Preference", "dns.naptr.preference",
6422 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6425 { &hf_dns_naptr_flags_length
,
6426 { "Flags Length", "dns.naptr.flags_length",
6427 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6430 { &hf_dns_naptr_flags
,
6431 { "Flags", "dns.naptr.flags",
6432 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6435 { &hf_dns_naptr_service_length
,
6436 { "Service Length", "dns.naptr.service_length",
6437 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6440 { &hf_dns_naptr_service
,
6441 { "Service", "dns.naptr.service",
6442 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6445 { &hf_dns_naptr_regex_length
,
6446 { "Regex Length", "dns.naptr.regex_length",
6447 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6450 { &hf_dns_naptr_regex
,
6451 { "Regex", "dns.naptr.regex",
6452 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6455 { &hf_dns_naptr_replacement_length
,
6456 { "Replacement Length", "dns.naptr.replacement_length",
6457 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6460 { &hf_dns_naptr_replacement
,
6461 { "Replacement", "dns.naptr.replacement",
6462 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6466 { "Name", "dns.resp.name",
6467 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6468 "Response Name", HFILL
}},
6471 { "Time to live", "dns.resp.ttl",
6472 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6473 "Response TTL", HFILL
}},
6476 { "Data length", "dns.resp.len",
6477 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6478 "Response Length", HFILL
}},
6481 { "Address", "dns.a",
6482 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
6483 "Response IPv4 Address", HFILL
}},
6485 { &hf_dns_a_ch_domain
,
6486 { "Chaos Domain", "dns.a.ch.domain",
6487 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6488 "Response Chaos Domain", HFILL
}},
6490 { &hf_dns_a_ch_addr
,
6491 { "Chaos Address", "dns.a.ch.addr",
6492 FT_UINT16
, BASE_OCT
, NULL
, 0x0,
6493 "Response Chaos Address", HFILL
}},
6496 { "Mail Destination", "dns.md",
6497 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6501 { "Mail Forwarder", "dns.mf",
6502 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6506 { "MailBox Domain", "dns.mb",
6507 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6511 { "Mail Group member", "dns.mg",
6512 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6516 { "Mail Rename domain", "dns.mr",
6517 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6521 { "Null (data)", "dns.null",
6522 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6526 { "AAAA Address", "dns.aaaa",
6527 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
6528 "AAAA Response Address", HFILL
}},
6531 { "CNAME", "dns.cname",
6532 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6533 "Response Primary Name", HFILL
}},
6535 { &hf_dns_rr_udp_payload_size_mdns
,
6536 { "UDP payload size", "dns.rr.udp_payload_size",
6537 FT_UINT16
, BASE_HEX
, NULL
, 0x7FFF,
6540 { &hf_dns_rr_udp_payload_size
,
6541 { "UDP payload size", "dns.rr.udp_payload_size",
6542 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6545 { &hf_dns_soa_mname
,
6546 { "Primary name server", "dns.soa.mname",
6547 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6550 { &hf_dns_soa_rname
,
6551 { "Responsible authority's mailbox", "dns.soa.rname",
6552 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6555 { &hf_dns_soa_serial_number
,
6556 { "Serial Number", "dns.soa.serial_number",
6557 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6560 { &hf_dns_soa_refresh_interval
,
6561 { "Refresh Interval", "dns.soa.refresh_interval",
6562 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6565 { &hf_dns_soa_retry_interval
,
6566 { "Retry Interval", "dns.soa.retry_interval",
6567 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6570 { &hf_dns_soa_expire_limit
,
6571 { "Expire limit", "dns.soa.expire_limit",
6572 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6575 { &hf_dns_soa_minimum_ttl
,
6576 { "Minimum TTL", "dns.soa.minimum_ttl",
6577 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6580 { &hf_dns_ptr_domain_name
,
6581 { "Domain Name", "dns.ptr.domain_name",
6582 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6585 { &hf_dns_wks_address
,
6586 { "Address", "dns.wks.address",
6587 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
6590 { &hf_dns_wks_protocol
,
6591 { "Protocol", "dns.wks.protocol",
6592 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &ipproto_val_ext
, 0x0,
6596 { "Bits", "dns.wks.bits",
6597 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
6600 { &hf_dns_hinfo_cpu_length
,
6601 { "CPU Length", "dns.hinfo.cpu_length",
6602 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6605 { &hf_dns_hinfo_cpu
,
6606 { "CPU", "dns.hinfo.cpu",
6607 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6610 { &hf_dns_hinfo_os_length
,
6611 { "OS Length", "dns.hinfo.os_length",
6612 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6616 { "OS", "dns.hinfo.os",
6617 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6620 { &hf_dns_minfo_r_mailbox
,
6621 { "Responsible Mailbox", "dns.minfo.r",
6622 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6625 { &hf_dns_minfo_e_mailbox
,
6626 { "Error Mailbox", "dns.minfo.e",
6627 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6630 { &hf_dns_mx_preference
,
6631 { "Preference", "dns.mx.preference",
6632 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6635 { &hf_dns_mx_mail_exchange
,
6636 { "Mail Exchange", "dns.mx.mail_exchange",
6637 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6640 { &hf_dns_txt_length
,
6641 { "TXT Length", "dns.txt.length",
6642 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6647 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6650 { &hf_dns_openpgpkey
,
6651 { "OpenPGP Key", "dns.openpgpkey",
6652 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6655 { &hf_dns_csync_soa
,
6656 { "SOA", "dns.csync.soa",
6657 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6660 { &hf_dns_csync_flags
,
6661 { "Flags", "dns.csync.flags",
6662 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6665 { &hf_dns_csync_flags_immediate
,
6666 { "immediate", "dns.csync.flags.immediate",
6667 FT_BOOLEAN
, 16, NULL
, 0x0001,
6670 { &hf_dns_csync_flags_soaminimum
,
6671 { "soaminimum", "dns.csync.flags.soaminimum",
6672 FT_BOOLEAN
, 16, NULL
, 0x0002,
6675 { &hf_dns_csync_type_bitmap
,
6676 { "Type Bitmap", "dns.csync.type_bitmap",
6677 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6680 { &hf_dns_zonemd_serial
,
6681 { "Serial", "dns.zonemd.serial",
6682 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6685 { &hf_dns_zonemd_scheme
,
6686 { "Scheme", "dns.zonemd.scheme",
6687 FT_UINT8
, BASE_DEC
| BASE_RANGE_STRING
, RVALS(dns_zonemd_scheme
), 0x0,
6690 { &hf_dns_zonemd_hash_algo
,
6691 { "Hash Algorithm", "dns.zonemd.hash_algo",
6692 FT_UINT8
, BASE_DEC
| BASE_RANGE_STRING
, RVALS(dns_zonemd_hash_algo
), 0x0,
6695 { &hf_dns_zonemd_digest
,
6696 { "Digest", "dns.zonemd.digest",
6697 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6700 { &hf_dns_svcb_priority
,
6701 { "SvcPriority", "dns.svcb.svcpriority",
6702 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6705 { &hf_dns_svcb_target
,
6706 { "TargetName", "dns.svcb.targetname",
6707 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6710 { &hf_dns_svcb_param_key
,
6711 { "SvcParamKey", "dns.svcb.svcparam.key",
6712 FT_UINT16
, BASE_DEC
, VALS(dns_svcb_param_key_vals
), 0x0,
6715 { &hf_dns_svcb_param_length
,
6716 { "SvcParamValue length", "dns.svcb.svcparam.value.length",
6717 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6720 { &hf_dns_svcb_param_value
,
6721 { "SvcParamValue", "dns.svcb.svcparam.value",
6722 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6725 { &hf_dns_svcb_param
,
6726 { "SvcParam", "dns.svcb.svcparam",
6727 FT_NONE
, BASE_NONE
, NULL
, 0x0,
6730 { &hf_dns_svcb_param_mandatory_key
,
6731 { "Mandatory key", "dns.svcb.svcparam.mandatory.key",
6732 FT_UINT16
, BASE_DEC
, VALS(dns_svcb_param_key_vals
), 0x0,
6733 "Mandatory keys in this RR", HFILL
}},
6735 { &hf_dns_svcb_param_alpn_length
,
6736 { "ALPN length", "dns.svcb.svcparam.alpn.length",
6737 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6740 { &hf_dns_svcb_param_alpn
,
6741 { "ALPN", "dns.svcb.svcparam.alpn",
6742 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6743 "Additional supported protocols", HFILL
}},
6745 { &hf_dns_svcb_param_port
,
6746 { "Port", "dns.svcb.svcparam.port",
6747 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6748 "Port for alternative endpoint", HFILL
}},
6750 { &hf_dns_svcb_param_ipv4hint_ip
,
6751 { "IP", "dns.svcb.svcparam.ipv4hint.ip",
6752 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
6753 "IPv4 address hints", HFILL
}},
6755 { &hf_dns_svcb_param_ipv6hint_ip
,
6756 { "IP", "dns.svcb.svcparam.ipv6hint.ip",
6757 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
6758 "IPv6 address hints", HFILL
}},
6760 { &hf_dns_svcb_param_dohpath
,
6761 { "DoH path", "dns.svcb.svcparam.dohpath",
6762 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6763 "DoH URI template", HFILL
}},
6765 { &hf_dns_svcb_param_odohconfig
,
6766 { "ODoHConfig", "dns.svcb.svcparam.odohconfig",
6767 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6768 "Oblivious DoH keys", HFILL
}},
6770 { &hf_dns_spf_length
,
6771 { "SPF Length", "dns.spf.length",
6772 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6777 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6780 { &hf_dns_ilnp_nodeid_preference
,
6781 { "Preference", "dns.ilnp.nid.preference",
6782 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6785 { &hf_dns_ilnp_nodeid
,
6786 { "NodeID", "dns.ilnp.nid",
6787 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6790 { &hf_dns_ilnp_locator32_preference
,
6791 { "Preference", "dns.ilnp.l32.preference",
6792 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6795 { &hf_dns_ilnp_locator32
,
6796 { "Locator32", "dns.ilnp.l32",
6797 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
6800 { &hf_dns_ilnp_locator64_preference
,
6801 { "Preference", "dns.ilnp.l64.preference",
6802 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6805 { &hf_dns_ilnp_locator64
,
6806 { "Locator64", "dns.ilnp.l64",
6807 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6810 { &hf_dns_ilnp_locatorfqdn_preference
,
6811 { "Preference", "dns.ilnp.lp.preference",
6812 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6815 { &hf_dns_ilnp_locatorfqdn
,
6816 { "Locator FQDN", "dns.ilnp.lp",
6817 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6821 { "EUI48 Address", "dns.eui48",
6822 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
6826 { "EUI64 Address", "dns.eui64",
6827 FT_EUI64
, BASE_NONE
, NULL
, 0x0,
6830 { &hf_dns_rrsig_type_covered
,
6831 { "Type Covered", "dns.rrsig.type_covered",
6832 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &dns_types_vals_ext
, 0x0,
6833 "Identifies the type of the RRset that is covered by this RRSIG record", HFILL
}},
6835 { &hf_dns_rrsig_algorithm
,
6836 { "Algorithm", "dns.rrsig.algorithm",
6837 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0x0,
6838 "Identifies the cryptographic algorithm used to create the signature", HFILL
}},
6840 { &hf_dns_rrsig_labels
,
6841 { "Labels", "dns.rrsig.labels",
6842 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6843 "Specifies the number of labels in the original RRSIG RR owner name", HFILL
}},
6845 { &hf_dns_rrsig_original_ttl
,
6846 { "Original TTL", "dns.rrsig.original_ttl",
6847 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
6848 "Specifies the TTL of the covered RRset as it appears in the authoritative zone", HFILL
}},
6850 { &hf_dns_rrsig_signature_expiration
,
6851 { "Signature Expiration", "dns.rrsig.signature_expiration",
6852 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
6853 "Specify a validity period for the signature", HFILL
}},
6855 { &hf_dns_rrsig_signature_inception
,
6856 { "Signature Inception", "dns.rrsig.signature_inception",
6857 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
6858 "Specify a validity period for the signature", HFILL
}},
6860 { &hf_dns_rrsig_key_tag
,
6861 { "Key Tag", "dns.rrsig.key_tag",
6862 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6863 "Contains the key tag value of the DNSKEY RR that validates this signature", HFILL
}},
6865 { &hf_dns_rrsig_signers_name
,
6866 { "Signer's name", "dns.rrsig.signers_name",
6867 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6868 "Identifies the owner name of the DNSKEY RR that a validator is supposed to use to validate this signature", HFILL
}},
6870 { &hf_dns_rrsig_signature
,
6871 { "Signature", "dns.rrsig.signature",
6872 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6873 "Contains the cryptographic signature that covers the RRSIG RDATA", HFILL
}},
6875 { &hf_dns_dnskey_flags
,
6876 { "Flags", "dns.dnskey.flags",
6877 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6880 { &hf_dns_dnskey_flags_zone_key
,
6881 { "Zone Key", "dns.dnskey.flags.zone_key",
6882 FT_BOOLEAN
, 16, TFS(&dns_dnskey_zone_key_tfs
), DNSKEY_FLAGS_ZK
,
6885 { &hf_dns_dnskey_flags_key_revoked
,
6886 { "Key Revoked", "dns.dnskey.flags.key_revoked",
6887 FT_BOOLEAN
, 16, TFS(&tfs_yes_no
), DNSKEY_FLAGS_KR
,
6890 { &hf_dns_dnskey_flags_secure_entry_point
,
6891 { "Key Signing Key", "dns.dnskey.flags.secure_entry_point",
6892 FT_BOOLEAN
, 16, TFS(&tfs_yes_no
), DNSKEY_FLAGS_SEP
,
6895 { &hf_dns_dnskey_flags_reserved
,
6896 { "Key Signing Key", "dns.dnskey.flags.reserved",
6897 FT_UINT16
, BASE_HEX
, NULL
, DNSKEY_FLAGS_RSV
,
6898 "Must be zero", HFILL
}},
6900 { &hf_dns_dnskey_protocol
,
6901 { "Protocol", "dns.dnskey.protocol",
6902 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6903 "Must be 3", HFILL
}},
6905 { &hf_dns_dnskey_algorithm
,
6906 { "Algorithm", "dns.dnskey.algorithm",
6907 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0x0,
6908 "Identifies the public key's cryptographic algorithm and determines the format of the Public Key field", HFILL
}},
6910 { &hf_dns_dnskey_key_id
,
6911 { "Key id", "dns.dnskey.key_id",
6912 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6915 { &hf_dns_dnskey_public_key
,
6916 { "Public Key", "dns.dnskey.public_key",
6917 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6920 { &hf_dns_key_flags
,
6921 { "Flags", "dns.key.flags",
6922 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
6925 { &hf_dns_key_flags_authentication
,
6926 { "Key allowed for authentication", "dns.key.flags.authentication",
6927 FT_BOOLEAN
, 16, TFS(&tfs_not_allowed_allowed
), 0x8000,
6930 { &hf_dns_key_flags_confidentiality
,
6931 { "Key allowed for confidentiality", "dns.key.flags.confidentiality",
6932 FT_BOOLEAN
, 16, TFS(&tfs_not_allowed_allowed
), 0x4000,
6935 { &hf_dns_key_flags_key_required
,
6936 { "Key required", "dns.key.flags.required",
6937 FT_BOOLEAN
, 16, TFS(&tfs_required_experimental
), 0x2000,
6940 { &hf_dns_key_flags_associated_user
,
6941 { "Key is associated with a user", "dns.key.flags.associated_user",
6942 FT_BOOLEAN
, 16, TFS(&tfs_yes_no
), 0x0400,
6945 { &hf_dns_key_flags_associated_named_entity
,
6946 { "Key is associated with the named entity", "dns.key.flags.associated_named_entity",
6947 FT_BOOLEAN
, 16, TFS(&tfs_yes_no
), 0x0200,
6950 { &hf_dns_key_flags_ipsec
,
6951 { "Key use with IPSEC", "dns.key.flags.ipsec",
6952 FT_BOOLEAN
, 16, TFS(&tfs_valid_invalid
), 0x0080,
6955 { &hf_dns_key_flags_mime
,
6956 { "Key use with MIME security multiparts", "dns.key.flags.mime",
6957 FT_BOOLEAN
, 16, TFS(&tfs_valid_invalid
), 0x0040,
6960 { &hf_dns_key_flags_signatory
,
6961 { "Signatory", "dns.key.flags.signatory",
6962 FT_UINT16
, BASE_DEC
, NULL
, 0x000F,
6965 { &hf_dns_key_protocol
,
6966 { "Protocol", "dns.key.protocol",
6967 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
6970 { &hf_dns_key_algorithm
,
6971 { "Algorithm", "dns.key.algorithm",
6972 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0x0,
6975 { &hf_dns_key_key_id
,
6976 { "Key ID", "dns.key.key_id",
6977 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6980 { &hf_dns_key_public_key
,
6981 { "Public Key", "dns.key.public_key",
6982 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6985 { &hf_dns_px_preference
,
6986 { "Preference", "dns.px.preference",
6987 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6990 { &hf_dns_px_map822
,
6991 { "MAP822", "dns.px.map822",
6992 FT_STRING
, BASE_NONE
, NULL
, 0x0,
6995 { &hf_dns_px_mapx400
,
6996 { "MAPX400", "dns.px.map400",
6997 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7000 { &hf_dns_tkey_algo_name
,
7001 { "Algorithm name", "dns.tkey.algo_name",
7002 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7005 { &hf_dns_tkey_signature_expiration
,
7006 { "Signature Expiration", "dns.tkey.signature_expiration",
7007 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
7008 "Specify a validity period for the signature", HFILL
}},
7010 { &hf_dns_tkey_signature_inception
,
7011 { "Signature Inception", "dns.tkey.signature_inception",
7012 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
7013 "Specify a validity period for the signature", HFILL
}},
7015 { &hf_dns_tkey_mode
,
7016 { "Mode", "dns.tkey.mode",
7017 FT_UINT16
, BASE_DEC
, VALS(tkey_mode_vals
), 0x0,
7020 { &hf_dns_tkey_error
,
7021 { "Error", "dns.tkey.error",
7022 FT_UINT16
, BASE_DEC
, VALS(rcode_vals
), 0x0,
7025 { &hf_dns_tkey_key_size
,
7026 { "Key Size", "dns.tkey.key_size",
7027 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7030 { &hf_dns_tkey_key_data
,
7031 { "Key Data", "dns.tkey.key_data",
7032 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7035 { &hf_dns_tkey_other_size
,
7036 { "Other Size", "dns.tkey.other_size",
7037 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7040 { &hf_dns_tkey_other_data
,
7041 { "Other Data", "dns.tkey.other_data",
7042 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7045 { &hf_dns_ipseckey_gateway_precedence
,
7046 { "Gateway Precedence", "dns.ipseckey.gateway_precedence",
7047 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7050 { &hf_dns_ipseckey_gateway_algorithm
,
7051 { "Gateway Algorithm", "dns.ipseckey.gateway_algorithm",
7052 FT_UINT8
, BASE_DEC
, VALS(gw_algo_vals
), 0x0,
7055 { &hf_dns_ipseckey_gateway_type
,
7056 { "Gateway Type", "dns.ipseckey.gateway_type",
7057 FT_UINT8
, BASE_DEC
, VALS(gw_type_vals
), 0x0,
7060 { &hf_dns_ipseckey_gateway_ipv4
,
7061 { "IPv4 Gateway", "dns.ipseckey.gateway_ipv4",
7062 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
7065 { &hf_dns_ipseckey_gateway_ipv6
,
7066 { "IPv6 Gateway", "dns.ipseckey.gateway_ipv6",
7067 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
7070 { &hf_dns_ipseckey_gateway_dns
,
7071 { "DNS Gateway", "dns.ipseckey.gateway_dns",
7072 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7075 { &hf_dns_ipseckey_public_key
,
7076 { "Public Key", "dns.ipseckey.public_key",
7077 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7080 { &hf_dns_xpf_ip_version
,
7081 { "IP Version", "dns.xpf.ip_version",
7082 FT_UINT16
, BASE_DEC
,
7083 VALS(ip_version_vals
), 0x0,
7086 { &hf_dns_xpf_protocol
,
7087 { "Protocol", "dns.xpf.protocol",
7088 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
,
7089 &ipproto_val_ext
, 0x0,
7092 { &hf_dns_xpf_source_ipv4
,
7093 { "IPv4 Source", "dns.xpf.source_ipv4",
7094 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
7097 { &hf_dns_xpf_destination_ipv4
,
7098 { "IPv4 Destination", "dns.xpf.destination_ipv4",
7099 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
7102 { &hf_dns_xpf_source_ipv6
,
7103 { "IPv6 Source", "dns.xpf.source_ipv6",
7104 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
7107 { &hf_dns_xpf_destination_ipv6
,
7108 { "IPv6 Destination", "dns.xpf.destination_ipv6",
7109 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
7112 { &hf_dns_xpf_sport
,
7113 { "Source port", "dns.xpf.sport",
7114 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7117 { &hf_dns_xpf_dport
,
7118 { "Destination port", "dns.xpf.dport",
7119 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7122 { &hf_dns_a6_prefix_len
,
7123 { "Prefix len", "dns.a6.prefix_len",
7124 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7127 { &hf_dns_a6_address_suffix
,
7128 { "Address Suffix", "dns.a6.address_suffix",
7129 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
7132 { &hf_dns_a6_prefix_name
,
7133 { "Prefix name", "dns.a6.prefix_name",
7134 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7138 { "Dname", "dns.dname",
7139 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7142 { &hf_dns_loc_version
,
7143 { "Version", "dns.loc.version",
7144 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7148 { "Size", "dns.loc.size",
7149 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7152 { &hf_dns_loc_horizontal_precision
,
7153 { "Horizontal Precision", "dns.loc.horizontal_precision",
7154 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7157 { &hf_dns_loc_vertical_precision
,
7158 { "Vertical Precision", "dns.loc.vertical_precision",
7159 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7162 { &hf_dns_loc_latitude
,
7163 { "Latitude", "dns.loc.latitude",
7164 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7167 { &hf_dns_loc_longitude
,
7168 { "Longitude", "dns.loc.longitude",
7169 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7172 { &hf_dns_loc_altitude
,
7173 { "Altitude", "dns.loc.altitude",
7174 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7177 { &hf_dns_loc_unknown_data
,
7178 { "Unknown data", "dns.loc.unknown_data",
7179 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7182 { &hf_dns_nxt_next_domain_name
,
7183 { "Next Domain Name", "dns.nxt.next_domain_name",
7184 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7187 { &hf_dns_kx_preference
,
7188 { "Preference", "dns.kx.preference",
7189 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7192 { &hf_dns_kx_key_exchange
,
7193 { "Key Exchange", "dns.kx.key_exchange",
7194 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7197 { &hf_dns_cert_type
,
7198 { "Type", "dns.cert.type",
7199 FT_UINT16
, BASE_DEC
, VALS(dns_cert_type_vals
), 0x0,
7202 { &hf_dns_cert_key_tag
,
7203 { "Key Tag", "dns.cert.key_tag",
7204 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
7207 { &hf_dns_cert_algorithm
,
7208 { "Algorithm", "dns.cert.algorithm",
7209 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0x0,
7212 { &hf_dns_cert_certificate
,
7213 { "Certificate (or CRL)", "dns.cert.certificate",
7214 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7217 { &hf_dns_nsec_next_domain_name
,
7218 { "Next Domain Name", "dns.nsec.next_domain_name",
7219 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7223 { "Name Server", "dns.ns",
7224 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7228 { "Option", "dns.opt",
7234 { "Option Code", "dns.opt.code",
7235 FT_UINT16
, BASE_DEC
,
7236 VALS(edns0_opt_code_vals
), 0x0,
7240 { "Option Length", "dns.opt.len",
7241 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7245 { "Option Data", "dns.opt.data",
7246 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7250 { "DAU", "dns.opt.dau",
7251 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0x0,
7252 "DNSSEC Algorithm Understood", HFILL
}},
7255 { "DHU", "dns.opt.dhu",
7256 FT_UINT8
, BASE_DEC
, VALS(dns_ds_digest_vals
), 0x0,
7257 "DS Hash Understood", HFILL
}},
7260 { "N3U", "dns.opt.n3u",
7261 FT_UINT8
, BASE_DEC
, VALS(hash_algorithms
), 0x0,
7262 "NSEC3 Hash Understood", HFILL
}},
7264 { &hf_dns_opt_client_family
,
7265 { "Family", "dns.opt.client.family",
7266 FT_UINT16
, BASE_DEC
,
7267 VALS(afn_vals
), 0x0,
7270 { &hf_dns_opt_client_netmask
,
7271 { "Source Netmask", "dns.opt.client.netmask",
7272 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7275 { &hf_dns_opt_client_scope
,
7276 { "Scope Netmask", "dns.opt.client.scope",
7277 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7280 { &hf_dns_opt_client_addr
,
7281 { "Client Subnet", "dns.opt.client.addr",
7282 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7285 { &hf_dns_opt_client_addr4
,
7286 { "Client Subnet", "dns.opt.client.addr4",
7287 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
7290 { &hf_dns_opt_client_addr6
,
7291 { "Client Subnet", "dns.opt.client.addr6",
7292 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
7295 { &hf_dns_opt_cookie_client
,
7296 { "Client Cookie", "dns.opt.cookie.client",
7297 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7300 { &hf_dns_opt_cookie_server
,
7301 { "Server Cookie", "dns.opt.cookie.server",
7302 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7305 { &hf_dns_opt_edns_tcp_keepalive_timeout
,
7306 { "Timeout", "dns.opt.edns_tcp_keepalive.timeout",
7307 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7308 "an idle timeout value for the TCP connection, specified in units of 100 milliseconds", HFILL
}},
7310 { &hf_dns_opt_padding
,
7311 { "Padding", "dns.opt.padding",
7312 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7313 "The PADDING octets SHOULD be set to 0x00", HFILL
}},
7315 { &hf_dns_opt_chain_fqdn
,
7316 { "Closest Trust Point", "dns.opt.chain.fqdn",
7317 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7318 "A variable length Fully Qualified Domain Name (FQDN) in DNS wire format of the requested start point of the chain", HFILL
}},
7320 { &hf_dns_opt_ext_error_info_code
,
7321 { "Info Code", "dns.opt.ext_error.info_code",
7322 FT_UINT16
, BASE_DEC
| BASE_RANGE_STRING
, RVALS(dns_ext_err_info_code
), 0x0,
7325 { &hf_dns_opt_ext_error_extra_text
,
7326 { "Extra Text", "dns.opt.ext_error.extra_text",
7327 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7330 { &hf_dns_opt_agent_domain
,
7331 { "Agent Domain", "dns.opt.agent_domain",
7332 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7335 { &hf_dns_opt_zoneversion_labelcount
,
7336 { "Labelcount", "dns.opt.zoneversion.labelcount",
7337 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
7340 { &hf_dns_opt_zoneversion_type
,
7341 { "Type", "dns.opt.zoneversion.type",
7342 FT_UINT8
, BASE_DEC
| BASE_RANGE_STRING
, RVALS(dns_zoneversion_type
), 0x0,
7345 { &hf_dns_opt_zoneversion_soa
,
7346 { "SOA-SERIAL", "dns.opt.zoneversion.soa",
7347 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7350 { &hf_dns_opt_zoneversion_version
,
7351 { "Version", "dns.opt.zoneversion.version",
7352 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7355 { &hf_dns_count_questions
,
7356 { "Questions", "dns.count.queries",
7357 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7358 "Number of queries in packet", HFILL
}},
7360 { &hf_dns_count_zones
,
7361 { "Zones", "dns.count.zones",
7362 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7363 "Number of zones in packet", HFILL
}},
7365 { &hf_dns_count_answers
,
7366 { "Answer RRs", "dns.count.answers",
7367 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7368 "Number of answers in packet", HFILL
}},
7370 { &hf_dns_count_prerequisites
,
7371 { "Prerequisites", "dns.count.prerequisites",
7372 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7373 "Number of prerequisites in packet", HFILL
}},
7375 { &hf_dns_count_auth_rr
,
7376 { "Authority RRs", "dns.count.auth_rr",
7377 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7378 "Number of authoritative records in packet", HFILL
}},
7380 { &hf_dns_count_updates
,
7381 { "Updates", "dns.count.updates",
7382 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7383 "Number of updates records in packet", HFILL
}},
7385 { &hf_dns_nsec3_algo
,
7386 { "Hash algorithm", "dns.nsec3.algo",
7387 FT_UINT8
, BASE_DEC
, VALS(hash_algorithms
), 0,
7390 { &hf_dns_nsec3_flags
,
7391 { "NSEC3 flags", "dns.nsec3.flags",
7392 FT_UINT8
, BASE_DEC
, NULL
, 0,
7395 { &hf_dns_nsec3_flag_optout
,
7396 { "NSEC3 Opt-out flag", "dns.nsec3.flags.opt_out",
7397 FT_BOOLEAN
, 8, TFS(&tfs_flags_nsec3_optout
), NSEC3_FLAG_OPTOUT
,
7400 { &hf_dns_nsec3_iterations
,
7401 { "NSEC3 iterations", "dns.nsec3.iterations",
7402 FT_UINT16
, BASE_DEC
, NULL
, 0,
7403 "Number of hashing iterations", HFILL
}},
7405 { &hf_dns_nsec3_salt_length
,
7406 { "Salt length", "dns.nsec3.salt_length",
7407 FT_UINT8
, BASE_DEC
, NULL
, 0,
7408 "Length of salt in bytes", HFILL
}},
7410 { &hf_dns_nsec3_salt_value
,
7411 { "Salt value", "dns.nsec3.salt_value",
7412 FT_BYTES
, BASE_NONE
, NULL
, 0,
7415 { &hf_dns_nsec3_hash_length
,
7416 { "Hash length", "dns.nsec3.hash_length",
7417 FT_UINT8
, BASE_DEC
, NULL
, 0,
7418 "Length in bytes of next hashed owner", HFILL
}},
7420 { &hf_dns_nsec3_hash_value
,
7421 { "Next hashed owner", "dns.nsec3.hash_value",
7422 FT_STRING
, BASE_NONE
, NULL
, 0,
7425 { &hf_dns_tlsa_certificate_usage
,
7426 { "Certificate Usage", "dns.tlsa.certificate_usage",
7427 FT_UINT8
, BASE_DEC
, VALS(tlsa_certificate_usage_vals
), 0,
7428 "Specifies the provided association that will be used to match the certificate presented in the TLS handshake", HFILL
}},
7430 { &hf_dns_tlsa_selector
,
7431 { "Selector", "dns.tlsa.selector",
7432 FT_UINT8
, BASE_DEC
, VALS(tlsa_selector_vals
), 0,
7433 "Specifies which part of the TLS certificate presented by the server will be matched against the association data", HFILL
}},
7435 { &hf_dns_tlsa_matching_type
,
7436 { "Matching Type", "dns.tlsa.matching_type",
7437 FT_UINT8
, BASE_DEC
, VALS(tlsa_matching_type_vals
), 0,
7438 "Specifies how the certificate association is presented", HFILL
}},
7440 { &hf_dns_tlsa_certificate_association_data
,
7441 { "Certificate Association Data", "dns.tlsa.certificate_association_data",
7442 FT_BYTES
, BASE_NONE
, NULL
, 0,
7443 "The data refers to the certificate in the association", HFILL
}},
7445 { &hf_dns_tsig_algorithm_name
,
7446 { "Algorithm Name", "dns.tsig.algorithm_name",
7447 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7448 "Name of algorithm used for the MAC", HFILL
}},
7450 { &hf_dns_tsig_time_signed
,
7451 { "Time Signed", "dns.tsig.time_signed",
7452 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
7456 { &hf_dns_tsig_original_id
,
7457 { "Original Id", "dns.tsig.original_id",
7458 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7461 { &hf_dns_tsig_error
,
7462 { "Error", "dns.tsig.error",
7463 FT_UINT16
, BASE_DEC
, VALS(rcode_vals
), 0x0,
7464 "Expanded RCODE for TSIG", HFILL
}},
7466 { &hf_dns_tsig_fudge
,
7467 { "Fudge", "dns.tsig.fudge",
7468 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7469 "Number of bytes for the MAC", HFILL
}},
7471 { &hf_dns_tsig_mac_size
,
7472 { "MAC Size", "dns.tsig.mac_size",
7473 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7474 "Number of bytes for the MAC", HFILL
}},
7476 { &hf_dns_tsig_other_len
,
7477 { "Other Len", "dns.tsig.other_len",
7478 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7479 "Number of bytes for Other Data", HFILL
}},
7482 { "MAC", "dns.tsig.mac",
7483 FT_NONE
, BASE_NONE
, NULL
, 0x0,
7486 { &hf_dns_tsig_other_data
,
7487 { "Other Data", "dns.tsig.other_data",
7488 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7491 { &hf_dns_response_in
,
7492 { "Response In", "dns.response_in",
7493 FT_FRAMENUM
, BASE_NONE
, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE
), 0x0,
7494 "The response to this DNS query is in this frame", HFILL
}},
7496 { &hf_dns_response_to
,
7497 { "Request In", "dns.response_to",
7498 FT_FRAMENUM
, BASE_NONE
, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST
), 0x0,
7499 "This is a response to the DNS query in this frame", HFILL
}},
7501 { &hf_dns_retransmission
,
7502 { "Retransmission", "dns.retransmission",
7503 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
7504 "This is a retransmission", HFILL
}},
7506 { &hf_dns_retransmit_request_in
,
7507 { "Retransmitted request. Original request in", "dns.retransmit_request_in",
7508 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
7509 "This is a retransmitted DNS query", HFILL
}},
7511 { &hf_dns_retransmit_response_in
,
7512 { "Retransmitted response. Original response in", "dns.retransmit_response_in",
7513 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
7514 "This is a retransmitted DNS response", HFILL
}},
7517 { "Time", "dns.time",
7518 FT_RELATIVE_TIME
, BASE_NONE
, NULL
, 0x0,
7519 "The time between the Query and the Response", HFILL
}},
7521 { &hf_dns_unsolicited
,
7522 { "Unsolicited", "dns.unsolicited",
7523 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
7524 "This is an unsolicited response", HFILL
}},
7526 { &hf_dns_count_add_rr
,
7527 { "Additional RRs", "dns.count.add_rr",
7528 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7529 "Number of additional records in packet", HFILL
}},
7531 { &hf_dns_sshfp_algorithm
,
7532 { "Algorithm", "dns.sshfp.algorithm",
7533 FT_UINT8
, BASE_DEC
, VALS(sshfp_algo_vals
), 0,
7536 { &hf_dns_sshfp_fingerprint_type
,
7537 { "Fingerprint type", "dns.sshfp.fingerprint.type",
7538 FT_UINT8
, BASE_DEC
, VALS(sshfp_fingertype_vals
), 0,
7541 { &hf_dns_sshfp_fingerprint
,
7542 { "Fingerprint", "dns.sshfp.fingerprint",
7543 FT_BYTES
, BASE_NONE
, NULL
, 0,
7546 { &hf_dns_hip_hit_length
,
7547 { "HIT length", "dns.hip.hit.length",
7548 FT_UINT8
, BASE_DEC
, NULL
, 0,
7551 { &hf_dns_hip_pk_algo
,
7552 { "HIT length", "dns.hip.hit.pk.algo",
7553 FT_UINT8
, BASE_DEC
, VALS(hip_algo_vals
), 0,
7556 { &hf_dns_hip_pk_length
,
7557 { "PK length", "dns.hip.pk.length",
7558 FT_UINT16
, BASE_DEC
, NULL
, 0,
7562 { "Host Identity Tag", "dns.hip.hit",
7563 FT_BYTES
, BASE_NONE
, NULL
, 0,
7567 { "HIP Public Key", "dns.hip.pk",
7568 FT_BYTES
, BASE_NONE
, NULL
, 0,
7571 { &hf_dns_hip_rendezvous_server
,
7572 { "Rendezvous Server", "dns.hip.rendezvous_server",
7573 FT_STRING
, BASE_NONE
, NULL
, 0,
7576 { &hf_dns_dhcid_rdata
,
7577 { "DHCID Data", "dns.dhcid.rdata",
7578 FT_BYTES
, BASE_NONE
, NULL
, 0,
7581 { &hf_dns_ds_key_id
,
7582 { "Key id", "dns.ds.key_id",
7583 FT_UINT16
, BASE_HEX
, NULL
, 0,
7586 { &hf_dns_ds_algorithm
,
7587 { "Algorithm", "dns.ds.algorithm",
7588 FT_UINT8
, BASE_DEC
, VALS(dnssec_algo_vals
), 0,
7591 { &hf_dns_ds_digest_type
,
7592 { "Digest Type", "dns.ds.digest_type",
7593 FT_UINT8
, BASE_DEC
, VALS(dns_ds_digest_vals
), 0,
7596 { &hf_dns_ds_digest
,
7597 { "Digest", "dns.ds.digest",
7598 FT_BYTES
, BASE_NONE
, NULL
, 0,
7601 { &hf_dns_apl_address_family
,
7602 { "Address Family", "dns.apl.address_family",
7603 FT_UINT16
, BASE_DEC
, VALS(afn_vals
), 0,
7606 { &hf_dns_apl_coded_prefix
,
7607 { "Prefix Length", "dns.apl.coded_prefix",
7608 FT_UINT8
, BASE_DEC
, NULL
, 0,
7611 { &hf_dns_apl_negation
,
7612 { "Negation Flag", "dns.apl.negation",
7613 FT_BOOLEAN
, 8, TFS(&tfs_dns_apl_negation
), DNS_APL_NEGATION
,
7616 { &hf_dns_apl_afdlength
,
7617 { "Address Length","dns.apl.afdlength",
7618 FT_UINT8
, BASE_DEC
, NULL
, DNS_APL_AFDLENGTH
,
7619 "in octets", HFILL
}},
7621 { &hf_dns_apl_afdpart_ipv4
,
7622 { "Address","dns.apl.afdpart.ipv4",
7623 FT_IPv4
, BASE_NONE
, NULL
, 0,
7626 { &hf_dns_apl_afdpart_ipv6
,
7627 { "Address","dns.apl.afdpart.ipv6",
7628 FT_IPv6
, BASE_NONE
, NULL
, 0,
7631 { &hf_dns_apl_afdpart_data
,
7632 { "Address","dns.apl.afdpart.data",
7633 FT_BYTES
, BASE_NONE
, NULL
, 0,
7636 { &hf_dns_gpos_longitude_length
,
7637 { "Longitude length","dns.gpos.longitude_length",
7638 FT_UINT8
, BASE_DEC
, NULL
, 0,
7641 { &hf_dns_gpos_longitude
,
7642 { "Longitude","dns.gpos.longitude",
7643 FT_STRING
, BASE_NONE
, NULL
, 0,
7646 { &hf_dns_gpos_latitude_length
,
7647 { "Latitude length","dns.gpos.latitude_length",
7648 FT_UINT8
, BASE_DEC
, NULL
, 0,
7651 { &hf_dns_gpos_latitude
,
7652 { "Latitude","dns.gpos.latitude",
7653 FT_STRING
, BASE_NONE
, NULL
, 0,
7656 { &hf_dns_gpos_altitude_length
,
7657 { "Altitude length","dns.gpos.altitude_length",
7658 FT_UINT8
, BASE_DEC
, NULL
, 0,
7661 { &hf_dns_gpos_altitude
,
7662 { "Altitude","dns.gpos.altitude",
7663 FT_STRING
, BASE_NONE
, NULL
, 0,
7666 { &hf_dns_rp_mailbox
,
7667 { "Mailbox","dns.rp.mailbox",
7668 FT_STRING
, BASE_NONE
, NULL
, 0,
7671 { &hf_dns_rp_txt_rr
,
7672 { "TXT RR","dns.rp.txt_rr",
7673 FT_STRING
, BASE_NONE
, NULL
, 0,
7676 { &hf_dns_afsdb_subtype
,
7677 { "Subtype","dns.afsdb.subtype",
7678 FT_UINT16
, BASE_DEC
, NULL
, 0,
7681 { &hf_dns_afsdb_hostname
,
7682 { "Hostname","dns.afsdb.hostname",
7683 FT_STRING
, BASE_NONE
, NULL
, 0,
7686 { &hf_dns_x25_length
,
7687 { "Length","dns.x25.length",
7688 FT_UINT8
, BASE_DEC
, NULL
, 0,
7691 { &hf_dns_x25_psdn_address
,
7692 { "PSDN-Address","dns.x25.psdn_address",
7693 FT_STRING
, BASE_NONE
, NULL
, 0,
7696 { &hf_dns_isdn_length
,
7697 { "Length","dns.idsn.length",
7698 FT_UINT8
, BASE_DEC
, NULL
, 0,
7701 { &hf_dns_isdn_address
,
7702 { "ISDN Address","dns.idsn.address",
7703 FT_STRING
, BASE_NONE
, NULL
, 0,
7706 { &hf_dns_isdn_sa_length
,
7707 { "Length","dns.idsn.sa.length",
7708 FT_UINT8
, BASE_DEC
, NULL
, 0,
7712 { "Sub Address","dns.idsn.sa.address",
7713 FT_STRING
, BASE_NONE
, NULL
, 0,
7716 { &hf_dns_rt_preference
,
7717 { "Preference","dns.rt.subtype",
7718 FT_UINT16
, BASE_DEC
, NULL
, 0,
7721 { &hf_dns_rt_intermediate_host
,
7722 { "Intermediate Hostname","dns.rt.intermediate_host",
7723 FT_STRING
, BASE_NONE
, NULL
, 0,
7726 { &hf_dns_nsap_rdata
,
7727 { "NSAP Data", "dns.nsap.rdata",
7728 FT_BYTES
, BASE_NONE
, NULL
, 0,
7731 { &hf_dns_nsap_ptr_owner
,
7732 { "Owner", "dns.nsap_ptr.owner",
7733 FT_STRING
, BASE_NONE
, NULL
, 0,
7736 { &hf_dns_caa_flags
,
7737 { "CAA Flags", "dns.caa.flags",
7738 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
7741 { &hf_dns_caa_flag_issuer_critical
,
7742 { "Issuer Critical", "dns.caa.flags.issuer_critical",
7743 FT_BOOLEAN
, 8, TFS(&tfs_critical_not_critical
), CAA_FLAG_ISSUER_CRITICAL
,
7744 "Other CAs must not issue certificates", HFILL
}},
7746 { &hf_dns_caa_issue
,
7747 { "Issue", "dns.caa.issue",
7748 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7749 "CA which is allowed to issue certificates", HFILL
}},
7751 { &hf_dns_caa_issuewild
,
7752 { "Issue Wildcard", "dns.caa.issuewild",
7753 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7754 "CA which is allowed to issue wildcard certificates", HFILL
}},
7756 { &hf_dns_caa_iodef
,
7757 { "Report URL", "dns.caa.iodef",
7758 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7759 "URL or email address for certificate issue requests and violation reports", HFILL
}},
7761 { &hf_dns_caa_unknown
,
7762 { "Unknown tag", "dns.caa.unknown",
7763 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7766 { &hf_dns_caa_tag_length
,
7767 { "Tag length", "dns.caa.tag_length",
7768 FT_UINT8
, BASE_DEC
, NULL
, 0,
7772 { "Tag", "dns.caa.tag",
7773 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7776 { &hf_dns_caa_value
,
7777 { "Value", "dns.caa.value",
7778 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7781 { &hf_dns_extraneous_data
,
7782 { "Extraneous Data Bytes", "dns.extraneous.data",
7783 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7786 { &hf_dns_extraneous_length
,
7787 { "Extraneous Data Length", "dns.extraneous.length",
7788 FT_INT32
, BASE_DEC
, NULL
, 0x0,
7791 { &hf_dns_wins_local_flag
,
7792 { "Local Flag", "dns.wins.local_flag",
7793 FT_BOOLEAN
, 32, NULL
, 0x1,
7796 { &hf_dns_wins_lookup_timeout
,
7797 { "Lookup timeout", "dns.wins.lookup_timeout",
7798 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7799 "In seconds", HFILL
}},
7801 { &hf_dns_wins_cache_timeout
,
7802 { "Cache timeout", "dns.wins.cache_timeout",
7803 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7804 "In seconds", HFILL
}},
7806 { &hf_dns_wins_nb_wins_servers
,
7807 { "Number of WINS servers", "dns.wins.nb_wins_servers",
7808 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7811 { &hf_dns_wins_server
,
7812 { "WINS Server Address", "dns.wins.wins_server",
7813 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
7816 { &hf_dns_winsr_local_flag
,
7817 { "Local Flag", "dns.winsr.local_flag",
7818 FT_BOOLEAN
, 32, NULL
, 0x1,
7821 { &hf_dns_winsr_lookup_timeout
,
7822 { "Lookup timeout", "dns.winsr.lookup_timeout",
7823 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7824 "In seconds", HFILL
}},
7826 { &hf_dns_winsr_cache_timeout
,
7827 { "Cache timeout", "dns.winsr.cache_timeout",
7828 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7829 "In seconds", HFILL
}},
7831 { &hf_dns_winsr_name_result_domain
,
7832 { "Name Result Domain", "dns.winsr.name_result_domain",
7833 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7837 { "Data", "dns.data",
7838 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7842 { "DNS Stateful Operation", "dns.dso",
7843 FT_NONE
, BASE_NONE
, NULL
, 0x0,
7846 { "DSO TLV", "dns.dso.tlv",
7847 FT_NONE
, BASE_NONE
, NULL
, 0x0,
7849 { &hf_dns_dso_tlv_type
,
7850 { "Type", "dns.dso.tlv.type",
7851 FT_UINT16
, BASE_DEC
| BASE_RANGE_STRING
, RVALS(dns_dso_type_rvals
), 0x0,
7853 { &hf_dns_dso_tlv_length
,
7854 { "Length", "dns.dso.tlv.length",
7855 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
7857 { &hf_dns_dso_tlv_data
,
7858 { "Data", "dns.dso.tlv.data",
7859 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7861 { &hf_dns_dso_tlv_keepalive_inactivity
,
7862 { "Inactivity Timeout", "dns.dso.tlv.keepalive.inactivity",
7863 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7864 "Inactivity Timeout (ms)", HFILL
}},
7865 { &hf_dns_dso_tlv_keepalive_interval
,
7866 { "Keepalive Interval", "dns.dso.tlv.keepalive.interval",
7867 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7868 "Keepalive Interval (ms)", HFILL
}},
7869 { &hf_dns_dso_tlv_retrydelay_retrydelay
,
7870 { "Retry Delay", "dns.dso.tlv.retrydelay.retrydelay",
7871 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
7872 "Retry Delay (ms)", HFILL
}},
7873 { &hf_dns_dso_tlv_encpad_padding
,
7874 { "Padding", "dns.dso.tlv.encpad.padding",
7875 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
7879 { "DNSCrypt", "dns.dnscrypt",
7880 FT_NONE
, BASE_NONE
, NULL
, 0x0,
7882 { &hf_dns_dnscrypt_magic
,
7883 { "Magic", "dns.dnscrypt.magic",
7884 FT_STRING
, BASE_NONE
, NULL
, 0x0,
7886 { &hf_dns_dnscrypt_esversion
,
7887 { "ES Version", "dns.dnscrypt.esversion",
7888 FT_UINT16
, BASE_HEX
, VALS(esversions
), 0,
7890 { &hf_dns_dnscrypt_protocol_version
,
7891 { "Protocol Version", "dns.dnscrypt.protocol_version",
7892 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
7893 { &hf_dns_dnscrypt_signature
,
7894 { "Signature", "dns.dnscrypt.signature",
7895 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
7896 { &hf_dns_dnscrypt_resolver_pk
,
7897 { "Resolver PK", "dns.dnscrypt.resolver_public_key",
7898 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
7899 { &hf_dns_dnscrypt_client_magic
,
7900 { "Client Magic", "dns.dnscrypt.client_magic",
7901 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
7902 { &hf_dns_dnscrypt_serial_number
,
7903 { "Serial Number", "dns.dnscrypt.serial_number",
7904 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
7905 {&hf_dns_dnscrypt_ts_start
,
7906 { "Valid From", "dns.dnscrypt.valid_from",
7907 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0, NULL
, HFILL
}},
7908 {&hf_dns_dnscrypt_ts_end
,
7909 { "Valid To", "dns.dnscrypt.valid_to",
7910 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0, NULL
, HFILL
}},
7913 static ei_register_info ei
[] = {
7914 { &ei_dns_a_class_undecoded
, { "dns.a.class.undecoded", PI_UNDECODED
, PI_NOTE
, "Undecoded class", EXPFILL
}},
7915 { &ei_dns_opt_bad_length
, { "dns.rr.opt.bad_length", PI_MALFORMED
, PI_ERROR
, "Length too long for any type of IP address.", EXPFILL
}},
7916 { &ei_dns_undecoded_option
, { "dns.undecoded.type", PI_UNDECODED
, PI_NOTE
, "Undecoded option", EXPFILL
}},
7917 { &ei_dns_depr_opc
, { "dns.depr.opc", PI_PROTOCOL
, PI_WARN
, "Deprecated opcode", EXPFILL
}},
7918 { &ei_ttl_high_bit_set
, { "dns.ttl.high_bit_set", PI_PROTOCOL
, PI_WARN
, "The uppermost bit of the TTL is set (RFC 2181, section 8)", EXPFILL
}},
7919 { &ei_dns_tsig_alg
, { "dns.tsig.noalg", PI_UNDECODED
, PI_WARN
, "No dissector for algorithm", EXPFILL
}},
7920 { &ei_dns_key_id_buffer_too_short
, { "dns.key_id_buffer_too_short", PI_PROTOCOL
, PI_WARN
, "Buffer too short to compute a key id", EXPFILL
}},
7921 { &ei_dns_retransmit_request
, { "dns.retransmit_request", PI_PROTOCOL
, PI_WARN
, "DNS query retransmission", EXPFILL
}},
7922 { &ei_dns_retransmit_response
, { "dns.retransmit_response", PI_PROTOCOL
, PI_WARN
, "DNS response retransmission", EXPFILL
}},
7923 { &ei_dns_extraneous_data
, { "dns.extraneous", PI_UNDECODED
, PI_NOTE
, "Extraneous data", EXPFILL
}},
7924 { &ei_dns_response_missing
, { "dns.response_missing", PI_PROTOCOL
, PI_WARN
, "DNS response missing", EXPFILL
}},
7927 static int *ett
[] = {
7941 &ett_dns_csdync_flags
,
7945 &ett_dns_extraneous
,
7948 module_t
*dns_module
;
7949 expert_module_t
* expert_dns
;
7951 proto_dns
= proto_register_protocol("Domain Name System", "DNS", "dns");
7952 proto_mdns
= proto_register_protocol("Multicast Domain Name System", "mDNS", "mdns");
7953 proto_llmnr
= proto_register_protocol("Link-local Multicast Name Resolution", "LLMNR", "llmnr");
7954 proto_register_field_array(proto_dns
, hf
, array_length(hf
));
7955 proto_register_subtree_array(ett
, array_length(ett
));
7956 expert_dns
= expert_register_protocol(proto_dns
);
7957 expert_register_field_array(expert_dns
, ei
, array_length(ei
));
7959 dns_module
= prefs_register_protocol(proto_dns
, NULL
);
7961 // preferences for dns_qr_statistics
7962 prefs_register_bool_preference(dns_module
, "qr_enable_statistics", "Enable Query-Response Statistics", "Enable Query-Response Statistics", &dns_qr_statistics_enabled
);
7963 perf_qr_enable_statistics
= prefs_find_preference(dns_module
, "qr_enable_statistics");
7964 dns_qr_statistics_enabled
= prefs_get_bool_value(perf_qr_enable_statistics
, pref_current
);
7965 prefs_register_bool_preference(dns_module
, "qr_qrn_enable_statistics", "Enable Display of Query-Record-Name", "Enable Display of Query-Record-Name", &dns_qr_qrn_statistics_enabled
);
7966 perf_qr_qrn_enable_statistics
= prefs_find_preference(dns_module
, "qr_qrn_enable_statistics");
7967 dns_qr_qrn_statistics_enabled
= prefs_get_bool_value(perf_qr_qrn_enable_statistics
, pref_current
);
7968 prefs_register_bool_preference(dns_module
, "qr_qrn_aud_zv_enable_statistics", "Enable Display of Query-Record-Name for Nodes with Zero-Values", "Enable Display of Query-Record-Name for Answers-Authorities-Additionals with Zero-Values. If this is set, it also requires dns.qr_qrn_enable_statistics to be set for it to work.", &dns_qr_qrn_aud_zv_statistics_enabled
);
7969 perf_qr_qrn_aud_zv_enable_statistics
= prefs_find_preference(dns_module
, "qr_qrn_aud_zv_enable_statistics");
7970 dns_qr_qrn_aud_zv_statistics_enabled
= prefs_get_bool_value(perf_qr_qrn_aud_zv_enable_statistics
, pref_current
);
7972 prefs_register_bool_preference(dns_module
, "desegment_dns_messages",
7973 "Reassemble DNS messages spanning multiple TCP segments",
7974 "Whether the DNS dissector should reassemble messages spanning multiple TCP segments."
7975 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
7978 prefs_register_uint_preference(dns_module
, "retransmission_timer",
7979 "Number of seconds allowed between retransmissions",
7980 "Number of seconds allowed between DNS requests with the same transaction ID to consider it a retransmission."
7981 " Otherwise its considered a new request.",
7982 10, &retransmission_timer
);
7984 prefs_register_obsolete_preference(dns_module
, "use_for_addr_resolution");
7986 prefs_register_static_text_preference(dns_module
, "text_use_for_addr_resolution",
7987 "DNS address resolution settings can be changed in the Name Resolution preferences",
7988 "DNS address resolution settings can be changed in the Name Resolution preferences");
7990 prefs_register_bool_preference(dns_module
, "enable_qname_stats",
7991 "Add queried names to DNS statistics",
7992 "Whether the DNS dissector should add queried names to DNS statistics.",
7996 dns_tsig_dissector_table
= register_dissector_table("dns.tsig.mac", "DNS TSIG MAC", proto_dns
, FT_STRING
, STRING_CASE_SENSITIVE
);
7998 dns_handle
= register_dissector("dns", dissect_dns
, proto_dns
);
7999 mdns_udp_handle
= register_dissector("mdns", dissect_mdns_udp
, proto_mdns
);
8000 llmnr_udp_handle
= register_dissector("llmnr", dissect_llmnr_udp
, proto_llmnr
);
8001 doq_handle
= register_dissector("dns.doq", dissect_dns_doq
, proto_dns
);
8003 dns_tap
= register_tap("dns");
8012 * indent-tabs-mode: nil
8015 * ex: set shiftwidth=2 tabstop=8 expandtab:
8016 * :indentSize=2:tabSize=8:noTabs=true: