Commit a8a7b95b authored by Daniel Salzman's avatar Daniel Salzman

dnsproxy: keep original qname letter case

parent 579c8c00
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -19,6 +19,7 @@
#include "knot/conf/schema.h"
#include "knot/query/capture.h" // Forces static module!
#include "knot/query/requestor.h" // Forces static module!
#include "knot/nameserver/process_query.h" // Forces static module!
#define MOD_REMOTE "\x06""remote"
#define MOD_TIMEOUT "\x07""timeout"
......@@ -75,7 +76,8 @@ static knotd_state_t dnsproxy_fwd(knotd_state_t state, knot_pkt_t *pkt,
/* Capture layer context. */
const knot_layer_api_t *capture = query_capture_api();
struct capture_param capture_param = {
.sink = pkt
.sink = pkt,
.orig_qname = qdata->extra->orig_qname
};
/* Create a forwarding request. */
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -36,6 +36,15 @@ static int begin(knot_layer_t *ctx, void *module_param)
static int prepare_query(knot_layer_t *ctx, knot_pkt_t *pkt)
{
assert(pkt && ctx && ctx->data);
struct capture_param *param = ctx->data;
// Restore to original QNAME if requested.
if (param->orig_qname != NULL && param->orig_qname[0] != '\0') {
memcpy(pkt->wire + KNOT_WIRE_HEADER_SIZE,
param->orig_qname, pkt->qname_size);
}
return KNOT_STATE_CONSUME;
}
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -28,5 +28,6 @@ const knot_layer_api_t *query_capture_api(void);
* \brief Processing module parameters.
*/
struct capture_param {
knot_pkt_t *sink; /*!< Container for captured response. */
knot_pkt_t *sink; /*!< Container for captured response. */
uint8_t *orig_qname; /*!< Original query name (case sensitive). */
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment