Skip to content
Open
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
34 changes: 34 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,43 @@ else
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"

# Check for ngtcp2 when openssl is supported
# Allow user to disable QUIC support with --without-ngtcp2
if test "x$with_ngtcp2" != "xno"; then
AC_ARG_WITH([ngtcp2],
[AS_HELP_STRING([--without-ngtcp2],
[disable QUIC support])],
[
case "$withval" in
n | no)
;;
y | ye | yes)
with_ngtcp2="yes"
;;
*)
with_ngtcp2="$withval"
;;
esac
], [
with_ngtcp2="yes"
]
)
if test "x$with_ngtcp2" = "xyes"; then
AC_MSG_CHECKING([for ngtcp2])
PKG_CHECK_MODULES([NGTCP2], [libngtcp2 libngtcp2_crypto_ossl],
[AC_MSG_RESULT([ngtcp2 libs found])
AC_DEFINE([HAVE_QUIC_NGTCP2], [1], [ngtcp2 is available])
LDFLAGS="$LDFLAGS $NGTCP2_CFLAGS"
LIBS="$NGTCP2_LIBS $LIBS"],
[AC_MSG_RESULT([ngtcp2 libs not found])
with_ngtcp2="no"])
fi
fi
fi
fi


# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only)
AC_CACHE_CHECK([TCP_CONGESTION socket option],
[iperf3_cv_header_tcp_congestion],
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ libiperf_la_SOURCES = \
iperf_udp.h \
iperf_sctp.c \
iperf_sctp.h \
iperf_quic.c \
iperf_quic.h \
iperf_util.c \
iperf_util.h \
iperf_time.c \
Expand Down
35 changes: 35 additions & 0 deletions src/iperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@

#include "iperf_pthread.h"

#if defined(HAVE_QUIC_NGTCP2)
#include <ngtcp2/ngtcp2.h>
#include <ngtcp2/ngtcp2_crypto.h>
#include <ngtcp2/ngtcp2_crypto_ossl.h>
#endif /* HAVE_QUIC_NGTCP2 */

/*
* Atomic types highly desired, but if not, we approximate what we need
* with normal integers and warn.
Expand Down Expand Up @@ -91,6 +97,28 @@ struct iperf_sctp_info
uint32_t cwnd;
};

#if defined (HAVE_QUIC_NGTCP2)
struct iperf_quic_conn_data {
struct iperf_stream *sp;
ngtcp2_conn *pconn; // Pointer to QUIC connection

ngtcp2_crypto_conn_ref ng_quic_conn_ref; // Reference to ngtcp2 connection for OpenSSL
int quic_handshake_completed;
int64_t quic_stream_id;
int quic_hello_writing;

ngtcp2_path_storage path; // QUIC path info
ngtcp2_cid dcid, scid; // Destination and Source Connection IDs

ngtcp2_crypto_ossl_ctx *ng_ssl_ctx; // ngtcp2 OpenSSL crypto context
SSL_CTX *ssl_ctx; // OpenSSL SSL context object
SSL *ssl; // OpenSSL SSL object

int got_app_data;
};
#endif /* HAVE_QUIC_NGTCP2 */


struct iperf_interval_results
{
atomic_iperf_size_t bytes_transferred; /* bytes transferred in this interval */
Expand Down Expand Up @@ -240,7 +268,9 @@ struct iperf_stream
uint64_t target;

struct sockaddr_storage local_addr;
socklen_t local_addr_len;
struct sockaddr_storage remote_addr;
socklen_t remote_addr_len;

int (*rcv) (struct iperf_stream * stream);
int (*snd) (struct iperf_stream * stream);
Expand All @@ -253,6 +283,10 @@ struct iperf_stream
SLIST_ENTRY(iperf_stream) streams;

void *data;

#if defined (HAVE_QUIC_NGTCP2)
struct iperf_quic_conn_data quic_conn_data; // QUIC context
#endif /* HAVE_QUIC_NGTCP2 */
};

struct protocol {
Expand All @@ -264,6 +298,7 @@ struct protocol {
int (*send)(struct iperf_stream *);
int (*recv)(struct iperf_stream *);
int (*init)(struct iperf_test *);
int (*connection_init)(struct iperf_stream *);
SLIST_ENTRY(protocol) protocols;
};

Expand Down
Loading