This file contains domain name handling functions. More...
#include "config.h"#include <ctype.h>#include "util/data/dname.h"#include "util/data/msgparse.h"#include "util/log.h"#include "util/storage/lookup3.h"#include "sldns/sbuffer.h"Functions | |
| size_t | query_dname_len (sldns_buffer *query) |
| Determine length of dname in buffer, no compression ptrs allowed,. | |
| size_t | dname_valid (uint8_t *dname, size_t maxlen) |
| Determine if dname in memory is correct. | |
| int | query_dname_compare (register uint8_t *d1, register uint8_t *d2) |
| compare uncompressed, noncanonical, registers are hints for speed | |
| void | query_dname_tolower (uint8_t *dname) |
| lowercase query dname | |
| void | pkt_dname_tolower (sldns_buffer *pkt, uint8_t *dname) |
| lowercase pkt dname (follows compression pointers) | |
| size_t | pkt_dname_len (sldns_buffer *pkt) |
| Determine correct, compressed, dname present in packet. | |
| int | dname_pkt_compare (sldns_buffer *pkt, uint8_t *d1, uint8_t *d2) |
| Compare dnames in packet (compressed). | |
| hashvalue_type | dname_query_hash (uint8_t *dname, hashvalue_type h) |
| Hash dname, label by label, lowercasing, into hashvalue. | |
| hashvalue_type | dname_pkt_hash (sldns_buffer *pkt, uint8_t *dname, hashvalue_type h) |
| Hash dname, label by label, lowercasing, into hashvalue. | |
| void | dname_pkt_copy (sldns_buffer *pkt, uint8_t *to, uint8_t *dname) |
| Copy over a valid dname and decompress it. | |
| void | dname_print (FILE *out, struct sldns_buffer *pkt, uint8_t *dname) |
| Debug helper. | |
| int | dname_count_labels (uint8_t *dname) |
| Count the number of labels in an uncompressed dname in memory. | |
| int | dname_count_size_labels (uint8_t *dname, size_t *size) |
| Count labels and dname length both, for uncompressed dname in memory. | |
| static int | memlowercmp (uint8_t *p1, uint8_t *p2, uint8_t len) |
| Compare labels in memory, lowercase while comparing. | |
| int | dname_lab_cmp (uint8_t *d1, int labs1, uint8_t *d2, int labs2, int *mlabs) |
| Compare dnames, sorted not canonical, but by label. | |
| int | dname_lab_startswith (uint8_t *label, char *prefix, char **endptr) |
| Check if labels starts with given prefix. | |
| int | dname_has_label (uint8_t *dname, size_t dnamelen, uint8_t *label) |
| Check if dname contains label. | |
| int | dname_buffer_write (sldns_buffer *pkt, uint8_t *dname) |
| Copy over a valid dname to a packet. | |
| void | dname_str (uint8_t *dname, char *str) |
| Debug helper. | |
| int | dname_strict_subdomain (uint8_t *d1, int labs1, uint8_t *d2, int labs2) |
| See if domain name d1 is a strict subdomain of d2. | |
| int | dname_strict_subdomain_c (uint8_t *d1, uint8_t *d2) |
| Like dname_strict_subdomain but counts labels. | |
| int | dname_subdomain_c (uint8_t *d1, uint8_t *d2) |
| Counts labels. | |
| int | dname_is_root (uint8_t *dname) |
| Returns true if the uncompressed wireformat dname is the root ".". | |
| void | dname_remove_label (uint8_t **dname, size_t *len) |
| Snip off first label from a dname, returning the parent zone. | |
| int | dname_remove_label_limit_len (uint8_t **dname, size_t *len, size_t lenlimit) |
| Same as dname_remove_label but fails if removal would surpass lenlimit. | |
| void | dname_remove_labels (uint8_t **dname, size_t *len, int n) |
| Snip off first N labels from a dname, returning the parent zone. | |
| int | dname_signame_label_count (uint8_t *dname) |
| Count labels for the RRSIG signature label field. | |
| int | dname_is_wild (uint8_t *dname) |
| Return true if the label is a wildcard, *.example.com. | |
| static int | memcanoncmp (uint8_t *p1, uint8_t len1, uint8_t *p2, uint8_t len2) |
| Compare labels in memory, lowercase while comparing. | |
| int | dname_canon_lab_cmp (uint8_t *d1, int labs1, uint8_t *d2, int labs2, int *mlabs) |
| Compare dnames, Canonical in rfc4034 sense, but by label. | |
| int | dname_canonical_compare (uint8_t *d1, uint8_t *d2) |
| Canonical dname compare. | |
| uint8_t * | dname_get_shared_topdomain (uint8_t *d1, uint8_t *d2) |
| Get the shared topdomain between two names. | |
This file contains domain name handling functions.
| size_t query_dname_len | ( | struct sldns_buffer * | query | ) |
Determine length of dname in buffer, no compression ptrs allowed,.
| query | the ldns buffer, current position at start of dname. at end, position is at end of the dname. |
References LDNS_MAX_DOMAINLEN, sldns_buffer_read_u8(), sldns_buffer_remaining(), and sldns_buffer_skip().
Referenced by chaos_replystr(), dname_test_qdl(), and query_info_parse().
| size_t dname_valid | ( | uint8_t * | dname, |
| size_t | len | ||
| ) |
Determine if dname in memory is correct.
no compression ptrs allowed.
| dname | where dname starts in memory. |
| len | dname is not allowed to exceed this length (i.e. of allocation). |
References LDNS_MAX_DOMAINLEN.
Referenced by az_add_additionals_from(), az_insert_rr_decompress(), az_remove_rr_decompress(), canonical_compare(), canonicalize_rdata(), create_synth_cname(), delegpt_rrset_add_ns(), dname_test_valid(), dns_error_reporting(), dnskey_verify_rrset_sig(), follow_cname_chain(), get_cname_target(), nsec_get_next(), nsec_has_type(), parse_get_cname_target(), reuse_move_writewait_away(), rpz_dname_to_trigger(), rpz_rr_to_action(), rrset_has_signer(), rrsig_get_signer(), and wipeout().
| void pkt_dname_tolower | ( | struct sldns_buffer * | pkt, |
| uint8_t * | dname | ||
| ) |
lowercase pkt dname (follows compression pointers)
| pkt | the packet, used to follow compression pointers. Position is unchanged. |
| dname | start of dname in packet. |
References LABEL_IS_PTR, MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_at(), sldns_buffer_end(), and sldns_buffer_limit().
Referenced by dname_test_pdtl(), and serviced_callbacks().
| size_t pkt_dname_len | ( | struct sldns_buffer * | pkt | ) |
Determine correct, compressed, dname present in packet.
Checks for parse errors.
| pkt | packet to read from (from current start position). |
References LABEL_IS_PTR, LDNS_MAX_DOMAINLEN, MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_limit(), sldns_buffer_position(), sldns_buffer_read_u8(), sldns_buffer_remaining(), sldns_buffer_set_position(), and sldns_buffer_skip().
Referenced by analyze_dname(), auth_zone_parse_notify_serial(), calc_size(), check_packet_ok(), check_xfer_packet(), chunk_rrlist_get_current(), decompress_rr_into_buffer(), dname_test_pkt_dname_len(), get_additional_name(), log_rrlist_position(), nsec_at_apex(), parse_edns_from_query_pkt(), parse_get_cname_target(), parse_query_section(), parse_section(), rdata_copy(), sanitize_nsec_is_overreach(), and skip_pkt_rr().
| int dname_pkt_compare | ( | struct sldns_buffer * | pkt, |
| uint8_t * | d1, | ||
| uint8_t * | d2 | ||
| ) |
Compare dnames in packet (compressed).
Dnames must be valid. routine performs lowercasing, so the packet casing is preserved.
| pkt | packet, used to resolve compression pointers. |
| d1 | dname to compare |
| d2 | dname to compare |
References LABEL_IS_PTR, LDNS_MAX_LABELLEN, log_assert, MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_at(), and sldns_buffer_limit().
Referenced by check_packet_ok(), check_xfer_packet(), rrset_parse_equals(), scrub_message(), scrub_normalize(), scrub_sanitize(), and smart_compare().
| hashvalue_type dname_query_hash | ( | uint8_t * | dname, |
| hashvalue_type | h | ||
| ) |
Hash dname, label by label, lowercasing, into hashvalue.
Dname in query format (not compressed).
| dname | dname to hash. |
| h | initial hash value. |
References LDNS_MAX_LABELLEN, and log_assert.
Referenced by hash_infra(), infra_create_ratedata(), infra_find_ratedata(), key_entry_hash(), query_info_hash(), and rrset_key_hash().
| hashvalue_type dname_pkt_hash | ( | struct sldns_buffer * | pkt, |
| uint8_t * | dname, | ||
| hashvalue_type | h | ||
| ) |
Hash dname, label by label, lowercasing, into hashvalue.
Dname in pkt format (compressed).
| pkt | packet, for resolving compression pointers. |
| dname | dname to hash, pointer to the pkt buffer. Must be valid format. No loops, etc. |
| h | initial hash value. |
References LABEL_IS_PTR, LDNS_MAX_LABELLEN, log_assert, MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_at(), and sldns_buffer_limit().
Referenced by pkt_hash_rrset(), and pkt_hash_rrset_first().
| void dname_pkt_copy | ( | struct sldns_buffer * | pkt, |
| uint8_t * | to, | ||
| uint8_t * | dname | ||
| ) |
Copy over a valid dname and decompress it.
| pkt | packet to resolve compression pointers. |
| to | buffer of size from pkt_len function to hold result. |
| dname | pointer into packet where dname starts. |
References LABEL_IS_PTR, LDNS_MAX_DOMAINLEN, LDNS_MAX_LABELLEN, log_assert, log_err(), MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_at(), and sldns_buffer_limit().
Referenced by decompress_rr_into_buffer(), log_rrlist_position(), msgparse_rrset_remove_rr(), parse_copy_decompress_rrset(), parse_create_qinfo(), pkt_strict_sub(), pkt_sub(), priv_lookup_name(), rdata_copy(), remove_rrset(), shorten_rrset(), sub_of_pkt(), synth_cname(), and synth_cname_rrset().
| void dname_print | ( | FILE * | out, |
| struct sldns_buffer * | pkt, | ||
| uint8_t * | dname | ||
| ) |
Debug helper.
Print wireformat dname to output.
| out | like stdout or a file. |
| pkt | if not NULL, the packet for resolving compression ptrs. |
| dname | pointer to (start of) dname. |
References LABEL_IS_PTR, LDNS_MAX_LABELLEN, MAX_COMPRESS_PTRS, PTR_OFFSET, sldns_buffer_at(), and sldns_buffer_limit().
Referenced by analyze_dname(), parse_section(), and print_neg_cache().
| int dname_count_labels | ( | uint8_t * | dname | ) |
Count the number of labels in an uncompressed dname in memory.
| dname | pointer to uncompressed dname. |
Referenced by anchors_lookup(), auth_xfer_find(), auth_zone_create(), auth_zone_find(), auth_zone_find_less_equal(), autr_tp_create(), az_domain_create(), az_find_domain(), az_find_name(), az_nsec3_get_nextcloser(), caps_white_apply_cfg(), dname_canonical_compare(), dname_get_shared_topdomain(), dname_strict_subdomain_c(), dname_subdomain_c(), dname_test_count_labels(), dns64_always_synth_for_qname(), dns64_insert_ignore_aaaa(), do_cache_lookup(), domain_limit_findcreate(), find_add_tp(), infra_find_ratelimit(), insert_query(), is_caps_whitelisted(), iter_dp_cangodown(), iter_msg_from_zone(), local_zones_answer(), lz_enter_override(), lz_enter_zone_tag(), neg_create_zone(), neg_find_nsec(), neg_find_zone(), neg_insert_data(), next_closer(), nsec_closest_encloser(), packed_rrset_encode(), processFindKey(), processQueryTargets(), rpz_data_delete_rr(), rpz_find_zone(), rpz_rr_to_action(), set_next_probe(), val_find_best_signer(), val_neg_getmsg(), val_nsec_proves_no_wc(), val_rrset_wildcard(), validate_cname_noanswer_response(), validate_nameerror_response(), and wipeout().
| int dname_count_size_labels | ( | uint8_t * | dname, |
| size_t * | size | ||
| ) |
Count labels and dname length both, for uncompressed dname in memory.
| dname | pointer to uncompressed dname. |
| size | length of dname, including root label. |
Referenced by anchor_store_new_key(), anchors_add_insecure(), anchors_delete_insecure(), auth_zones_find_zone(), az_find_candidate_ce(), compress_rdata(), delegpt_add_ns(), delegpt_add_ns_mlc(), delegpt_create_mlc(), delegpt_set_name(), delegpt_set_name_mlc(), dname_test_count_size_labels(), forwards_find(), forwards_lookup(), fwd_add_stub_hole(), hints_delete_stub(), hints_find(), hints_lookup_stub(), local_zones_add_RR(), lz_enter_rr_into_zone(), lz_enter_rr_str(), lz_setup_implicit(), nsec3_prove_wildcard(), parse_arg_name(), parse_dname(), priv_lookup_name(), read_names(), rpz_find_zone(), val_find_best_signer(), val_neg_getmsg(), and wipeout().
|
static |
Compare labels in memory, lowercase while comparing.
| p1 | label 1 |
| p2 | label 2 |
| len | number of bytes to compare. |
Referenced by dname_has_label(), and memcanoncmp().
| int dname_lab_cmp | ( | uint8_t * | d1, |
| int | labs1, | ||
| uint8_t * | d2, | ||
| int | labs2, | ||
| int * | mlabs | ||
| ) |
Compare dnames, sorted not canonical, but by label.
Such that zone contents follows zone apex.
| d1 | first dname. pointer to uncompressed wireformat. |
| labs1 | number of labels in first dname. |
| d2 | second dname. pointer to uncompressed wireformat. |
| labs2 | number of labels in second dname. |
| mlabs | number of labels that matched exactly (the shared topdomain). |
References log_assert.
Referenced by anchor_cmp(), anchors_init_parents_locked(), anchors_lookup(), auth_xfer_cmp(), auth_zone_cmp(), compress_tree_search(), dname_get_shared_topdomain(), dname_strict_subdomain(), dname_subdomain_c(), dname_test_dname_lab_cmp(), forwards_lookup(), fwd_cmp(), fwd_init_parents(), local_zone_cmp(), local_zones_tags_lookup(), lz_setup_implicit(), name_tree_compare(), name_tree_init_parents(), name_tree_lookup(), neg_closest_data_parent(), neg_closest_zone_parent(), and val_find_best_signer().
| int dname_lab_startswith | ( | uint8_t * | label, |
| char * | prefix, | ||
| char ** | endptr | ||
| ) |
Check if labels starts with given prefix.
| label | dname label |
| prefix | the string to match label with, null terminated. |
| endptr | pointer to location in label after prefix, only if return value is 1. NULL if nothing in the label after the prefix, i.e. prefix and label are the same. |
Referenced by processFinished(), rpz_dname_to_trigger(), and rpz_rr_to_action().
| int dname_has_label | ( | uint8_t * | dname, |
| size_t | dnamelen, | ||
| uint8_t * | label | ||
| ) |
Check if dname contains label.
| dname | dname |
| dnamelen | length of dname |
| label | label to be checked for presence in dname |
References memlowercmp().
Referenced by dname_test_has_label().
| int dname_buffer_write | ( | struct sldns_buffer * | pkt, |
| uint8_t * | dname | ||
| ) |
Copy over a valid dname to a packet.
| pkt | packet to copy to. |
| dname | dname to copy. |
References sldns_buffer_remaining(), sldns_buffer_write(), and sldns_buffer_write_u8().
Referenced by compress_any_dname().
| void dname_str | ( | uint8_t * | dname, |
| char * | str | ||
| ) |
Debug helper.
Print dname to given string buffer (string buffer must be at least 255 chars, in printable form. This may lose information (? for nonprintable characters, or & if the name is too long, # for a bad label length). Upon return, the buffer will always have a terminating \0 value.
| dname | uncompressed wireformat. |
| str | buffer of at least 255 length. |
References LDNS_MAX_DOMAINLEN, and LDNS_MAX_LABELLEN.
Referenced by anchors_assemble_rrsets(), answer_notify(), auth_xfer_probe_lookup_callback(), auth_xfer_probe_timer_callback(), auth_xfer_probe_udp_callback(), auth_xfer_transfer_lookup_callback(), auth_zone_delegpt(), auth_zone_log(), auth_zone_read_zonefile(), auth_zone_zonemd_check_hash(), auth_zone_zonemd_fail(), autr_debug_print_tp(), autr_tp_create(), delegpt_log(), do_dump_requestlist(), do_list_auth_zones(), do_list_local_zones(), dump_infra_host(), errinf_dname(), errinf_rrset(), errinf_to_str_bogus(), errinf_to_str_servfail(), fill_canon(), forwards_insert_data(), get_mesh_status(), hints_insert(), infra_ratelimit_inc(), iter_stub_fwd_no_cache(), local_zones_answer(), log_name_addr(), log_nametypeclass(), log_query_in(), log_reply_info(), log_rpz_apply(), log_rrlist_position(), lz_enter_zone_dname(), lz_inform_print(), print_neg_cache(), processLastResort(), processQueryTargets(), query_for_targets(), rate_list(), respip_rewrite_reply(), reuse_move_writewait_away(), rpz_callback_from_iterator_cname(), rpz_callback_from_worker_request(), rpz_insert_response_ip_trigger(), rpz_insert_rr(), serviced_perturb_qname(), ssl_print_name_dp(), test_long_names(), val_init(), worker_handle_request(), xfr_probe_lookup_host(), xfr_probe_send_or_end(), xfr_probe_send_probe(), xfr_process_chunk_list(), xfr_set_timeout(), xfr_transfer_init_fetch(), xfr_transfer_lookup_host(), xfr_transfer_nexttarget_or_end(), xfr_write_after_update(), zonemd_generate_test(), and zonemd_lookup_dnskey().
| int dname_strict_subdomain | ( | uint8_t * | d1, |
| int | labs1, | ||
| uint8_t * | d2, | ||
| int | labs2 | ||
| ) |
See if domain name d1 is a strict subdomain of d2.
That is a subdomain, but not equal.
| d1 | domain name, uncompressed wireformat |
| labs1 | number of labels in d1, including root label. |
| d2 | domain name, uncompressed wireformat |
| labs2 | number of labels in d2, including root label. |
References dname_lab_cmp().
Referenced by az_nsec3_get_nextcloser(), dname_strict_subdomain_c(), dname_test_strict_subdomain(), hints_lookup_stub(), is_terminal(), iter_msg_from_zone(), iter_stub_fwd_no_cache(), and set_kiddo_parents().
| int dname_strict_subdomain_c | ( | uint8_t * | d1, |
| uint8_t * | d2 | ||
| ) |
Like dname_strict_subdomain but counts labels.
| d1 | domain name, uncompressed wireformat |
| d2 | domain name, uncompressed wireformat |
References dname_count_labels(), and dname_strict_subdomain().
Referenced by az_empty_nonterminal(), cname_under_previous_dname(), handle_cname_response(), nsec_proves_nodata(), pkt_strict_sub(), processInit(), processQueryResponse(), response_type_from_server(), val_find_signer(), val_nsec_proves_insecuredelegation(), val_nsec_proves_name_error(), and validate_msg_signatures().
| int dname_subdomain_c | ( | uint8_t * | d1, |
| uint8_t * | d2 | ||
| ) |
Counts labels.
Tests if d1 is a subdomain of d2.
| d1 | domain name, uncompressed wireformat |
| d2 | domain name, uncompressed wireformat |
References dname_count_labels(), and dname_lab_cmp().
Referenced by auth_zone_delegpt(), az_find_wildcard(), dname_test_subdomain(), dns_cache_lookup(), dnskey_verify_rrset_sig(), filter_init(), follow_cname_chain(), generate_parentside_target_query(), iter_dp_is_useless(), iter_ds_toolow(), iter_scrub_ds(), nsec3_find_closest_encloser(), nsec_proves_nodata(), pkt_sub(), processDSNSFind(), processFindKey(), processInit(), processInitRequest2(), processQueryResponse(), processQueryTargets(), response_type_from_server(), rpz_dname_to_trigger(), rpz_insert_rr(), rpz_remove_rr(), rpz_rr_to_action(), sub_of_pkt(), sum_subtree_inuse(), sum_zone_subtree_inuse(), val_find_best_signer(), val_mark_insecure(), val_neg_addreferral(), val_neg_addreply(), val_neg_getmsg(), val_nsec_proves_insecuredelegation(), val_nsec_proves_name_error(), wipeout(), zone_del_kcache(), zone_del_msg(), zone_del_rrset(), and zonemd_simple_domain().
| int dname_is_root | ( | uint8_t * | dname | ) |
Returns true if the uncompressed wireformat dname is the root ".".
| dname | the dname to check |
References LABEL_IS_PTR, and log_assert.
Referenced by auth_zones_find_zone(), calc_data_need(), calc_zone_need(), can_have_last_resort(), check_data(), check_zone_invariants(), del_empty_term(), dname_test_isroot(), dns_cache_lookup(), filter_init(), forward_request(), key_cache_obtain(), local_zones_tags_lookup(), name_tree_next_root(), nsec3_do_prove_nodata(), nsec_proves_nodata(), processInitRequest(), processInitRequest2(), and processLastResort().
| void dname_remove_label | ( | uint8_t ** | dname, |
| size_t * | len | ||
| ) |
Snip off first label from a dname, returning the parent zone.
| dname | from what to strip off. uncompressed wireformat. |
| len | length, adjusted to become less. return dname stripped off, or "." if input was ".". |
References LABEL_IS_PTR, and log_assert.
Referenced by auth_zones_downstream_answer(), auth_zones_find_zone(), calc_data_need(), calc_zone_need(), del_empty_term(), dname_remove_labels(), dname_test_removelabel(), dns_cache_lookup(), filter_init(), filter_next(), forward_request(), insert_can_owner(), key_cache_obtain(), local_zones_tags_lookup(), lz_find_create_node(), neg_data_chain(), neg_find_nsec3_ce(), neg_zone_chain(), nsec3_find_closest_encloser(), nsec3_get_nextowner_b32(), nsec_proves_nodata(), processDSNSFind(), processInit(), processInitRequest(), processInitRequest2(), and val_neg_getmsg().
| int dname_remove_label_limit_len | ( | uint8_t ** | dname, |
| size_t * | len, | ||
| size_t | lenlimit | ||
| ) |
Same as dname_remove_label but fails if removal would surpass lenlimit.
If no failure, snip off first label from a dname, returning the parent zone.
| dname | from what to strip off. uncompressed wireformat. |
| len | length, adjusted to become less. |
| lenlimit | length limit that we can't surpass (usually the zone apex). |
References LABEL_IS_PTR, and log_assert.
Referenced by az_domain_go_up(), az_find_candidate_ce(), az_find_nsec_cover(), az_find_wildcard(), az_generate_wildcard_answer(), az_nsec3_find_ce(), and dname_test_removelabellimitlen().
| void dname_remove_labels | ( | uint8_t ** | dname, |
| size_t * | len, | ||
| int | n | ||
| ) |
Snip off first N labels from a dname, returning the parent zone.
| dname | from what to strip off. uncompressed wireformat. |
| len | length, adjusted to become less. |
| n | number of labels to strip off (from the left). if 0, nothing happens. return stripped off, or "." if input was ".". |
References dname_remove_label().
Referenced by az_nsec3_get_nextcloser(), dname_get_shared_topdomain(), lz_setup_implicit(), next_closer(), processFindKey(), processQueryTargets(), val_nsec_proves_no_wc(), and val_rrset_wildcard().
| int dname_signame_label_count | ( | uint8_t * | dname | ) |
Count labels for the RRSIG signature label field.
Like a normal labelcount, but "*" wildcard and "." root are not counted.
| dname | valid uncompressed wireformat. |
Referenced by dname_test_sigcount(), dnskey_verify_rrset_sig(), and insert_can_owner().
| int dname_is_wild | ( | uint8_t * | dname | ) |
Return true if the label is a wildcard, *.example.com.
| dname | valid uncompressed wireformat. |
Referenced by dname_test_iswild(), local_data_answer(), nsec_proves_nodata(), val_nsec_prove_nodata_dsreply(), and val_rrset_wildcard().
|
static |
Compare labels in memory, lowercase while comparing.
Returns canonical order for labels. If all is equal, the shortest is first.
| p1 | label 1 |
| len1 | length of label 1. |
| p2 | label 2 |
| len2 | length of label 2. |
References memlowercmp().
Referenced by dname_canon_lab_cmp().
| int dname_canon_lab_cmp | ( | uint8_t * | d1, |
| int | labs1, | ||
| uint8_t * | d2, | ||
| int | labs2, | ||
| int * | mlabs | ||
| ) |
Compare dnames, Canonical in rfc4034 sense, but by label.
Such that zone contents follows zone apex.
| d1 | first dname. pointer to uncompressed wireformat. |
| labs1 | number of labels in first dname. |
| d2 | second dname. pointer to uncompressed wireformat. |
| labs2 | number of labels in second dname. |
| mlabs | number of labels that matched exactly (the shared topdomain). |
References log_assert, and memcanoncmp().
Referenced by auth_data_cmp(), dname_canonical_compare(), local_data_cmp(), val_neg_data_compare(), val_neg_zone_compare(), and wipeout().
| int dname_canonical_compare | ( | uint8_t * | d1, |
| uint8_t * | d2 | ||
| ) |
Canonical dname compare.
Takes care of counting labels. Per rfc 4034 canonical order.
| d1 | first dname. pointer to uncompressed wireformat. |
| d2 | second dname. pointer to uncompressed wireformat. |
References dname_canon_lab_cmp(), and dname_count_labels().
Referenced by dname_test_canoncmp(), nsec_proves_nodata(), processQueryTargets(), rrset_canonical_sort_cmp(), and val_nsec_proves_name_error().
| uint8_t * dname_get_shared_topdomain | ( | uint8_t * | d1, |
| uint8_t * | d2 | ||
| ) |
Get the shared topdomain between two names.
Root "." or longer.
| d1 | first dname. pointer to uncompressed wireformat. |
| d2 | second dname. pointer to uncompressed wireformat. |
References dname_count_labels(), dname_lab_cmp(), dname_remove_labels(), and LDNS_MAX_DOMAINLEN.
Referenced by auth_zones_find_zone(), az_find_candidate_ce(), dname_test_topdomain(), nsec_closest_encloser(), and rpz_find_zone().