reply_info Struct Reference

Structure to store DNS query and the reply packet. More...

#include <msgreply.h>

Data Fields

uint16_t flags
 the flags for the answer, host byte order.
 
uint8_t authoritative
 This flag informs unbound the answer is authoritative and the AA flag should be preserved.
 
uint8_t qdcount
 Number of RRs in the query section. More...
 
uint32_t padding
 32 bit padding to pad struct member alignment to 64 bits.
 
time_t ttl
 TTL of the entire reply (for negative caching). More...
 
time_t prefetch_ttl
 TTL for prefetch. More...
 
time_t serve_expired_ttl
 Reply TTL extended with serve expired TTL, to limit time to serve expired message.
 
time_t serve_expired_norec_ttl
 TTL for an expired entry to be used without attempting recursion since a previous recursion attempt failed to update the message. More...
 
enum sec_status security
 The security status from DNSSEC validation of this message.
 
sldns_ede_code reason_bogus
 EDE (rfc8914) code with reason for DNSSEC bogus status. More...
 
char * reason_bogus_str
 EDE (rfc8914) NULL-terminated string with human-readable reason for DNSSEC bogus status. More...
 
size_t an_numrrsets
 Number of RRsets in each section. More...
 
size_t ns_numrrsets
 Count of authority section RRsets.
 
size_t ar_numrrsets
 Count of additional section RRsets.
 
size_t rrset_count
 number of RRsets: an_numrrsets + ns_numrrsets + ar_numrrsets
 
struct ub_packed_rrset_key ** rrsets
 List of pointers (only) to the rrsets in the order in which they appear in the reply message. More...
 
struct rrset_ref ref [1]
 Packed array of ids (see counts) and pointers to packed_rrset_key. More...
 

Detailed Description

Structure to store DNS query and the reply packet.

To use it, copy over the flags from reply and modify using flags from the query (RD,CD if not AA). prepend ID.

Memory layout is: o struct o rrset_ref array o packed_rrset_key* array.

Memory layout is sometimes not packed, when the message is synthesized, for easy of the generation. It is allocated packed when it is copied from the region allocation to the malloc allocation.

Field Documentation

◆ qdcount

uint8_t reply_info::qdcount

Number of RRs in the query section.

If qdcount is not 0, then it is 1, and the data that appears in the reply is the same as the query_info. Host byte order.

Referenced by construct_reply_info_base(), dns64_adjust_a(), dns_msg_create(), dump_msg(), load_msg(), local_encode(), reply_equal(), reply_info_copy(), rpz_local_encode(), rrset_msg(), synth_dname_msg(), and tomsg().

◆ ttl

◆ prefetch_ttl

time_t reply_info::prefetch_ttl

TTL for prefetch.

After it has expired, a prefetch is suitable. Smaller than the TTL, otherwise the prefetch would not happen.

Referenced by bogus_del_msg(), construct_reply_info_base(), dns64_adjust_a(), dns_cache_prefetch_adjust(), iter_prepend(), load_msg(), msg_ttl(), negative_del_msg(), parse_copy_decompress(), reply_info_copy(), reply_info_set_ttls(), rrset_msg(), store_rrsets(), synth_dname_msg(), tomsg(), and zone_del_msg().

◆ serve_expired_norec_ttl

time_t reply_info::serve_expired_norec_ttl

TTL for an expired entry to be used without attempting recursion since a previous recursion attempt failed to update the message.

This is just an efficiency timer when serve-expired-client-timeout is configured. It will make Unbound immediately reply with the expired entry instead of trying resolution first. It is set on cached entries by modules that identified problems while resolving, e.g., failed upstreams from Iterator, or failed validation from Validator.

Referenced by answer_from_cache(), construct_reply_info_base(), dns64_adjust_a(), error_response_cache(), parse_copy_decompress(), reply_info_copy(), reply_info_set_ttls(), rrset_msg(), synth_dname_msg(), and tomsg().

◆ reason_bogus

sldns_ede_code reply_info::reason_bogus

EDE (rfc8914) code with reason for DNSSEC bogus status.

Used for caching the EDE.

Referenced by construct_reply_info_base(), dns_msg_create(), dump_msg(), gen_dns_msg(), load_msg(), local_encode(), msg_create(), reply_info_copy(), rrset_msg(), synth_dname_msg(), and tomsg().

◆ reason_bogus_str

char* reply_info::reason_bogus_str

EDE (rfc8914) NULL-terminated string with human-readable reason for DNSSEC bogus status.

Used for caching the EDE.

Referenced by construct_reply_info_base(), dns_msg_deepcopy_region(), dump_msg(), reply_info_copy(), reply_info_parsedelete(), and tomsg().

◆ an_numrrsets

size_t reply_info::an_numrrsets

◆ rrsets

struct ub_packed_rrset_key** reply_info::rrsets

List of pointers (only) to the rrsets in the order in which they appear in the reply message.


Number of elements is ancount+nscount+arcount RRsets. This is a pointer to that array. Use the accessor function for access.

Referenced by addr_to_additional(), answer_from_cache(), az_add_negative_soa(), az_change_dnames(), calc_data_need(), caps_strip_reply(), check_the_rrsigs(), cname_under_previous_dname(), construct_reply_info_base(), deleg_remove_nonsecure_additional(), delegpt_from_message(), detect_wrongly_truncated(), dns_cache_store(), dns_cache_store_msg(), dns_msg_ansadd(), dns_msg_authadd(), dns_msg_deepcopy_region(), dump_msg(), extract_keys(), fill_res(), find_NS(), find_rrset_type(), handle_cname_response(), iter_ds_toolow(), iter_msg_from_zone(), iter_msg_has_dnssec(), iter_prepend(), iter_scrub_ds(), iter_scrub_nxdomain(), iter_store_parentside_neg(), limit_nsec_ttl(), local_encode(), msg_add_rrset_an(), msg_add_rrset_ar(), msg_add_rrset_ns(), msg_grow_array(), msg_rrset_duplicate(), msg_ttl(), no_data_for_rrsig(), parse_copy_decompress(), pr_rrs(), print_dp_main(), print_packet_rrsets(), remove_spurious_authority(), repinfo_copy_rrsets(), reply_all_rrsets_secure(), reply_check_cname_chain(), reply_equal(), reply_find_answer_rrset(), reply_find_final_cname_target(), reply_find_rrset(), reply_find_rrset_section_an(), reply_find_rrset_section_ns(), reply_find_soa(), reply_get_NS_rrset(), reply_has_nsec(), reply_info_alloc_rrset_keys(), reply_info_parsedelete(), reply_nsec_signer(), respip_addr_lookup(), respip_data_answer(), rpz_add_soa(), rpz_local_encode(), store_rrsets(), tomsg(), val_chase_cname(), val_check_nonsecure(), val_fill_reply(), val_find_DS(), val_find_signer(), val_has_signed_nsecs(), val_mark_indeterminate(), val_mark_insecure(), val_neg_addreferral(), val_neg_addreply(), val_next_unchecked(), val_reply_remove_auth(), validate_cname_noanswer_response(), validate_cname_response(), validate_nameerror_response(), validate_nodata_response(), validate_positive_response(), validate_referral_response(), and verifytest_entry().

◆ ref

struct rrset_ref reply_info::ref[1]

Packed array of ids (see counts) and pointers to packed_rrset_key.

The number equals ancount+nscount+arcount RRsets. These are sorted in ascending pointer, the locking order. So this list can be locked (and id, ttl checked), to see if all the data is available and recent enough.

This is defined as an array of size 1, so that the compiler associates the identifier with this position in the structure. Array bound overflow on this array then gives access to the further elements of the array, which are allocated after the main structure.

It could be more pure to define as array of size 0, ref[0]. But ref[1] may be less confusing for compilers. Use the accessor function for access.

Referenced by answer_from_cache(), construct_reply_info_base(), dns_cache_store_msg(), dump_msg(), invalidateQueryInCache(), reply_info_set_ttls(), reply_info_sortref(), store_rrsets(), and tomsg().


The documentation for this struct was generated from the following file: