aboutsummaryrefslogtreecommitdiff
path: root/contrib/unbound/dnstap
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/unbound/dnstap')
-rw-r--r--contrib/unbound/dnstap/dnstap.c4
-rw-r--r--contrib/unbound/dnstap/dnstap.m439
-rw-r--r--contrib/unbound/dnstap/dnstap.proto2
-rw-r--r--contrib/unbound/dnstap/dtstream.c2
4 files changed, 39 insertions, 8 deletions
diff --git a/contrib/unbound/dnstap/dnstap.c b/contrib/unbound/dnstap/dnstap.c
index 071fd0895fe6..3b27301825c2 100644
--- a/contrib/unbound/dnstap/dnstap.c
+++ b/contrib/unbound/dnstap/dnstap.c
@@ -542,7 +542,7 @@ dt_msg_send_outside_query(struct dt_env *env,
qflags = sldns_buffer_read_u16_at(qmsg, 2);
/* type */
- if (qflags & BIT_RD) {
+ if ((qflags & BIT_RD)) {
if (!env->log_forwarder_query_messages)
return;
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_QUERY);
@@ -599,7 +599,7 @@ dt_msg_send_outside_response(struct dt_env *env,
qflags = ntohs(qflags);
/* type */
- if (qflags & BIT_RD) {
+ if ((qflags & BIT_RD)) {
if (!env->log_forwarder_response_messages)
return;
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_RESPONSE);
diff --git a/contrib/unbound/dnstap/dnstap.m4 b/contrib/unbound/dnstap/dnstap.m4
index 78d0dd68b762..89eda929bfb3 100644
--- a/contrib/unbound/dnstap/dnstap.m4
+++ b/contrib/unbound/dnstap/dnstap.m4
@@ -18,10 +18,41 @@ AC_DEFUN([dt_DNSTAP],
[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!])
- fi
+ AC_PATH_PROG([PROTOC], [protoc])
+ # 'protoc-c' is deprecated. We use 'protoc' instead. If it can not be
+ # found, try 'protoc-c'.
+ if test -z "$PROTOC"; then
+ AC_PATH_PROG([PROTOC_C], [protoc-c])
+ else
+ PROTOC_C="$PROTOC"
+ fi
+ if test -z "$PROTOC_C"; then
+ AC_MSG_ERROR([[The protoc or protoc-c program was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c to provide protoc or protoc-c]])
+ fi
+
+ # Check for protoc-gen-c plugin
+ AC_PATH_PROG([PROTOC_GEN_C], [protoc-gen-c])
+ if test -z "$PROTOC_GEN_C"; then
+ AC_MSG_ERROR([[The protoc-gen-c plugin was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c-compiler to provide protoc-gen-c]])
+ fi
+
+ # Test that protoc-gen-c actually works
+ AC_MSG_CHECKING([if protoc-gen-c plugin works])
+ cat > conftest.proto << EOF
+syntax = "proto2";
+message TestMessage {
+ optional string test_field = 1;
+}
+EOF
+ if $PROTOC_C --c_out=. conftest.proto >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+ rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+ else
+ AC_MSG_RESULT([no])
+ rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+ AC_MSG_ERROR([[The protoc-gen-c plugin is not working properly. Please ensure protobuf-c-compiler is properly installed]])
+ fi
+
AC_ARG_WITH([protobuf-c],
AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]),
[
diff --git a/contrib/unbound/dnstap/dnstap.proto b/contrib/unbound/dnstap/dnstap.proto
index dfc8ad411d94..75b8757c2081 100644
--- a/contrib/unbound/dnstap/dnstap.proto
+++ b/contrib/unbound/dnstap/dnstap.proto
@@ -98,7 +98,7 @@ message Policy {
// rule: the rule matched by the message.
//
// In a RPZ context, this is the owner name of the rule in
- // the Reponse Policy Zone in wire format.
+ // the Response Policy Zone in wire format.
optional bytes rule = 2;
// action: the policy action taken in response to the
diff --git a/contrib/unbound/dnstap/dtstream.c b/contrib/unbound/dnstap/dtstream.c
index 2d5ab20f0c84..39d43403bc62 100644
--- a/contrib/unbound/dnstap/dtstream.c
+++ b/contrib/unbound/dnstap/dtstream.c
@@ -1509,7 +1509,7 @@ void dtio_output_cb(int ATTR_UNUSED(fd), short bits, void* arg)
}
#endif
- if((bits&UB_EV_READ || dtio->ssl_brief_write)) {
+ if((bits&UB_EV_READ) || dtio->ssl_brief_write) {
#ifdef HAVE_SSL
if(dtio->ssl_brief_write)
(void)dtio_disable_brief_write(dtio);