static void ask_forwarder_done(struct tevent_req *subreq);
static struct tevent_req *ask_forwarder_send(
+ struct dns_server *dns,
TALLOC_CTX *mem_ctx, struct tevent_context *ev,
const char *forwarder, struct dns_name_question *question)
{
struct tevent_req *req, *subreq;
struct ask_forwarder_state *state;
+ struct dns_res_rec *options;
struct dns_name_packet out_packet = { 0, };
DATA_BLOB out_blob;
enum ndr_err_code ndr_err;
+ WERROR werr;
req = tevent_req_create(mem_ctx, &state, struct ask_forwarder_state);
if (req == NULL) {
out_packet.qdcount = 1;
out_packet.questions = question;
+ werr = dns_generate_options(dns, state, &options);
+ if (!W_ERROR_IS_OK(werr)) {
+ tevent_req_werror(req, werr);
+ return tevent_req_post(req, ev);
+ }
+
+ out_packet.arcount = 1;
+ out_packet.additional = options;
+
ndr_err = ndr_push_struct_blob(
&out_blob, state, &out_packet,
(ndr_push_flags_fn_t)ndr_push_dns_name_packet);
in->questions[0].name));
subreq = ask_forwarder_send(
+ dns,
state, ev, lpcfg_dns_forwarder(dns->task->lp_ctx),
&in->questions[0]);
if (tevent_req_nomem(subreq, req)) {
struct dns_server_zone *zones;
struct dns_server_tkey_store *tkeys;
struct cli_credentials *server_credentials;
+ uint16_t max_payload;
};
struct dns_request_state {
TALLOC_CTX *mem_ctx,
const char *name,
struct ldb_dn **_dn);
+WERROR dns_generate_options(struct dns_server *dns,
+ TALLOC_CTX *mem_ctx,
+ struct dns_res_rec **options);
struct dns_server_tkey *dns_find_tkey(struct dns_server_tkey_store *store,
const char *name);
WERROR dns_verify_tsig(struct dns_server *dns,
*_dn = dn;
return WERR_OK;
}
+
+WERROR dns_generate_options(struct dns_server *dns,
+ TALLOC_CTX *mem_ctx,
+ struct dns_res_rec **options)
+{
+ struct dns_res_rec *o;
+
+ o = talloc_zero(mem_ctx, struct dns_res_rec);
+ if (o == NULL) {
+ return WERR_NOMEM;
+ }
+ o->name = '\0';
+ o->rr_type = DNS_QTYPE_OPT;
+ /* This is ugly, but RFC2671 wants the payload size in this field */
+ o->rr_class = (enum dns_qclass) dns->max_payload;
+ o->ttl = 0;
+ o->length = 0;
+
+ *options = o;
+ return WERR_OK;
+}