Commit 23669071 authored by Daniel Salzman's avatar Daniel Salzman

dnsproxy: don't append duplicate TSIG and EDNS in non-fallback mode

parent 7f3aa3f6
/* 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
......@@ -417,9 +417,10 @@ knot_rrset_t knotd_qdata_zone_apex_rrset(knotd_qdata_t *qdata, uint16_t type);
/*! General query processing states. */
typedef enum {
KNOTD_STATE_NOOP = 0, /*!< No response. */
KNOTD_STATE_DONE = 4, /*!< Finished. */
KNOTD_STATE_FAIL = 5, /*!< Error. */
KNOTD_STATE_NOOP = 0, /*!< No response. */
KNOTD_STATE_DONE = 4, /*!< Finished. */
KNOTD_STATE_FAIL = 5, /*!< Error. */
KNOTD_STATE_FINAL = 6, /*!< Finished and finalized (QNAME, EDNS, TSIG). */
} knotd_state_t;
/*! brief Internet query processing states. */
......
......@@ -116,7 +116,7 @@ static knotd_state_t dnsproxy_fwd(knotd_state_t state, knot_pkt_t *pkt,
knot_tsig_append(pkt->wire, &pkt->size, pkt->max_size, pkt->tsig_rr);
}
return KNOTD_STATE_DONE;
return (proxy->fallback ? KNOTD_STATE_DONE : KNOTD_STATE_FINAL);
}
int dnsproxy_load(knotd_mod_t *mod)
......
......@@ -547,6 +547,10 @@ finish:
/* Error processing. */
next_state = process_query_err(ctx, pkt);
break;
case KNOT_STATE_FINAL:
/* Just skipped postprocessing. */
next_state = KNOT_STATE_DONE;
break;
default:
set_rcode_to_packet(pkt, qdata);
}
......
/* 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
......@@ -32,7 +32,8 @@ typedef enum {
KNOT_STATE_PRODUCE, //!< Produce data.
KNOT_STATE_RESET, //!< Restart processing.
KNOT_STATE_DONE, //!< Finished.
KNOT_STATE_FAIL //!< Error.
KNOT_STATE_FAIL, //!< Error.
KNOT_STATE_FINAL, //!< Finished and finalized.
} knot_layer_state_t;
typedef struct knot_layer_api knot_layer_api_t;
......
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