[ldns-users] redefinition of bool, overlap of Z and DO in EDNS

Jan Včelák jv at fcelda.cz
Tue Apr 4 17:03:14 UTC 2017

Hello ldns developers.

I have some more patches for ldns in queue. But first I want to make
sure that all the changes make sense and that I'm not making your job
difficult. Is the repository on GitHub [1] supported and open for pull
requests? It seems a bit behind the official one [2]. It's easier for
me to send contribution via pull request than via e-mail.

I also just noticed that all tags disappeared from the official
repository. Please, can you check?

We have been using ldns in C++ but hit the problem that ldns redefines
default bool type in common.h [3]. That breaks some constexpr
definitions which involve boolean types and follow that include. Ugly
workaround is to include ldns.h and then undefine true, false, and
bool. Does the code still make sense today? Can I just update the
macro conditions to include stdbool.h with C and do nothing with C++?

And the last thing: The ldns_pkt_set_edns_z() function clears the DO
flag. This looks intentional. But the only way to clear all but DO
flag in EDNS (if I want to use ldns API) is to read the DO flag, use
the function above the clear all flags, and set DO to its original
value. This is confusing as EDNS(0) RFC [4] shows Z and DO as separate
fields. I was thinking about changing getter/setter function for Z to
exclude DO flag. Does it make sense or do you suggest different

[1] https://github.com/NLnetLabs/ldns
[2] https://git.nlnetlabs.nl/ldns/
[3] https://github.com/NLnetLabs/ldns/blob/release-1.7.0/ldns/common.h.in#L40-L56
[4] https://tools.ietf.org/html/rfc6891#section-6.1.3



More information about the ldns-users mailing list