import unbound 1.19.3, ok florian
authorsthen <sthen@openbsd.org>
Sat, 13 Apr 2024 12:23:45 +0000 (12:23 +0000)
committersthen <sthen@openbsd.org>
Sat, 13 Apr 2024 12:23:45 +0000 (12:23 +0000)
usr.sbin/unbound/dnstap/dnstap.h
usr.sbin/unbound/dnstap/dnstap.m4
usr.sbin/unbound/testcode/testpkts.c
usr.sbin/unbound/testcode/unitauth.c

index 169bdc2..77914c2 100644 (file)
@@ -133,6 +133,7 @@ dt_msg_send_client_query(struct dt_env *env,
                         struct sockaddr_storage *qsock,
                         struct sockaddr_storage *rsock,
                         enum comm_point_type cptype,
+                        void *cpssl,
                         struct sldns_buffer *qmsg,
                         struct timeval* tstamp);
 
@@ -149,6 +150,7 @@ dt_msg_send_client_response(struct dt_env *env,
                            struct sockaddr_storage *qsock,
                            struct sockaddr_storage *rsock,
                            enum comm_point_type cptype,
+                           void *cpssl,
                            struct sldns_buffer *rmsg);
 
 /**
@@ -168,6 +170,7 @@ dt_msg_send_outside_query(struct dt_env *env,
                          struct sockaddr_storage *rsock,
                          struct sockaddr_storage *qsock,
                          enum comm_point_type cptype,
+                         void *cpssl,
                          uint8_t *zone, size_t zone_len,
                          struct sldns_buffer *qmsg);
 
@@ -192,6 +195,7 @@ dt_msg_send_outside_response(struct dt_env *env,
                             struct sockaddr_storage *rsock,
                             struct sockaddr_storage *qsock,
                             enum comm_point_type cptype,
+                            void *cpssl,
                             uint8_t *zone, size_t zone_len,
                             uint8_t *qbuf, size_t qbuf_len,
                             const struct timeval *qtime,
index be8b40c..80b7bc9 100644 (file)
@@ -5,45 +5,76 @@
 # Check for required dnstap libraries and add dnstap configure args.
 AC_DEFUN([dt_DNSTAP],
 [
-  AC_ARG_ENABLE([dnstap],
-    AS_HELP_STRING([--enable-dnstap],
-                   [Enable dnstap support (requires protobuf-c)]),
-    [opt_dnstap=$enableval], [opt_dnstap=no])
+    AC_ARG_ENABLE([dnstap],
+        AS_HELP_STRING([--enable-dnstap],
+            [Enable dnstap support (requires protobuf-c)]),
+        [opt_dnstap=$enableval],
+        [opt_dnstap=no])
 
-  AC_ARG_WITH([dnstap-socket-path],
-    AS_HELP_STRING([--with-dnstap-socket-path=pathname],
-                   [set default dnstap socket path]),
-    [opt_dnstap_socket_path=$withval], [opt_dnstap_socket_path="$1"])
+    AC_ARG_WITH([dnstap-socket-path],
+        AS_HELP_STRING([--with-dnstap-socket-path=pathname],
+            [set default dnstap socket path]),
+        [opt_dnstap_socket_path=$withval],
+        [opt_dnstap_socket_path="$1"])
 
-  if test "x$opt_dnstap" != "xno"; then
-    AC_PATH_PROG([PROTOC_C], [protoc-c])
-    if test -z "$PROTOC_C"; then
-      AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
+    if test "x$opt_dnstap" != "xno"; then
+        AC_PATH_PROG([PROTOC_C], [protoc-c])
+        if test -z "$PROTOC_C"; then
+          AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
+        fi
+        AC_ARG_WITH([protobuf-c],
+            AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]),
+            [
+                # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
+                if test -f $withval/include/google/protobuf-c/protobuf-c.h; then
+                    CFLAGS="$CFLAGS -I$withval/include/google"
+                else
+                    CFLAGS="$CFLAGS -I$withval/include"
+                fi
+                LDFLAGS="$LDFLAGS -L$withval/lib"
+            ],
+            [
+                ifdef([PKG_CHECK_MODULES],
+                    [
+                        PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c],
+                            [
+                                CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS"
+                                LIBS="$LIBS $PROTOBUFC_LIBS"
+                            ],
+                            [
+                                # pkg-config failed; try falling back to known values
+                                # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
+                                if test -f /usr/include/google/protobuf-c/protobuf-c.h; then
+                                    CFLAGS="$CFLAGS -I/usr/include/google"
+                                else
+                                    if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then
+                                        CFLAGS="$CFLAGS -I/usr/local/include/google"
+                                        LDFLAGS="$LDFLAGS -L/usr/local/lib"
+                                    else
+                                        AC_MSG_ERROR([The protobuf-c package was not found with pkg-config. Please install protobuf-c!])
+                                    fi
+                                fi
+                            ]
+                        )
+                    ],
+                    [
+                        # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
+                        if test -f /usr/include/google/protobuf-c/protobuf-c.h; then
+                            CFLAGS="$CFLAGS -I/usr/include/google"
+                        else
+                            if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then
+                                CFLAGS="$CFLAGS -I/usr/local/include/google"
+                                LDFLAGS="$LDFLAGS -L/usr/local/lib"
+                            fi
+                        fi
+                    ]
+                )
+            ]
+        )
+        AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
+            AC_MSG_ERROR([The protobuf-c library was not found. Please install the development libraries for protobuf-c!]))
+        $2
+    else
+        $3
     fi
-    AC_ARG_WITH([protobuf-c], AS_HELP_STRING([--with-protobuf-c=path],
-       [Path where protobuf-c is installed, for dnstap]), [
-         # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
-         if test -f $withval/include/google/protobuf-c/protobuf-c.h; then
-           CFLAGS="$CFLAGS -I$withval/include/google"
-         else
-           CFLAGS="$CFLAGS -I$withval/include"
-         fi
-         LDFLAGS="$LDFLAGS -L$withval/lib"
-       ], [
-         # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
-         if test -f /usr/include/google/protobuf-c/protobuf-c.h; then
-           CFLAGS="$CFLAGS -I/usr/include/google"
-         else
-           if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then
-             CFLAGS="$CFLAGS -I/usr/local/include/google"
-             LDFLAGS="$LDFLAGS -L/usr/local/lib"
-           fi
-         fi
-    ])
-    AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
-      AC_MSG_ERROR([The protobuf-c library was not found. Please install the development libraries for protobuf-c!]))
-    $2
-  else
-    $3
-  fi
 ])
index aa852f0..8c68c48 100644 (file)
@@ -470,6 +470,7 @@ get_origin(const char* name, struct sldns_file_parse_state* pstate, char* parse)
        store = *end;
        *end = 0;
        verbose(3, "parsing '%s'\n", parse);
+       pstate->origin_len = sizeof(pstate->origin);
        status = sldns_str2wire_dname_buf(parse, pstate->origin,
                &pstate->origin_len);
        *end = store;
index 11eeb43..23c57e0 100644 (file)
@@ -279,14 +279,14 @@ static struct q_ans example_com_queries[] = {
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir.example.com.    3600    IN      DNAME   redir.example.org.\n"
-"abc.redir.example.com.        0       IN      CNAME   abc.redir.example.org.\n"
+"abc.redir.example.com.        3600    IN      CNAME   abc.redir.example.org.\n"
        },
 
        { "example.com", "foo.abc.redir.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir.example.com.    3600    IN      DNAME   redir.example.org.\n"
-"foo.abc.redir.example.com.    0       IN      CNAME   foo.abc.redir.example.org.\n"
+"foo.abc.redir.example.com.    3600    IN      CNAME   foo.abc.redir.example.org.\n"
        },
 
        { "example.com", "redir2.example.com. DNAME", "",
@@ -299,42 +299,42 @@ static struct q_ans example_com_queries[] = {
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"abc.redir2.example.com.       0       IN      CNAME   abc.redir2.example.org.\n"
+"abc.redir2.example.com.       3600    IN      CNAME   abc.redir2.example.org.\n"
        },
 
        { "example.com", "obscured.redir2.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"obscured.redir2.example.com.  0       IN      CNAME   obscured.redir2.example.org.\n"
+"obscured.redir2.example.com.  3600    IN      CNAME   obscured.redir2.example.org.\n"
        },
 
        { "example.com", "under2.redir2.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"under2.redir2.example.com.    0       IN      CNAME   under2.redir2.example.org.\n"
+"under2.redir2.example.com.    3600    IN      CNAME   under2.redir2.example.org.\n"
        },
 
        { "example.com", "doubleobscured.under2.redir2.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"doubleobscured.under2.redir2.example.com.     0       IN      CNAME   doubleobscured.under2.redir2.example.org.\n"
+"doubleobscured.under2.redir2.example.com.     3600    IN      CNAME   doubleobscured.under2.redir2.example.org.\n"
        },
 
        { "example.com", "foo.doubleobscured.under2.redir2.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"foo.doubleobscured.under2.redir2.example.com. 0       IN      CNAME   foo.doubleobscured.under2.redir2.example.org.\n"
+"foo.doubleobscured.under2.redir2.example.com. 3600    IN      CNAME   foo.doubleobscured.under2.redir2.example.org.\n"
        },
 
        { "example.com", "foo.under2.redir2.example.com. A", "",
 ";flags QR AA rcode NOERROR\n"
 ";answer section\n"
 "redir2.example.com.   3600    IN      DNAME   redir2.example.org.\n"
-"foo.under2.redir2.example.com.        0       IN      CNAME   foo.under2.redir2.example.org.\n"
+"foo.under2.redir2.example.com.        3600    IN      CNAME   foo.under2.redir2.example.org.\n"
        },
 
        { "example.com", "sub.example.com. NS", "",