mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
resolve: do not cache mDNS goodbye packet
Fixes #24842. (cherry picked from commita78049fc0e
) (cherry picked from commit140fee4627
)
This commit is contained in:
parent
d44dbdb682
commit
165b8f8853
@ -410,6 +410,7 @@ static void dns_cache_item_update_positive(
|
||||
|
||||
static int dns_cache_put_positive(
|
||||
DnsCache *c,
|
||||
DnsProtocol protocol,
|
||||
DnsResourceRecord *rr,
|
||||
DnsAnswer *answer,
|
||||
DnsPacket *full_packet,
|
||||
@ -471,6 +472,10 @@ static int dns_cache_put_positive(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do not cache mDNS goodbye packet. */
|
||||
if (protocol == DNS_PROTOCOL_MDNS && rr->ttl <= 1)
|
||||
return 0;
|
||||
|
||||
/* Otherwise, add the new RR */
|
||||
r = dns_cache_init(c);
|
||||
if (r < 0)
|
||||
@ -681,6 +686,7 @@ static bool rr_eligible(DnsResourceRecord *rr) {
|
||||
int dns_cache_put(
|
||||
DnsCache *c,
|
||||
DnsCacheMode cache_mode,
|
||||
DnsProtocol protocol,
|
||||
DnsResourceKey *key,
|
||||
int rcode,
|
||||
DnsAnswer *answer,
|
||||
@ -774,6 +780,7 @@ int dns_cache_put(
|
||||
|
||||
r = dns_cache_put_positive(
|
||||
c,
|
||||
protocol,
|
||||
item->rr,
|
||||
primary ? answer : NULL,
|
||||
primary ? full_packet : NULL,
|
||||
|
@ -26,6 +26,7 @@ void dns_cache_prune(DnsCache *c);
|
||||
int dns_cache_put(
|
||||
DnsCache *c,
|
||||
DnsCacheMode cache_mode,
|
||||
DnsProtocol protocol,
|
||||
DnsResourceKey *key,
|
||||
int rcode,
|
||||
DnsAnswer *answer,
|
||||
|
@ -821,6 +821,7 @@ static void dns_transaction_cache_answer(DnsTransaction *t) {
|
||||
|
||||
dns_cache_put(&t->scope->cache,
|
||||
t->scope->manager->enable_cache,
|
||||
t->scope->protocol,
|
||||
dns_transaction_key(t),
|
||||
t->answer_rcode,
|
||||
t->answer,
|
||||
|
@ -423,7 +423,19 @@ static int on_mdns_packet(sd_event_source *s, int fd, uint32_t revents, void *us
|
||||
}
|
||||
}
|
||||
|
||||
dns_cache_put(&scope->cache, scope->manager->enable_cache, NULL, DNS_PACKET_RCODE(p), p->answer, NULL, false, _DNSSEC_RESULT_INVALID, UINT32_MAX, p->family, &p->sender);
|
||||
dns_cache_put(
|
||||
&scope->cache,
|
||||
scope->manager->enable_cache,
|
||||
DNS_PROTOCOL_MDNS,
|
||||
NULL,
|
||||
DNS_PACKET_RCODE(p),
|
||||
p->answer,
|
||||
NULL,
|
||||
false,
|
||||
_DNSSEC_RESULT_INVALID,
|
||||
UINT32_MAX,
|
||||
p->family,
|
||||
&p->sender);
|
||||
|
||||
} else if (dns_packet_validate_query(p) > 0) {
|
||||
log_debug("Got mDNS query packet for id %u", DNS_PACKET_ID(p));
|
||||
|
Loading…
Reference in New Issue
Block a user