mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-27 04:04:53 +02:00
- Fix to move msgparse_rrset_remove_rr code to util/msgparse.c.
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "util/regional.h"
|
||||
#include "util/rfc_1982.h"
|
||||
#include "util/edns.h"
|
||||
#include "util/net_help.h"
|
||||
#include "sldns/rrdef.h"
|
||||
#include "sldns/sbuffer.h"
|
||||
#include "sldns/parseutil.h"
|
||||
@@ -1306,3 +1307,27 @@ log_edns_opt_list(enum verbosity_value level, const char* info_str,
|
||||
}
|
||||
}
|
||||
|
||||
/** remove RR from msgparse RRset, return true if rrset is entirely bad */
|
||||
int
|
||||
msgparse_rrset_remove_rr(const char* str, sldns_buffer* pkt, struct rrset_parse* rrset,
|
||||
struct rr_parse* prev, struct rr_parse* rr, struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
{
|
||||
if(verbosity >= VERB_QUERY && rrset->dname_len <= LDNS_MAX_DOMAINLEN && str) {
|
||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
||||
dname_pkt_copy(pkt, buf, rrset->dname);
|
||||
if(addr)
|
||||
log_name_addr(VERB_QUERY, str, buf, addr, addrlen);
|
||||
else log_nametypeclass(VERB_QUERY, str, buf,
|
||||
rrset->type, ntohs(rrset->rrset_class));
|
||||
}
|
||||
if(prev)
|
||||
prev->next = rr->next;
|
||||
else rrset->rr_first = rr->next;
|
||||
if(rrset->rr_last == rr)
|
||||
rrset->rr_last = prev;
|
||||
rrset->rr_count --;
|
||||
rrset->size -= rr->size;
|
||||
/* rr struct still exists, but is unlinked, so that in the for loop
|
||||
* the rr->next works fine to continue. */
|
||||
return rrset->rr_count == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user