edns.udp_size = EDNS_ADVERTISED_SIZE;
edns.bits &= EDNS_DO;
edns.opt_list = NULL;
+ EDNS_OPT_APPEND_EDE(&edns, worker->scratchpad,
+ LDNS_EDNS_EDE, "query with bad edns keepalive.");
verbose(VERB_ALGO, "query with bad edns keepalive.");
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
error_encode(c->buffer, LDNS_RCODE_FORMERR, &qinfo,
};
typedef enum sldns_enum_edns_option sldns_edns_option;
+enum sldns_enum_ede_code
+{
+ LDNS_EDE_OTHER = 0,
+ LDNS_EDE_UNSUPPORTED_DNSKEY_ALG = 1,
+ LDNS_EDE_UNSUPPORTED_DS_DIGEST = 2
+};
+typedef enum sldns_enum_ede_code sldns_ede_code;
+
#define LDNS_EDNS_MASK_DO_BIT 0x8000
/** TSIG and TKEY extended rcodes (16bit), 0-15 are the normal rcodes. */
int edns_opt_append(struct edns_data* edns, struct regional* region,
uint16_t code, size_t len, uint8_t* data);
+/**
+ * Append edns EDE option to edns options list
+ * @param EDNS: the edns data structure to append the edns option to.
+ * @param REGION: region to allocate the new edns option.
+ * @param CODE: the EDE code.
+ * @param TXT: Additional text for the option
+ */
+#define EDNS_OPT_APPEND_EDE(EDNS, REGION, CODE, TXT) \
+ do { \
+ struct { \
+ uint16_t code; \
+ char text[sizeof(TXT) - 1]; \
+ } ede = { htons(CODE), TXT }; \
+ edns_opt_append((EDNS), (REGION), LDNS_EDNS_EDE, \
+ sizeof(uint16_t) + sizeof(TXT) - 1, \
+ (void *)&ede); \
+ } while(0);
+
/**
* Append edns option to edns option list
* @param list: the edns option list to append the edns option to.