Draft: resolver,api: tweak logic for AD bit and set AA if all RRsets have rank KR_RANK_AUTH.
AD: my understanding is that RFC 4035, section 3.2.3, mandates non-empty Answer or Authority section to set the AD bit in responses.
AA: by using logic similar to that for the AD bit, AA bit in responses is set in resolver's answer_finalize if all RRsets are non-secure (so no AD bit) and have rank KR_RANK_AUTH.
KR_RANK_AUTH is safe enough because in current code it is never set alone.
If a RRset has only KR_RANK_AUTH, it indicates that an authoritative response is wanted.
Can add and use another flag if desired, but I'd prefer not to.
Merge request reports
Activity
I completely fail to see why the _AUTH rank should imply AA=1 flag, nor the algorithm proposed.
AA=1 means that the server sending the answer is an authoritative server for the first record in ANSWER section.
Knot Resolver can do this for data generated locally (e.g. the
local-data:
part of config). For others it doesn't make sense to me.Thanks for your review. You made me think and I've reworked almost everything.
Algorithm: it was a deliberate choice for it to be extremely defensive and check everything everywhere. But you are right, it was exaggerated.
Flag: I choose _AUTH because I noticed it is always paired with another flag, so felt like setting only _AUTH, with no other flag, would be safe. In my tests I didn't get AA for anything that wasn't local data, but I may have missed some case. Btw, I have added a different flag.
I'd appreciate if you could re-review the fixup commits.
375 375 VERBOSE_MSG(last, "insecure because of opt-out\n"); 376 376 secure = false; /* the last answer is insecure due to opt-out */ 377 377 } 378 if (!request->answ_selected.len && !request->auth_selected.len) { 379 /* RFC 4035, section 3.2.3 mandates non-empty Answer or Authority. */ 380 secure = false; 381 } changed this line in version 2 of the diff
Thanks, addressed in
the fixup commits as well.No, it seems I've squashed it already into the original commit.Edited by menakite
added 40 commits
-
0f062dbc...ae7b3e6c - 33 commits from branch
knot:master
- 4372e7be - resolver: don't set AD if both Answer and Authority are empty.
- fabfdc03 - resolver,api: set AA bit if all RRsets have (only) rank KR_RANK_AUTH.
- 14c1e33a - resolver: update documentation for flag KR_RANK_AUTH.
- afaf6776 - fixup! resolver,api: set AA bit if all RRsets have (only) rank KR_RANK_AUTH.
- 30fa447d - fixup! resolver,api: set AA bit if all RRsets have (only) rank KR_RANK_AUTH.
- d98e1414 - fixup! resolver,api: set AA bit if all RRsets have (only) rank KR_RANK_AUTH.
- 3b812768 - fixup! resolver: update documentation for flag KR_RANK_AUTH.
Toggle commit list-
0f062dbc...ae7b3e6c - 33 commits from branch
65 65 66 66 bool kr_rank_test(uint8_t rank, uint8_t kr_flag) 67 67 { 68 68 if (kr_fails_assert(kr_rank_check(rank) && kr_rank_check(kr_flag))) - Comment on lines +50 to 68
This is just to avoid the assert in line 68.
Edited by menakite There's a comment that we can't add more bits than we have now
/* @note Rank must not exceed 6 bits */
I think this comment doesn't hold anymore, but it's not easy to be sure, as rank is handled on many places.
Edited by Vladimír Čunát
added 1 commit
- 7444519d - fixup! resolver,api: set AA bit if all RRsets have (only) rank KR_RANK_AUTH.