Release 2.8.7

- [BUGFIX] Initial packet size check for IETF mini conn applies to
  UDP payload, not QUIC packet.
- Support old and new school loss_bits transport parameter.
- Use Q run length of 64 as suggested in the loss bits Draft.
- Undo square wave count when packet is delayed.
- Code cleanup; minor fixes.
This commit is contained in:
Dmitri Tikhonov 2020-01-09 11:52:25 -05:00
parent 72bbf1fbee
commit 7d09751dbb
253 changed files with 457 additions and 363 deletions

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
LSQUIC APIs
===========

View file

@ -1,3 +1,12 @@
2020-01-09
- 2.8.7
- [BUGFIX] Initial packet size check for IETF mini conn applies to
UDP payload, not QUIC packet.
- Support old and new school loss_bits transport parameter.
- Use Q run length of 64 as suggested in the loss bits Draft.
- Undo square wave count when packet is delayed.
- Code cleanup; minor fixes.
2020-01-06
- 2.8.5
- [HTTP3] Verify number of bytes in incoming DATA frames against

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
cmake_minimum_required(VERSION 2.8)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
In addition to the LiteSpeed QUIC Team, the following people contributed
to the LiteSpeed Client Library:

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
LSQUIC Examples
===============

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc
Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef __LSQUIC_H__
#define __LSQUIC_H__
@ -25,7 +25,7 @@ extern "C" {
#define LSQUIC_MAJOR_VERSION 2
#define LSQUIC_MINOR_VERSION 8
#define LSQUIC_PATCH_VERSION 5
#define LSQUIC_PATCH_VERSION 7
/**
* Engine flags:
@ -377,7 +377,7 @@ typedef struct ssl_ctx_st * (*lsquic_lookup_cert_f)(
#define LSQUIC_DF_ALLOW_MIGRATION 1
/** Use QL loss bits by default */
#define LSQUIC_DF_QL_BITS 1
#define LSQUIC_DF_QL_BITS 2
/* 1: Cubic; 2: BBR */
#define LSQUIC_DF_CC_ALGO 1
@ -675,7 +675,7 @@ struct lsquic_engine_settings {
/**
* Source Connection ID length. Only applicable to the IETF QUIC
* versions. Valid values are 4 through 18, inclusive.
* versions. Valid values are 0 through 20, inclusive.
*
* Default value is @ref LSQUIC_DF_SCID_LEN.
*/
@ -748,7 +748,11 @@ struct lsquic_engine_settings {
unsigned es_cc_algo;
/**
* Use QL loss bits.
* Use QL loss bits. Allowed values are:
* 0: Do not use loss bits
* 1: Allow loss bits
* 2: Allow and send loss bits
* -1: Allow and send loss bits, sending old-style boolean loss_bits TP
*
* Default value is @ref LSQUIC_DF_QL_BITS
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef __LSQUIC_TYPES_H__
#define __LSQUIC_TYPES_H__

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
cmake_minimum_required(VERSION 2.8)
add_subdirectory(liblsquic)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE.
# Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE.
SET(lsquic_STAT_SRCS
ls-qpack/lsqpack.c
lsquic_alarmset.c

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/* libfiu - Fault Injection in Userspace
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_alarmset.c -- A set of alarms
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_alarmset.h -- A set of alarms
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_arr.c
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_arr.h -- Array
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_attq.c -- Advisory Tick Time Queue
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_attq.h -- Advisory Tick Time Queue
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE.chrome file.

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_BBR_H
#define LSQUIC_BBR_H

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <inttypes.h>
#include <stddef.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_BW_SAMPLER_H
#define LSQUIC_BW_SAMPLER_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_BYTESWAP_H
#define LSQUIC_BYTESWAP_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* Stream/crypto handshake adapter for the client side.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* Stream/crypto handshake adapter for the client side.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_cong_ctl.h -- congestion control interface
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <inttypes.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_conn.h -- Connection interface
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_conn_flow.h -- Connection flow control-related functions
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_conn_public.h -- Connection's "public interface"
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <stdbool.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef __LSQUIC_CRT_COMPRESS_H__
#define __LSQUIC_CRT_COMPRESS_H__

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef __LSQUIC_CRYPTO_H__
#define __LSQUIC_CRYPTO_H__

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_cubic.c -- LSQUIC CUBIC implementation.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_cubic.h -- CUBIC congestion control protocol.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_data_in_if.h -- DATA in interface
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_di_error.c -- A placeholder when things go wrong
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_di_hash.c -- Copy incoming data into a hash
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_di_nocopy.c -- The "no-copy" data in stream.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_ENC_SESS_H
#define LSQUIC_ENC_SESS_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <stddef.h>
#include <stdint.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_enc_sess_ietf.c -- Crypto session for IETF QUIC
*/
@ -235,7 +235,8 @@ struct enc_sess_iquic
ESI_CACHED_INFO = 1 << 9,
ESI_1RTT_ACKED = 1 << 10,
ESI_WANT_TICKET = 1 << 11,
ESI_QL_BITS = 1 << 12,
ESI_RECV_QL_BITS = 1 << 12,
ESI_SEND_QL_BITS = 1 << 13,
} esi_flags;
enum evp_aead_direction_t
esi_dir[2]; /* client, server */
@ -326,7 +327,7 @@ apply_hp (struct enc_sess_iquic *enc_sess,
hp->hp_gen_mask(enc_sess, hp, cliser, dst + packno_off + 4, mask);
LSQ_DEBUG("apply header protection using mask %s",
HEXSTR(mask, 5, mask_str));
if (enc_sess->esi_flags & ESI_QL_BITS)
if (enc_sess->esi_flags & ESI_SEND_QL_BITS)
dst[0] ^= (0x7 | ((dst[0] >> 7) << 3)) & mask[0];
else
dst[0] ^= (0xF | (((dst[0] & 0x80) == 0) << 4)) & mask[0];
@ -387,7 +388,7 @@ strip_hp (struct enc_sess_iquic *enc_sess,
hp->hp_gen_mask(enc_sess, hp, cliser, iv, mask);
LSQ_DEBUG("strip header protection using mask %s",
HEXSTR(mask, 5, mask_str));
if (enc_sess->esi_flags & ESI_QL_BITS)
if (enc_sess->esi_flags & ESI_RECV_QL_BITS)
dst[0] ^= (0x7 | ((dst[0] >> 7) << 3)) & mask[0];
else
dst[0] ^= (0xF | (((dst[0] & 0x80) == 0) << 4)) & mask[0];
@ -538,8 +539,13 @@ gen_trans_params (struct enc_sess_iquic *enc_sess, unsigned char *buf,
- !!(params.tp_flags & (TRAPA_PREFADDR_IPv4|TRAPA_PREFADDR_IPv6));
if (!settings->es_allow_migration)
params.tp_disable_active_migration = 1;
if (settings->es_ql_bits)
if (settings->es_ql_bits == -1)
params.tp_flags |= TRAPA_QL_BITS_OLD;
else if (settings->es_ql_bits)
{
params.tp_loss_bits = settings->es_ql_bits - 1;
params.tp_flags |= TRAPA_QL_BITS;
}
len = lsquic_tp_encode(&params, buf, bufsz);
if (len >= 0)
@ -1469,11 +1475,36 @@ get_peer_transport_params (struct enc_sess_iquic *enc_sess)
}
if ((trans_params->tp_flags & TRAPA_QL_BITS)
&& enc_sess->esi_enpub->enp_settings.es_ql_bits)
&& enc_sess->esi_enpub->enp_settings.es_ql_bits)
{
LSQ_DEBUG("enable QL loss bits");
enc_sess->esi_flags |= ESI_QL_BITS;
unsigned our_loss_bits;
if (enc_sess->esi_enpub->enp_settings.es_ql_bits == -1)
our_loss_bits = 1;
else
our_loss_bits = enc_sess->esi_enpub->enp_settings.es_ql_bits - 1;
switch ((our_loss_bits << 1) | trans_params->tp_loss_bits)
{
case (0 << 1) | 0:
LSQ_DEBUG("both sides only tolerate QL bits: don't enable them");
break;
case (0 << 1) | 1:
LSQ_DEBUG("peer sends QL bits, we receive them");
enc_sess->esi_flags |= ESI_RECV_QL_BITS;
break;
case (1 << 1) | 0:
LSQ_DEBUG("we send QL bits, peer receives them");
enc_sess->esi_flags |= ESI_SEND_QL_BITS;
break;
default/*1 << 1) | 1*/:
LSQ_DEBUG("enable sending and receiving QL bits");
enc_sess->esi_flags |= ESI_RECV_QL_BITS;
enc_sess->esi_flags |= ESI_SEND_QL_BITS;
break;
}
}
else
LSQ_DEBUG("no QL bits");
return 0;
}
@ -1633,14 +1664,6 @@ static const enum enc_level hety2el[] =
};
static const enum header_type pns2hety[] =
{
[PNS_INIT] = HETY_INITIAL,
[PNS_HSK] = HETY_HANDSHAKE,
[PNS_APP] = HETY_NOT_SET,
};
static const enum enc_level pns2enc_level[] =
{
[PNS_INIT] = ENC_LEV_CLEAR,
@ -1671,19 +1694,9 @@ iquic_esf_encrypt_packet (enc_session_t *enc_session_p,
enum packnum_space pns;
char errbuf[ERR_ERROR_STRING_BUF_LEN];
if (packet_out->po_flags & PO_MINI)
{
/* XXX TODO Don't rely on PO_MINI, generalize this logic */
assert(enc_sess->esi_flags & ESI_SERVER);
enc_level = hety2el[ packet_out->po_header_type ];
}
else
{
pns = lsquic_packet_out_pns(packet_out);
/* TODO Obviously, will need more logic for 0-RTT */
enc_level = pns2enc_level[ pns ];
packet_out->po_header_type = pns2hety[ pns ];
}
pns = lsquic_packet_out_pns(packet_out);
/* TODO Obviously, will need more logic for 0-RTT */
enc_level = pns2enc_level[ pns ];
cliser = !!(enc_sess->esi_flags & ESI_SERVER);
if (enc_level == ENC_LEV_FORW)
@ -1985,7 +1998,7 @@ iquic_esf_decrypt_packet (enc_session_t *enc_session_p,
goto err;
}
if (enc_sess->esi_flags & ESI_QL_BITS)
if (enc_sess->esi_flags & ESI_SEND_QL_BITS)
{
packet_in->pi_flags |= PI_LOG_QL_BITS;
if (dst[0] & 0x10)
@ -2021,7 +2034,9 @@ iquic_esf_decrypt_packet (enc_session_t *enc_session_p,
{
LSQ_ERROR("could not init seal crypto ctx (key phase)");
cleanup_crypto_ctx(&pair->ykp_ctx[ !cliser ]);
/* XXX Is this the proper thing to do? Packet decrypted fine... */
/* This is a severe error, abort connection */
enc_sess->esi_conn->cn_if->ci_internal_error(enc_sess->esi_conn,
"crypto ctx failure during key phase shift");
dec_packin = DECPI_BADCRYPT;
goto err;
}
@ -2180,15 +2195,22 @@ iquic_esf_zero_rtt_enabled (enc_session_t *enc_session_p)
}
int
static int
iquic_esfi_reset_dcid (enc_session_t *enc_session_p,
const lsquic_cid_t *old_dcid, const lsquic_cid_t *new_dcid)
{
struct enc_sess_iquic *const enc_sess = enc_session_p;
struct crypto_ctx_pair *pair;
enc_sess->esi_odcid = *old_dcid;
enc_sess->esi_flags |= ESI_ODCID;
/* TODO: free previous handshake keys */
/* Free previous handshake keys */
assert(enc_sess->esi_hsk_pairs);
pair = &enc_sess->esi_hsk_pairs[ENC_LEV_CLEAR];
cleanup_crypto_ctx(&pair->ykp_ctx[0]);
cleanup_crypto_ctx(&pair->ykp_ctx[1]);
if (0 == setup_handshake_keys(enc_sess, new_dcid))
{
LSQ_INFOC("reset DCID to %"CID_FMT, CID_BITS(new_dcid));

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <time.h>
#ifdef WIN32
#include <vc_compat.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_eng_hist.h - Engine history.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_engine.c - QUIC engine
*/
@ -383,13 +383,12 @@ lsquic_engine_check_settings (const struct lsquic_engine_settings *settings,
"The maximum value of idle timeout is 600 seconds");
return -1;
}
if (!(!(flags & ENG_SERVER) && settings->es_scid_len == 0)
&& (settings->es_scid_len < 4 || settings->es_scid_len > 18))
if (settings->es_scid_len > MAX_CID_LEN)
{
if (err_buf)
snprintf(err_buf, err_buf_sz, "Source connection ID cannot be %u "
"bytes long; it must be between 4 and 18.",
settings->es_scid_len);
"bytes long; it must be between 0 and %u.",
settings->es_scid_len, MAX_CID_LEN);
return -1;
}
@ -400,6 +399,15 @@ lsquic_engine_check_settings (const struct lsquic_engine_settings *settings,
"algorithm value %u", settings->es_cc_algo);
return -1;
}
if (!(settings->es_ql_bits >= -1 && settings->es_ql_bits <= 2))
{
if (err_buf)
snprintf(err_buf, err_buf_sz, "Invalid QL bits value %d ",
settings->es_ql_bits);
return -1;
}
return 0;
}
@ -1021,7 +1029,7 @@ find_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
static lsquic_conn_t *
find_or_create_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
struct packin_parse_state *ppstate, const struct sockaddr *sa_local,
const struct sockaddr *sa_peer, void *peer_ctx)
const struct sockaddr *sa_peer, void *peer_ctx, size_t packet_in_size)
{
struct lsquic_hash_elem *el;
struct purga_el *puel;
@ -1133,7 +1141,7 @@ find_or_create_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
if ((1 << version) & LSQUIC_IETF_VERSIONS)
{
conn = lsquic_mini_conn_ietf_new(&engine->pub, packet_in, version,
sa_peer->sa_family == AF_INET, NULL);
sa_peer->sa_family == AF_INET, NULL, packet_in_size);
}
else
{
@ -1244,11 +1252,10 @@ find_conn_by_srst (struct lsquic_engine *engine,
static int
process_packet_in (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
struct packin_parse_state *ppstate, const struct sockaddr *sa_local,
const struct sockaddr *sa_peer, void *peer_ctx, int full_udp_packet)
const struct sockaddr *sa_peer, void *peer_ctx, size_t packet_in_size)
{
lsquic_conn_t *conn;
const unsigned char *packet_in_data;
size_t packet_in_size;
if (lsquic_packet_in_is_gquic_prst(packet_in)
&& !engine->pub.enp_settings.es_honor_prst)
@ -1260,14 +1267,14 @@ process_packet_in (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
if (engine->flags & ENG_SERVER)
conn = find_or_create_conn(engine, packet_in, ppstate, sa_local,
sa_peer, peer_ctx);
sa_peer, peer_ctx, packet_in_size);
else
conn = find_conn(engine, packet_in, ppstate, sa_local);
if (!conn)
{
if (engine->pub.enp_settings.es_honor_prst
&& full_udp_packet
&& packet_in_size == packet_in->pi_data_sz /* Full UDP packet */
&& !(packet_in->pi_flags & PI_GQUIC)
&& engine->pub.enp_srst_hash
&& (conn = find_conn_by_srst(engine, packet_in)))
@ -2653,7 +2660,7 @@ lsquic_engine_packet_in (lsquic_engine_t *engine,
packet_in->pi_flags |= (3 & ecn) << PIBIT_ECN_SHIFT;
eng_hist_inc(&engine->history, packet_in->pi_received, sl_packets_in);
s = process_packet_in(engine, packet_in, &ppstate, sa_local, sa_peer,
peer_ctx, packet_in->pi_data_sz == packet_in_size);
peer_ctx, packet_in_size);
n_zeroes += s == 0;
}
while (0 == s && packet_in_data < packet_end);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_engine_public.h -- Engine's "public interface"
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef WIN32
#include <arpa/inet.h>
#else

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_ev_log.h -- Event logger
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frab_list.c -- List of buffer for simple reading and writing
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frab_list.h -- List of buffer for simple reading and writing
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <stdint.h>
#include "lsquic_frame_common.h"

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frame_common.h
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frame_reader.c -- Read HTTP frames from stream
*/
@ -513,6 +513,7 @@ static int
decode_and_pass_payload (struct lsquic_frame_reader *fr)
{
struct headers_state *hs = &fr->fr_state.by_type.headers_state;
const uint32_t hpack_static_table_size = 61;
const unsigned char *comp, *end;
enum frame_reader_error err;
int s;
@ -547,7 +548,7 @@ decode_and_pass_payload (struct lsquic_frame_reader *fr)
buf, buf + 16 * 1024, &name_len, &val_len, &name_idx);
if (s == 0)
{
if (name_idx > 61 /* XXX 61 */)
if (name_idx > hpack_static_table_size)
name_idx = 0; /* Work around bug in ls-hpack */
err = (enum frame_reader_error)
fr->fr_hsi_if->hsi_process_header(hset, name_idx, buf,

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frame_reader.h -- Read HTTP frames from stream
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frame_writer.c -- write frames to HEADERS stream.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_frame_writer.h -- write frames to HEADERS stream.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_full_conn.c -- A "full" connection object has full functionality
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_FULL_CONN_H
#define LSQUIC_FULL_CONN_H

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_full_conn_ietf.c -- IETF QUIC connection.
*/
@ -2710,7 +2710,8 @@ handshake_ok (struct lsquic_conn *lconn)
(lsquic_tp_to_str(params, buf, sizeof(buf)), buf));
if ((params->tp_flags & TRAPA_QL_BITS)
&& conn->ifc_settings->es_ql_bits)
&& (conn->ifc_settings->es_ql_bits == 2
|| conn->ifc_settings->es_ql_bits == -1))
{
LSQ_DEBUG("turn on QL loss bits");
lsquic_send_ctl_do_ql_bits(&conn->ifc_send_ctl);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* Global state
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#define _GNU_SOURCE /* for memmem */
#include <netinet/in.h>
@ -567,22 +567,6 @@ make_compress_cert_hash_item(lsquic_str_t *domain, lsquic_str_t *crts_compress_b
}
/* server */
#if __GNUC__
__attribute__((unused)) /* XXX why? */
#endif
static void
free_compress_cert_hash_item(compress_cert_hash_item_t *item)
{
if (item)
{
lsquic_str_delete(item->crts_compress_buf);
lsquic_str_delete(item->domain);
free(item);
}
}
/* server */
static int insert_compress_certs(compress_cert_hash_item_t *item)
{
@ -2947,22 +2931,6 @@ verify_stk (enc_session_t *enc_session_p,
}
#if 0 /* unused */
enum AEAD_TYPE determineaead()
{
return AEAD_AESG;
}
enum KENX_TYPE determinekexs()
{
/* only support C255 now */
return KENX_C255;
}
#endif /* 0 */
static uint64_t combine_path_id_pack_num(uint8_t path_id, uint64_t pack_num)
{
uint64_t v = ((uint64_t)path_id << 56) | pack_num;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_HANDSHAKE_H
#define LSQUIC_HANDSHAKE_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hash.c
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hash.c -- A generic hash
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <inttypes.h>
#include <stddef.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hcsi_reader.h -- HTTP Control Stream Incoming (HCSI) reader
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hcso_writer.c - write to outgoing HTTP Control Stream
*/
@ -21,6 +21,7 @@
#include "lsquic_varint.h"
#include "lsquic_byteswap.h"
#include "lsquic_hcso_writer.h"
#include "lsquic_conn.h"
#define LSQUIC_LOGGER_MODULE LSQLM_HCSO_WRITER
#define LSQUIC_LOG_CONN_ID \
@ -67,6 +68,8 @@ static lsquic_stream_ctx_t *
hcso_on_new (void *stream_if_ctx, struct lsquic_stream *stream)
{
struct hcso_writer *writer = stream_if_ctx;
struct lsquic_conn *lconn;
writer->how_stream = stream;
lsquic_frab_list_init(&writer->how_fral, 0x100, NULL, NULL, NULL);
#ifndef NDEBUG
@ -85,7 +88,8 @@ hcso_on_new (void *stream_if_ctx, struct lsquic_stream *stream)
if (0 != hcso_write_type(writer))
{
LSQ_INFO("cannot write to frab list");
/* TODO: abort connection */
lconn = lsquic_stream_conn(stream);
lconn->cn_if->ci_internal_error(lconn, "cannot write to frab list");
}
LSQ_DEBUG("create HTTP Control Stream Writer");
lsquic_stream_wantwrite(stream, 1);
@ -301,6 +305,7 @@ hcso_on_write (struct lsquic_stream *stream, lsquic_stream_ctx_t *ctx)
.lsqr_ctx = &writer->how_fral
};
ssize_t nw;
struct lsquic_conn *lconn;
#ifndef NDEBUG
if (stream->tosend_off < 8 && (writer->how_flags & HOW_CHOP_STREAM))
@ -320,8 +325,9 @@ hcso_on_write (struct lsquic_stream *stream, lsquic_stream_ctx_t *ctx)
}
else
{
/* TODO: abort connection */
LSQ_WARN("cannot write to stream: %s", strerror(errno));
lconn = lsquic_stream_conn(stream);
lconn->cn_if->ci_internal_error(lconn, "cannot write to stream: %s",
strerror(errno));
lsquic_stream_wantwrite(stream, 0);
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hcso_writer.h
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_HEADERS_H
#define LSQUIC_HEADERS_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* HEADERS stream logic
*/
@ -414,7 +414,7 @@ lsquic_headers_stream_mem_used (const struct headers_stream *hs)
size = sizeof(*hs);
size += lsquic_frame_reader_mem_used(hs->hs_fr);
size += lsquic_frame_writer_mem_used(hs->hs_fw);
/* XXX: get rid of this mem_used business as we no longer use it? */
/* XXX: does not cover HPACK encoder and HPACK decoder */
return size;
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_headers_stream.h -- HEADERS stream interface
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <stddef.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_HKDF_H
#define LSQUIC_HKDF_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hq.h -- HTTP over QUIC (HQ) types
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_hspack_valid.c -- Handshake packet validator.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <ctype.h>
#include <stddef.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_HTTP1X_IF_H
#define LSQUIC_HTTP1X_IF_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_IETF_H
#define LSQUIC_IETF_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_INT_TYPES_H
#define LSQUIC_INT_TYPES_H 1

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* LSQUIC Logger implementation.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_logger.h -- logging functions and macros.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_malo.c -- malo allocator implementation.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_malo.h -- Fast allocator for fixed-sized objects.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_min_heap.c
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_min_heap.h -- Min-heap for connections
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mini_conn.c -- Mini connection.
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mini_conn.h -- Mini-connection
*

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mini_conn_ietf.c -- Mini connection used by the IETF QUIC
*/
@ -391,13 +391,14 @@ static const struct crypto_stream_if crypto_stream_if =
static int
is_first_packet_ok (const struct lsquic_packet_in *packet_in)
is_first_packet_ok (const struct lsquic_packet_in *packet_in,
size_t udp_payload_size)
{
if (packet_in->pi_data_sz < IQUIC_MIN_INIT_PACKET_SZ)
if (udp_payload_size < IQUIC_MIN_INIT_PACKET_SZ)
{
/* [draft-ietf-quic-transport-24] Section 14 */
LSQ_LOG1(LSQ_LOG_DEBUG, "incoming packet too small: %hu bytes",
packet_in->pi_data_sz);
LSQ_LOG1(LSQ_LOG_DEBUG, "incoming UDP payload too small: %zu bytes",
udp_payload_size);
return 0;
}
/* TODO: Move decryption of the first packet into this function? */
@ -408,14 +409,15 @@ is_first_packet_ok (const struct lsquic_packet_in *packet_in)
struct lsquic_conn *
lsquic_mini_conn_ietf_new (struct lsquic_engine_public *enpub,
const struct lsquic_packet_in *packet_in,
enum lsquic_version version, int is_ipv4, const lsquic_cid_t *odcid)
enum lsquic_version version, int is_ipv4, const lsquic_cid_t *odcid,
size_t udp_payload_size)
{
struct ietf_mini_conn *conn;
enc_session_t *enc_sess;
enum enc_level i;
const struct enc_session_funcs_iquic *esfi;
if (!is_first_packet_ok(packet_in))
if (!is_first_packet_ok(packet_in, udp_payload_size))
return NULL;
conn = lsquic_malo_get(enpub->enp_mm.malo.mini_conn_ietf);
@ -709,14 +711,6 @@ imico_dispatch_stream_events (struct ietf_mini_conn *conn)
}
static unsigned
imico_process_stream_frame (IMICO_PROC_FRAME_ARGS)
{
LSQ_WARN("%s: TODO", __func__);
return 0;
}
static int
imico_stash_stream_frame (struct ietf_mini_conn *conn,
enum enc_level enc_level, struct lsquic_packet_in *packet_in,
@ -1025,7 +1019,6 @@ static unsigned (*const imico_process_frames[N_QUIC_FRAMES])
(IMICO_PROC_FRAME_ARGS) =
{
[QUIC_FRAME_PADDING] = imico_process_padding_frame,
[QUIC_FRAME_STREAM] = imico_process_stream_frame,
[QUIC_FRAME_CRYPTO] = imico_process_crypto_frame,
[QUIC_FRAME_ACK] = imico_process_ack_frame,
[QUIC_FRAME_PING] = imico_process_ping_frame,
@ -1044,6 +1037,8 @@ static unsigned (*const imico_process_frames[N_QUIC_FRAMES])
[QUIC_FRAME_STOP_SENDING] = imico_process_invalid_frame,
[QUIC_FRAME_PATH_CHALLENGE] = imico_process_invalid_frame,
[QUIC_FRAME_PATH_RESPONSE] = imico_process_invalid_frame,
/* STREAM frame can only come in the App PNS and we delay those packets: */
[QUIC_FRAME_STREAM] = imico_process_invalid_frame,
};
@ -1582,12 +1577,13 @@ imico_generate_conn_close (struct ietf_mini_conn *conn)
break;
}
need = conn->imc_conn.cn_pf->pf_connect_close_frame_size(is_app,
error_code, 0, rlen);
LSQ_DEBUG("will generate %u CONNECTION_CLOSE frame%.*s",
pns_max - pns + 1, pns_max > pns, "s");
do
{
header_type = pns2hety[pns];
need = 30; /* Guess */ /* TODO: calculate, don't guess */
packet_out = imico_get_packet_out(conn, header_type, need);
if (!packet_out)
return;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mini_conn_ietf.h -- Mini connection used by the IETF QUIC
*/
@ -110,7 +110,8 @@ struct ietf_mini_conn
struct lsquic_conn *
lsquic_mini_conn_ietf_new (struct lsquic_engine_public *,
const struct lsquic_packet_in *,
enum lsquic_version, int is_ipv4, const struct lsquic_cid *);
enum lsquic_version, int is_ipv4, const struct lsquic_cid *,
size_t udp_payload_size);
int
lsquic_mini_conn_ietf_ecn_ok (const struct ietf_mini_conn *);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* Based on Google code released under BSD license here:
* https://groups.google.com/forum/#!topic/bbr-dev/3RTgkzi5ZD8

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSQUIC_MINMAX_H
#define LSQUIC_MINMAX_H

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mm.c -- Memory manager.
*/

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mm.h -- Memory manager.
*

Some files were not shown because too many files have changed in this diff Show more