diff options
author | Tom Gundersen <teg@jklm.no> | 2015-07-06 16:48:24 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-11-27 01:35:47 +0100 |
commit | d74fb368b18f0fbd9a4fe6f15691bbea7f3c4a01 (patch) | |
tree | d7f2e66d4b67420d6c9bd0dfd399492254b4fd14 /src/resolve/resolved-dns-scope.c | |
parent | 7586f4d172dd9c3ccc3126fc47dca9e49adec132 (diff) |
resolved: announce support for large UDP packets
This is often needed for proper DNSSEC support, and even to handle AAAA records
without falling back to TCP.
If the path between the client and server is fully compliant, this should always
work, however, that is not the case, and overlarge packets will get mysteriously
lost in some cases.
For that reason, we use a similar fallback mechanism as we do for palin EDNS0,
EDNS0+DO, etc.:
The large UDP size feature is different from the other supported feature, as we
cannot simply verify that it works based on receiving a reply (as the server
will usually send us much smaller packets than what we claim to support, so
simply receiving a reply does not mean much).
For that reason, we keep track of the largest UDP packet we ever received, as this
is the smallest known good size (defaulting to the standard 512 bytes). If
announcing the default large size of 4096 fails (in the same way as the other
features), we fall back to the known good size. The same logic of retrying after a
grace-period applies.
Diffstat (limited to 'src/resolve/resolved-dns-scope.c')
-rw-r--r-- | src/resolve/resolved-dns-scope.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 80070da2b9..09e6872d26 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -186,10 +186,16 @@ int dns_scope_emit(DnsScope *s, int fd, DnsServer *server, DnsPacket *p) { if (server->possible_features >= DNS_SERVER_FEATURE_LEVEL_EDNS0) { bool edns_do; + size_t packet_size; edns_do = server->possible_features >= DNS_SERVER_FEATURE_LEVEL_DO; - r = dns_packet_append_opt_rr(p, DNS_PACKET_UNICAST_SIZE_MAX, edns_do, &saved_size); + if (server->possible_features >= DNS_SERVER_FEATURE_LEVEL_LARGE) + packet_size = DNS_PACKET_UNICAST_SIZE_LARGE_MAX; + else + packet_size = server->received_udp_packet_max; + + r = dns_packet_append_opt_rr(p, packet_size, edns_do, &saved_size); if (r < 0) return r; |