1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

Revert "resolve: mDNS transaction max attempts fix"

This reverts commit 127b26f3d8.

The commit made mDNS queries quite unstable.
Note that, RFC 6762 does not explicitly prohibit to send a request
multiple times.
This commit is contained in:
Yu Watanabe 2022-07-04 05:24:52 +09:00
parent d50a58e725
commit c3dbb13288
2 changed files with 8 additions and 28 deletions

View File

@ -1622,7 +1622,7 @@ static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
return 0; return 0;
} }
if (t->n_attempts >= dns_transaction_attempts_max(t->scope->protocol, t->probing)) { if (t->n_attempts >= TRANSACTION_ATTEMPTS_MAX(t->scope->protocol)) {
DnsTransactionState result; DnsTransactionState result;
if (t->scope->protocol == DNS_PROTOCOL_LLMNR) if (t->scope->protocol == DNS_PROTOCOL_LLMNR)

View File

@ -214,31 +214,11 @@ DnsTransactionSource dns_transaction_source_from_string(const char *s) _pure_;
/* Maximum attempts to send LLMNR requests, see RFC 4795 Section 2.7 */ /* Maximum attempts to send LLMNR requests, see RFC 4795 Section 2.7 */
#define LLMNR_TRANSACTION_ATTEMPTS_MAX 3 #define LLMNR_TRANSACTION_ATTEMPTS_MAX 3
/* Maximum attempts to send MDNS requests is one except for probe requests, see RFC 6762 Section 8.1 /* Maximum attempts to send MDNS requests, see RFC 6762 Section 8.1 */
* RFC 6762 differentiates between normal (single-shot/continuous) and probe requests. #define MDNS_TRANSACTION_ATTEMPTS_MAX 3
* It therefore makes sense to attempt each normal query only once with no retries.
* Otherwise we'd be sending out three attempts for even a normal query. */
#define MDNS_TRANSACTION_ATTEMPTS_MAX 1
#define MDNS_PROBE_TRANSACTION_ATTEMPTS_MAX 3 #define TRANSACTION_ATTEMPTS_MAX(p) (((p) == DNS_PROTOCOL_LLMNR) ? \
LLMNR_TRANSACTION_ATTEMPTS_MAX : \
static inline unsigned dns_transaction_attempts_max(DnsProtocol p, bool probing) { (((p) == DNS_PROTOCOL_MDNS) ? \
MDNS_TRANSACTION_ATTEMPTS_MAX : \
switch (p) { DNS_TRANSACTION_ATTEMPTS_MAX))
case DNS_PROTOCOL_LLMNR:
return LLMNR_TRANSACTION_ATTEMPTS_MAX;
case DNS_PROTOCOL_MDNS:
if (probing)
return MDNS_PROBE_TRANSACTION_ATTEMPTS_MAX;
else
return MDNS_TRANSACTION_ATTEMPTS_MAX;
case DNS_PROTOCOL_DNS:
return DNS_TRANSACTION_ATTEMPTS_MAX;
default:
return 0;
}
}