summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2012-03-26 18:05:46 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2012-03-26 18:05:46 +0000
commitc155c55d3127aa7ea1798d4167bf35593ab5ad82 (patch)
tree352ebbdd95f72d3095f45641dd66a7958bdeba2f
parent4eabd8f63f2d931a9c5d375c0e773cb72ce7a1f6 (diff)
Import Unbound 1.4.16 to work on in-tree (not yet linked to the build).
These are the direct sources from NLnet Labs upstream, minus these: compat contrib libunbound/python pythonmod testcode testdata winrc ok deraadt@ jakob@
-rw-r--r--usr.sbin/unbound/daemon/daemon.h38
-rw-r--r--usr.sbin/unbound/iterator/iter_fwd.c266
-rw-r--r--usr.sbin/unbound/libunbound/context.h31
-rw-r--r--usr.sbin/unbound/libunbound/libworker.h95
-rw-r--r--usr.sbin/unbound/services/localzone.h38
-rw-r--r--usr.sbin/unbound/services/modstack.c31
-rw-r--r--usr.sbin/unbound/util/data/dname.c125
-rw-r--r--usr.sbin/unbound/util/data/msgparse.c276
-rw-r--r--usr.sbin/unbound/util/data/msgparse.h42
9 files changed, 429 insertions, 513 deletions
diff --git a/usr.sbin/unbound/daemon/daemon.h b/usr.sbin/unbound/daemon/daemon.h
index 86ddab1df73..8e47ea00b9e 100644
--- a/usr.sbin/unbound/daemon/daemon.h
+++ b/usr.sbin/unbound/daemon/daemon.h
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -59,11 +59,6 @@ struct local_zones;
struct ub_randstate;
struct daemon_remote;
-#include "dnstap/dnstap_config.h"
-#ifdef USE_DNSTAP
-struct dt_env;
-#endif
-
/**
* Structure holding worker list.
* Holds globally visible information.
@@ -77,13 +72,8 @@ struct daemon {
char* pidfile;
/** port number that has ports opened. */
int listening_port;
- /** array of listening ports, opened. Listening ports per worker,
- * or just one element[0] shared by the worker threads. */
- struct listen_port** ports;
- /** size of ports array */
- size_t num_ports;
- /** reuseport is enabled if true */
- int reuseport;
+ /** listening ports, opened, to be shared by threads */
+ struct listen_port* ports;
/** port number for remote that has ports opened. */
int rc_port;
/** listening ports for remote control */
@@ -114,10 +104,6 @@ struct daemon {
struct timeval time_last_stat;
/** time when daemon started */
struct timeval time_boot;
-#ifdef USE_DNSTAP
- /** the dnstap environment master value, copied and changed by threads*/
- struct dt_env* dtenv;
-#endif
};
/**
diff --git a/usr.sbin/unbound/iterator/iter_fwd.c b/usr.sbin/unbound/iterator/iter_fwd.c
index 0feee032c96..2df1f9c46f6 100644
--- a/usr.sbin/unbound/iterator/iter_fwd.c
+++ b/usr.sbin/unbound/iterator/iter_fwd.c
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -40,14 +40,16 @@
* Keep track of forward zones and config settings.
*/
#include "config.h"
+#include <ldns/rdata.h>
+#include <ldns/dname.h>
+#include <ldns/rr.h>
#include "iterator/iter_fwd.h"
#include "iterator/iter_delegpt.h"
+#include "util/regional.h"
#include "util/log.h"
#include "util/config_file.h"
#include "util/net_help.h"
#include "util/data/dname.h"
-#include "sldns/rrdef.h"
-#include "sldns/str2wire.h"
int
fwd_cmp(const void* k1, const void* k2)
@@ -71,36 +73,21 @@ forwards_create(void)
sizeof(struct iter_forwards));
if(!fwd)
return NULL;
+ fwd->region = regional_create();
+ if(!fwd->region) {
+ forwards_delete(fwd);
+ return NULL;
+ }
return fwd;
}
-static void fwd_zone_free(struct iter_forward_zone* n)
-{
- if(!n) return;
- delegpt_free_mlc(n->dp);
- free(n->name);
- free(n);
-}
-
-static void delfwdnode(rbnode_t* n, void* ATTR_UNUSED(arg))
-{
- struct iter_forward_zone* node = (struct iter_forward_zone*)n;
- fwd_zone_free(node);
-}
-
-static void fwd_del_tree(struct iter_forwards* fwd)
-{
- if(fwd->tree)
- traverse_postorder(fwd->tree, &delfwdnode, NULL);
- free(fwd->tree);
-}
-
void
forwards_delete(struct iter_forwards* fwd)
{
if(!fwd)
return;
- fwd_del_tree(fwd);
+ regional_destroy(fwd->region);
+ free(fwd->tree);
free(fwd);
}
@@ -109,30 +96,20 @@ static int
forwards_insert_data(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
size_t nmlen, int nmlabs, struct delegpt* dp)
{
- struct iter_forward_zone* node = (struct iter_forward_zone*)malloc(
+ struct iter_forward_zone* node = regional_alloc(fwd->region,
sizeof(struct iter_forward_zone));
- if(!node) {
- delegpt_free_mlc(dp);
+ if(!node)
return 0;
- }
node->node.key = node;
node->dclass = c;
- node->name = memdup(nm, nmlen);
- if(!node->name) {
- delegpt_free_mlc(dp);
- free(node);
+ node->name = regional_alloc_init(fwd->region, nm, nmlen);
+ if(!node->name)
return 0;
- }
node->namelen = nmlen;
node->namelabs = nmlabs;
node->dp = dp;
if(!rbtree_insert(fwd->tree, &node->node)) {
- char buf[257];
- dname_str(nm, buf);
- log_err("duplicate forward zone %s ignored.", buf);
- delegpt_free_mlc(dp);
- free(node->name);
- free(node);
+ log_err("duplicate forward zone ignored.");
}
return 1;
}
@@ -175,58 +152,58 @@ fwd_init_parents(struct iter_forwards* fwd)
}
/** set zone name */
-static struct delegpt*
-read_fwds_name(struct config_stub* s)
+static int
+read_fwds_name(struct iter_forwards* fwd, struct config_stub* s,
+ struct delegpt* dp)
{
- struct delegpt* dp;
- uint8_t* dname;
- size_t dname_len;
+ ldns_rdf* rdf;
if(!s->name) {
log_err("forward zone without a name (use name \".\" to forward everything)");
- return NULL;
+ return 0;
}
- dname = sldns_str2wire_dname(s->name, &dname_len);
- if(!dname) {
+ rdf = ldns_dname_new_frm_str(s->name);
+ if(!rdf) {
log_err("cannot parse forward zone name %s", s->name);
- return NULL;
+ return 0;
}
- if(!(dp=delegpt_create_mlc(dname))) {
- free(dname);
+ if(!delegpt_set_name(dp, fwd->region, ldns_rdf_data(rdf))) {
+ ldns_rdf_deep_free(rdf);
log_err("out of memory");
- return NULL;
+ return 0;
}
- free(dname);
- return dp;
+ ldns_rdf_deep_free(rdf);
+ return 1;
}
/** set fwd host names */
static int
-read_fwds_host(struct config_stub* s, struct delegpt* dp)
+read_fwds_host(struct iter_forwards* fwd, struct config_stub* s,
+ struct delegpt* dp)
{
struct config_strlist* p;
- uint8_t* dname;
- size_t dname_len;
+ ldns_rdf* rdf;
for(p = s->hosts; p; p = p->next) {
log_assert(p->str);
- dname = sldns_str2wire_dname(p->str, &dname_len);
- if(!dname) {
+ rdf = ldns_dname_new_frm_str(p->str);
+ if(!rdf) {
log_err("cannot parse forward %s server name: '%s'",
s->name, p->str);
return 0;
}
- if(!delegpt_add_ns_mlc(dp, dname, 0)) {
- free(dname);
+ if(!delegpt_add_ns(dp, fwd->region, ldns_rdf_data(rdf), 0)) {
+ ldns_rdf_deep_free(rdf);
log_err("out of memory");
return 0;
}
- free(dname);
+ ldns_rdf_deep_free(rdf);
}
return 1;
}
/** set fwd server addresses */
static int
-read_fwds_addr(struct config_stub* s, struct delegpt* dp)
+read_fwds_addr(struct iter_forwards* fwd, struct config_stub* s,
+ struct delegpt* dp)
{
struct config_strlist* p;
struct sockaddr_storage addr;
@@ -238,7 +215,7 @@ read_fwds_addr(struct config_stub* s, struct delegpt* dp)
s->name, p->str);
return 0;
}
- if(!delegpt_add_addr_mlc(dp, &addr, addrlen, 0, 0)) {
+ if(!delegpt_add_addr(dp, fwd->region, &addr, addrlen, 0, 0)) {
log_err("out of memory");
return 0;
}
@@ -252,38 +229,43 @@ read_forwards(struct iter_forwards* fwd, struct config_file* cfg)
{
struct config_stub* s;
for(s = cfg->forwards; s; s = s->next) {
- struct delegpt* dp;
- if(!(dp=read_fwds_name(s)))
- return 0;
- if(!read_fwds_host(s, dp) || !read_fwds_addr(s, dp)) {
- delegpt_free_mlc(dp);
+ struct delegpt* dp = delegpt_create(fwd->region);
+ if(!dp) {
+ log_err("out of memory");
return 0;
}
/* set flag that parent side NS information is included.
* Asking a (higher up) server on the internet is not useful */
- /* the flag is turned off for 'forward-first' so that the
- * last resort will ask for parent-side NS record and thus
- * fallback to the internet name servers on a failure */
- dp->has_parent_side_NS = (uint8_t)!s->isfirst;
- verbose(VERB_QUERY, "Forward zone server list:");
- delegpt_log(VERB_QUERY, dp);
+ dp->has_parent_side_NS = 1;
+ if(!read_fwds_name(fwd, s, dp) ||
+ !read_fwds_host(fwd, s, dp) ||
+ !read_fwds_addr(fwd, s, dp))
+ return 0;
if(!forwards_insert(fwd, LDNS_RR_CLASS_IN, dp))
return 0;
+ verbose(VERB_QUERY, "Forward zone server list:");
+ delegpt_log(VERB_QUERY, dp);
}
return 1;
}
-/** insert a stub hole (if necessary) for stub name */
+/** see if zone needs to have a hole inserted */
static int
-fwd_add_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
+need_hole_insert(rbtree_t* tree, struct iter_forward_zone* zone)
{
- struct iter_forward_zone key;
- key.node.key = &key;
- key.dclass = c;
- key.name = nm;
- key.namelabs = dname_count_size_labels(key.name, &key.namelen);
- return forwards_insert_data(fwd, key.dclass, key.name,
- key.namelen, key.namelabs, NULL);
+ struct iter_forward_zone k;
+ if(rbtree_search(tree, zone))
+ return 0; /* exact match exists */
+ k = *zone;
+ k.node.key = &k;
+ /* search up the tree */
+ do {
+ dname_remove_label(&k.name, &k.namelen);
+ k.namelabs --;
+ if(rbtree_search(tree, &k))
+ return 1; /* found an upper forward zone, need hole */
+ } while(k.namelabs > 1);
+ return 0; /* no forwards above, no holes needed */
}
/** make NULL entries for stubs */
@@ -291,20 +273,28 @@ static int
make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg)
{
struct config_stub* s;
- uint8_t* dname;
- size_t dname_len;
+ struct iter_forward_zone key;
+ key.node.key = &key;
+ key.dclass = LDNS_RR_CLASS_IN;
for(s = cfg->stubs; s; s = s->next) {
- dname = sldns_str2wire_dname(s->name, &dname_len);
- if(!dname) {
+ ldns_rdf* rdf = ldns_dname_new_frm_str(s->name);
+ if(!rdf) {
log_err("cannot parse stub name '%s'", s->name);
return 0;
}
- if(!fwd_add_stub_hole(fwd, LDNS_RR_CLASS_IN, dname)) {
- free(dname);
+ key.name = ldns_rdf_data(rdf);
+ key.namelabs = dname_count_size_labels(key.name, &key.namelen);
+ if(!need_hole_insert(fwd->tree, &key)) {
+ ldns_rdf_deep_free(rdf);
+ continue;
+ }
+ if(!forwards_insert_data(fwd, key.dclass, key.name,
+ key.namelen, key.namelabs, NULL)) {
+ ldns_rdf_deep_free(rdf);
log_err("out of memory");
return 0;
}
- free(dname);
+ ldns_rdf_deep_free(rdf);
}
return 1;
}
@@ -312,7 +302,8 @@ make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg)
int
forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
{
- fwd_del_tree(fwd);
+ free(fwd->tree);
+ regional_free_all(fwd->region);
fwd->tree = rbtree_create(fwd_cmp);
if(!fwd->tree)
return 0;
@@ -327,20 +318,6 @@ forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
}
struct delegpt*
-forwards_find(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
-{
- rbnode_t* res = NULL;
- struct iter_forward_zone key;
- key.node.key = &key;
- key.dclass = qclass;
- key.name = qname;
- key.namelabs = dname_count_size_labels(qname, &key.namelen);
- res = rbtree_search(fwd->tree, &key);
- if(res) return ((struct iter_forward_zone*)res)->dp;
- return NULL;
-}
-
-struct delegpt*
forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
{
/* lookup the forward zone in the tree */
@@ -434,36 +411,15 @@ forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass)
size_t
forwards_get_mem(struct iter_forwards* fwd)
{
- struct iter_forward_zone* p;
- size_t s;
if(!fwd)
return 0;
- s = sizeof(*fwd) + sizeof(*fwd->tree);
- RBTREE_FOR(p, struct iter_forward_zone*, fwd->tree) {
- s += sizeof(*p) + p->namelen + delegpt_get_mem(p->dp);
- }
- return s;
-}
-
-static struct iter_forward_zone*
-fwd_zone_find(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
-{
- struct iter_forward_zone key;
- key.node.key = &key;
- key.dclass = c;
- key.name = nm;
- key.namelabs = dname_count_size_labels(nm, &key.namelen);
- return (struct iter_forward_zone*)rbtree_search(fwd->tree, &key);
+ return sizeof(*fwd) + sizeof(*fwd->tree) +
+ regional_get_mem(fwd->region);
}
int
forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
{
- struct iter_forward_zone *z;
- if((z=fwd_zone_find(fwd, c, dp->name)) != NULL) {
- (void)rbtree_delete(fwd->tree, &z->node);
- fwd_zone_free(z);
- }
if(!forwards_insert(fwd, c, dp))
return 0;
fwd_init_parents(fwd);
@@ -473,34 +429,14 @@ forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
void
forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
{
- struct iter_forward_zone *z;
- if(!(z=fwd_zone_find(fwd, c, nm)))
- return; /* nothing to do */
- (void)rbtree_delete(fwd->tree, &z->node);
- fwd_zone_free(z);
- fwd_init_parents(fwd);
-}
-
-int
-forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
-{
- if(!fwd_add_stub_hole(fwd, c, nm)) {
- return 0;
- }
- fwd_init_parents(fwd);
- return 1;
-}
-
-void
-forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
-{
- struct iter_forward_zone *z;
- if(!(z=fwd_zone_find(fwd, c, nm)))
+ struct iter_forward_zone key;
+ key.node.key = &key;
+ key.dclass = c;
+ key.name = nm;
+ key.namelabs = dname_count_size_labels(nm, &key.namelen);
+ if(!rbtree_search(fwd->tree, &key))
return; /* nothing to do */
- if(z->dp != NULL)
- return; /* not a stub hole */
- (void)rbtree_delete(fwd->tree, &z->node);
- fwd_zone_free(z);
+ (void)rbtree_delete(fwd->tree, &key);
fwd_init_parents(fwd);
}
diff --git a/usr.sbin/unbound/libunbound/context.h b/usr.sbin/unbound/libunbound/context.h
index 31ca09c6db0..8898f3ebfdf 100644
--- a/usr.sbin/unbound/libunbound/context.h
+++ b/usr.sbin/unbound/libunbound/context.h
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -48,8 +48,6 @@
#include "util/data/packed_rrset.h"
struct libworker;
struct tube;
-struct sldns_buffer;
-struct event_base;
/**
* The context structure
@@ -113,11 +111,6 @@ struct ub_ctx {
/** random state used to seed new random state structures */
struct ub_randstate* seed_rnd;
- /** event base for event oriented interface */
- struct event_base* event_base;
- /** libworker for event based interface */
- struct libworker* event_worker;
-
/** next query number (to try) to use */
int next_querynum;
/** number of async queries outstanding */
@@ -241,7 +234,7 @@ void context_query_delete(struct ctx_query* q);
* @param cbarg: user arg for async queries.
* @return new ctx_query or NULL for malloc failure.
*/
-struct ctx_query* context_new(struct ub_ctx* ctx, const char* name, int rrtype,
+struct ctx_query* context_new(struct ub_ctx* ctx, char* name, int rrtype,
int rrclass, ub_callback_t cb, void* cbarg);
/**
@@ -282,7 +275,7 @@ uint8_t* context_serialize_new_query(struct ctx_query* q, uint32_t* len);
* @return: an alloc, or NULL on mem error.
*/
uint8_t* context_serialize_answer(struct ctx_query* q, int err,
- struct sldns_buffer* pkt, uint32_t* len);
+ ldns_buffer* pkt, uint32_t* len);
/**
* Serialize a query cancellation. Serializes query async id
diff --git a/usr.sbin/unbound/libunbound/libworker.h b/usr.sbin/unbound/libunbound/libworker.h
index 0103b5d8898..c3896fc5a82 100644
--- a/usr.sbin/unbound/libunbound/libworker.h
+++ b/usr.sbin/unbound/libunbound/libworker.h
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -41,8 +41,8 @@
* and if in the background continues until exit, if in the foreground
* returns from the procedure when done.
*/
-#ifndef LIBUNBOUND_LIBWORKER_H
-#define LIBUNBOUND_LIBWORKER_H
+#ifndef LIBUNBOUND_WORKER_H
+#define LIBUNBOUND_WORKER_H
#include "util/data/packed_rrset.h"
struct ub_ctx;
struct ub_result;
@@ -57,8 +57,6 @@ struct comm_point;
struct comm_reply;
struct regional;
struct tube;
-struct sldns_buffer;
-struct event_base;
/**
* The library-worker status structure
@@ -108,33 +106,54 @@ int libworker_bg(struct ub_ctx* ctx);
*/
int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q);
-/**
- * create worker for event-based interface.
- * @param ctx: context with config.
- * @param eb: event base.
- * @return new worker or NULL.
- */
-struct libworker* libworker_create_event(struct ub_ctx* ctx,
- struct event_base* eb);
+/** cleanup the cache to remove all rrset IDs from it, arg is libworker */
+void libworker_alloc_cleanup(void* arg);
/**
- * Attach context_query to mesh for callback in event-driven setup.
- * @param ctx: context
- * @param q: context query entry
- * @param async_id: store query num if query takes long.
- * @return 0 if finished OK, else error.
+ * Worker service routine to send serviced queries to authoritative servers.
+ * @param qname: query name. (host order)
+ * @param qnamelen: length in bytes of qname, including trailing 0.
+ * @param qtype: query type. (host order)
+ * @param qclass: query class. (host order)
+ * @param flags: host order flags word, with opcode and CD bit.
+ * @param dnssec: if set, EDNS record will have DO bit set.
+ * @param want_dnssec: signatures needed.
+ * @param addr: where to.
+ * @param addrlen: length of addr.
+ * @param zone: delegation point name.
+ * @param zonelen: length of zone name wireformat dname.
+ * @param q: wich query state to reactivate upon return.
+ * @return: false on failure (memory or socket related). no query was
+ * sent.
*/
-int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q,
- int* async_id);
+struct outbound_entry* libworker_send_query(uint8_t* qname, size_t qnamelen,
+ uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec,
+ int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen,
+ uint8_t* zone, size_t zonelen, struct module_qstate* q);
-/**
- * delete worker for event-based interface. does not free the event_base.
- * @param w: event-based worker to delete.
- */
-void libworker_delete_event(struct libworker* w);
+/** process incoming replies from the network */
+int libworker_handle_reply(struct comm_point* c, void* arg, int error,
+ struct comm_reply* reply_info);
-/** cleanup the cache to remove all rrset IDs from it, arg is libworker */
-void libworker_alloc_cleanup(void* arg);
+/** process incoming serviced query replies from the network */
+int libworker_handle_service_reply(struct comm_point* c, void* arg, int error,
+ struct comm_reply* reply_info);
+
+/** handle control command coming into server */
+void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
+ int err, void* arg);
+
+/** handle opportunity to write result back */
+void libworker_handle_result_write(struct tube* tube, uint8_t* msg, size_t len,
+ int err, void* arg);
+
+/** mesh callback with fg results */
+void libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf,
+ enum sec_status s, char* why_bogus);
+
+/** mesh callback with bg results */
+void libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf,
+ enum sec_status s, char* why_bogus);
/**
* fill result from parsed message, on error fills servfail
@@ -145,7 +164,7 @@ void libworker_alloc_cleanup(void* arg);
* On error, the res may contain a different status
* (out of memory is not secure, not bogus).
*/
-void libworker_enter_result(struct ub_result* res, struct sldns_buffer* buf,
+void libworker_enter_result(struct ub_result* res, ldns_buffer* buf,
struct regional* temp, enum sec_status msg_security);
-#endif /* LIBUNBOUND_LIBWORKER_H */
+#endif /* LIBUNBOUND_WORKER_H */
diff --git a/usr.sbin/unbound/services/localzone.h b/usr.sbin/unbound/services/localzone.h
index 3d62a69d191..794988e66bb 100644
--- a/usr.sbin/unbound/services/localzone.h
+++ b/usr.sbin/unbound/services/localzone.h
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -48,8 +48,6 @@ struct regional;
struct config_file;
struct edns_data;
struct query_info;
-struct sldns_buffer;
-struct comm_reply;
/**
* Local zone type
@@ -71,11 +69,7 @@ enum localzone_type {
local_zone_redirect,
/** remove default AS112 blocking contents for zone
* nodefault is used in config not during service. */
- local_zone_nodefault,
- /** log client address, but no block (transparent) */
- local_zone_inform,
- /** log client address, and block (drop) */
- local_zone_inform_deny
+ local_zone_nodefault
};
/**
@@ -83,7 +77,7 @@ enum localzone_type {
*/
struct local_zones {
/** lock on the localzone tree */
- lock_rw_t lock;
+ lock_quick_t lock;
/** rbtree of struct local_zone */
rbtree_t ztree;
};
@@ -225,14 +219,12 @@ void local_zones_print(struct local_zones* zones);
* @param edns: edns info (parsed).
* @param buf: buffer with query ID and flags, also for reply.
* @param temp: temporary storage region.
- * @param repinfo: source address for checks. may be NULL.
* @return true if answer is in buffer. false if query is not answered
* by authority data. If the reply should be dropped altogether, the return
* value is true, but the buffer is cleared (empty).
*/
int local_zones_answer(struct local_zones* zones, struct query_info* qinfo,
- struct edns_data* edns, struct sldns_buffer* buf, struct regional* temp,
- struct comm_reply* repinfo);
+ struct edns_data* edns, ldns_buffer* buf, struct regional* temp);
/**
* Parse the string into localzone type.
@@ -294,9 +286,11 @@ void local_zones_del_zone(struct local_zones* zones, struct local_zone* zone);
* name of the RR is created.
* @param zones: the zones tree. Not locked by caller.
* @param rr: string with on RR.
+ * @param buf: buffer for scratch.
* @return false on failure.
*/
-int local_zones_add_RR(struct local_zones* zones, const char* rr);
+int local_zones_add_RR(struct local_zones* zones, const char* rr,
+ ldns_buffer* buf);
/**
* Remove data from domain name in the tree.
diff --git a/usr.sbin/unbound/services/modstack.c b/usr.sbin/unbound/services/modstack.c
index 49bb2fd15ad..7395598c31c 100644
--- a/usr.sbin/unbound/services/modstack.c
+++ b/usr.sbin/unbound/services/modstack.c
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -43,7 +43,6 @@
#include "services/modstack.h"
#include "util/module.h"
#include "util/fptr_wlist.h"
-#include "dns64/dns64.h"
#include "iterator/iterator.h"
#include "validator/validator.h"
@@ -60,12 +59,12 @@ count_modules(const char* s)
return 0;
while(*s) {
/* skip whitespace */
- while(*s && isspace((unsigned char)*s))
+ while(*s && isspace((int)*s))
s++;
- if(*s && !isspace((unsigned char)*s)) {
+ if(*s && !isspace((int)*s)) {
/* skip identifier */
num++;
- while(*s && !isspace((unsigned char)*s))
+ while(*s && !isspace((int)*s))
s++;
}
}
@@ -117,7 +116,6 @@ module_list_avail(void)
{
/* these are the modules available */
static const char* names[] = {
- "dns64",
#ifdef WITH_PYTHONMODULE
"python",
#endif
@@ -135,7 +133,6 @@ static fbgetfunctype*
module_funcs_avail(void)
{
static struct module_func_block* (*fb[])(void) = {
- &dns64_get_funcblock,
#ifdef WITH_PYTHONMODULE
&pythonmod_get_funcblock,
#endif
@@ -152,7 +149,7 @@ module_func_block* module_factory(const char** str)
const char* s = *str;
const char** names = module_list_avail();
fbgetfunctype* fb = module_funcs_avail();
- while(*s && isspace((unsigned char)*s))
+ while(*s && isspace((int)*s))
s++;
while(names[i]) {
if(strncmp(names[i], s, strlen(names[i])) == 0) {
diff --git a/usr.sbin/unbound/util/data/dname.c b/usr.sbin/unbound/util/data/dname.c
index 79bf52ad472..d2b299744fb 100644
--- a/usr.sbin/unbound/util/data/dname.c
+++ b/usr.sbin/unbound/util/data/dname.c
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
@@ -45,18 +45,17 @@
#include "util/data/msgparse.h"
#include "util/log.h"
#include "util/storage/lookup3.h"
-#include "sldns/sbuffer.h"
/* determine length of a dname in buffer, no compression pointers allowed */
size_t
-query_dname_len(sldns_buffer* query)
+query_dname_len(ldns_buffer* query)
{
size_t len = 0;
size_t labellen;
while(1) {
- if(sldns_buffer_remaining(query) < 1)
+ if(ldns_buffer_remaining(query) < 1)
return 0; /* parse error, need label len */
- labellen = sldns_buffer_read_u8(query);
+ labellen = ldns_buffer_read_u8(query);
if(labellen&0xc0)
return 0; /* no compression allowed in queries */
len += labellen + 1;
@@ -64,9 +63,9 @@ query_dname_len(sldns_buffer* query)
return 0; /* too long */
if(labellen == 0)
return len;
- if(sldns_buffer_remaining(query) < labellen)
+ if(ldns_buffer_remaining(query) < labellen)
return 0; /* parse error, need content */
- sldns_buffer_skip(query, (ssize_t)labellen);
+ ldns_buffer_skip(query, (ssize_t)labellen);
}
}
@@ -114,8 +113,8 @@ query_dname_compare(register uint8_t* d1, register uint8_t* d2)
while(lab1--) {
/* compare bytes first for speed */
if(*d1 != *d2 &&
- tolower((unsigned char)*d1) != tolower((unsigned char)*d2)) {
- if(tolower((unsigned char)*d1) < tolower((unsigned char)*d2))
+ tolower((int)*d1) != tolower((int)*d2)) {
+ if(tolower((int)*d1) < tolower((int)*d2))
return -1;
return 1;
}
@@ -138,7 +137,7 @@ query_dname_tolower(uint8_t* dname)
while(labellen) {
dname++;
while(labellen--) {
- *dname = (uint8_t)tolower((unsigned char)*dname);
+ *dname = (uint8_t)tolower((int)*dname);
dname++;
}
labellen = *dname;
@@ -146,31 +145,31 @@ query_dname_tolower(uint8_t* dname)
}
void
-pkt_dname_tolower(sldns_buffer* pkt, uint8_t* dname)
+pkt_dname_tolower(ldns_buffer* pkt, uint8_t* dname)
{
uint8_t lablen;
int count = 0;
- if(dname >= sldns_buffer_end(pkt))
+ if(dname >= ldns_buffer_end(pkt))
return;
lablen = *dname++;
while(lablen) {
if(LABEL_IS_PTR(lablen)) {
if((size_t)PTR_OFFSET(lablen, *dname)
- >= sldns_buffer_limit(pkt))
+ >= ldns_buffer_limit(pkt))
return;
- dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
+ dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
lablen = *dname++;
if(count++ > MAX_COMPRESS_PTRS)
return;
continue;
}
- if(dname+lablen >= sldns_buffer_end(pkt))
+ if(dname+lablen >= ldns_buffer_end(pkt))
return;
while(lablen--) {
- *dname = (uint8_t)tolower((unsigned char)*dname);
+ *dname = (uint8_t)tolower((int)*dname);
dname++;
}
- if(dname >= sldns_buffer_end(pkt))
+ if(dname >= ldns_buffer_end(pkt))
return;
lablen = *dname++;
}
@@ -178,7 +177,7 @@ pkt_dname_tolower(sldns_buffer* pkt, uint8_t* dname)
size_t
-pkt_dname_len(sldns_buffer* pkt)
+pkt_dname_len(ldns_buffer* pkt)
{
size_t len = 0;
int ptrcount = 0;
@@ -189,22 +188,22 @@ pkt_dname_len(sldns_buffer* pkt)
/* check compression pointers, loops, out of bounds */
while(1) {
/* read next label */
- if(sldns_buffer_remaining(pkt) < 1)
+ if(ldns_buffer_remaining(pkt) < 1)
return 0;
- labellen = sldns_buffer_read_u8(pkt);
+ labellen = ldns_buffer_read_u8(pkt);
if(LABEL_IS_PTR(labellen)) {
/* compression ptr */
uint16_t ptr;
- if(sldns_buffer_remaining(pkt) < 1)
+ if(ldns_buffer_remaining(pkt) < 1)
return 0;
- ptr = PTR_OFFSET(labellen, sldns_buffer_read_u8(pkt));
+ ptr = PTR_OFFSET(labellen, ldns_buffer_read_u8(pkt));
if(ptrcount++ > MAX_COMPRESS_PTRS)
return 0; /* loop! */
- if(sldns_buffer_limit(pkt) <= ptr)
+ if(ldns_buffer_limit(pkt) <= ptr)
return 0; /* out of bounds! */
if(!endpos)
- endpos = sldns_buffer_position(pkt);
- sldns_buffer_set_position(pkt, ptr);
+ endpos = ldns_buffer_position(pkt);
+ ldns_buffer_set_position(pkt, ptr);
} else {
/* label contents */
if(labellen > 0x3f)
@@ -216,19 +215,19 @@ pkt_dname_len(sldns_buffer* pkt)
/* end of dname */
break;
}
- if(sldns_buffer_remaining(pkt) < labellen)
+ if(ldns_buffer_remaining(pkt) < labellen)
return 0;
- sldns_buffer_skip(pkt, (ssize_t)labellen);
+ ldns_buffer_skip(pkt, (ssize_t)labellen);
}
}
if(endpos)
- sldns_buffer_set_position(pkt, endpos);
+ ldns_buffer_set_position(pkt, endpos);
return len;
}
int
-dname_pkt_compare(sldns_buffer* pkt, uint8_t* d1, uint8_t* d2)
+dname_pkt_compare(ldns_buffer* pkt, uint8_t* d1, uint8_t* d2)
{
uint8_t len1, len2;
log_assert(pkt && d1 && d2);
@@ -237,12 +236,12 @@ dname_pkt_compare(sldns_buffer* pkt, uint8_t* d1, uint8_t* d2)
while( len1 != 0 || len2 != 0 ) {
/* resolve ptrs */
if(LABEL_IS_PTR(len1)) {
- d1 = sldns_buffer_at(pkt, PTR_OFFSET(len1, *d1));
+ d1 = ldns_buffer_at(pkt, PTR_OFFSET(len1, *d1));
len1 = *d1++;
continue;
}
if(LABEL_IS_PTR(len2)) {
- d2 = sldns_buffer_at(pkt, PTR_OFFSET(len2, *d2));
+ d2 = ldns_buffer_at(pkt, PTR_OFFSET(len2, *d2));
len2 = *d2++;
continue;
}
@@ -256,8 +255,8 @@ dname_pkt_compare(sldns_buffer* pkt, uint8_t* d1, uint8_t* d2)
log_assert(len1 == len2 && len1 != 0);
/* compare labels */
while(len1--) {
- if(tolower((unsigned char)*d1++) != tolower((unsigned char)*d2++)) {
- if(tolower((unsigned char)d1[-1]) < tolower((unsigned char)d2[-1]))
+ if(tolower((int)*d1++) != tolower((int)*d2++)) {
+ if(tolower((int)d1[-1]) < tolower((int)d2[-1]))
return -1;
return 1;
}
@@ -282,7 +281,7 @@ dname_query_hash(uint8_t* dname, hashvalue_t h)
labuf[0] = lablen;
i=0;
while(lablen--)
- labuf[++i] = (uint8_t)tolower((unsigned char)*dname++);
+ labuf[++i] = (uint8_t)tolower((int)*dname++);
h = hashlittle(labuf, labuf[0] + 1, h);
lablen = *dname++;
}
@@ -291,7 +290,7 @@ dname_query_hash(uint8_t* dname, hashvalue_t h)
}
hashvalue_t
-dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_t h)
+dname_pkt_hash(ldns_buffer* pkt, uint8_t* dname, hashvalue_t h)
{
uint8_t labuf[LDNS_MAX_LABELLEN+1];
uint8_t lablen;
@@ -302,7 +301,7 @@ dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_t h)
while(lablen) {
if(LABEL_IS_PTR(lablen)) {
/* follow pointer */
- dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
+ dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
lablen = *dname++;
continue;
}
@@ -310,7 +309,7 @@ dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_t h)
labuf[0] = lablen;
i=0;
while(lablen--)
- labuf[++i] = (uint8_t)tolower((unsigned char)*dname++);
+ labuf[++i] = (uint8_t)tolower((int)*dname++);
h = hashlittle(labuf, labuf[0] + 1, h);
lablen = *dname++;
}
@@ -318,7 +317,7 @@ dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_t h)
return h;
}
-void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
+void dname_pkt_copy(ldns_buffer* pkt, uint8_t* to, uint8_t* dname)
{
/* copy over the dname and decompress it at the same time */
size_t len = 0;
@@ -327,7 +326,7 @@ void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
while(lablen) {
if(LABEL_IS_PTR(lablen)) {
/* follow pointer */
- dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
+ dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
lablen = *dname++;
continue;
}
@@ -348,7 +347,7 @@ void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
*to = 0;
}
-void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname)
+void dname_print(FILE* out, ldns_buffer* pkt, uint8_t* dname)
{
uint8_t lablen;
if(!out) out = stdout;
@@ -364,7 +363,7 @@ void dname_print(FILE* out, struct sldns_buffer* pkt, uint8_t* dname)
fputs("??compressionptr??", out);
return;
}
- dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
+ dname = ldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
lablen = *dname++;
continue;
}
@@ -423,8 +422,8 @@ static int
memlowercmp(uint8_t* p1, uint8_t* p2, uint8_t len)
{
while(len--) {
- if(*p1 != *p2 && tolower((unsigned char)*p1) != tolower((unsigned char)*p2)) {
- if(tolower((unsigned char)*p1) < tolower((unsigned char)*p2))
+ if(*p1 != *p2 && tolower((int)*p1) != tolower((int)*p2)) {
+ if(tolower((int)*p1) < tolower((int)*p2))
return -1;
return 1;
}
@@ -480,10 +479,10 @@ dname_lab_cmp(uint8_t* d1, int labs1, uint8_t* d2, int labs2, int* mlabs)
* lastdiff = c;
* lastmlabs = atlabel; } apart from d1++,d2++ */
while(len1) {
- if(*d1 != *d2 && tolower((unsigned char)*d1)
- != tolower((unsigned char)*d2)) {
- if(tolower((unsigned char)*d1) <
- tolower((unsigned char)*d2)) {
+ if(*d1 != *d2 && tolower((int)*d1)
+ != tolower((int)*d2)) {
+ if(tolower((int)*d1) <
+ tolower((int)*d2)) {
lastdiff = -1;
lastmlabs = atlabel;
d1 += len1;
@@ -518,21 +517,21 @@ dname_lab_cmp(uint8_t* d1, int labs1, uint8_t* d2, int labs2, int* mlabs)
}
int
-dname_buffer_write(sldns_buffer* pkt, uint8_t* dname)
+dname_buffer_write(ldns_buffer* pkt, uint8_t* dname)
{
uint8_t lablen;
- if(sldns_buffer_remaining(pkt) < 1)
+ if(ldns_buffer_remaining(pkt) < 1)
return 0;
lablen = *dname++;
- sldns_buffer_write_u8(pkt, lablen);
+ ldns_buffer_write_u8(pkt, lablen);
while(lablen) {
- if(sldns_buffer_remaining(pkt) < (size_t)lablen+1)
+ if(ldns_buffer_remaining(pkt) < (size_t)lablen+1)
return 0;
- sldns_buffer_write(pkt, dname, lablen);
+ ldns_buffer_write(pkt, dname, lablen);
dname += lablen;
lablen = *dname++;
- sldns_buffer_write_u8(pkt, lablen);
+ ldns_buffer_write_u8(pkt, lablen);
}
return 1;
}
@@ -561,7 +560,7 @@ void dname_str(uint8_t* dname, char* str)
return;
}
while(lablen--) {
- if(isalnum((unsigned char)*dname)
+ if(isalnum((int)*dname)
|| *dname == '-' || *dname == '_'
|| *dname == '*')
*s++ = *(char*)dname++;
diff --git a/usr.sbin/unbound/util/data/msgparse.c b/usr.sbin/unbound/util/data/msgparse.c
index 108c9dacb39..a03f543e827 100644
--- a/usr.sbin/unbound/util/data/msgparse.c
+++ b/usr.sbin/unbound/util/data/msgparse.c
@@ -21,40 +21,38 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file
* Routines for message parsing a packet buffer to a descriptive structure.
*/
#include "config.h"
+#include <ldns/ldns.h>
#include "util/data/msgparse.h"
+#include "util/net_help.h"
#include "util/data/dname.h"
#include "util/data/packed_rrset.h"
#include "util/storage/lookup3.h"
#include "util/regional.h"
-#include "sldns/rrdef.h"
-#include "sldns/sbuffer.h"
-#include "sldns/parseutil.h"
-#include "sldns/wire2str.h"
/** smart comparison of (compressed, valid) dnames from packet */
static int
-smart_compare(sldns_buffer* pkt, uint8_t* dnow,
+smart_compare(ldns_buffer* pkt, uint8_t* dnow,
uint8_t* dprfirst, uint8_t* dprlast)
{
if(LABEL_IS_PTR(*dnow)) {
/* ptr points to a previous dname */
- uint8_t* p = sldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1]));
+ uint8_t* p = ldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1]));
if( p == dprfirst || p == dprlast )
return 0;
/* prev dname is also a ptr, both ptrs are the same. */
@@ -71,7 +69,7 @@ smart_compare(sldns_buffer* pkt, uint8_t* dnow,
static struct rrset_parse*
new_rrset(struct msg_parse* msg, uint8_t* dname, size_t dnamelen,
uint16_t type, uint16_t dclass, hashvalue_t hash,
- uint32_t rrset_flags, sldns_pkt_section section,
+ uint32_t rrset_flags, ldns_pkt_section section,
struct regional* region)
{
struct rrset_parse* p = regional_alloc(region, sizeof(*p));
@@ -102,52 +100,52 @@ new_rrset(struct msg_parse* msg, uint8_t* dname, size_t dnamelen,
/** See if next rrset is nsec at zone apex */
static int
-nsec_at_apex(sldns_buffer* pkt)
+nsec_at_apex(ldns_buffer* pkt)
{
/* we are at ttl position in packet. */
- size_t pos = sldns_buffer_position(pkt);
+ size_t pos = ldns_buffer_position(pkt);
uint16_t rdatalen;
- if(sldns_buffer_remaining(pkt) < 7) /* ttl+len+root */
+ if(ldns_buffer_remaining(pkt) < 7) /* ttl+len+root */
return 0; /* eek! */
- sldns_buffer_skip(pkt, 4); /* ttl */;
- rdatalen = sldns_buffer_read_u16(pkt);
- if(sldns_buffer_remaining(pkt) < rdatalen) {
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_skip(pkt, 4); /* ttl */;
+ rdatalen = ldns_buffer_read_u16(pkt);
+ if(ldns_buffer_remaining(pkt) < rdatalen) {
+ ldns_buffer_set_position(pkt, pos);
return 0; /* parse error happens later */
}
/* must validate the nsec next domain name format */
if(pkt_dname_len(pkt) == 0) {
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_set_position(pkt, pos);
return 0; /* parse error */
}
/* see if SOA bit is set. */
- if(sldns_buffer_position(pkt) < pos+4+rdatalen) {
+ if(ldns_buffer_position(pkt) < pos+4+rdatalen) {
/* nsec type bitmap contains items */
uint8_t win, blen, bits;
/* need: windownum, bitmap len, firstbyte */
- if(sldns_buffer_position(pkt)+3 > pos+4+rdatalen) {
- sldns_buffer_set_position(pkt, pos);
+ if(ldns_buffer_position(pkt)+3 > pos+4+rdatalen) {
+ ldns_buffer_set_position(pkt, pos);
return 0; /* malformed nsec */
}
- win = sldns_buffer_read_u8(pkt);
- blen = sldns_buffer_read_u8(pkt);
- bits = sldns_buffer_read_u8(pkt);
+ win = ldns_buffer_read_u8(pkt);
+ blen = ldns_buffer_read_u8(pkt);
+ bits = ldns_buffer_read_u8(pkt);
/* 0window always first window. bitlen >=1 or parse
error really. bit 0x2 is SOA. */
if(win == 0 && blen >= 1 && (bits & 0x02)) {
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_set_position(pkt, pos);
return 1;
}
}
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_set_position(pkt, pos);
return 0;
}
/** Calculate rrset flags */
static uint32_t
-pkt_rrset_flags(sldns_buffer* pkt, uint16_t type, sldns_pkt_section sec)
+pkt_rrset_flags(ldns_buffer* pkt, uint16_t type, ldns_pkt_section sec)
{
uint32_t f = 0;
if(type == LDNS_RR_TYPE_NSEC && nsec_at_apex(pkt)) {
@@ -159,7 +157,7 @@ pkt_rrset_flags(sldns_buffer* pkt, uint16_t type, sldns_pkt_section sec)
}
hashvalue_t
-pkt_hash_rrset(sldns_buffer* pkt, uint8_t* dname, uint16_t type,
+pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type,
uint16_t dclass, uint32_t rrset_flags)
{
/* note this MUST be identical to rrset_key_hash in packed_rrset.c */
@@ -174,7 +172,7 @@ pkt_hash_rrset(sldns_buffer* pkt, uint8_t* dname, uint16_t type,
/** create partial dname hash for rrset hash */
static hashvalue_t
-pkt_hash_rrset_first(sldns_buffer* pkt, uint8_t* dname)
+pkt_hash_rrset_first(ldns_buffer* pkt, uint8_t* dname)
{
/* works together with pkt_hash_rrset_rest */
/* note this MUST be identical to rrset_key_hash in packed_rrset.c */
@@ -200,7 +198,7 @@ pkt_hash_rrset_rest(hashvalue_t dname_h, uint16_t type, uint16_t dclass,
/** compare rrset_parse with data */
static int
-rrset_parse_equals(struct rrset_parse* p, sldns_buffer* pkt, hashvalue_t h,
+rrset_parse_equals(struct rrset_parse* p, ldns_buffer* pkt, hashvalue_t h,
uint32_t rrset_flags, uint8_t* dname, size_t dnamelen,
uint16_t type, uint16_t dclass)
{
@@ -213,7 +211,7 @@ rrset_parse_equals(struct rrset_parse* p, sldns_buffer* pkt, hashvalue_t h,
struct rrset_parse*
-msgparse_hashtable_lookup(struct msg_parse* msg, sldns_buffer* pkt,
+msgparse_hashtable_lookup(struct msg_parse* msg, ldns_buffer* pkt,
hashvalue_t h, uint32_t rrset_flags, uint8_t* dname, size_t dnamelen,
uint16_t type, uint16_t dclass)
{
@@ -229,26 +227,26 @@ msgparse_hashtable_lookup(struct msg_parse* msg, sldns_buffer* pkt,
/** return type networkformat that rrsig in packet covers */
static int
-pkt_rrsig_covered(sldns_buffer* pkt, uint8_t* here, uint16_t* type)
+pkt_rrsig_covered(ldns_buffer* pkt, uint8_t* here, uint16_t* type)
{
- size_t pos = sldns_buffer_position(pkt);
- sldns_buffer_set_position(pkt, (size_t)(here-sldns_buffer_begin(pkt)));
+ size_t pos = ldns_buffer_position(pkt);
+ ldns_buffer_set_position(pkt, (size_t)(here-ldns_buffer_begin(pkt)));
/* ttl + len + size of small rrsig(rootlabel, no signature) */
- if(sldns_buffer_remaining(pkt) < 4+2+19)
+ if(ldns_buffer_remaining(pkt) < 4+2+19)
return 0;
- sldns_buffer_skip(pkt, 4); /* ttl */
- if(sldns_buffer_read_u16(pkt) < 19) /* too short */ {
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_skip(pkt, 4); /* ttl */
+ if(ldns_buffer_read_u16(pkt) < 19) /* too short */ {
+ ldns_buffer_set_position(pkt, pos);
return 0;
}
- *type = sldns_buffer_read_u16(pkt);
- sldns_buffer_set_position(pkt, pos);
+ *type = ldns_buffer_read_u16(pkt);
+ ldns_buffer_set_position(pkt, pos);
return 1;
}
/** true if covered type equals prevtype */
static int
-pkt_rrsig_covered_equals(sldns_buffer* pkt, uint8_t* here, uint16_t type)
+pkt_rrsig_covered_equals(ldns_buffer* pkt, uint8_t* here, uint16_t type)
{
uint16_t t;
if(pkt_rrsig_covered(pkt, here, &t) && t == type)
@@ -273,7 +271,7 @@ msgparse_bucket_remove(struct msg_parse* msg, struct rrset_parse* rrset)
/** change section of rrset from previous to current section */
static void
change_section(struct msg_parse* msg, struct rrset_parse* rrset,
- sldns_pkt_section section)
+ ldns_pkt_section section)
{
struct rrset_parse *p, *prev;
/* remove from list */
@@ -316,7 +314,7 @@ change_section(struct msg_parse* msg, struct rrset_parse* rrset,
/** see if rrset of type RRSIG contains sig over given type */
static int
-rrset_has_sigover(sldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type,
+rrset_has_sigover(ldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type,
int* hasother)
{
int res = 0;
@@ -333,7 +331,7 @@ rrset_has_sigover(sldns_buffer* pkt, struct rrset_parse* rrset, uint16_t type,
/** move rrsigs from sigset to dataset */
static int
-moveover_rrsigs(sldns_buffer* pkt, struct regional* region,
+moveover_rrsigs(ldns_buffer* pkt, struct regional* region,
struct rrset_parse* sigset, struct rrset_parse* dataset, int duplicate)
{
struct rr_parse* sig = sigset->rr_first;
@@ -383,8 +381,8 @@ moveover_rrsigs(sldns_buffer* pkt, struct regional* region,
/** change an rrsig rrset for use as data rrset */
static struct rrset_parse*
change_rrsig_rrset(struct rrset_parse* sigset, struct msg_parse* msg,
- sldns_buffer* pkt, uint16_t datatype, uint32_t rrset_flags,
- int hasother, sldns_pkt_section section, struct regional* region)
+ ldns_buffer* pkt, uint16_t datatype, uint32_t rrset_flags,
+ int hasother, ldns_pkt_section section, struct regional* region)
{
struct rrset_parse* dataset = sigset;
hashvalue_t hash = pkt_hash_rrset(pkt, sigset->dname, datatype,
@@ -453,13 +451,13 @@ change_rrsig_rrset(struct rrset_parse* sigset, struct msg_parse* msg,
* @return 0 on out of memory.
*/
static int
-find_rrset(struct msg_parse* msg, sldns_buffer* pkt, uint8_t* dname,
+find_rrset(struct msg_parse* msg, ldns_buffer* pkt, uint8_t* dname,
size_t dnamelen, uint16_t type, uint16_t dclass, hashvalue_t* hash,
uint32_t* rrset_flags,
uint8_t** prev_dname_first, uint8_t** prev_dname_last,
size_t* prev_dnamelen, uint16_t* prev_type,
uint16_t* prev_dclass, struct rrset_parse** rrset_prev,
- sldns_pkt_section section, struct regional* region)
+ ldns_pkt_section section, struct regional* region)
{
hashvalue_t dname_h = pkt_hash_rrset_first(pkt, dname);
uint16_t covtype;
@@ -476,7 +474,7 @@ find_rrset(struct msg_parse* msg, sldns_buffer* pkt, uint8_t* dname,
}
/* check if rrsig over previous item */
if(type == LDNS_RR_TYPE_RRSIG && dclass == *prev_dclass &&
- pkt_rrsig_covered_equals(pkt, sldns_buffer_current(pkt),
+ pkt_rrsig_covered_equals(pkt, ldns_buffer_current(pkt),
*prev_type) &&
smart_compare(pkt, dname, *prev_dname_first,
*prev_dname_last) == 0) {
@@ -490,7 +488,7 @@ find_rrset(struct msg_parse* msg, sldns_buffer* pkt, uint8_t* dname,
/* if rrsig - try to lookup matching data set first */
if(type == LDNS_RR_TYPE_RRSIG && pkt_rrsig_covered(pkt,
- sldns_buffer_current(pkt), &covtype)) {
+ ldns_buffer_current(pkt), &covtype)) {
*hash = pkt_hash_rrset_rest(dname_h, covtype, dclass,
*rrset_flags);
*rrset_prev = msgparse_hashtable_lookup(msg, pkt, *hash,
@@ -571,27 +569,27 @@ find_rrset(struct msg_parse* msg, sldns_buffer* pkt, uint8_t* dname,
* @return: 0 if OK, or rcode on error.
*/
static int
-parse_query_section(sldns_buffer* pkt, struct msg_parse* msg)
+parse_query_section(ldns_buffer* pkt, struct msg_parse* msg)
{
if(msg->qdcount == 0)
return 0;
if(msg->qdcount > 1)
return LDNS_RCODE_FORMERR;
log_assert(msg->qdcount == 1);
- if(sldns_buffer_remaining(pkt) <= 0)
+ if(ldns_buffer_remaining(pkt) <= 0)
return LDNS_RCODE_FORMERR;
- msg->qname = sldns_buffer_current(pkt);
+ msg->qname = ldns_buffer_current(pkt);
if((msg->qname_len = pkt_dname_len(pkt)) == 0)
return LDNS_RCODE_FORMERR;
- if(sldns_buffer_remaining(pkt) < sizeof(uint16_t)*2)
+ if(ldns_buffer_remaining(pkt) < sizeof(uint16_t)*2)
return LDNS_RCODE_FORMERR;
- msg->qtype = sldns_buffer_read_u16(pkt);
- msg->qclass = sldns_buffer_read_u16(pkt);
+ msg->qtype = ldns_buffer_read_u16(pkt);
+ msg->qclass = ldns_buffer_read_u16(pkt);
return 0;
}
size_t
-get_rdf_size(sldns_rdf_type rdf)
+get_rdf_size(ldns_rdf_type rdf)
{
switch(rdf) {
case LDNS_RDF_TYPE_CLASS:
@@ -617,7 +615,7 @@ get_rdf_size(sldns_rdf_type rdf)
return 16;
break;
default:
- log_assert(0); /* add type above */
+ log_assert(false); /* add type above */
/* only types that appear before a domain *
* name are needed. rest is simply copied. */
}
@@ -626,16 +624,16 @@ get_rdf_size(sldns_rdf_type rdf)
/** calculate the size of one rr */
static int
-calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
+calc_size(ldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
{
- const sldns_rr_descriptor* desc;
+ const ldns_rr_descriptor* desc;
uint16_t pkt_len; /* length of rr inside the packet */
rr->size = sizeof(uint16_t); /* the rdatalen */
- sldns_buffer_skip(pkt, 4); /* skip ttl */
- pkt_len = sldns_buffer_read_u16(pkt);
- if(sldns_buffer_remaining(pkt) < pkt_len)
+ ldns_buffer_skip(pkt, 4); /* skip ttl */
+ pkt_len = ldns_buffer_read_u16(pkt);
+ if(ldns_buffer_remaining(pkt) < pkt_len)
return 0;
- desc = sldns_rr_descript(type);
+ desc = ldns_rr_descript(type);
if(pkt_len > 0 && desc && desc->_dname_count > 0) {
int count = (int)desc->_dname_count;
int rdf = 0;
@@ -646,22 +644,20 @@ calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
switch(desc->_wireformat[rdf]) {
case LDNS_RDF_TYPE_DNAME:
/* decompress every domain name */
- oldpos = sldns_buffer_position(pkt);
+ oldpos = ldns_buffer_position(pkt);
if((len = pkt_dname_len(pkt)) == 0)
return 0; /* malformed dname */
- if(sldns_buffer_position(pkt)-oldpos > pkt_len)
+ if(ldns_buffer_position(pkt)-oldpos > pkt_len)
return 0; /* dname exceeds rdata */
- pkt_len -= sldns_buffer_position(pkt)-oldpos;
+ pkt_len -= ldns_buffer_position(pkt)-oldpos;
rr->size += len;
count--;
len = 0;
break;
case LDNS_RDF_TYPE_STR:
- if(pkt_len < 1) {
- /* NOTREACHED, due to 'while(>0)' */
+ if(pkt_len < 1)
return 0; /* len byte exceeds rdata */
- }
- len = sldns_buffer_current(pkt)[0] + 1;
+ len = ldns_buffer_current(pkt)[0] + 1;
break;
default:
len = get_rdf_size(desc->_wireformat[rdf]);
@@ -670,7 +666,7 @@ calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
if(pkt_len < len)
return 0; /* exceeds rdata */
pkt_len -= len;
- sldns_buffer_skip(pkt, (ssize_t)len);
+ ldns_buffer_skip(pkt, (ssize_t)len);
rr->size += len;
}
rdf++;
@@ -678,41 +674,41 @@ calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
}
/* remaining rdata */
rr->size += pkt_len;
- sldns_buffer_skip(pkt, (ssize_t)pkt_len);
+ ldns_buffer_skip(pkt, (ssize_t)pkt_len);
return 1;
}
/** skip rr ttl and rdata */
static int
-skip_ttl_rdata(sldns_buffer* pkt)
+skip_ttl_rdata(ldns_buffer* pkt)
{
uint16_t rdatalen;
- if(sldns_buffer_remaining(pkt) < 6) /* ttl + rdatalen */
+ if(ldns_buffer_remaining(pkt) < 6) /* ttl + rdatalen */
return 0;
- sldns_buffer_skip(pkt, 4); /* ttl */
- rdatalen = sldns_buffer_read_u16(pkt);
- if(sldns_buffer_remaining(pkt) < rdatalen)
+ ldns_buffer_skip(pkt, 4); /* ttl */
+ rdatalen = ldns_buffer_read_u16(pkt);
+ if(ldns_buffer_remaining(pkt) < rdatalen)
return 0;
- sldns_buffer_skip(pkt, (ssize_t)rdatalen);
+ ldns_buffer_skip(pkt, (ssize_t)rdatalen);
return 1;
}
/** see if RRSIG is a duplicate of another */
static int
-sig_is_double(sldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata)
+sig_is_double(ldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata)
{
uint16_t rlen, siglen;
- size_t pos = sldns_buffer_position(pkt);
+ size_t pos = ldns_buffer_position(pkt);
struct rr_parse* sig;
- if(sldns_buffer_remaining(pkt) < 6)
+ if(ldns_buffer_remaining(pkt) < 6)
return 0;
- sldns_buffer_skip(pkt, 4); /* ttl */
- rlen = sldns_buffer_read_u16(pkt);
- if(sldns_buffer_remaining(pkt) < rlen) {
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_skip(pkt, 4); /* ttl */
+ rlen = ldns_buffer_read_u16(pkt);
+ if(ldns_buffer_remaining(pkt) < rlen) {
+ ldns_buffer_set_position(pkt, pos);
return 0;
}
- sldns_buffer_set_position(pkt, pos);
+ ldns_buffer_set_position(pkt, pos);
sig = rrset->rrsig_first;
while(sig) {
@@ -741,9 +737,9 @@ sig_is_double(sldns_buffer* pkt, struct rrset_parse* rrset, uint8_t* ttldata)
/** Add rr (from packet here) to rrset, skips rr */
static int
-add_rr_to_rrset(struct rrset_parse* rrset, sldns_buffer* pkt,
+add_rr_to_rrset(struct rrset_parse* rrset, ldns_buffer* pkt,
struct msg_parse* msg, struct regional* region,
- sldns_pkt_section section, uint16_t type)
+ ldns_pkt_section section, uint16_t type)
{
struct rr_parse* rr;
/* check section of rrset. */
@@ -767,7 +763,7 @@ add_rr_to_rrset(struct rrset_parse* rrset, sldns_buffer* pkt,
if( (msg->qtype == LDNS_RR_TYPE_RRSIG ||
msg->qtype == LDNS_RR_TYPE_ANY)
- && sig_is_double(pkt, rrset, sldns_buffer_current(pkt))) {
+ && sig_is_double(pkt, rrset, ldns_buffer_current(pkt))) {
if(!skip_ttl_rdata(pkt))
return LDNS_RCODE_FORMERR;
return 0;
@@ -777,7 +773,7 @@ add_rr_to_rrset(struct rrset_parse* rrset, sldns_buffer* pkt,
if(!(rr = (struct rr_parse*)regional_alloc(region, sizeof(*rr))))
return LDNS_RCODE_SERVFAIL;
rr->outside_packet = 0;
- rr->ttl_data = sldns_buffer_current(pkt);
+ rr->ttl_data = ldns_buffer_current(pkt);
rr->next = 0;
if(type == LDNS_RR_TYPE_RRSIG && rrset->type != LDNS_RR_TYPE_RRSIG) {
if(rrset->rrsig_last)
@@ -813,8 +809,8 @@ add_rr_to_rrset(struct rrset_parse* rrset, sldns_buffer* pkt,
* @return: 0 if OK, or rcode on error.
*/
static int
-parse_section(sldns_buffer* pkt, struct msg_parse* msg,
- struct regional* region, sldns_pkt_section section,
+parse_section(ldns_buffer* pkt, struct msg_parse* msg,
+ struct regional* region, ldns_pkt_section section,
uint16_t num_rrs, size_t* num_rrsets)
{
uint16_t i;
@@ -829,39 +825,39 @@ parse_section(sldns_buffer* pkt, struct msg_parse* msg,
if(num_rrs == 0)
return 0;
- if(sldns_buffer_remaining(pkt) <= 0)
+ if(ldns_buffer_remaining(pkt) <= 0)
return LDNS_RCODE_FORMERR;
for(i=0; i<num_rrs; i++) {
/* parse this RR. */
- dname = sldns_buffer_current(pkt);
+ dname = ldns_buffer_current(pkt);
if((dnamelen = pkt_dname_len(pkt)) == 0)
return LDNS_RCODE_FORMERR;
- if(sldns_buffer_remaining(pkt) < 10) /* type, class, ttl, len */
+ if(ldns_buffer_remaining(pkt) < 10) /* type, class, ttl, len */
return LDNS_RCODE_FORMERR;
- type = sldns_buffer_read_u16(pkt);
- sldns_buffer_read(pkt, &dclass, sizeof(dclass));
+ type = ldns_buffer_read_u16(pkt);
+ ldns_buffer_read(pkt, &dclass, sizeof(dclass));
if(0) { /* debug show what is being parsed. */
if(type == LDNS_RR_TYPE_RRSIG) {
uint16_t t;
if(pkt_rrsig_covered(pkt,
- sldns_buffer_current(pkt), &t))
+ ldns_buffer_current(pkt), &t))
fprintf(stderr, "parse of %s(%d) [%s(%d)]",
- sldns_rr_descript(type)?
- sldns_rr_descript(type)->_name: "??",
+ ldns_rr_descript(type)?
+ ldns_rr_descript(type)->_name: "??",
(int)type,
- sldns_rr_descript(t)?
- sldns_rr_descript(t)->_name: "??",
+ ldns_rr_descript(t)?
+ ldns_rr_descript(t)->_name: "??",
(int)t);
} else
fprintf(stderr, "parse of %s(%d)",
- sldns_rr_descript(type)?
- sldns_rr_descript(type)->_name: "??",
+ ldns_rr_descript(type)?
+ ldns_rr_descript(type)->_name: "??",
(int)type);
fprintf(stderr, " %s(%d) ",
- sldns_lookup_by_id(sldns_rr_classes,
- (int)ntohs(dclass))?sldns_lookup_by_id(
- sldns_rr_classes, (int)ntohs(dclass))->name:
+ ldns_lookup_by_id(ldns_rr_classes,
+ (int)ntohs(dclass))?ldns_lookup_by_id(
+ ldns_rr_classes, (int)ntohs(dclass))->name:
"??", (int)ntohs(dclass));
dname_print(stderr, pkt, dname);
fprintf(stderr, "\n");
@@ -885,8 +881,8 @@ parse_section(sldns_buffer* pkt, struct msg_parse* msg,
fprintf(stderr, "is part of existing: ");
dname_print(stderr, pkt, rrset->dname);
fprintf(stderr, " type %s(%d)\n",
- sldns_rr_descript(rrset->type)?
- sldns_rr_descript(rrset->type)->_name: "??",
+ ldns_rr_descript(rrset->type)?
+ ldns_rr_descript(rrset->type)->_name: "??",
(int)rrset->type);
}
/* add to rrset. */
@@ -898,18 +894,18 @@ parse_section(sldns_buffer* pkt, struct msg_parse* msg,
}
int
-parse_packet(sldns_buffer* pkt, struct msg_parse* msg, struct regional* region)
+parse_packet(ldns_buffer* pkt, struct msg_parse* msg, struct regional* region)
{
int ret;
- if(sldns_buffer_remaining(pkt) < LDNS_HEADER_SIZE)
+ if(ldns_buffer_remaining(pkt) < LDNS_HEADER_SIZE)
return LDNS_RCODE_FORMERR;
/* read the header */
- sldns_buffer_read(pkt, &msg->id, sizeof(uint16_t));
- msg->flags = sldns_buffer_read_u16(pkt);
- msg->qdcount = sldns_buffer_read_u16(pkt);
- msg->ancount = sldns_buffer_read_u16(pkt);
- msg->nscount = sldns_buffer_read_u16(pkt);
- msg->arcount = sldns_buffer_read_u16(pkt);
+ ldns_buffer_read(pkt, &msg->id, sizeof(uint16_t));
+ msg->flags = ldns_buffer_read_u16(pkt);
+ msg->qdcount = ldns_buffer_read_u16(pkt);
+ msg->ancount = ldns_buffer_read_u16(pkt);
+ msg->nscount = ldns_buffer_read_u16(pkt);
+ msg->arcount = ldns_buffer_read_u16(pkt);
if(msg->qdcount > 1)
return LDNS_RCODE_FORMERR;
if((ret = parse_query_section(pkt, msg)) != 0)
@@ -920,13 +916,13 @@ parse_packet(sldns_buffer* pkt, struct msg_parse* msg, struct regional* region)
if((ret = parse_section(pkt, msg, region, LDNS_SECTION_AUTHORITY,
msg->nscount, &msg->ns_rrsets)) != 0)
return ret;
- if(sldns_buffer_remaining(pkt) == 0 && msg->arcount == 1) {
+ if(ldns_buffer_remaining(pkt) == 0 && msg->arcount == 1) {
/* BIND accepts leniently that an EDNS record is missing.
* so, we do too. */
} else if((ret = parse_section(pkt, msg, region,
LDNS_SECTION_ADDITIONAL, msg->arcount, &msg->ar_rrsets)) != 0)
return ret;
- /* if(sldns_buffer_remaining(pkt) > 0) { */
+ /* if(ldns_buffer_remaining(pkt) > 0) { */
/* there is spurious data at end of packet. ignore */
/* } */
msg->rrset_count = msg->an_rrsets + msg->ns_rrsets + msg->ar_rrsets;
@@ -984,23 +980,23 @@ parse_extract_edns(struct msg_parse* msg, struct edns_data* edns)
edns->edns_present = 1;
edns->ext_rcode = found->rr_last->ttl_data[0];
edns->edns_version = found->rr_last->ttl_data[1];
- edns->bits = sldns_read_uint16(&found->rr_last->ttl_data[2]);
+ edns->bits = ldns_read_uint16(&found->rr_last->ttl_data[2]);
edns->udp_size = ntohs(found->rrset_class);
/* ignore rdata and rrsigs */
return 0;
}
int
-parse_edns_from_pkt(sldns_buffer* pkt, struct edns_data* edns)
+parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns)
{
- log_assert(LDNS_QDCOUNT(sldns_buffer_begin(pkt)) == 1);
- log_assert(LDNS_ANCOUNT(sldns_buffer_begin(pkt)) == 0);
- log_assert(LDNS_NSCOUNT(sldns_buffer_begin(pkt)) == 0);
+ log_assert(LDNS_QDCOUNT(ldns_buffer_begin(pkt)) == 1);
+ log_assert(LDNS_ANCOUNT(ldns_buffer_begin(pkt)) == 0);
+ log_assert(LDNS_NSCOUNT(ldns_buffer_begin(pkt)) == 0);
/* check edns section is present */
- if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) {
+ if(LDNS_ARCOUNT(ldns_buffer_begin(pkt)) > 1) {
return LDNS_RCODE_FORMERR;
}
- if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) == 0) {
+ if(LDNS_ARCOUNT(ldns_buffer_begin(pkt)) == 0) {
memset(edns, 0, sizeof(*edns));
edns->udp_size = 512;
return 0;
@@ -1008,15 +1004,15 @@ parse_edns_from_pkt(sldns_buffer* pkt, struct edns_data* edns)
/* domain name must be the root of length 1. */
if(pkt_dname_len(pkt) != 1)
return LDNS_RCODE_FORMERR;
- if(sldns_buffer_remaining(pkt) < 10) /* type, class, ttl, rdatalen */
+ if(ldns_buffer_remaining(pkt) < 10) /* type, class, ttl, rdatalen */
return LDNS_RCODE_FORMERR;
- if(sldns_buffer_read_u16(pkt) != LDNS_RR_TYPE_OPT)
+ if(ldns_buffer_read_u16(pkt) != LDNS_RR_TYPE_OPT)
return LDNS_RCODE_FORMERR;
edns->edns_present = 1;
- edns->udp_size = sldns_buffer_read_u16(pkt); /* class is udp size */
- edns->ext_rcode = sldns_buffer_read_u8(pkt); /* ttl used for bits */
- edns->edns_version = sldns_buffer_read_u8(pkt);
- edns->bits = sldns_buffer_read_u16(pkt);
+ edns->udp_size = ldns_buffer_read_u16(pkt); /* class is udp size */
+ edns->ext_rcode = ldns_buffer_read_u8(pkt); /* ttl used for bits */
+ edns->edns_version = ldns_buffer_read_u8(pkt);
+ edns->bits = ldns_buffer_read_u16(pkt);
/* ignore rdata and rrsigs */
return 0;
}
diff --git a/usr.sbin/unbound/util/data/msgparse.h b/usr.sbin/unbound/util/data/msgparse.h
index 44497c8ca38..830d68e16cd 100644
--- a/usr.sbin/unbound/util/data/msgparse.h
+++ b/usr.sbin/unbound/util/data/msgparse.h
@@ -21,16 +21,16 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file
@@ -63,9 +63,7 @@
#ifndef UTIL_DATA_MSGPARSE_H
#define UTIL_DATA_MSGPARSE_H
#include "util/storage/lruhash.h"
-#include "sldns/pkthdr.h"
-#include "sldns/rrdef.h"
-struct sldns_buffer;
+#include <ldns/packet.h>
struct rrset_parse;
struct rr_parse;
struct regional;
@@ -73,11 +71,9 @@ struct regional;
/** number of buckets in parse rrset hash table. Must be power of 2. */
#define PARSE_TABLE_SIZE 32
/** Maximum TTL that is allowed. */
-extern time_t MAX_TTL;
+extern uint32_t MAX_TTL;
/** Minimum TTL that is allowed. */
-extern time_t MIN_TTL;
-/** Maximum Negative TTL that is allowed */
-extern time_t MAX_NEG_TTL;
+extern uint32_t MIN_TTL;
/** Negative cache time (for entries without any RRs.) */
#define NORR_TTL 5 /* seconds */
@@ -141,7 +137,7 @@ struct rrset_parse {
/** which section was it found in: one of
* LDNS_SECTION_ANSWER, LDNS_SECTION_AUTHORITY, LDNS_SECTION_ADDITIONAL
*/
- sldns_pkt_section section;
+ ldns_pkt_section section;
/** start of (possibly compressed) dname in packet */
uint8_t* dname;
/** length of the dname uncompressed wireformat */
@@ -223,7 +219,7 @@ struct edns_data {
* @param rdf: the rdf type from the descriptor.
* @return: size in octets. 0 on failure.
*/
-size_t get_rdf_size(sldns_rdf_type rdf);
+size_t get_rdf_size(ldns_rdf_type rdf);
/**
* Parse the packet.
@@ -233,7 +229,7 @@ size_t get_rdf_size(sldns_rdf_type rdf);
* @param region: how to alloc results.
* @return: 0 if OK, or rcode on error.
*/
-int parse_packet(struct sldns_buffer* pkt, struct msg_parse* msg,
+int parse_packet(ldns_buffer* pkt, struct msg_parse* msg,
struct regional* region);
/**
@@ -263,7 +259,7 @@ int parse_extract_edns(struct msg_parse* msg, struct edns_data* edns);
* @return: 0 on success, or an RCODE on error.
* RCODE formerr if OPT is badly formatted and so on.
*/
-int parse_edns_from_pkt(struct sldns_buffer* pkt, struct edns_data* edns);
+int parse_edns_from_pkt(ldns_buffer* pkt, struct edns_data* edns);
/**
* Calculate hash value for rrset in packet.
@@ -274,7 +270,7 @@ int parse_edns_from_pkt(struct sldns_buffer* pkt, struct edns_data* edns);
* @param rrset_flags: rrset flags (same as packed_rrset flags).
* @return hash value
*/
-hashvalue_t pkt_hash_rrset(struct sldns_buffer* pkt, uint8_t* dname, uint16_t type,
+hashvalue_t pkt_hash_rrset(ldns_buffer* pkt, uint8_t* dname, uint16_t type,
uint16_t dclass, uint32_t rrset_flags);
/**
@@ -290,7 +286,7 @@ hashvalue_t pkt_hash_rrset(struct sldns_buffer* pkt, uint8_t* dname, uint16_t ty
* @return NULL or the rrset_parse if found.
*/
struct rrset_parse* msgparse_hashtable_lookup(struct msg_parse* msg,
- struct sldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags,
+ ldns_buffer* pkt, hashvalue_t h, uint32_t rrset_flags,
uint8_t* dname, size_t dnamelen, uint16_t type, uint16_t dclass);
/**