summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2017-08-11 12:51:43 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2017-08-11 12:51:43 +0000
commit2d70ce1a227e03b941e1f24d64265d32c9203724 (patch)
treead6aa7dd243bd9f737adb5f54ce57195a22217d6 /usr.sbin
parent879b26c96d81d0e2597ee5695c81ec07e329768d (diff)
update to 4.1.17
OK sthen
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/nsd/Makefile.in15
-rw-r--r--usr.sbin/nsd/configure.ac2
-rw-r--r--usr.sbin/nsd/dns.c4
-rw-r--r--usr.sbin/nsd/dns.h5
-rw-r--r--usr.sbin/nsd/namedb.c1
-rw-r--r--usr.sbin/nsd/rdata.c12
-rw-r--r--usr.sbin/nsd/xfrd-tcp.c19
-rw-r--r--usr.sbin/nsd/zonec.c8
8 files changed, 58 insertions, 8 deletions
diff --git a/usr.sbin/nsd/Makefile.in b/usr.sbin/nsd/Makefile.in
index 3391cd0d4b2..495160c0826 100644
--- a/usr.sbin/nsd/Makefile.in
+++ b/usr.sbin/nsd/Makefile.in
@@ -169,8 +169,11 @@ cutest: $(CUTEST_OBJ) $(LIBOBJS)
udb-inspect: udb-inspect.o $(COMMON_OBJ) $(LIBOBJS)
$(LINK) -o $@ udb-inspect.o $(COMMON_OBJ) $(LIBOBJS) $(LIBS)
+xfr-inspect: xfr-inspect.o $(COMMON_OBJ) $(LIBOBJS)
+ $(LINK) -o $@ xfr-inspect.o $(COMMON_OBJ) $(LIBOBJS) $(LIBS)
+
clean:
- rm -f *.o $(TARGETS) $(MANUALS) cutest udb-inspect nsd-mem
+ rm -f *.o $(TARGETS) $(MANUALS) cutest udb-inspect xfr-inspect nsd-mem
realclean: clean
rm -f Makefile config.h config.log config.status
@@ -283,6 +286,9 @@ qtest.o: $(srcdir)/tpkg/cutest/qtest.c
udb-inspect.o: $(srcdir)/tpkg/cutest/udb-inspect.c
$(COMPILE) -c $(srcdir)/tpkg/cutest/udb-inspect.c
+xfr-inspect.o: $(srcdir)/tpkg/cutest/xfr-inspect.c
+ $(COMPILE) -c $(srcdir)/tpkg/cutest/xfr-inspect.c
+
zlexer.c: $(srcdir)/zlexer.lex
if test "$(LEX)" != ":"; then rm -f $@ ;\
echo '#include "config.h"' > $@ ;\
@@ -366,7 +372,8 @@ dname.o: $(srcdir)/dname.c config.h $(srcdir)/dns.h $(srcdir)/dname.h $(srcdir)/
$(srcdir)/util.h $(srcdir)/query.h $(srcdir)/namedb.h $(srcdir)/radtree.h $(srcdir)/rbtree.h $(srcdir)/nsd.h $(srcdir)/edns.h $(srcdir)/packet.h $(srcdir)/tsig.h
dns.o: $(srcdir)/dns.c config.h $(srcdir)/dns.h $(srcdir)/zonec.h $(srcdir)/namedb.h $(srcdir)/dname.h $(srcdir)/buffer.h \
$(srcdir)/region-allocator.h $(srcdir)/util.h $(srcdir)/radtree.h $(srcdir)/rbtree.h zparser.h
-edns.o: $(srcdir)/edns.c config.h $(srcdir)/dns.h $(srcdir)/edns.h $(srcdir)/buffer.h $(srcdir)/region-allocator.h $(srcdir)/util.h
+edns.o: $(srcdir)/edns.c config.h $(srcdir)/dns.h $(srcdir)/edns.h $(srcdir)/buffer.h $(srcdir)/region-allocator.h $(srcdir)/util.h \
+ $(srcdir)/nsd.h $(srcdir)/query.h $(srcdir)/namedb.h $(srcdir)/dname.h $(srcdir)/radtree.h $(srcdir)/rbtree.h $(srcdir)/packet.h $(srcdir)/tsig.h
ipc.o: $(srcdir)/ipc.c config.h $(srcdir)/ipc.h $(srcdir)/netio.h $(srcdir)/region-allocator.h $(srcdir)/buffer.h $(srcdir)/util.h \
$(srcdir)/xfrd-tcp.h $(srcdir)/xfrd.h $(srcdir)/rbtree.h $(srcdir)/namedb.h $(srcdir)/dname.h $(srcdir)/dns.h $(srcdir)/radtree.h $(srcdir)/options.h \
$(srcdir)/tsig.h $(srcdir)/nsd.h $(srcdir)/edns.h $(srcdir)/xfrd-notify.h $(srcdir)/difffile.h $(srcdir)/udb.h
@@ -509,3 +516,7 @@ udb-inspect.o: $(srcdir)/tpkg/cutest/udb-inspect.c config.h $(srcdir)/udb.h $(sr
$(srcdir)/udb.h $(srcdir)/udbzone.h $(srcdir)/dns.h $(srcdir)/udbradtree.h $(srcdir)/util.h $(srcdir)/buffer.h $(srcdir)/region-allocator.h \
$(srcdir)/util.h $(srcdir)/packet.h $(srcdir)/namedb.h $(srcdir)/dname.h $(srcdir)/buffer.h $(srcdir)/radtree.h $(srcdir)/rbtree.h $(srcdir)/rdata.h \
$(srcdir)/namedb.h $(srcdir)/difffile.h $(srcdir)/options.h config.h
+xfr-inspect.o: $(srcdir)/tpkg/cutest/xfr-inspect.c config.h $(srcdir)/udbzone.h $(srcdir)/udb.h $(srcdir)/dns.h \
+ $(srcdir)/udbradtree.h $(srcdir)/util.h $(srcdir)/buffer.h $(srcdir)/region-allocator.h $(srcdir)/util.h $(srcdir)/packet.h $(srcdir)/namedb.h \
+ $(srcdir)/dname.h $(srcdir)/buffer.h $(srcdir)/radtree.h $(srcdir)/rbtree.h $(srcdir)/rdata.h $(srcdir)/namedb.h $(srcdir)/difffile.h \
+ $(srcdir)/options.h config.h
diff --git a/usr.sbin/nsd/configure.ac b/usr.sbin/nsd/configure.ac
index e9cba15c44a..89d69d88ebe 100644
--- a/usr.sbin/nsd/configure.ac
+++ b/usr.sbin/nsd/configure.ac
@@ -4,7 +4,7 @@ dnl
sinclude(acx_nlnetlabs.m4)
-AC_INIT(NSD,4.1.16,nsd-bugs@nlnetlabs.nl)
+AC_INIT(NSD,4.1.17,nsd-bugs@nlnetlabs.nl)
AC_CONFIG_HEADER([config.h])
CFLAGS="$CFLAGS"
diff --git a/usr.sbin/nsd/dns.c b/usr.sbin/nsd/dns.c
index c50fbe78bfe..9d8ac8a545c 100644
--- a/usr.sbin/nsd/dns.c
+++ b/usr.sbin/nsd/dns.c
@@ -739,6 +739,10 @@ static rrtype_descriptor_type rrtype_descriptors[(RRTYPE_DESCRIPTORS_LENGTH+1)]
{ TYPE_CAA, "CAA", T_CAA, 3, 3,
{ RDATA_WF_BYTE, RDATA_WF_TEXT, RDATA_WF_LONG_TEXT },
{ RDATA_ZF_BYTE, RDATA_ZF_TAG, RDATA_ZF_LONG_TEXT } },
+ /* 258 - AVC */
+ { TYPE_AVC, "AVC", T_AVC, 1, 1,
+ { RDATA_WF_TEXTS },
+ { RDATA_ZF_TEXTS } },
/* 32768 - TA */
/* 32769 */
diff --git a/usr.sbin/nsd/dns.h b/usr.sbin/nsd/dns.h
index 5fc35046c40..54dddefbfd9 100644
--- a/usr.sbin/nsd/dns.h
+++ b/usr.sbin/nsd/dns.h
@@ -158,6 +158,7 @@ typedef enum nsd_rc nsd_rc_type;
#define TYPE_ANY 255 /* any type (wildcard) */
#define TYPE_URI 256 /* RFC 7553 */
#define TYPE_CAA 257 /* RFC 6844 */
+#define TYPE_AVC 258
#define TYPE_DLV 32769 /* RFC 4431 */
#define PSEUDO_TYPE_DLV RRTYPE_DESCRIPTORS_LENGTH
@@ -260,9 +261,9 @@ typedef struct rrtype_descriptor rrtype_descriptor_type;
* Indexed by type. The special type "0" can be used to get a
* descriptor for unknown types (with one binary rdata).
*
- * CAA + 1
+ * AVC + 1
*/
-#define RRTYPE_DESCRIPTORS_LENGTH (TYPE_CAA + 1)
+#define RRTYPE_DESCRIPTORS_LENGTH (TYPE_AVC + 1)
rrtype_descriptor_type *rrtype_descriptor_by_name(const char *name);
rrtype_descriptor_type *rrtype_descriptor_by_type(uint16_t type);
diff --git a/usr.sbin/nsd/namedb.c b/usr.sbin/nsd/namedb.c
index f59f0b76fa3..bcc41aad926 100644
--- a/usr.sbin/nsd/namedb.c
+++ b/usr.sbin/nsd/namedb.c
@@ -305,6 +305,7 @@ void zone_add_domain_in_hash_tree(region_type* region, rbtree_type** tree,
{
if(!*tree)
*tree = rbtree_create(region, cmpf);
+ if(node->key) return;
memset(node, 0, sizeof(rbnode_type));
node->key = domain;
rbtree_insert(*tree, node);
diff --git a/usr.sbin/nsd/rdata.c b/usr.sbin/nsd/rdata.c
index 3368e69fa7c..68d03ce82e2 100644
--- a/usr.sbin/nsd/rdata.c
+++ b/usr.sbin/nsd/rdata.c
@@ -396,8 +396,11 @@ rdata_base64_to_string(buffer_type *output, rdata_atom_type rdata,
{
int length;
size_t size = rdata_atom_size(rdata);
- if(size == 0)
+ if(size == 0) {
+ /* single zero represents empty buffer */
+ buffer_write(output, "0", 1);
return 1;
+ }
buffer_reserve(output, size * 2 + 1);
length = __b64_ntop(rdata_atom_data(rdata), size,
(char *) buffer_current(output), size * 2);
@@ -428,7 +431,12 @@ static int
rdata_hex_to_string(buffer_type *output, rdata_atom_type rdata,
rr_type* ATTR_UNUSED(rr))
{
- hex_to_string(output, rdata_atom_data(rdata), rdata_atom_size(rdata));
+ if(rdata_atom_size(rdata) == 0) {
+ /* single zero represents empty buffer, such as CDS deletes */
+ buffer_printf(output, "0");
+ } else {
+ hex_to_string(output, rdata_atom_data(rdata), rdata_atom_size(rdata));
+ }
return 1;
}
diff --git a/usr.sbin/nsd/xfrd-tcp.c b/usr.sbin/nsd/xfrd-tcp.c
index 70eef515b58..2715689439f 100644
--- a/usr.sbin/nsd/xfrd-tcp.c
+++ b/usr.sbin/nsd/xfrd-tcp.c
@@ -642,9 +642,18 @@ int conn_write(struct xfrd_tcp* tcp)
if(tcp->total_bytes < sizeof(tcp->msglen)) {
uint16_t sendlen = htons(tcp->msglen);
+#ifdef HAVE_WRITEV
+ struct iovec iov[2];
+ iov[0].iov_base = (uint8_t*)&sendlen + tcp->total_bytes;
+ iov[0].iov_len = sizeof(sendlen) - tcp->total_bytes;
+ iov[1].iov_base = buffer_begin(tcp->packet);
+ iov[1].iov_len = buffer_limit(tcp->packet);
+ sent = writev(tcp->fd, iov, 2);
+#else /* HAVE_WRITEV */
sent = write(tcp->fd,
(const char*)&sendlen + tcp->total_bytes,
sizeof(tcp->msglen) - tcp->total_bytes);
+#endif /* HAVE_WRITEV */
if(sent == -1) {
if(errno == EAGAIN || errno == EINTR) {
@@ -656,11 +665,19 @@ int conn_write(struct xfrd_tcp* tcp)
}
tcp->total_bytes += sent;
+ if(sent > (ssize_t)sizeof(tcp->msglen))
+ buffer_skip(tcp->packet, sent-sizeof(tcp->msglen));
if(tcp->total_bytes < sizeof(tcp->msglen)) {
/* incomplete write, resume later */
return 0;
}
- assert(tcp->total_bytes == sizeof(tcp->msglen));
+#ifdef HAVE_WRITEV
+ if(tcp->total_bytes == tcp->msglen + sizeof(tcp->msglen)) {
+ /* packet done */
+ return 1;
+ }
+#endif
+ assert(tcp->total_bytes >= sizeof(tcp->msglen));
}
assert(tcp->total_bytes < tcp->msglen + sizeof(tcp->msglen));
diff --git a/usr.sbin/nsd/zonec.c b/usr.sbin/nsd/zonec.c
index 02e1a056b83..1b20b84d90f 100644
--- a/usr.sbin/nsd/zonec.c
+++ b/usr.sbin/nsd/zonec.c
@@ -89,6 +89,10 @@ zparser_conv_hex(region_type *region, const char *hex, size_t len)
uint8_t *t;
int i;
+ if(len == 1 && hex[0] == '0') {
+ /* single 0 represents empty buffer */
+ return alloc_rdata(region, 0);
+ }
if (len % 2 != 0) {
zc_error_prev_line("number of hex digits must be a multiple of 2");
} else if (len > MAX_RDLENGTH * 2) {
@@ -639,6 +643,10 @@ zparser_conv_b64(region_type *region, const char *b64)
uint16_t *r = NULL;
int i;
+ if(strcmp(b64, "0") == 0) {
+ /* single 0 represents empty buffer */
+ return alloc_rdata(region, 0);
+ }
i = __b64_pton(b64, buffer, B64BUFSIZE);
if (i == -1) {
zc_error_prev_line("invalid base64 data");