Check TTL in known-answers list and only reply if it's less than half.
This ensures we still update responders that do not remove records that are about to expire (with less than half of the actual TTL).
This commit is contained in:
parent
c821cdcbe4
commit
ac1908875b
4
mdnsd.c
4
mdnsd.c
@ -280,8 +280,10 @@ static int process_mdns_pkt(struct mdnsd *svr, struct mdns_pkt *pkt, struct mdns
|
||||
struct rr_list *ans = NULL, *prev_ans = NULL;
|
||||
for (ans = reply->rr_ans; ans; ) {
|
||||
struct rr_list *next_ans = ans->next;
|
||||
struct rr_entry *known_ans = rr_entry_match(pkt->rr_ans, ans->e);
|
||||
|
||||
if (rr_entry_match(pkt->rr_ans, ans->e)) {
|
||||
// discard answers that have at least half of the actual TTL
|
||||
if (known_ans != NULL && known_ans->ttl >= ans->e->ttl / 2) {
|
||||
char *namestr = nlabel_to_str(ans->e->name);
|
||||
DEBUG_PRINTF("removing answer for %s\n", namestr);
|
||||
free(namestr);
|
||||
|
Loading…
Reference in New Issue
Block a user