-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcoap_dns: implement Max-Age-based TTL calculation #18443
gcoap_dns: implement Max-Age-based TTL calculation #18443
Conversation
Since this is still a draft, I might as well give my opinion on it. I further assume that the MAX_AGE option is to allow for CoAP caching - but the way this is specified now requires to modify the DNS message in a weird way - why calculate the sum and not mandate that MAX_AGE and DNS TTL must always match? Now you have some weird cross-layer dependency where neither of the two values are valid on their own. |
42617a6
to
6f18132
Compare
I further assume that the MAX_AGE option is to allow for CoAP caching
- but the way this is specified now requires to modify the DNS message
in a weird way - why calculate the sum and not mandate that MAX_AGE
and DNS TTL must always match?
A DNS response may contain multiple records with different TTLs. (Even
though I don't immediately see from this code how it's done in the
implementation here).
I think this is really error-prone. I suppose the original idea was to
just carry the DNS message verbatim over CoAP, but now this requires a
modification.
It is not modifying the message. It is accounting for the fact that what
is stated in the message will *still* be true for so-and-so-many seconds
to come (which is Max-Age's semantics), and make use of it.
|
Thank you for the clarification.
Sounds like the DNS message should be modified. |
The server will not get around manipulating the message. For DNS subscriptions e.g. a complete different message format is used, which is not intended to be used over other transports than DNS over TLS. However, since CoAP supports Observe, we actually want subscriptions. Additionally, the performance benefits of the solution implemented here are non-negligible: See also:
|
+ in the end we want to use the quite verbose wire format only as a fallback anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's weird, but apparently this is in the standard now.
There is no standard yet, just a draft. If that changes, we can always change it here too. |
i.e. you are also welcome to discuss this either on the core mailing list or in the dedicated GitHub repo |
Contribution description
This implements the TTL calculation algorithm that is described in Section 4.3.2 of the current draft.
Testing procedure
tests/gcoap_dns
should still compile. DNS caching itself is currently not implemented in tests, but the code should speak for itself.Issues/PRs references
None