Skip to content

Commit

Permalink
Release 2.24.0
Browse files Browse the repository at this point in the history
- [FEATURE] QUIC and HTTP/3 Internet Draft 31 support.  Drop ID-30
  and ID-31 support.
- [BUGFIX] Divide-by-zero in newly enabled conn stats code when no
  packets were sent.
- [BUGFIX] Memory leak in gQUIC client when server hello cannot be
  parsed.
- [BUGFIX] Server Initial packet size calculation.
- Log user-agent and CONN_CLOSE reason when peer reports error.
- Example programs: Specify ALPN for echo and md5 clients and servers
  (issue #184).
- Example programs: Don't add "QUIC_" prefix to lines in keylog file
  (issue #185).
- http_server: Fix fd leak in preadv mode; fix preadv() usage when
  reading from disk.
  • Loading branch information
Dmitri Tikhonov committed Oct 28, 2020
1 parent 078f537 commit 4429f8e
Show file tree
Hide file tree
Showing 33 changed files with 250 additions and 118 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2020-10-28
- 2.24.0
- [FEATURE] QUIC and HTTP/3 Internet Draft 31 support. Drop ID-30
and ID-31 support.
- [BUGFIX] Divide-by-zero in newly enabled conn stats code when no
packets were sent.
- [BUGFIX] Memory leak in gQUIC client when server hello cannot be
parsed.
- [BUGFIX] Server Initial packet size calculation.
- Log user-agent and CONN_CLOSE reason when peer reports error.
- Example programs: Specify ALPN for echo and md5 clients and servers
(issue #184).
- Example programs: Don't add "QUIC_" prefix to lines in keylog file
(issue #185).
- http_server: Fix fd leak in preadv mode; fix preadv() usage when
reading from disk.

2020-10-22
- 2.23.3
- [BUGFIX] Update packetization threshold when writing to stream
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ distribution is used in our own products: LiteSpeed Web Server, LiteSpeed ADC,
and OpenLiteSpeed.

Currently supported QUIC versions are Q043, Q046, Q050, ID-27, ID-28, ID-29,
ID-30, and ID-31. Support for newer versions is added soon after they
are released.
and ID-32. Support for newer versions is added soon after they are released.

Documentation
-------------
Expand Down
1 change: 1 addition & 0 deletions bin/echo_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ main (int argc, char **argv)

TAILQ_INIT(&sports);
prog_init(&prog, 0, &sports, &client_echo_stream_if, &client_ctx);
prog.prog_api.ea_alpn = "echo";

while (-1 != (opt = getopt(argc, argv, PROG_OPTS "h")))
{
Expand Down
3 changes: 3 additions & 0 deletions bin/echo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include "lsquic.h"
#include "test_common.h"
#include "../src/liblsquic/lsquic_hash.h"
#include "test_cert.h"
#include "prog.h"

#include "../src/liblsquic/lsquic_logger.h"
Expand Down Expand Up @@ -218,6 +220,7 @@ main (int argc, char **argv)
}
}

add_alpn("echo");
if (0 != prog_prep(&prog))
{
LSQ_ERROR("could not prep");
Expand Down
40 changes: 37 additions & 3 deletions bin/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,39 @@ my_preadv (void *user_data, const struct iovec *iov, int iovcnt)
{
#if HAVE_PREADV
lsquic_stream_ctx_t *const st_h = user_data;
return preadv(st_h->file_fd, iov, iovcnt, st_h->written);
ssize_t nread = preadv(st_h->file_fd, iov, iovcnt, st_h->written);
LSQ_DEBUG("%s: wrote %zd bytes", __func__, (size_t) nread);
return nread;
#else
return -1;
#endif
}


static size_t
pwritev_fallback_read (void *lsqr_ctx, void *buf, size_t count)
{
lsquic_stream_ctx_t *const st_h = lsqr_ctx;
struct iovec iov;
size_t ntoread;

ntoread = st_h->file_size - st_h->written;
if (ntoread > count)
count = ntoread;
iov.iov_base = buf;
iov.iov_len = count;
return my_preadv(lsqr_ctx, &iov, 1);
}


static size_t
pwritev_fallback_size (void *lsqr_ctx)
{
lsquic_stream_ctx_t *const st_h = lsqr_ctx;
return st_h->file_size - st_h->written;
}


static void
http_server_on_write (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
{
Expand Down Expand Up @@ -624,11 +650,17 @@ http_server_on_write (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
to_write = s_pwritev;
nw = lsquic_stream_pwritev(stream, my_preadv, st_h, to_write);
if (nw == 0)
goto use_reader;
{
struct lsquic_reader reader = {
.lsqr_read = pwritev_fallback_read,
.lsqr_size = pwritev_fallback_size,
.lsqr_ctx = st_h,
};
nw = lsquic_stream_writef(stream, &reader);
}
}
else
{
use_reader:
nw = lsquic_stream_writef(stream, &st_h->reader);
}
if (nw < 0)
Expand Down Expand Up @@ -1006,6 +1038,8 @@ http_server_on_close (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
free(st_h->req_path);
if (st_h->reader.lsqr_ctx)
destroy_lsquic_reader_ctx(st_h->reader.lsqr_ctx);
if (s_pwritev)
close(st_h->file_fd);
if (st_h->req)
interop_server_hset_destroy(st_h->req);
free(st_h);
Expand Down
1 change: 1 addition & 0 deletions bin/md5_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ main (int argc, char **argv)

TAILQ_INIT(&sports);
prog_init(&prog, 0, &sports, &client_file_stream_if, &client_ctx);
prog.prog_api.ea_alpn = "md5";

while (-1 != (opt = getopt(argc, argv, PROG_OPTS "bhr:f:p:")))
{
Expand Down
3 changes: 3 additions & 0 deletions bin/md5_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "lsquic.h"
#include "test_common.h"
#include "../src/liblsquic/lsquic_hash.h"
#include "test_cert.h"
#include "prog.h"

#include "../src/liblsquic/lsquic_logger.h"
Expand Down Expand Up @@ -325,6 +327,7 @@ main (int argc, char **argv)
}
}

add_alpn("md5");
if (0 != prog_prep(&prog))
{
LSQ_ERROR("could not prep");
Expand Down
5 changes: 0 additions & 5 deletions bin/prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,6 @@ keylog_open (void *ctx, lsquic_conn_t *conn)
static void
keylog_log_line (void *handle, const char *line)
{
size_t len;

len = strlen(line);
if (len < sizeof("QUIC_") - 1 || strncmp(line, "QUIC_", 5))
fputs("QUIC_", handle);
fputs(line, handle);
fputs("\n", handle);
fflush(handle);
Expand Down
8 changes: 2 additions & 6 deletions docs/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,9 @@ developed by the IETF. Both types are included in a single enum:

IETF QUIC version ID 29

.. member:: LSQVER_ID30
.. member:: LSQVER_ID32

IETF QUIC version ID 30; this version is deprecated.

.. member:: LSQVER_ID31

IETF QUIC version ID 31
IETF QUIC version ID 32

.. member:: N_LSQVER

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = u'LiteSpeed Technologies'

# The short X.Y version
version = u'2.23'
version = u'2.24'
# The full version, including alpha/beta/rc tags
release = u'2.23.3'
release = u'2.24.0'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Most of the code in this distribution has been used in our own products
since 2017.

Currently supported QUIC versions are Q043, Q046, Q050, ID-27, ID-28,
ID-29, ID-30, and ID-31.
ID-29, and ID-32.
Support for newer versions will be added soon after they are released.

LSQUIC is licensed under the `MIT License`_; see LICENSE in the source
Expand Down
26 changes: 10 additions & 16 deletions include/lsquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ extern "C" {
#endif

#define LSQUIC_MAJOR_VERSION 2
#define LSQUIC_MINOR_VERSION 23
#define LSQUIC_PATCH_VERSION 3
#define LSQUIC_MINOR_VERSION 24
#define LSQUIC_PATCH_VERSION 0

/**
* Engine flags:
Expand Down Expand Up @@ -92,14 +92,9 @@ enum lsquic_version
LSQVER_ID29,

/**
* IETF QUIC Draft-30
* IETF QUIC Draft-32
*/
LSQVER_ID30,

/**
* IETF QUIC Draft-31
*/
LSQVER_ID31,
LSQVER_ID32,

/**
* Special version to trigger version negotiation.
Expand All @@ -112,7 +107,7 @@ enum lsquic_version

/**
* We currently support versions 43, 46, 50, Draft-27, Draft-28, Draft-29,
* Draft-30, and Draft-31.
* and Draft-32.
* @see lsquic_version
*/
#define LSQUIC_SUPPORTED_VERSIONS ((1 << N_LSQVER) - 1)
Expand All @@ -125,18 +120,17 @@ enum lsquic_version
#define LSQUIC_EXPERIMENTAL_VERSIONS ( \
(1 << LSQVER_VERNEG) | LSQUIC_EXPERIMENTAL_Q098)

#define LSQUIC_DEPRECATED_VERSIONS ((1 << LSQVER_ID27) | (1 << LSQVER_ID28) \
| (1 << LSQVER_ID30))
#define LSQUIC_DEPRECATED_VERSIONS ((1 << LSQVER_ID27) | (1 << LSQVER_ID28))

#define LSQUIC_GQUIC_HEADER_VERSIONS (1 << LSQVER_043)

#define LSQUIC_IETF_VERSIONS ((1 << LSQVER_ID27) | (1 << LSQVER_ID28) \
| (1 << LSQVER_ID29) | (1 << LSQVER_ID30) \
| (1 << LSQVER_ID31) | (1 << LSQVER_VERNEG))
| (1 << LSQVER_ID29) \
| (1 << LSQVER_ID32) | (1 << LSQVER_VERNEG))

#define LSQUIC_IETF_DRAFT_VERSIONS ((1 << LSQVER_ID27) | (1 << LSQVER_ID28) \
| (1 << LSQVER_ID29) | (1 << LSQVER_ID30) \
| (1 << LSQVER_ID31) | (1 << LSQVER_VERNEG))
| (1 << LSQVER_ID29) \
| (1 << LSQVER_ID32) | (1 << LSQVER_VERNEG))

enum lsquic_hsk_status
{
Expand Down
1 change: 1 addition & 0 deletions src/liblsquic/lsquic_chsk_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ hsk_client_on_read (lsquic_stream_t *stream, struct lsquic_stream_ctx *sh)
/* fallthru */
case DATA_FORMAT_ERROR:
LSQ_INFO("lsquic_enc_session_handle_chlo_reply returned an error");
lsquic_mm_put_16k(c_hsk->mm, c_hsk->buf_in);
c_hsk->buf_in = NULL;
lsquic_stream_wantread(stream, 0);
c_hsk->lconn->cn_if->ci_hsk_done(c_hsk->lconn, LSQ_HSK_FAIL);
Expand Down
3 changes: 1 addition & 2 deletions src/liblsquic/lsquic_enc_sess.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ extern const struct enc_session_funcs_iquic lsquic_enc_session_iquic_ietf_v1;
ver == LSQVER_ID27 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_ID28 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_ID29 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_ID30 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_ID31 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_ID32 ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_VERNEG ? &lsquic_enc_session_common_ietf_v1 : \
ver == LSQVER_050 ? &lsquic_enc_session_common_gquic_2 : \
&lsquic_enc_session_common_gquic_1 )
Expand Down
5 changes: 2 additions & 3 deletions src/liblsquic/lsquic_enc_sess_ietf.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ static const struct alpn_map {
{ LSQVER_ID27, (unsigned char *) "\x05h3-27", },
{ LSQVER_ID28, (unsigned char *) "\x05h3-28", },
{ LSQVER_ID29, (unsigned char *) "\x05h3-29", },
{ LSQVER_ID30, (unsigned char *) "\x05h3-30", },
{ LSQVER_ID31, (unsigned char *) "\x05h3-31", },
{ LSQVER_VERNEG, (unsigned char *) "\x05h3-31", },
{ LSQVER_ID32, (unsigned char *) "\x05h3-32", },
{ LSQVER_VERNEG, (unsigned char *) "\x05h3-32", },
};

struct enc_sess_iquic;
Expand Down
3 changes: 2 additions & 1 deletion src/liblsquic/lsquic_full_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,8 @@ full_conn_ci_destroy (lsquic_conn_t *lconn)
conn->fc_stats.in.packets, conn->fc_stats.in.undec_packets,
conn->fc_stats.in.dup_packets, conn->fc_stats.in.err_packets,
conn->fc_stats.out.packets,
conn->fc_stats.out.stream_data_sz / conn->fc_stats.out.packets);
conn->fc_stats.out.stream_data_sz /
(conn->fc_stats.out.packets ? conn->fc_stats.out.packets : 1));
LSQ_NOTICE("ACKs: in: %lu; processed: %lu; merged: %lu",
conn->fc_stats.in.n_acks, conn->fc_stats.in.n_acks_proc,
conn->fc_stats.in.n_acks_merged);
Expand Down
Loading

0 comments on commit 4429f8e

Please sign in to comment.