o edns is added when DO bit is set by pkt2wire.
o size_t case in rdlen of nsec3 next owner name, for 255 long next
owner names.
o salt string2host from 5+len to 1+len. Fixes, some sort of typo?
o added NSEC3 keysigning types to the keysize calculation routine.
o added DO flag (set on returned message) and copy_query to returned
message options to ldns-testpackets.
ldns_pkt_set_ra(reply, true);
} else if(str_keyword(&parse, "AD")) {
ldns_pkt_set_ad(reply, true);
+ } else if(str_keyword(&parse, "DO")) {
+ ldns_pkt_set_edns_do(reply, true);
} else {
error("could not parse REPLY: '%s'", parse);
}
return;
if(str_keyword(&parse, "copy_id")) {
e->copy_id = true;
+ } else if(str_keyword(&parse, "copy_query")) {
+ e->copy_query = true;
} else if(str_keyword(&parse, "sleep=")) {
e->sleeptime = (unsigned int) strtol(parse, (char**)&parse, 10);
while(isspace(*parse))
e->match_transport = transport_any;
e->reply_list = NULL;
e->copy_id = false;
+ e->copy_query = false;
e->sleeptime = 0;
e->next = NULL;
return e;
/* copy & adjust packet */
if(match->copy_id)
ldns_pkt_set_id(answer_pkt, ldns_pkt_id(query_pkt));
+ if(match->copy_query) {
+ ldns_rr_list* list = ldns_pkt_get_section_clone(query_pkt,
+ LDNS_SECTION_QUESTION);
+ ldns_rr_list_deep_free(ldns_pkt_question(answer_pkt));
+ ldns_pkt_set_question(answer_pkt, list);
+ }
if(match->sleeptime > 0) {
verbose(3, "sleeping for %d seconds\n", match->sleeptime);
sleep(match->sleeptime);
(opcode) QUERY IQUERY STATUS NOTIFY UPDATE
(rcode) NOERROR FORMERR SERVFAIL NXDOMAIN NOTIMPL YXDOMAIN
YXRRSET NXRRSET NOTAUTH NOTZONE
- (flags) QR AA TC RD CD RA AD
+ (flags) QR AA TC RD CD RA AD DO
REPLY ...
; any additional actions to do.
; 'copy_id' copies the ID from the query to the answer.
ADJUST copy_id
+ ; 'copy_query' copies the query name, type and class to the answer.
+ ADJUST copy_query
; 'sleep=10' sleeps for 10 seconds before giving the answer (TCP is open)
ADJUST [sleep=<num>] ; sleep before giving any reply
ADJUST [packet_sleep=<num>] ; sleep before this packet in sequence
/** how to adjust the reply packet */
/** copy over the ID from the query into the answer */
bool copy_id;
+ /** copy the query nametypeclass from query into the answer */
+ bool copy_query;
/** in seconds */
unsigned int sleeptime;
ldns_pkt_edns(const ldns_pkt *pkt) {
return (ldns_pkt_edns_udp_size(pkt) > 0 ||
ldns_pkt_edns_extended_rcode(pkt) > 0 ||
- ldns_pkt_edns_data(pkt)
+ ldns_pkt_edns_data(pkt) ||
+ ldns_pkt_edns_do(pkt)
);
}
switch (alg) {
case LDNS_SIGN_DSA:
+ case LDNS_SIGN_DSA_NSEC3:
if (len > 0) {
t = keydata[0];
return (64 + t*8)*8;
break;
case LDNS_SIGN_RSAMD5:
case LDNS_SIGN_RSASHA1:
+ case LDNS_SIGN_RSASHA1_NSEC3:
if (len > 0) {
if (keydata[0] == 0) {
/* big exponent */
data = LDNS_XMALLOC(uint8_t, 1 + salt_length);
data[0] = salt_length;
memcpy(&data[1], salt, salt_length);
- *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, 5 + salt_length, data);
+ *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, 1 + salt_length, data);
LDNS_FREE(data);
- return LDNS_STATUS_OK;
+ return LDNS_STATUS_OK;
}
ldns_status
case LDNS_RDF_TYPE_B32_EXT:
case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER:
/* length is stored in first byte */
- cur_rdf_length = (uint8_t) wire[*pos] + 1;
+ cur_rdf_length = ((size_t) wire[*pos]) + 1;
break;
case LDNS_RDF_TYPE_APL:
case LDNS_RDF_TYPE_B64: