-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Serve stale #159
Conversation
- Add missing account for expired_responses.
- Added respip/cname_alias/rpz logic to serve stale.
/* 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))) |
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.
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.
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.
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)) { |
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.
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).
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.
Fixed in 2a6274a
util/config_file.h
Outdated
/** 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 */ |
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.
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.
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.
Fixed in 479b4c6
* qstate: the query state. | ||
* lookup_qinfo: the qinfo to lookup for. | ||
*/ | ||
typedef struct dns_msg* serve_expired_lookup_func_type( |
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.
It would be nice to have a fptr_wlist item for this func_type to check for the possible allowed values.
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.
Fixed in ea29698
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.
Looks good! Thanks for looking into the zero TTL case.
No description provided.