From: W.C.A. Wijngaards Date: Thu, 24 Aug 2023 14:15:36 +0000 (+0200) Subject: - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fd254b319401980d73045d99e41170b79ce8f7e;p=thirdparty%2Funbound.git - dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for ngtcp2_conn_shutdown_stream. --- diff --git a/config.h.in b/config.h.in index 6dd686960..97887a2fa 100644 --- a/config.h.in +++ b/config.h.in @@ -423,6 +423,9 @@ /* Define to 1 if you have the `ngtcp2_ccerr_default' function. */ #undef HAVE_NGTCP2_CCERR_DEFAULT +/* Define if ngtcp2_conn_shutdown_stream has 4 arguments. */ +#undef HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4 + /* Define to 1 if you have the `ngtcp2_crypto_encrypt_cb' function. */ #undef HAVE_NGTCP2_CRYPTO_ENCRYPT_CB diff --git a/configure b/configure index 61f1e123a..dcc533371 100755 --- a/configure +++ b/configure @@ -20282,6 +20282,40 @@ _ACEOF fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ngtcp2_conn_shutdown_stream has 4 arguments" >&5 +$as_echo_n "checking whether ngtcp2_conn_shutdown_stream has 4 arguments... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include + +int +main () +{ + + (void)ngtcp2_conn_shutdown_stream(NULL, 0, 0, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi # set static linking for uninstalled libraries if requested diff --git a/configure.ac b/configure.ac index 764090730..96f979a3c 100644 --- a/configure.ac +++ b/configure.ac @@ -1542,6 +1542,19 @@ if test x_$withval = x_yes -o x_$withval != x_no; then AC_CHECK_MEMBERS([struct ngtcp2_pkt_hd.tokenlen, struct ngtcp2_settings.tokenlen],,,[AC_INCLUDES_DEFAULT #include ]) + + AC_MSG_CHECKING([whether ngtcp2_conn_shutdown_stream has 4 arguments]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT +#include + ],[ + (void)ngtcp2_conn_shutdown_stream(NULL, 0, 0, 0); + ])],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4, 1, [Define if ngtcp2_conn_shutdown_stream has 4 arguments.]) + ],[ + AC_MSG_RESULT(no) + ]) + fi # set static linking for uninstalled libraries if requested diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index fbc73b1ab..956f740e8 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -3860,8 +3860,11 @@ doq_stream_close(struct doq_conn* conn, struct doq_stream* stream, if(send_shutdown) { verbose(VERB_ALGO, "doq: shutdown stream_id %d with app_error_code %d", (int)stream->stream_id, (int)DOQ_APP_ERROR_CODE); - ret = ngtcp2_conn_shutdown_stream(conn->conn, stream->stream_id, - DOQ_APP_ERROR_CODE); + ret = ngtcp2_conn_shutdown_stream(conn->conn, +#ifdef HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4 + 0, +#endif + stream->stream_id, DOQ_APP_ERROR_CODE); if(ret != 0) { log_err("doq ngtcp2_conn_shutdown_stream %d failed: %s", (int)stream->stream_id, ngtcp2_strerror(ret)); @@ -4238,8 +4241,11 @@ doq_stream_open_cb(ngtcp2_conn* ATTR_UNUSED(conn), int64_t stream_id, )) { int rv; verbose(VERB_ALGO, "doq: no mem for new stream"); - rv = ngtcp2_conn_shutdown_stream(doq_conn->conn, stream_id, - NGTCP2_CONNECTION_REFUSED); + rv = ngtcp2_conn_shutdown_stream(doq_conn->conn, +#ifdef HAVE_NGTCP2_CONN_SHUTDOWN_STREAM4 + 0, +#endif + stream_id, NGTCP2_CONNECTION_REFUSED); if(rv != 0) { log_err("ngtcp2_conn_shutdown_stream failed: %s", ngtcp2_strerror(rv)); diff --git a/util/netevent.c b/util/netevent.c index a06fa4e12..e93fe0e78 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -1949,7 +1949,7 @@ doq_accept(struct comm_point* c, struct doq_pkt_addr* paddr, ngtcp2_strerror(rv)); return 0; } - if(c->doq_socket->validate_addr || + if(c->doq_socket->validate_addr || #ifdef HAVE_STRUCT_NGTCP2_PKT_HD_TOKENLEN hd.tokenlen #else