]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- dnsoverquic, fix for newer ngtcp2 version, detect number of arguments for
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 24 Aug 2023 14:15:36 +0000 (16:15 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 24 Aug 2023 14:15:36 +0000 (16:15 +0200)
  ngtcp2_conn_shutdown_stream.

config.h.in
configure
configure.ac
services/listen_dnsport.c
util/netevent.c

index 6dd6869602c8af30cd339ad3e83a24e12c717382..97887a2fa09844915c529995c503535b772c600f 100644 (file)
 /* 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
 
index 61f1e123a04411d84e0a1787c8c300b8af420d18..dcc533371d88c1efca23edf01dd61f900440e402 100755 (executable)
--- 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 <ngtcp2/ngtcp2.h>
+
+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
index 764090730b68e376c4ffb4a4a32f7ea17ad35a5b..96f979a3c1e96ab7ded2d00ebb194e8552479074 100644 (file)
@@ -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 <ngtcp2/ngtcp2.h>
     ])
+
+    AC_MSG_CHECKING([whether ngtcp2_conn_shutdown_stream has 4 arguments])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
+#include <ngtcp2/ngtcp2.h>
+    ],[
+       (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
index fbc73b1ab9a051f91e2b35ba10bba51f27fa68e8..956f740e848fac1621469e4a85602bd2625c255c 100644 (file)
@@ -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));
index a06fa4e1277074d200c5fe456918d97512df8ac9..e93fe0e785c266ee6f402c3bbe5bb297ee94d30f 100644 (file)
@@ -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