From: Vladimír Čunát Date: Tue, 23 Mar 2021 10:11:44 +0000 (+0100) Subject: lib/selection*: try to avoid TCP in STUB mode X-Git-Tag: v5.3.1~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a07a58f739dc48b85aa6ac1e61150ee3847ff4a1;p=thirdparty%2Fknot-resolver.git lib/selection*: try to avoid TCP in STUB mode The target of STUB might commonly not have good support for "advanced" features like TCP. --- diff --git a/NEWS b/NEWS index 839084d65..c8682aba5 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Knot Resolver 5.3.1 (2021-03-dd) Improvements ------------ - doh2: send HTTP error status codes (#618, !1102) +- policy.STUB: try to avoid TCP (compared to 5.3.0; !1155) Bugfixes -------- diff --git a/lib/selection_forward.c b/lib/selection_forward.c index 165aa53f4..6fa3d743a 100644 --- a/lib/selection_forward.c +++ b/lib/selection_forward.c @@ -86,6 +86,9 @@ void forward_choose_transport(struct kr_query *qry, * says nothing about the network RTT of said target, since * it is doing resolution upstream. */ (*transport)->timeout = FORWARDING_TIMEOUT; + /* Try to avoid TCP in STUB case. It seems better for common use cases. */ + if (qry->flags.STUB && !tcp && (*transport)->protocol == KR_TRANSPORT_TCP) + (*transport)->protocol = KR_TRANSPORT_UDP; /* We need to propagate this to flags since it's used in other * parts of the resolver (e.g. logging and stats). */ qry->flags.TCP = tcp;