summaryrefslogtreecommitdiff
path: root/rr.c
diff options
context:
space:
mode:
authorMatthijs Mekking <matje@NLnetLabs.nl>2009-10-13 14:46:24 +0200
committerMatthijs Mekking <matje@NLnetLabs.nl>2009-10-13 14:46:24 +0200
commitb33346b0005a3575f6760ccf97865ae4f69724f6 (patch)
tree043c0473d3952889309e94464199afac734f8356 /rr.c
parent5ef45193926c9f97daebe21bd2d79cb196a75df0 (diff)
downloadldns-b33346b0005a3575f6760ccf97865ae4f69724f6.tar.gz
fix rr_compare_no_rdata, so it does not sort in reverse order
Diffstat (limited to 'rr.c')
-rw-r--r--rr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/rr.c b/rr.c
index 3b1fe326..6ca23d48 100644
--- a/rr.c
+++ b/rr.c
@@ -1397,14 +1397,16 @@ ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2)
return 1;
}
+ /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */
if (ldns_rr_get_class(rr1) != ldns_rr_get_class(rr2)) {
- return ldns_rr_get_class(rr2) - ldns_rr_get_class(rr1);
+ return ldns_rr_get_class(rr1) - ldns_rr_get_class(rr2);
}
+ /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */
if (ldns_rr_get_type(rr1) != ldns_rr_get_type(rr2)) {
- return ldns_rr_get_type(rr2) - ldns_rr_get_type(rr1);
+ return ldns_rr_get_type(rr1) - ldns_rr_get_type(rr2);
}
-
+
/* offset is the owername length + ttl + type + class + rdlen == start of wire format rdata */
offset = ldns_rdf_size(ldns_rr_owner(rr1)) + 4 + 2 + 2 + 2;
/* if either record doesn't have any RDATA... */