Re: nsd 4.1.19

2018-01-26 Thread Florian Obser
On Fri, Jan 26, 2018 at 05:38:46PM +, Stuart Henderson wrote:
> On 2018/01/26 18:12, Florian Obser wrote:
> > anyone else?
> > Got around to read the diff, not too much insanity in there, going to
> > commit soon.
> 
> ok with me.
> 
> > diff --git nsd.c nsd.c
> > index f2cf6ccf0cb..dfbc58696b3 100644
> > --- nsd.c
> > +++ nsd.c
> > @@ -579,6 +579,7 @@ main(int argc, char *argv[])
> > case 'v':
> > version();
> > /* version exits */
> > +   break;
> >  #ifndef NDEBUG
> > case 'F':
> > sscanf(optarg, "%x", _debug_facilities);
> > @@ -980,6 +981,7 @@ main(int argc, char *argv[])
> > break;
> > case -1:
> > error("fork() failed: %s", strerror(errno));
> > +   break;
> > default:
> > /* Parent is done */
> > server_close_all_sockets(nsd.udp, nsd.ifs);
> 
> that gcc lint thing doesn't seem particularly clever if those are needed!
> 

Indeed, there is also some comment spam that's not relevant for us, I
left that in to not create conflicts for future updates.

I like this one :D

/** Fallthrough: AXFR over UDP queries are discarded. */
+   /* fallthrough */


I dropped this though:

+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"

Don't want to find out in two weeks time what gcc on the luna88k
thinks about that...

-- 
I'm not entirely sure you are real.



Re: nsd 4.1.19

2018-01-26 Thread Stuart Henderson
On 2018/01/26 18:12, Florian Obser wrote:
> anyone else?
> Got around to read the diff, not too much insanity in there, going to
> commit soon.

ok with me.

> diff --git nsd.c nsd.c
> index f2cf6ccf0cb..dfbc58696b3 100644
> --- nsd.c
> +++ nsd.c
> @@ -579,6 +579,7 @@ main(int argc, char *argv[])
>   case 'v':
>   version();
>   /* version exits */
> + break;
>  #ifndef NDEBUG
>   case 'F':
>   sscanf(optarg, "%x", _debug_facilities);
> @@ -980,6 +981,7 @@ main(int argc, char *argv[])
>   break;
>   case -1:
>   error("fork() failed: %s", strerror(errno));
> + break;
>   default:
>   /* Parent is done */
>   server_close_all_sockets(nsd.udp, nsd.ifs);

that gcc lint thing doesn't seem particularly clever if those are needed!



Re: nsd 4.1.19

2018-01-26 Thread Florian Obser
rovide timespec def if not available */
-#ifndef CONFIG_DEFINES
-#define CONFIG_DEFINES
-#ifndef HAVE_STRUCT_TIMESPEC
-#ifndef __timespec_defined
-#define __timespec_defined 1
-   struct timespec {
-   longtv_sec; /* seconds */
-   longtv_nsec;/* nanoseconds */
-   };
-#endif /* !__timespec_defined */
-#endif /* !HAVE_STRUCT_TIMESPEC */
-#endif /* !CONFIG_DEFINES */
-
-int __b64_ntop(uint8_t const *, size_t, char *, size_t);
-int __b64_pton(char const *, uint8_t*, size_t);
diff --git configure configure
index 15ceae2b292..e73ca9121cd 100644
--- configure
+++ configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSD 4.1.17.
+# Generated by GNU Autoconf 2.69 for NSD 4.1.19.
 #
 # Report bugs to <nsd-b...@nlnetlabs.nl>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='NSD'
 PACKAGE_TARNAME='nsd'
-PACKAGE_VERSION='4.1.17'
-PACKAGE_STRING='NSD 4.1.17'
+PACKAGE_VERSION='4.1.19'
+PACKAGE_STRING='NSD 4.1.19'
 PACKAGE_BUGREPORT='nsd-b...@nlnetlabs.nl'
 PACKAGE_URL=''
 
@@ -732,6 +732,7 @@ enable_nsec3
 enable_minimal_responses
 enable_mmap
 enable_radix_tree
+enable_packed
 '
   ac_precious_vars='build_alias
 host_alias
@@ -1284,7 +1285,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 4.1.17 to adapt to many kinds of systems.
+\`configure' configures NSD 4.1.19 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1345,7 +1346,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of NSD 4.1.17:";;
+ short | recursive ) echo "Configuration of NSD 4.1.19:";;
esac
   cat <<\_ACEOF
 
@@ -1381,6 +1382,8 @@ Optional Features:
   --disable-radix-treeYou can disable the radix tree and use the red-black
   tree for the main lookups, the red-black tree uses
   less memory, but uses some more CPU.
+  --enable-packed Enable packed structure alignment, uses less memory,
+  but unaligned reads.
 
 Optional Packages:
   --with-PACKAGE[=ARG]use PACKAGE [ARG=yes]
@@ -1491,7 +1494,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-NSD configure 4.1.17
+NSD configure 4.1.19
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2200,7 +2203,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 4.1.17, which was
+It was created by NSD $as_me 4.1.19, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -8266,9 +8269,11 @@ $as_echo "no" >&6; }
fi
 fi
 if test "x$found_b64_ntop" = xyes; then
-   $as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h
 
-   $as_echo "#define HAVE_B64_PTON 1" >>confdefs.h
+$as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_B64_PTON 1" >>confdefs.h
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -9171,6 +9176,54 @@ _ACEOF
;;
 esac
 
+# Check whether --enable-packed was given.
+if test "${enable_packed+set}" = set; then :
+  enableval=$enable_packed;
+fi
+
+case "$enable_packed" in
+   yes)
+
+cat >>confdefs.h <<_ACEOF
+#define PACKED_STRUCTS /**/
+_ACEOF
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports 
-Wno-address-of-packed-member" >&5
+$as_echo_n "checking whether $CC supports -Wno-address-of-packed-member... " 
>&6; }
+cache=`echo Wno-address-of-packed-member | sed 'y%.=/+-%___p_%'`
+if eval \${cv_prog_cc_flag_$cache+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+echo 'void f(void){}' >conftest.c
+if test -z "`$CC $CPPFLAGS $CFLAGS -Wno-address-of-packed-member -c conftest.c 
2>&1`"; then
+eval "cv_prog_cc_flag_$cache=yes"
+else
+eval "cv_prog_cc_flag_$cache=no"
+fi
+rm -f conftest conftest.o conftest.c
+
+fi
+
+if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+:
+CFLAGS="$CFLAGS -Wno-address-of-packed-member"
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >

Re: nsd 4.1.19

2018-01-13 Thread Florian Obser
On Fri, Jan 12, 2018 at 11:28:48AM -0700, Todd C. Miller wrote:
> On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote:
> 
> > so, here is 4.1.19. I haven't gotten around to reading the diff yet.
> > But I tossed it in production.
> >
> > When trying to re-gen config.h.in autheader bombs out:
> >
> > [florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69
> > autoheader-2.69: warning: missing template: HAVE_B64_NTOP
> > autoheader-2.69: Use AC_DEFINE([HAVE_B64_NTOP], [], [Description])
> > autoheader-2.69: warning: missing template: HAVE_B64_PTON
> 
> This will fix it.  I guess no one tried to re-run autoheader after
> the configure.ac changes.

Indeed. Please commit, OK florian

> 
>  - todd
> 
> --- configure.ac.orig Fri Jan 12 11:27:48 2018
> +++ configure.ac  Fri Jan 12 11:27:57 2018
> @@ -687,8 +687,8 @@
>   fi
>  fi
>  if test "x$found_b64_ntop" = xyes; then
> - AC_DEFINE(HAVE_B64_NTOP)
> - AC_DEFINE(HAVE_B64_PTON)
> + AC_DEFINE(HAVE_B64_NTOP, 1, [Define to 1 if you have the `b64_ntop' 
> function.])
> + AC_DEFINE(HAVE_B64_PTON, 1, [Define to 1 if you have the `b64_ntop' 
> function.])
>   AC_MSG_RESULT(yes)
>  else
>   AC_LIBOBJ([b64_ntop])
> 

-- 
I'm not entirely sure you are real.



Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote:

> so, here is 4.1.19. I haven't gotten around to reading the diff yet.
> But I tossed it in production.

So far so good here.  A note to others, you'll need to "make cleandir"
in /usr/src/usr.sbin/nsd (or just remove /usr/obj/usr.sbin/nsd)
before rebuilding or you will get errors about ATTR_PACKED.

We may want to add a make rule to re-run configure when it changes
(or when config.h.in changes) to avoid this kind of problem.

 - todd



Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote:

> so, here is 4.1.19. I haven't gotten around to reading the diff yet.
> But I tossed it in production.
>
> When trying to re-gen config.h.in autheader bombs out:
>
> [florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69
> autoheader-2.69: warning: missing template: HAVE_B64_NTOP
> autoheader-2.69: Use AC_DEFINE([HAVE_B64_NTOP], [], [Description])
> autoheader-2.69: warning: missing template: HAVE_B64_PTON

This will fix it.  I guess no one tried to re-run autoheader after
the configure.ac changes.

 - todd

--- configure.ac.orig   Fri Jan 12 11:27:48 2018
+++ configure.acFri Jan 12 11:27:57 2018
@@ -687,8 +687,8 @@
fi
 fi
 if test "x$found_b64_ntop" = xyes; then
-   AC_DEFINE(HAVE_B64_NTOP)
-   AC_DEFINE(HAVE_B64_PTON)
+   AC_DEFINE(HAVE_B64_NTOP, 1, [Define to 1 if you have the `b64_ntop' 
function.])
+   AC_DEFINE(HAVE_B64_PTON, 1, [Define to 1 if you have the `b64_ntop' 
function.])
AC_MSG_RESULT(yes)
 else
AC_LIBOBJ([b64_ntop])



Re: nsd 4.1.19

2018-01-12 Thread Florian Obser

Oh and yes, that packed BS is completely retarded.

Seeing how many commits it took to have it not constantly spass out on
different compilers, it's amazing that someone didn't take the hint and
gave up on it. No idea what the usecase is suppsed to be.

-- 
I'm not entirely sure you are real.



nsd 4.1.19

2018-01-12 Thread Florian Obser
so, here is 4.1.19. I haven't gotten around to reading the diff yet.
But I tossed it in production.

When trying to re-gen config.h.in autheader bombs out:

[florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69
autoheader-2.69: warning: missing template: HAVE_B64_NTOP
autoheader-2.69: Use AC_DEFINE([HAVE_B64_NTOP], [], [Description])
autoheader-2.69: warning: missing template: HAVE_B64_PTON

I suppose this has something to do with our b64 half-arsery?
Anyone has a clue? For now I copied config.h.in from the
release tgz.

Tests, OKs?

diff --git Makefile.in Makefile.in
index 495160c0826..3468101c19d 100644
--- Makefile.in
+++ Makefile.in
@@ -286,9 +286,6 @@ 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"' > $@ ;\
@@ -516,7 +513,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 \
+xfr-inspect.o: $(srcdir)/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 axfr.c axfr.c
index 6f6b0957e99..dd34c0c3cee 100644
--- axfr.c
+++ axfr.c
@@ -201,6 +201,7 @@ answer_axfr_ixfr(struct nsd *nsd, struct query *q)
return query_axfr(nsd, q);
}
/** Fallthrough: AXFR over UDP queries are discarded. */
+   /* fallthrough */
case TYPE_IXFR:
RCODE_SET(q->packet, RCODE_IMPL);
return QUERY_PROCESSED;
diff --git config.h.in config.h.in
index 6c44616432f..34091d5eb3f 100644
--- config.h.in
+++ config.h.in
@@ -73,6 +73,9 @@
 /* Define to 1 if you have the `endpwent' function. */
 #undef HAVE_ENDPWENT
 
+/* Define to 1 if you have the `ERR_load_crypto_strings' function. */
+#undef HAVE_ERR_LOAD_CRYPTO_STRINGS
+
 /* Define to 1 if you have the `event_base_free' function. */
 #undef HAVE_EVENT_BASE_FREE
 
@@ -88,6 +91,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_EVENT_H
 
+/* Define to 1 if you have the `EVP_cleanup' function. */
+#undef HAVE_EVP_CLEANUP
+
 /* Define to 1 if you have the `ev_default_loop' function. */
 #undef HAVE_EV_DEFAULT_LOOP
 
@@ -194,6 +200,12 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_OPENSSL_ERR_H
 
+/* Define to 1 if you have the `OPENSSL_init_crypto' function. */
+#undef HAVE_OPENSSL_INIT_CRYPTO
+
+/* Define to 1 if you have the `OPENSSL_init_ssl' function. */
+#undef HAVE_OPENSSL_INIT_SSL
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_OPENSSL_RAND_H
 
@@ -426,6 +438,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Define this to use packed structure alignment. */
+#undef PACKED_STRUCTS
+
 /* Pathname to the NSD pidfile */
 #undef PIDFILE
 
@@ -483,6 +498,9 @@
 /* Define this to enable mmap instead of malloc. Experimental. */
 #undef USE_MMAP_ALLOC
 
+/* Define this to configure to use the radix tree. */
+#undef USE_RADIX_TREE
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
@@ -817,5 +835,11 @@ int memcmp(const void *x, const void *y, size_t n);
 #endif /* !HAVE_STRUCT_TIMESPEC */
 #endif /* !CONFIG_DEFINES */
 
+#ifdef PACKED_STRUCTS
+#define ATTR_PACKED __attribute__((packed))
+#else
+#define ATTR_PACKED
+#endif
+
 int __b64_ntop(uint8_t const *, size_t, char *, size_t);
 int __b64_pton(char const *, uint8_t*, size_t);
diff --git configure configure
index 15ceae2b292..c8a8743f384 100644
--- configure
+++ configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSD 4.1.17.
+# Generated by GNU Autoconf 2.69 for NSD 4.1.19.
 #
 # Report bugs to <nsd-b...@nlnetlabs.nl>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='NSD'
 PACKAGE_TARNAME='nsd'
-PACKAGE_VERSION='4.1.17'
-PACKAGE_STRING='NSD 4.1.17'
+PAC