[ldns-users] ldns_rr_list_sort() sorts by which criterion?

Lars Rohwedder roker at pep-project.org
Tue Aug 8 18:06:45 UTC 2017

> Since the MX 'PREFERENCE' field is stored at the beginning of the record
> data as a 16-bit big endian integer, the most preferred (lowest) values
> will be at the beginning of the list. But even if the RRs are sorted
> correctly for SMTP purposes, you still need to randomize among MX
> records with the same PREFERENCE, if you are going to make an SMTP
> connection. (RFC 5321 says "MUST randomize".)

Okay, so for MX and SRV records this ordering would work but is
sub-optimal, because it would work but violates the RFC.

Is there a function in LDNS library that does that "pick one at random"
from an RR List or do I have to write my own (and parse all the RR
members first and all that nasty PITA stuff)? :-o


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20170808/d27303ca/attachment.bin>

More information about the ldns-users mailing list