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

Willem Toorop willem at nlnetlabs.nl
Thu Apr 6 07:06:33 UTC 2017

Op 04-04-17 om 19:03 schreef Jan Včelák:
> 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.

Hi Jan, I'll take pull requests via github.  That is actually slightly
easier than applying mailbox patches for me too.

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

Yes, something went wrong with the move to a new gitlab instance.  They
should be back now.

> 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++?

Yes that seems more stable than what we have now.  Use of stdbool.h in a
library is regrettable really.  We have had problems before where the
type of bool differed during library compile time and library usage.
Maybe a more stable but still backwards compatible behavioural mechanism
would be to define a DONT_HAVE_STDBOOL_H when the header was not
detected during configure..., I'll try to think of something for you to

> 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
> solution?

Yes, I am conservative to the extreme with changing behaviour with ldns,
sorry.  I suggest to update the documentation to make it more clear, and
add another getter/setter that only changes the Z bits.

-- Willem

> [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
> Regards,
> Jan
> _______________________________________________
> ldns-users mailing list
> ldns-users at nlnetlabs.nl
> https://open.nlnetlabs.nl/mailman/listinfo/ldns-users

More information about the ldns-users mailing list