Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
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

Serve stale #159

Open
wants to merge 30 commits into
base: master
from
Open

Serve stale #159

wants to merge 30 commits into from

Conversation

@gthess
Copy link
Contributor

gthess commented Feb 3, 2020

No description provided.

@jedisct1

This comment has been minimized.

Copy link

jedisct1 commented on a48c3c7 Nov 24, 2019

What is the patent situation with this?

This comment has been minimized.

Copy link
Member

bjovereinder replied Nov 24, 2019

The IPR for this draft is published here: https://datatracker.ietf.org/ipr/search/?id=draft-ietf-dnsop-serve-stale&submit=draft

"Royalty-Free, Reasonable and Non-Discriminatory License to All Implementers"

@gthess gthess requested a review from wcawijngaards Feb 3, 2020
/* Check if we are allowed to return expired entries:
* - serve_expired needs to be set
* - if SERVE_EXPIRED_TTL is set make sure that the record is not older
* than that. */
if((time_t)expiry < *qstate->env->now &&
!qstate->env->cfg->serve_expired)
(!qstate->env->cfg->serve_expired ||
(SERVE_EXPIRED_TTL &&
*qstate->env->now - (time_t)expiry > SERVE_EXPIRED_TTL)))
Comment on lines +431 to +438

This comment has been minimized.

Copy link
@wcawijngaards

wcawijngaards Feb 3, 2020

Member

If time_t is unsigned, the now - expiry is going to be a large number, and thus give the wrong outcome. Perhaps rewrite to like now > constant + expiry that does not have the subtraction. Or add a test that now > expiry, that could actually be in the if statement at the start, but I am not sure all cases have it.

This comment has been minimized.

Copy link
@wcawijngaards

wcawijngaards Feb 3, 2020

Member

Actually, it is safe, in the cases of the if-statement (in those cases the subtraction has a positive outcome), but on its own it would not be.

}
if(rep->c->tcp_req_info) {
if(!tcp_req_info_add_meshstate(rep->c->tcp_req_info, mesh, s)) {
log_err("mesh_new_client: out of memory add tcpreqinfo");
goto servfail_mem;
}
}
/* add serve expired timer if required and not already there */
if(timeout && !mesh_serve_expired_init(s, timeout)) {

This comment has been minimized.

Copy link
@wcawijngaards

wcawijngaards Feb 3, 2020

Member

This exits the routine when out of memory, but does not print an error message. Also inside mesh_serve_expired_init there is no error message (eg. for the regional_alloc call).

This comment has been minimized.

Copy link
@gthess

gthess Feb 4, 2020

Author Contributor

Fixed in 2a6274a

/** TTL for the serve expired replies */
int serve_expired_reply_ttl;
/** serve expired entries only after trying to update the entries and this
* timeout is reached */

This comment has been minimized.

Copy link
@wcawijngaards

wcawijngaards Feb 3, 2020

Member

add in milliseconds. Also the serve_expired_reply_ttl and serve_expired_client_timeout do not have a recommended value shown (commented out) in doc/example.conf.in.

This comment has been minimized.

Copy link
@gthess

gthess Feb 4, 2020

Author Contributor

Fixed in 479b4c6

* qstate: the query state.
* lookup_qinfo: the qinfo to lookup for.
*/
typedef struct dns_msg* serve_expired_lookup_func_type(

This comment has been minimized.

Copy link
@wcawijngaards

wcawijngaards Feb 3, 2020

Member

It would be nice to have a fptr_wlist item for this func_type to check for the possible allowed values.

This comment has been minimized.

Copy link
@gthess

gthess Feb 4, 2020

Author Contributor

Fixed in ea29698

Copy link
Member

wcawijngaards left a comment

Looks good! Thanks for looking into the zero TTL case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.