mirror of
https://github.com/NLnetLabs/unbound.git
synced 2024-09-21 22:57:08 +00:00
Fix unit test to attach edns record.
git-svn-id: file:///svn/unbound/trunk@289 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
f3c0cd34d8
commit
c18d584466
@ -270,6 +270,7 @@ testpkt(ldns_buffer* pkt, struct alloc_cache* alloc, ldns_buffer* out,
|
||||
ret = reply_info_encode(&qi, rep, id, flags, out, timenow,
|
||||
region, 65535);
|
||||
unit_assert(ret != 0); /* udp packets should fit */
|
||||
attach_edns_record(out, &edns);
|
||||
if(vbmp) printf("inlen %u outlen %u\n",
|
||||
(unsigned)ldns_buffer_limit(pkt),
|
||||
(unsigned)ldns_buffer_limit(out));
|
||||
|
@ -1076,9 +1076,8 @@ calc_edns_field_size(struct edns_data* edns)
|
||||
return 1 + 2 + 2 + 4 + 2;
|
||||
}
|
||||
|
||||
/** append EDNS field as last record in packet */
|
||||
static void
|
||||
attach_edns_field(ldns_buffer* pkt, struct edns_data* edns)
|
||||
void
|
||||
attach_edns_record(ldns_buffer* pkt, struct edns_data* edns)
|
||||
{
|
||||
size_t len;
|
||||
if(!edns || !edns->edns_present)
|
||||
@ -1124,7 +1123,7 @@ reply_info_answer_encode(struct query_info* qinf, struct reply_info* rep,
|
||||
log_err("reply encode: out of memory");
|
||||
return 0;
|
||||
}
|
||||
attach_edns_field(pkt, edns);
|
||||
attach_edns_record(pkt, edns);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -298,4 +298,13 @@ int reply_info_encode(struct query_info* qinfo, struct reply_info* rep,
|
||||
struct msgreply_entry* query_info_entrysetup(struct query_info* q,
|
||||
struct reply_info* r, hashvalue_t h);
|
||||
|
||||
/**
|
||||
* Attach EDNS record to buffer. Buffer has complete packet. There must
|
||||
* be enough room left for the EDNS record.
|
||||
* @param pkt: packet added to.
|
||||
* @param edns: if NULL or present=0, nothing is added to the packet.
|
||||
*/
|
||||
void attach_edns_record(ldns_buffer* pkt, struct edns_data* edns);
|
||||
|
||||
|
||||
#endif /* UTIL_DATA_MSGREPLY_H */
|
||||
|
Loading…
Reference in New Issue
Block a user