add asynchrony support to BIND 9 query plugins
Closes #2141 (closed)
See comments added to
query.h for a high level (and somewhat more detailed) description of the changes. Newly added unit tests to
query_test.c will also help understand how it works.
Some other notes:
- I've confirmed
- The first few commits (cc973537..c502bc53) are relatively trivial refactoring, on top of which the main changes are made. 1f11cf4b just extracts the recursion quota check without any change. Commit f1f2ae73 should also preserve the behavior (but the main change depends on it).
- As noted in
hooks.h, this implementation may not work well if multiple plugins are used at the same time. I have an idea to mititage this issue, but also as noted I suspect it would be already fragile to use multiple indendent plugins even without this MR's change anyway. So I chose not to make it unnecessarily more complicated. But if this can be a blocking issue I'll incrementally update the branch to address this point.
- In the added unit tests, I used BIND 9's assertion macro (
INSIST) instead of cmocka's macros like
assert_int_equal, since the latter often caused hangup on failure (I suspect it's due to referece leak but didn't fully figure it out). Now that all tests pass anyway, I don't mind changing it to cmokca's macros if this can be a blocking issue. This implementation shares
ns_client_t.fetchhandlewith normal DNS recursion, assuming !4124 (merged) will be eventually merged, at which point it should be safe since these two types of recursion shouldn't run at the same time.