]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kdig: tls tfo fix missing include file
authorJan Hak <jan.hak@nic.cz>
Fri, 19 Mar 2021 09:28:32 +0000 (10:28 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 19 Mar 2021 14:26:07 +0000 (15:26 +0100)
src/utils/common/tls.c

index e58a4c504d73588e9adfa1f8c5bd869e8b12f128..1328927c5c7b390f70c49b966d06648aaec85702 100644 (file)
 #include <gnutls/gnutls.h>
 #include <gnutls/ocsp.h>
 #include <gnutls/x509.h>
+#define GNUTLS_VERSION_FASTOPEN_READY 0x030503
+#if GNUTLS_VERSION_NUMBER >= GNUTLS_VERSION_FASTOPEN_READY
 #include <gnutls/socket.h>
+#endif
 
 #include "utils/common/tls.h"
 #include "utils/common/cert.h"
@@ -525,12 +528,19 @@ int tls_ctx_connect(tls_ctx_t *ctx, int sockfd, const char *remote, bool fastope
        }
 
        gnutls_session_set_ptr(ctx->session, ctx);
+
        if (fastopen) {
+#if GNUTLS_VERSION_NUMBER >= GNUTLS_VERSION_FASTOPEN_READY
                gnutls_transport_set_fastopen(ctx->session, sockfd, (struct sockaddr *)addr,
                                              sockaddr_len(addr), 0);
+#else
+               gnutls_deinit(ctx->session);
+               return KNOT_ENOTSUP;
+#endif
        } else {
                gnutls_transport_set_int(ctx->session, sockfd);
        }
+
        gnutls_handshake_set_timeout(ctx->session, 1000 * ctx->wait);
 
        if (protocol != NULL) {