mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Release 2.10.3
- [BUGFIX] Cancel path responses and challenges on old path when switching to new path. - Logging network path information.
This commit is contained in:
parent
8c1565cb1c
commit
f2a7fa84cd
8 changed files with 76 additions and 45 deletions
|
@ -1,3 +1,9 @@
|
|||
2020-01-31
|
||||
- 2.10.3
|
||||
- [BUGFIX] Cancel path responses and challenges on old path when
|
||||
switching to new path
|
||||
- Logging network path information.
|
||||
|
||||
2020-01-30
|
||||
- 2.10.2
|
||||
- [BUGFIX] Do not delay ACKs for Initial and Handshake packets.
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
|
||||
#define LSQUIC_MAJOR_VERSION 2
|
||||
#define LSQUIC_MINOR_VERSION 10
|
||||
#define LSQUIC_PATCH_VERSION 2
|
||||
#define LSQUIC_PATCH_VERSION 3
|
||||
|
||||
/**
|
||||
* Engine flags:
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <string.h>
|
||||
#include <sys/queue.h>
|
||||
#include <time.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -2048,38 +2047,6 @@ lose_matching_packets (const lsquic_engine_t *engine, struct out_batch *batch,
|
|||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sockaddr2str (const struct sockaddr *addr, char *buf, size_t sz)
|
||||
{
|
||||
unsigned short port;
|
||||
int len;
|
||||
|
||||
switch (addr->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
port = ntohs(((struct sockaddr_in *) addr)->sin_port);
|
||||
if (!inet_ntop(AF_INET, &((struct sockaddr_in *) addr)->sin_addr,
|
||||
buf, sz))
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
case AF_INET6:
|
||||
port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
|
||||
if (!inet_ntop(AF_INET6, &((struct sockaddr_in6 *) addr)->sin6_addr,
|
||||
buf, sz))
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
default:
|
||||
port = 0;
|
||||
(void) snprintf(buf, sz, "<invalid family %d>", addr->sa_family);
|
||||
break;
|
||||
}
|
||||
|
||||
len = strlen(buf);
|
||||
if (len < (int) sz)
|
||||
snprintf(buf + len, sz - (size_t) len, ":%hu", port);
|
||||
}
|
||||
|
||||
|
||||
struct send_batch_ctx {
|
||||
struct conns_stailq *closed_conns;
|
||||
struct conns_tailq *ticked_conns;
|
||||
|
@ -2121,8 +2088,8 @@ close_conn_on_send_error (struct lsquic_engine *engine,
|
|||
conn->cn_flags & LSCONN_EVANESCENT ? "evanecsent" :
|
||||
conn->cn_flags & LSCONN_MINI ? "mini" : "regular",
|
||||
CID_BITS(lsquic_conn_log_cid(conn)),
|
||||
(sockaddr2str(batch->outs[n].local_sa, buf[0], sizeof(buf[0])), buf[0]),
|
||||
(sockaddr2str(batch->outs[n].dest_sa, buf[1], sizeof(buf[1])), buf[1]),
|
||||
SA2STR(batch->outs[n].local_sa, buf[0]),
|
||||
SA2STR(batch->outs[n].dest_sa, buf[1]),
|
||||
e_val);
|
||||
if (conn->cn_flags & LSCONN_EVANESCENT)
|
||||
lsquic_prq_drop(conn);
|
||||
|
|
|
@ -3931,6 +3931,9 @@ switch_path_to (struct id24_full_conn *conn, unsigned char path_id)
|
|||
conn->ifc_cur_path_id = path_id;
|
||||
conn->ifc_pub.path = CUR_NPATH(conn);
|
||||
conn->ifc_conn.cn_cur_cce_idx = CUR_CPATH(conn)->cop_cce_idx;
|
||||
conn->ifc_send_flags &= ~(SF_SEND_PATH_CHAL << old_path_id);
|
||||
conn->ifc_send_flags &= ~(SF_SEND_PATH_RESP << old_path_id);
|
||||
lsquic_alarmset_unset(&conn->ifc_alset, AL_PATH_CHAL + old_path_id);
|
||||
if (conn->ifc_flags & IFC_SERVER)
|
||||
{
|
||||
memset(&conn->ifc_paths[old_path_id], 0, sizeof(conn->ifc_paths[0]));
|
||||
|
|
|
@ -4137,15 +4137,15 @@ switch_path_to (struct ietf_full_conn *conn, unsigned char path_id)
|
|||
assert(conn->ifc_cur_path_id != path_id);
|
||||
|
||||
EV_LOG_CONN_EVENT(LSQUIC_LOG_CONN_ID, "switched paths");
|
||||
/* TODO: reset cwnd and RTT estimate.
|
||||
* See [draft-ietf-quic-transport-23] Section 9.4.
|
||||
*/
|
||||
lsquic_send_ctl_repath(&conn->ifc_send_ctl,
|
||||
CUR_NPATH(conn), &conn->ifc_paths[path_id].cop_path);
|
||||
maybe_retire_dcid(conn, &CUR_NPATH(conn)->np_dcid);
|
||||
conn->ifc_cur_path_id = path_id;
|
||||
conn->ifc_pub.path = CUR_NPATH(conn);
|
||||
conn->ifc_conn.cn_cur_cce_idx = CUR_CPATH(conn)->cop_cce_idx;
|
||||
conn->ifc_send_flags &= ~(SF_SEND_PATH_CHAL << old_path_id);
|
||||
conn->ifc_send_flags &= ~(SF_SEND_PATH_RESP << old_path_id);
|
||||
lsquic_alarmset_unset(&conn->ifc_alset, AL_PATH_CHAL + old_path_id);
|
||||
if (conn->ifc_flags & IFC_SERVER)
|
||||
{
|
||||
memset(&conn->ifc_paths[old_path_id], 0, sizeof(conn->ifc_paths[0]));
|
||||
|
@ -6776,10 +6776,17 @@ path_matches (const struct network_path *path,
|
|||
|
||||
|
||||
static void
|
||||
record_to_path (struct network_path *path, void *peer_ctx,
|
||||
record_to_path (struct ietf_full_conn *conn, struct conn_path *copath, void *peer_ctx,
|
||||
const struct sockaddr *local_sa, const struct sockaddr *peer_sa)
|
||||
{
|
||||
size_t len = local_sa->sa_family == AF_INET ? sizeof(struct sockaddr_in)
|
||||
struct network_path *path;
|
||||
size_t len;
|
||||
char path_str[2][INET6_ADDRSTRLEN + sizeof(":65535")];
|
||||
|
||||
LSQ_DEBUG("record path %d: (%s - %s)", (int) (copath - conn->ifc_paths),
|
||||
SA2STR(local_sa, path_str[0]), SA2STR(peer_sa, path_str[1]));
|
||||
path = &copath->cop_path;
|
||||
len = local_sa->sa_family == AF_INET ? sizeof(struct sockaddr_in)
|
||||
: sizeof(struct sockaddr_in6);
|
||||
memcpy(NP_LOCAL_SA(path), local_sa, len);
|
||||
len = peer_sa->sa_family == AF_INET ? sizeof(struct sockaddr_in)
|
||||
|
@ -6830,7 +6837,7 @@ ietf_full_conn_ci_record_addrs (struct lsquic_conn *lconn, void *peer_ctx,
|
|||
|
||||
if (first_unused)
|
||||
{
|
||||
record_to_path(&first_unused->cop_path, peer_ctx, local_sa, peer_sa);
|
||||
record_to_path(conn, first_unused, peer_ctx, local_sa, peer_sa);
|
||||
if (0 == conn->ifc_used_paths && !(conn->ifc_flags & IFC_SERVER))
|
||||
/* First path is considered valid immediately */
|
||||
first_unused->cop_flags |= COP_VALIDATED;
|
||||
|
@ -6843,7 +6850,7 @@ ietf_full_conn_ci_record_addrs (struct lsquic_conn *lconn, void *peer_ctx,
|
|||
if (first_unvalidated || first_other)
|
||||
{
|
||||
victim = first_unvalidated ? first_unvalidated : first_other;
|
||||
record_to_path(&victim->cop_path, peer_ctx, local_sa, peer_sa);
|
||||
record_to_path(conn, victim, peer_ctx, local_sa, peer_sa);
|
||||
return victim - conn->ifc_paths;
|
||||
}
|
||||
|
||||
|
|
|
@ -1769,6 +1769,7 @@ ietf_mini_conn_ci_record_addrs (struct lsquic_conn *lconn, void *peer_ctx,
|
|||
const struct sockaddr *orig_peer_sa;
|
||||
struct lsquic_packet_out *packet_out;
|
||||
size_t len;
|
||||
char path_str[4][INET6_ADDRSTRLEN + sizeof(":65535")];
|
||||
|
||||
if (NP_IS_IPv6(&conn->imc_path) != (AF_INET6 == peer_sa->sa_family))
|
||||
TAILQ_FOREACH(packet_out, &conn->imc_packets_out, po_next)
|
||||
|
@ -1776,10 +1777,19 @@ ietf_mini_conn_ci_record_addrs (struct lsquic_conn *lconn, void *peer_ctx,
|
|||
imico_return_enc_data(conn, packet_out);
|
||||
|
||||
orig_peer_sa = NP_PEER_SA(&conn->imc_path);
|
||||
if (orig_peer_sa->sa_family != 0
|
||||
&& !(lsquic_sockaddr_eq(NP_PEER_SA(&conn->imc_path), peer_sa)
|
||||
if (orig_peer_sa->sa_family == 0)
|
||||
LSQ_DEBUG("connection to %s from %s", SA2STR(local_sa, path_str[0]),
|
||||
SA2STR(peer_sa, path_str[1]));
|
||||
else if (!(lsquic_sockaddr_eq(NP_PEER_SA(&conn->imc_path), peer_sa)
|
||||
&& lsquic_sockaddr_eq(NP_LOCAL_SA(&conn->imc_path), local_sa)))
|
||||
{
|
||||
LSQ_DEBUG("path changed from (%s - %s) to (%s - %s)",
|
||||
SA2STR(NP_LOCAL_SA(&conn->imc_path), path_str[0]),
|
||||
SA2STR(NP_PEER_SA(&conn->imc_path), path_str[1]),
|
||||
SA2STR(local_sa, path_str[2]),
|
||||
SA2STR(peer_sa, path_str[3]));
|
||||
conn->imc_flags |= IMC_PATH_CHANGED;
|
||||
}
|
||||
|
||||
len = local_sa->sa_family == AF_INET ? sizeof(struct sockaddr_in)
|
||||
: sizeof(struct sockaddr_in6);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <vc_compat.h>
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#if !(defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) && defined(__APPLE__)
|
||||
#include <mach/mach_time.h>
|
||||
|
@ -277,3 +278,35 @@ lsquic_sockaddr_eq (const struct sockaddr *a, const struct sockaddr *b)
|
|||
&((struct sockaddr_in6 *) b)->sin6_addr,
|
||||
sizeof(((struct sockaddr_in6 *) b)->sin6_addr));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
lsquic_sockaddr2str (const struct sockaddr *addr, char *buf, size_t sz)
|
||||
{
|
||||
unsigned short port;
|
||||
int len;
|
||||
|
||||
switch (addr->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
port = ntohs(((struct sockaddr_in *) addr)->sin_port);
|
||||
if (!inet_ntop(AF_INET, &((struct sockaddr_in *) addr)->sin_addr,
|
||||
buf, sz))
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
case AF_INET6:
|
||||
port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
|
||||
if (!inet_ntop(AF_INET6, &((struct sockaddr_in6 *) addr)->sin6_addr,
|
||||
buf, sz))
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
default:
|
||||
port = 0;
|
||||
(void) snprintf(buf, sz, "<invalid family %d>", addr->sa_family);
|
||||
break;
|
||||
}
|
||||
|
||||
len = strlen(buf);
|
||||
if (len < (int) sz)
|
||||
snprintf(buf + len, sz - (size_t) len, ":%hu", port);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,11 @@ lsquic_hexstr (const unsigned char *buf, size_t bufsz, char *out, size_t outsz);
|
|||
int
|
||||
lsquic_sockaddr_eq (const struct sockaddr *a, const struct sockaddr *b);
|
||||
|
||||
void
|
||||
lsquic_sockaddr2str (const struct sockaddr *addr, char *buf, size_t sz);
|
||||
|
||||
#define SA2STR(sa_, buf_) (lsquic_sockaddr2str(sa_, buf_, sizeof(buf_)), buf_)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue