summaryrefslogtreecommitdiffstats
path: root/lib/resolve.c
diff options
context:
space:
mode:
authorOto Šťáva <oto.stava@nic.cz>2022-02-07 14:56:33 +0100
committerVladimír Čunát <vladimir.cunat@nic.cz>2022-02-22 11:52:11 +0100
commitefb26841923ab29fff5e7bfdfe7699469e775c41 (patch)
treeb8ed2cdae92d5a48684f191c489063b745f9cb54 /lib/resolve.c
parentdaemon: correct PROXYv2 handling for TCP sessions (diff)
downloadknot-resolver-efb26841923ab29fff5e7bfdfe7699469e775c41.tar.xz
knot-resolver-efb26841923ab29fff5e7bfdfe7699469e775c41.zip
daemon: add PROXYv2 SSL TLV handling + minor refactoring
Diffstat (limited to 'lib/resolve.c')
-rw-r--r--lib/resolve.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/resolve.c b/lib/resolve.c
index 2a4e672e..e6157496 100644
--- a/lib/resolve.c
+++ b/lib/resolve.c
@@ -369,7 +369,7 @@ static int edns_create(knot_pkt_t *pkt, const struct kr_request *req)
wire_size += KR_COOKIE_OPT_MAX_LEN;
}
#endif /* ENABLE_COOKIES */
- if (req->qsource.flags.tls) {
+ if (req->qsource.flags.tls || req->qsource.comm_flags.tls) {
wire_size += edns_padding_option_size(req->ctx->tls_padding);
}
return knot_pkt_reserve(pkt, wire_size);
@@ -456,7 +456,7 @@ static int answer_padding(struct kr_request *request)
{
if (kr_fails_assert(request && request->answer && request->ctx))
return kr_error(EINVAL);
- if (!request->qsource.flags.tls) {
+ if (!request->qsource.flags.tls && !request->qsource.comm_flags.tls) {
/* Not meaningful to pad without encryption. */
return kr_ok();
}
@@ -741,9 +741,10 @@ knot_pkt_t *kr_request_ensure_answer(struct kr_request *request)
// Find answer_max: limit on DNS wire length.
uint16_t answer_max;
const struct kr_request_qsource_flags *qs_flags = &request->qsource.flags;
- if (kr_fails_assert((qs_flags->tls || qs_flags->http) ? qs_flags->tcp : true))
+ const struct kr_request_qsource_flags *qs_cflags = &request->qsource.comm_flags;
+ if (kr_fails_assert(!(qs_flags->tls || qs_cflags->tls || qs_cflags->http) || qs_flags->tcp))
goto fail;
- if (!request->qsource.addr || qs_flags->tcp) {
+ if (!request->qsource.addr || qs_flags->tcp || qs_cflags->tcp) {
// not on UDP
answer_max = KNOT_WIRE_MAX_PKTSIZE;
} else if (knot_pkt_has_edns(qs_pkt)) {