Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/unbound.h
/asynclook
/delayer
/shell-parse
/dohclient
/doqclient
/lock-verify
Expand Down
12 changes: 10 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ STREAMTCP_SRC=testcode/streamtcp.c
STREAMTCP_OBJ=streamtcp.lo
STREAMTCP_OBJ_LINK=$(STREAMTCP_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
$(SLDNS_OBJ)
SHELL_PARSE_SRC=testcode/shell-parse.c
SHELL_PARSE_OBJ=shell-parse.lo
SHELL_PARSE_OBJ_LINK=$(SHELL_PARSE_OBJ) $(COMMON_OBJ) $(COMPAT_OBJ) \
$(SLDNS_OBJ)
DOHCLIENT_SRC=testcode/dohclient.c
DOHCLIENT_OBJ=dohclient.lo
DOHCLIENT_OBJ_LINK=$(DOHCLIENT_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
Expand Down Expand Up @@ -301,7 +305,7 @@ ALL_OBJ=$(COMMON_OBJ) $(UNITTEST_OBJ) $(DAEMON_OBJ) \
$(CONTROL_OBJ) $(UBANCHOR_OBJ) $(PETAL_OBJ) $(DNSTAP_SOCKET_OBJ)\
$(COMPAT_OBJ) $(PYUNBOUND_OBJ) \
$(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ) $(SLDNS_OBJ) \
$(DOHCLIENT_OBJ) $(DOQCLIENT_OBJ) $(READZONE_OBJ)
$(SHELL_PARSE_OBJ) $(DOHCLIENT_OBJ) $(DOQCLIENT_OBJ) $(READZONE_OBJ)

COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@
LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
Expand Down Expand Up @@ -338,7 +342,7 @@ rsrc_unbound_checkconf.o: $(srcdir)/winrc/rsrc_unbound_checkconf.rc config.h
TEST_BIN=asynclook$(EXEEXT) delayer$(EXEEXT) \
lock-verify$(EXEEXT) memstats$(EXEEXT) perf$(EXEEXT) \
petal$(EXEEXT) pktview$(EXEEXT) streamtcp$(EXEEXT) \
$(DNSTAP_SOCKET_TESTBIN) dohclient$(EXEEXT) doqclient$(EXEEXT) \
$(DNSTAP_SOCKET_TESTBIN) shell-parse$(EXEEXT) dohclient$(EXEEXT) doqclient$(EXEEXT) \
testbound$(EXEEXT) unittest$(EXEEXT) readzone$(EXEEXT)
tests: all $(TEST_BIN)

Expand Down Expand Up @@ -417,6 +421,9 @@ asynclook$(EXEEXT): $(ASYNCLOOK_OBJ_LINK) libunbound.la
streamtcp$(EXEEXT): $(STREAMTCP_OBJ_LINK)
$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS)

shell-parse$(EXEEXT): $(SHELL_PARSE_OBJ_LINK)
$(LINK) -o $@ $(SHELL_PARSE_OBJ_LINK)

dohclient$(EXEEXT): $(DOHCLIENT_OBJ_LINK)
$(LINK) -o $@ $(DOHCLIENT_OBJ_LINK) $(SSLLIB) $(LIBS)

Expand Down Expand Up @@ -1616,6 +1623,7 @@ parseutil.lo parseutil.o: $(srcdir)/sldns/parseutil.c config.h $(srcdir)/sldns/p
rrdef.lo rrdef.o: $(srcdir)/sldns/rrdef.c config.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/parseutil.h
str2wire.lo str2wire.o: $(srcdir)/sldns/str2wire.c config.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h \
$(srcdir)/sldns/wire2str.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parse.h $(srcdir)/sldns/parseutil.h
shell-parse.lo shell-parse.o: $(srcdir)/testcode/shell-parse.c config.h $(srcdir)/sldns/keyraw.h $(srcdir)/sldns/parse.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h
dohclient.lo dohclient.o: $(srcdir)/testcode/dohclient.c config.h $(srcdir)/sldns/wire2str.h \
$(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/parseutil.h \
$(srcdir)/util/data/msgencode.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \
Expand Down
7 changes: 7 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@
/* Define to 1 if you have the <ngtcp2/ngtcp2.h> header file. */
#undef HAVE_NGTCP2_NGTCP2_H

/* Define this to use libcoap */
#undef HAVE_COAP

/* Use libnss for crypto */
#undef HAVE_NSS

Expand Down Expand Up @@ -1631,6 +1634,10 @@ char *unbound_stat_strdup_log(const char *s, const char* file, int line,
#define UNBOUND_DNS_OVER_HTTPS_PORT 443
/** default port for DNS over QUIC traffic. */
#define UNBOUND_DNS_OVER_QUIC_PORT 853
/** default port for DNS over COAP over UDP traffic. */
#define UNBOUND_DNS_OVER_COAP_PORT 5683
/** default port for DNS over COAP over DTLS over UDP traffic. */
#define UNBOUND_DNS_OVER_COAPS_PORT 5684
/** default port for unbound control traffic, registered port with IANA,
ub-dns-control 8953/tcp unbound dns nameserver control */
#define UNBOUND_CONTROL_PORT 8953
Expand Down
32 changes: 32 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,38 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
])
fi

# coap (Constrained Application (CoAP) protocol implementation in C for DNS over CoAP)
AC_ARG_WITH(libcoap, AS_HELP_STRING([--with-libcoap=path],[specify explicit path for libcoap.]),
[ ],[ withval="no" ])
found_libcoap="no"
if test x_$withval = x_yes -o x_$withval != x_no; then
AC_MSG_CHECKING(for libcoap)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr"
fi
for dir in $withval ; do
if test -f "$dir/include/coap3/coap.h"; then
found_libcoap="yes"
dnl assume /usr is in default path.
if test "$dir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$dir/include"
LDFLAGS="$LDFLAGS -L$dir/lib"
fi
AC_MSG_RESULT(found in $dir)
AC_DEFINE([HAVE_COAP], [1], [Define this to use DNS over CoAP.])
LIBS="$LIBS -lcoap-3-openssl"
break;
fi
done
if test x_$found_libcoap != x_yes; then
AC_MSG_ERROR([Could not find libcoap, coap.h])
fi
AC_CHECK_HEADERS([coap3/coap.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([coap_io_process], [], [], [AC_INCLUDES_DEFAULT
#include <coap3/coap.h>
])
fi

# nghttp2
AC_ARG_WITH(libnghttp2, AS_HELP_STRING([--with-libnghttp2=path],[specify explicit path for libnghttp2.]),
[ ],[ withval="no" ])
Expand Down
9 changes: 9 additions & 0 deletions daemon/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_COAP
#include <coap3/coap.h>
#endif /* HAVE_COAP */
#ifdef USE_CACHEDB
#include "cachedb/cachedb.h"
#endif
Expand Down Expand Up @@ -320,6 +323,9 @@ daemon_init(void)
free(daemon);
return NULL;
}
#ifdef HAVE_COAP
coap_startup();
#endif /* HAVE_COAP */
return daemon;
}

Expand Down Expand Up @@ -920,6 +926,9 @@ daemon_cleanup(struct daemon* daemon)
doq_table_delete(daemon->doq_table);
daemon->doq_table = NULL;
#endif
#ifdef HAVE_COAP
coap_cleanup();
#endif /* HAVE_COAP */
daemon->cfg = NULL;
}

Expand Down
1 change: 1 addition & 0 deletions daemon/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
: cfg->tcp_idle_timeout,
cfg->harden_large_queries, cfg->http_max_streams,
cfg->http_endpoint, cfg->http_notls_downstream,
cfg->coap_endpoint,
worker->daemon->tcl, worker->daemon->listen_dot_sslctx,
worker->daemon->listen_doh_sslctx,
worker->daemon->listen_quic_sslctx,
Expand Down
Loading