[ldns-users] case sensitive (should be case insensitive) dname comparison in ldns_pkt_rr_list_by_name and ldns_pkt_rr_list_by_name_and_type

Johannes Naab jn at stusta.de
Wed Nov 13 19:21:19 UTC 2013


Hi,

the ldns_pkt_rr_list_by_name and ldns_pkt_rr_list_by_name_and_type
compare their names with ldns_rdf_compare, and thus are case sensitive
with respect to the owner names.

While DNS should in general preserve the case of the domain names,
domain name comparisons should be done in a case insensitive manner (RFC
1034 Section 3.1, RFC 4343).

Is the current behavior (case sensitive comparison) of
ldns_pkt_rr_list_by_name intended?

My current use case:
There are (unfortunately) some DNS Servers, which do not follow the case
preservation recommendation, but I still want to extract the relevant
information in a somewhat efficient manner.

One of such DNS providers appears to be dnspod.net. Even so the original
query is all upper case, the answer names (both in question and answer
section) are lower case.
If I use the original (upper case) query name, ldns fails to extract the
resource records. (The only way around this is to iterate over the
rr_list, and compare each owner with the original query name. This is
exactly what I tried to avoid in the first place, since I use pyLDNS).

Replacing ldns_rdf_compare with ldns_dname_compare in the two functions
seems to work for me, however I'm not sure how to properly check the rdf
type, and what other implications this change might have.

% drill @f2y1dns1.dnspod.net. DNSPOD.NET. NS
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 13558
;; flags: qr aa rd ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; dnspod.net.	IN	NS

;; ANSWER SECTION:
dnspod.net.	172800	IN	NS	f2y1dns1.dnspod.net.
dnspod.net.	172800	IN	NS	f2y1dns2.dnspod.net.

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 386 msec
;; SERVER: 221.204.186.8
;; WHEN: Wed Nov 13 20:10:50 2013
;; MSG SIZE  rcvd: 94

Johannes

-- 



More information about the ldns-users mailing list