summaryrefslogtreecommitdiff
path: root/util/data/msgreply.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/data/msgreply.c')
-rw-r--r--util/data/msgreply.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/util/data/msgreply.c b/util/data/msgreply.c
index ae2fe02b6d7c..e25b42cc257a 100644
--- a/util/data/msgreply.c
+++ b/util/data/msgreply.c
@@ -631,9 +631,14 @@ query_info_entrysetup(struct query_info* q, struct reply_info* r,
e->entry.key = e;
e->entry.data = r;
lock_rw_init(&e->entry.lock);
- lock_protect(&e->entry.lock, &e->key, sizeof(e->key));
- lock_protect(&e->entry.lock, &e->entry.hash, sizeof(e->entry.hash) +
- sizeof(e->entry.key) + sizeof(e->entry.data));
+ lock_protect(&e->entry.lock, &e->key.qname, sizeof(e->key.qname));
+ lock_protect(&e->entry.lock, &e->key.qname_len, sizeof(e->key.qname_len));
+ lock_protect(&e->entry.lock, &e->key.qtype, sizeof(e->key.qtype));
+ lock_protect(&e->entry.lock, &e->key.qclass, sizeof(e->key.qclass));
+ lock_protect(&e->entry.lock, &e->key.local_alias, sizeof(e->key.local_alias));
+ lock_protect(&e->entry.lock, &e->entry.hash, sizeof(e->entry.hash));
+ lock_protect(&e->entry.lock, &e->entry.key, sizeof(e->entry.key));
+ lock_protect(&e->entry.lock, &e->entry.data, sizeof(e->entry.data));
lock_protect(&e->entry.lock, e->key.qname, e->key.qname_len);
q->qname = NULL;
return e;
@@ -896,6 +901,25 @@ reply_all_rrsets_secure(struct reply_info* rep)
return 1;
}
+struct reply_info*
+parse_reply_in_temp_region(sldns_buffer* pkt, struct regional* region,
+ struct query_info* qi)
+{
+ struct reply_info* rep;
+ struct msg_parse* msg;
+ if(!(msg = regional_alloc(region, sizeof(*msg)))) {
+ return NULL;
+ }
+ memset(msg, 0, sizeof(*msg));
+ sldns_buffer_set_position(pkt, 0);
+ if(parse_packet(pkt, msg, region) != 0)
+ return 0;
+ if(!parse_create_msg(pkt, msg, NULL, qi, &rep, region)) {
+ return 0;
+ }
+ return rep;
+}
+
int edns_opt_append(struct edns_data* edns, struct regional* region,
uint16_t code, size_t len, uint8_t* data)
{