diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-11-23 20:30:27 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-11-23 20:30:27 +0000 |
commit | 86a833612919dac1402816d877b573288b333507 (patch) | |
tree | f77fc8e7d41a1726e649248fd6343841b1bfc449 /usr.sbin | |
parent | 4f2dfd8624d5483f761809d6816f2da1e9aaf2d8 (diff) |
resolve conflicts
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/nsd/axfr.c | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/config.h.in | 11 | ||||
-rw-r--r-- | usr.sbin/nsd/configure | 20 | ||||
-rw-r--r-- | usr.sbin/nsd/configure.ac | 5 | ||||
-rw-r--r-- | usr.sbin/nsd/dname.c | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/dns.h | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-checkconf.8.in | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-notify.8.in | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-notify.c | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-patch.8.in | 4 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-patch.c | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-xfer.8.in | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd-xfer.c | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd.8.in | 4 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd.c | 10 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd.conf.5.in | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsdc.8.in | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/nsec3.c | 7 | ||||
-rw-r--r-- | usr.sbin/nsd/query.c | 10 | ||||
-rw-r--r-- | usr.sbin/nsd/server.c | 35 | ||||
-rw-r--r-- | usr.sbin/nsd/xfrd-tcp.c | 6 | ||||
-rw-r--r-- | usr.sbin/nsd/zonec.8.in | 4 | ||||
-rw-r--r-- | usr.sbin/nsd/zonec.c | 15 |
23 files changed, 96 insertions, 54 deletions
diff --git a/usr.sbin/nsd/axfr.c b/usr.sbin/nsd/axfr.c index 341e00b25f3..b921a45197e 100644 --- a/usr.sbin/nsd/axfr.c +++ b/usr.sbin/nsd/axfr.c @@ -189,6 +189,7 @@ answer_axfr_ixfr(struct nsd *nsd, struct query *q) acl->ip_address_spec, acl->key_name?acl->key_name:"NOKEY")); return query_axfr(nsd, q); } + /** Fallthrough: AXFR over UDP queries are discarded. */ case TYPE_IXFR: RCODE_SET(q->packet, RCODE_IMPL); return QUERY_PROCESSED; diff --git a/usr.sbin/nsd/config.h.in b/usr.sbin/nsd/config.h.in index 8d75e5e9ed8..a9e30685cea 100644 --- a/usr.sbin/nsd/config.h.in +++ b/usr.sbin/nsd/config.h.in @@ -275,6 +275,9 @@ /* Define to 1 if you have the <time.h> header file. */ #undef HAVE_TIME_H +/* Define to 1 if you have the `tzset' function. */ +#undef HAVE_TZSET + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H @@ -293,6 +296,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the `writev' function. */ +#undef HAVE_WRITEV + /* Define to the default nsd identity. */ #undef IDENTITY @@ -667,6 +673,11 @@ int memcmp(const void *x, const void *y, size_t n); #endif +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + + diff --git a/usr.sbin/nsd/configure b/usr.sbin/nsd/configure index dc4edae718b..7a2dceb34d4 100644 --- a/usr.sbin/nsd/configure +++ b/usr.sbin/nsd/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for NSD 3.2.13. +# Generated by GNU Autoconf 2.68 for NSD 3.2.14. # # Report bugs to <nsd-bugs@nlnetlabs.nl>. # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='NSD' PACKAGE_TARNAME='nsd' -PACKAGE_VERSION='3.2.13' -PACKAGE_STRING='NSD 3.2.13' +PACKAGE_VERSION='3.2.14' +PACKAGE_STRING='NSD 3.2.14' PACKAGE_BUGREPORT='nsd-bugs@nlnetlabs.nl' PACKAGE_URL='' @@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures NSD 3.2.13 to adapt to many kinds of systems. +\`configure' configures NSD 3.2.14 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1319,7 +1319,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of NSD 3.2.13:";; + short | recursive ) echo "Configuration of NSD 3.2.14:";; esac cat <<\_ACEOF @@ -1447,7 +1447,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -NSD configure 3.2.13 +NSD configure 3.2.14 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1927,7 +1927,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by NSD $as_me 3.2.13, which was +It was created by NSD $as_me 3.2.14, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -6815,7 +6815,7 @@ _ACEOF fi done -for ac_func in alarm chroot dup2 endpwent gethostname memset memcpy socket strcasecmp strchr strdup strerror strncasecmp strtol getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime setusercontext initgroups setresuid setreuid setresgid setregid getpwnam +for ac_func in tzset alarm chroot dup2 endpwent gethostname memset memcpy socket strcasecmp strchr strdup strerror strncasecmp strtol writev getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime setusercontext initgroups setresuid setreuid setresgid setregid getpwnam do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -8162,7 +8162,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by NSD $as_me 3.2.13, which was +This file was extended by NSD $as_me 3.2.14, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8224,7 +8224,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -NSD config.status 3.2.13 +NSD config.status 3.2.14 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/usr.sbin/nsd/configure.ac b/usr.sbin/nsd/configure.ac index 908518c3592..d03e0753bc1 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,3.2.13,nsd-bugs@nlnetlabs.nl) +AC_INIT(NSD,3.2.14,nsd-bugs@nlnetlabs.nl) AC_CONFIG_HEADER([config.h]) AC_AIX @@ -474,7 +474,7 @@ AC_TYPE_SIGNAL AC_FUNC_FSEEKO AC_SYS_LARGEFILE AC_CHECK_FUNCS([arc4random arc4random_uniform]) -AC_CHECK_FUNCS([alarm chroot dup2 endpwent gethostname memset memcpy socket strcasecmp strchr strdup strerror strncasecmp strtol getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime setusercontext initgroups setresuid setreuid setresgid setregid getpwnam]) +AC_CHECK_FUNCS([tzset alarm chroot dup2 endpwent gethostname memset memcpy socket strcasecmp strchr strdup strerror strncasecmp strtol writev getaddrinfo getnameinfo freeaddrinfo gai_strerror sigaction sigprocmask strptime setusercontext initgroups setresuid setreuid setresgid setregid getpwnam]) # check if setreuid en setregid fail, on MacOSX10.4(darwin8). if echo $build_os | grep darwin8 > /dev/null; then @@ -807,6 +807,7 @@ char *strptime(const char *s, const char *format, struct tm *tm); ]) AH_BOTTOM( AHX_MEMCMP_BROKEN(nsd) +AHX_CONFIG_MAXHOSTNAMELEN ) AH_BOTTOM([ diff --git a/usr.sbin/nsd/dname.c b/usr.sbin/nsd/dname.c index 4e29782faff..6eaf2e570bc 100644 --- a/usr.sbin/nsd/dname.c +++ b/usr.sbin/nsd/dname.c @@ -571,4 +571,4 @@ dname_make_wildcard(struct region *region, *wildcard = new_dname; return 0; } -#endif
\ No newline at end of file +#endif diff --git a/usr.sbin/nsd/dns.h b/usr.sbin/nsd/dns.h index 72982e0e7ae..f4cd1f8334a 100644 --- a/usr.sbin/nsd/dns.h +++ b/usr.sbin/nsd/dns.h @@ -135,7 +135,7 @@ typedef enum nsd_rc nsd_rc_type; #define TYPE_DHCID 49 /* RFC4701 DHCP information */ #define TYPE_NSEC3 50 /* NSEC3, secure denial, prevents zonewalking */ #define TYPE_NSEC3PARAM 51 /* NSEC3PARAM at zone apex nsec3 parameters */ -#define TYPE_TLSA 52 /* draft-ietf-dane-protocol */ +#define TYPE_TLSA 52 /* RFC 6698 */ #define TYPE_SPF 99 /* RFC 4408 */ diff --git a/usr.sbin/nsd/nsd-checkconf.8.in b/usr.sbin/nsd/nsd-checkconf.8.in index 6680f62553c..ef7ff02c18e 100644 --- a/usr.sbin/nsd/nsd-checkconf.8.in +++ b/usr.sbin/nsd/nsd-checkconf.8.in @@ -1,4 +1,4 @@ -.TH "nsd\-checkconf" "8" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd\-checkconf" "8" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" diff --git a/usr.sbin/nsd/nsd-notify.8.in b/usr.sbin/nsd/nsd-notify.8.in index f2d032bfce5..6106f3e841d 100644 --- a/usr.sbin/nsd/nsd-notify.8.in +++ b/usr.sbin/nsd/nsd-notify.8.in @@ -1,4 +1,4 @@ -.TH "nsd\-notify" "8" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd\-notify" "8" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" diff --git a/usr.sbin/nsd/nsd-notify.c b/usr.sbin/nsd/nsd-notify.c index bef9aa64ef2..91fd591340e 100644 --- a/usr.sbin/nsd/nsd-notify.c +++ b/usr.sbin/nsd/nsd-notify.c @@ -220,7 +220,6 @@ add_key(region_type* region, const char* opt, tsig_algorithm_type** algo) } if (!(*algo)) { - *delim2 = ':'; log_msg(LOG_ERR, "bad tsig algorithm %s", opt); return 0; } diff --git a/usr.sbin/nsd/nsd-patch.8.in b/usr.sbin/nsd/nsd-patch.8.in index fa64313ec03..77c4af9ab68 100644 --- a/usr.sbin/nsd/nsd-patch.8.in +++ b/usr.sbin/nsd/nsd-patch.8.in @@ -1,10 +1,10 @@ -.TH "nsd\-patch" "8" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd\-patch" "8" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" .LP .B nsd\-patch -\- NSD zone patcher version 3.2.13. +\- NSD zone patcher version 3.2.14. .SH "SYNOPSIS" .B nsd\-patch .RB [ \-c diff --git a/usr.sbin/nsd/nsd-patch.c b/usr.sbin/nsd/nsd-patch.c index 3cbd6b07189..6b722122291 100644 --- a/usr.sbin/nsd/nsd-patch.c +++ b/usr.sbin/nsd/nsd-patch.c @@ -173,6 +173,7 @@ exist_difffile(struct nsd_options* opt) file, strerror(errno)); return 0; } + fclose(f); return 1; } diff --git a/usr.sbin/nsd/nsd-xfer.8.in b/usr.sbin/nsd/nsd-xfer.8.in index 3f875b7cb66..938ee7f0cb7 100644 --- a/usr.sbin/nsd/nsd-xfer.8.in +++ b/usr.sbin/nsd/nsd-xfer.8.in @@ -1,4 +1,4 @@ -.TH "nsd\-xfer" "8" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd\-xfer" "8" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" diff --git a/usr.sbin/nsd/nsd-xfer.c b/usr.sbin/nsd/nsd-xfer.c index d344974c6f8..551ae816da1 100644 --- a/usr.sbin/nsd/nsd-xfer.c +++ b/usr.sbin/nsd/nsd-xfer.c @@ -28,12 +28,10 @@ #include "dns.h" #include "packet.h" #include "query.h" -#include "rdata.h" #include "region-allocator.h" #include "tsig.h" #include "tsig-openssl.h" #include "util.h" -#include "zonec.h" /* diff --git a/usr.sbin/nsd/nsd.8.in b/usr.sbin/nsd/nsd.8.in index ed6c41f289b..144af781ffa 100644 --- a/usr.sbin/nsd/nsd.8.in +++ b/usr.sbin/nsd/nsd.8.in @@ -1,10 +1,10 @@ -.TH "NSD" "8" "Jul 27, 2012" "NLnet Labs" "NSD 3.2.13" +.TH "NSD" "8" "Nov 1, 2012" "NLnet Labs" "NSD 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" .LP .B nsd -\- Name Server Daemon (NSD) version 3.2.13. +\- Name Server Daemon (NSD) version 3.2.14. .SH "SYNOPSIS" .LP .B nsd diff --git a/usr.sbin/nsd/nsd.c b/usr.sbin/nsd/nsd.c index df82978b885..8599c01db3c 100644 --- a/usr.sbin/nsd/nsd.c +++ b/usr.sbin/nsd/nsd.c @@ -189,7 +189,7 @@ readpid(const char *file) return -1; } - pid = strtol(pidbuf, &t, 10); + pid = (pid_t) strtol(pidbuf, &t, 10); if (*t && *t != '\n') { return -1; @@ -1083,10 +1083,18 @@ main(int argc, char *argv[]) nsd.options->xfrdfile += l; nsd.options->difffile += l; +#ifdef HAVE_TZSET + /* set timezone whilst not yet in chroot */ + tzset(); +#endif if (chroot(nsd.chrootdir)) { log_msg(LOG_ERR, "unable to chroot: %s", strerror(errno)); exit(1); } + if (chdir("/")) { + log_msg(LOG_ERR, "unable to chdir to chroot: %s", strerror(errno)); + exit(1); + } DEBUG(DEBUG_IPC,1, (LOG_INFO, "changed root directory to %s", nsd.chrootdir)); } diff --git a/usr.sbin/nsd/nsd.conf.5.in b/usr.sbin/nsd/nsd.conf.5.in index 066f3e52257..92c778f54a9 100644 --- a/usr.sbin/nsd/nsd.conf.5.in +++ b/usr.sbin/nsd/nsd.conf.5.in @@ -1,4 +1,4 @@ -.TH "nsd.conf" "5" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd.conf" "5" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" diff --git a/usr.sbin/nsd/nsdc.8.in b/usr.sbin/nsd/nsdc.8.in index 0e4ae4a0b26..ac17ad66492 100644 --- a/usr.sbin/nsd/nsdc.8.in +++ b/usr.sbin/nsd/nsdc.8.in @@ -1,4 +1,4 @@ -.TH "NSDC" "8" "Jul 27, 2012" "NLnet Labs" "NSDC 3.2.13" +.TH "NSDC" "8" "Nov 1, 2012" "NLnet Labs" "NSDC 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" diff --git a/usr.sbin/nsd/nsec3.c b/usr.sbin/nsd/nsec3.c index f4e0cbc0c93..4a08bff5181 100644 --- a/usr.sbin/nsd/nsec3.c +++ b/usr.sbin/nsd/nsec3.c @@ -819,17 +819,18 @@ nsec3_add_ds_proof(struct query *query, struct answer *answer, /* prove closest provable encloser */ domain_type* par = domain->parent; domain_type* prev_par = NULL; + assert(par); /* must be provable, thus there must be a parent */ #ifdef FULL_PREHASH - while(par && !par->nsec3_is_exact) + while(!par->nsec3_is_exact) #else - while(par && !par->nsec3_cover) + while(!par->nsec3_cover) #endif { prev_par = par; par = par->parent; + assert(par); /* parent zone apex must be provable, thus this ends */ } - assert(par); /* parent zone apex must be provable, thus this ends */ nsec3_add_rrset(query, answer, AUTHORITY_SECTION, par->nsec3_cover); /* we took several steps to go to the provable parent, so diff --git a/usr.sbin/nsd/query.c b/usr.sbin/nsd/query.c index 81beac7afc3..b44472d8005 100644 --- a/usr.sbin/nsd/query.c +++ b/usr.sbin/nsd/query.c @@ -17,7 +17,6 @@ #include <ctype.h> #include <errno.h> #include <limits.h> -#include <netdb.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> @@ -384,7 +383,7 @@ process_tsig(struct query* q) static query_state_type answer_notify(struct nsd* nsd, struct query *query) { - int acl_num; + int acl_num, acl_num_xfr; acl_options_t *why; nsd_rc_type rc; @@ -411,10 +410,14 @@ answer_notify(struct nsd* nsd, struct query *query) if((acl_num = acl_check_incoming(zone_opt->allow_notify, query, &why)) != -1) { + /* Find priority candidate for request XFR. -1 if no match */ + acl_num_xfr = acl_check_incoming( + zone_opt->request_xfr, query, NULL); sig_atomic_t mode = NSD_PASS_TO_XFRD; int s = nsd->this_child->parent_fd; uint16_t sz; uint32_t acl_send = htonl(acl_num); + uint32_t acl_xfr = htonl(acl_num_xfr); size_t pos; assert(why); DEBUG(DEBUG_XFRD,1, (LOG_INFO, "got notify %s passed acl %s %s", @@ -432,7 +435,8 @@ answer_notify(struct nsd* nsd, struct query *query) !write_socket(s, &sz, sizeof(sz)) || !write_socket(s, buffer_begin(query->packet), buffer_limit(query->packet)) || - !write_socket(s, &acl_send, sizeof(acl_send))) { + !write_socket(s, &acl_send, sizeof(acl_send)) || + !write_socket(s, &acl_xfr, sizeof(acl_xfr))) { log_msg(LOG_ERR, "error in IPC notify server2main, %s", strerror(errno)); return query_error(query, NSD_RC_SERVFAIL); diff --git a/usr.sbin/nsd/server.c b/usr.sbin/nsd/server.c index b546fc7810c..aa0c659cb98 100644 --- a/usr.sbin/nsd/server.c +++ b/usr.sbin/nsd/server.c @@ -12,6 +12,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> +#include <sys/uio.h> #include <sys/wait.h> #include <netinet/in.h> @@ -750,6 +751,9 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, log_msg(LOG_ERR, "unable to reload the database: %s", strerror(errno)); exit(1); } +#ifndef FULL_PREHASH + prehash(nsd->db, 0); +#endif } if(!diff_read_file(nsd->db, nsd->options, NULL, nsd->child_count)) { log_msg(LOG_ERR, "unable to load the diff file: %s", nsd->options->difffile); @@ -808,7 +812,7 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio, /* Send quit command to parent: blocking, wait for receipt. */ do { DEBUG(DEBUG_IPC,1, (LOG_INFO, "reload: ipc send quit to main")); - if (write_socket(cmdsocket, &cmd, sizeof(cmd)) == -1) + if (!write_socket(cmdsocket, &cmd, sizeof(cmd))) { log_msg(LOG_ERR, "problems sending command from reload %d to oldnsd %d: %s", (int)nsd->pid, (int)old_pid, strerror(errno)); @@ -1020,8 +1024,7 @@ server_main(struct nsd *nsd) reload_listener.fd = -1; reload_listener.event_types = NETIO_EVENT_NONE; /* inform xfrd reload attempt ended */ - if(!write_socket(xfrd_listener.fd, - &cmd, sizeof(cmd)) == -1) { + if(!write_socket(xfrd_listener.fd, &cmd, sizeof(cmd))) { log_msg(LOG_ERR, "problems " "sending SOAEND to xfrd: %s", strerror(errno)); @@ -1174,9 +1177,9 @@ server_main(struct nsd *nsd) /* Truncate the pid file. */ if ((fd = open(nsd->pidfile, O_WRONLY | O_TRUNC, 0644)) == -1) { log_msg(LOG_ERR, "can not truncate the pid file %s: %s", nsd->pidfile, strerror(errno)); + } else { + close(fd); } - close(fd); - /* Unlink it if possible... */ unlinkpid(nsd->pidfile); @@ -1738,9 +1741,18 @@ handle_tcp_writing(netio_type *netio, if (data->bytes_transmitted < sizeof(q->tcplen)) { /* Writing the response packet length. */ uint16_t n_tcplen = htons(q->tcplen); +#ifdef HAVE_WRITEV + struct iovec iov[2]; + iov[0].iov_base = (uint8_t*)&n_tcplen + data->bytes_transmitted; + iov[0].iov_len = sizeof(n_tcplen) - data->bytes_transmitted; + iov[1].iov_base = buffer_begin(q->packet); + iov[1].iov_len = buffer_limit(q->packet); + sent = writev(handler->fd, iov, 2); +#else /* HAVE_WRITEV */ sent = write(handler->fd, (const char *) &n_tcplen + data->bytes_transmitted, sizeof(n_tcplen) - data->bytes_transmitted); +#endif /* HAVE_WRITEV */ if (sent == -1) { if (errno == EAGAIN || errno == EINTR) { /* @@ -1770,11 +1782,13 @@ handle_tcp_writing(netio_type *netio, return; } - assert(data->bytes_transmitted == sizeof(q->tcplen)); +#ifdef HAVE_WRITEV + sent -= sizeof(n_tcplen); + /* handle potential 'packet done' code */ + goto packet_could_be_done; +#endif } - assert(data->bytes_transmitted < q->tcplen + sizeof(q->tcplen)); - sent = write(handler->fd, buffer_current(q->packet), buffer_remaining(q->packet)); @@ -1798,8 +1812,11 @@ handle_tcp_writing(netio_type *netio, } } - buffer_skip(q->packet, sent); data->bytes_transmitted += sent; +#ifdef HAVE_WRITEV + packet_could_be_done: +#endif + buffer_skip(q->packet, sent); if (data->bytes_transmitted < q->tcplen + sizeof(q->tcplen)) { /* * Still more data to write when socket becomes diff --git a/usr.sbin/nsd/xfrd-tcp.c b/usr.sbin/nsd/xfrd-tcp.c index 0f09e447368..b0fea134aa1 100644 --- a/usr.sbin/nsd/xfrd-tcp.c +++ b/usr.sbin/nsd/xfrd-tcp.c @@ -181,8 +181,10 @@ xfrd_tcp_obtain(xfrd_tcp_set_t* set, xfrd_zone_t* zone) break; } } - - assert(zone->tcp_conn != -1); + /** What if there is no free tcp_buffer? return; */ + if (zone->tcp_conn < 0) { + return; + } zone->tcp_waiting = 0; diff --git a/usr.sbin/nsd/zonec.8.in b/usr.sbin/nsd/zonec.8.in index 4a66da70c57..9aee4d614cd 100644 --- a/usr.sbin/nsd/zonec.8.in +++ b/usr.sbin/nsd/zonec.8.in @@ -1,10 +1,10 @@ -.TH "nsd\-zonec" "8" "Jul 27, 2012" "NLnet Labs" "nsd 3.2.13" +.TH "nsd\-zonec" "8" "Nov 1, 2012" "NLnet Labs" "nsd 3.2.14" .\" Copyright (c) 2001\-2011, NLnet Labs. All rights reserved. .\" See LICENSE for the license. .SH "NAME" .LP .B nsd\-zonec -\- NSD zone compiler version 3.2.13. +\- NSD zone compiler version 3.2.14. .SH "SYNOPSIS" .LP .B nsd\-zonec diff --git a/usr.sbin/nsd/zonec.c b/usr.sbin/nsd/zonec.c index b719beb8057..713b35dada7 100644 --- a/usr.sbin/nsd/zonec.c +++ b/usr.sbin/nsd/zonec.c @@ -37,7 +37,6 @@ #include "rdata.h" #include "region-allocator.h" #include "util.h" -#include "zparser.h" #include "options.h" #include "nsec3.h" @@ -391,13 +390,13 @@ zparser_conv_text(region_type *region, const char *text, size_t len) if (len > 255) { zc_error_prev_line("text string is longer than 255 characters," " try splitting it into multiple parts"); - } else { - uint8_t *p; - r = alloc_rdata(region, len + 1); - p = (uint8_t *) (r + 1); - *p = len; - memcpy(p + 1, text, len); + len = 255; } + uint8_t *p; + r = alloc_rdata(region, len + 1); + p = (uint8_t *) (r + 1); + *p = len; + memcpy(p + 1, text, len); return r; } @@ -688,7 +687,7 @@ zparser_conv_loc(region_type *region, char *str) zc_error_prev_line("space expected after seconds"); return NULL; } - + /* No need for precision specifiers, it's a double */ if (sscanf(start, "%lf", &d) != 1) { zc_error_prev_line("error parsing seconds"); } |