CLEANUP: quic: create a dedicated quic_conn module
xprt_quic module was too large and did not reflect the true architecture
by contrast to the other protocols in haproxy.
Extract code related to XPRT layer and keep it under xprt_quic module.
This code should only contains a simple API to communicate between QUIC
lower layer and connection/MUX.
The vast majority of the code has been moved into a new module named
quic_conn. This module is responsible to the implementation of QUIC
lower layer. Conceptually, it overlaps with TCP kernel implementation
when comparing QUIC and HTTP1/2 stacks of haproxy.
This should be backported up to 2.6.
(cherry picked from commit 92fa63f735
)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
parent
228883ca32
commit
4a6be622b2
3
Makefile
3
Makefile
@ -645,7 +645,8 @@ OPTIONS_OBJS += src/quic_sock.o src/proto_quic.o src/xprt_quic.o src/quic_tls.o
|
||||
src/cbuf.o src/qpack-dec.o src/qpack-tbl.o src/h3.o src/qpack-enc.o \
|
||||
src/hq_interop.o src/cfgparse-quic.o src/quic_loss.o \
|
||||
src/quic_tp.o src/quic_stream.o src/quic_stats.o src/h3_stats.o \
|
||||
src/quic_cc_cubic.o src/qmux_trace.o src/qmux_http.o
|
||||
src/quic_cc_cubic.o src/qmux_trace.o src/qmux_http.o \
|
||||
src/quic_conn.o
|
||||
endif
|
||||
|
||||
ifneq ($(USE_LUA),)
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <haproxy/buf.h>
|
||||
#include <haproxy/chunk.h>
|
||||
#include <haproxy/quic_cc-t.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
|
||||
void quic_cc_init(struct quic_cc *cc, struct quic_cc_algo *algo, struct quic_conn *qc);
|
||||
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* include/haproxy/xprt_quic-t.h
|
||||
* This file contains applet function prototypes
|
||||
* include/haproxy/quic_conn-t.h
|
||||
*
|
||||
* Copyright 2019 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com>
|
||||
*
|
||||
@ -19,8 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _HAPROXY_XPRT_QUIC_T_H
|
||||
#define _HAPROXY_XPRT_QUIC_T_H
|
||||
#ifndef _HAPROXY_QUIC_CONN_T_H
|
||||
#define _HAPROXY_QUIC_CONN_T_H
|
||||
|
||||
#ifdef USE_QUIC
|
||||
#ifndef USE_OPENSSL
|
||||
#error "Must define USE_OPENSSL"
|
||||
@ -707,4 +707,4 @@ struct quic_conn {
|
||||
};
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
#endif /* _HAPROXY_XPRT_QUIC_T_H */
|
||||
#endif /* _HAPROXY_QUIC_CONN_T_H */
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* include/haproxy/xprt_quic.h
|
||||
* This file contains QUIC xprt function prototypes
|
||||
* include/haproxy/quic_conn.h
|
||||
*
|
||||
* Copyright 2020 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com>
|
||||
*
|
||||
@ -19,8 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _HAPROXY_XPRT_QUIC_H
|
||||
#define _HAPROXY_XPRT_QUIC_H
|
||||
#ifndef _HAPROXY_QUIC_CONN_H
|
||||
#define _HAPROXY_QUIC_CONN_H
|
||||
#ifdef USE_QUIC
|
||||
#ifndef USE_OPENSSL
|
||||
#error "Must define USE_OPENSSL"
|
||||
@ -40,11 +39,11 @@
|
||||
|
||||
#include <haproxy/listener.h>
|
||||
#include <haproxy/quic_cc.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/quic_frame.h>
|
||||
#include <haproxy/quic_loss.h>
|
||||
#include <haproxy/mux_quic.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
@ -707,5 +706,9 @@ void qc_notify_close(struct quic_conn *qc);
|
||||
|
||||
void qc_release_frm(struct quic_conn *qc, struct quic_frame *frm);
|
||||
|
||||
void qc_check_close_on_released_mux(struct quic_conn *qc);
|
||||
|
||||
void quic_conn_release(struct quic_conn *qc);
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
#endif /* _HAPROXY_XPRT_QUIC_H */
|
||||
#endif /* _HAPROXY_QUIC_CONN_H */
|
@ -26,9 +26,9 @@
|
||||
#error "Must define USE_OPENSSL"
|
||||
#endif
|
||||
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/quic_frame-t.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
const char *quic_frame_type_string(enum quic_frame_type ft);
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include <haproxy/quic_loss-t.h>
|
||||
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_tls-t.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
static inline void quic_loss_init(struct quic_loss *ql)
|
||||
{
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
#include <haproxy/dynbuf.h>
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_tls-t.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
void quic_tls_keys_hexdump(struct buffer *buf,
|
||||
const struct quic_tls_secrets *secs);
|
||||
|
@ -6,8 +6,8 @@
|
||||
#endif
|
||||
|
||||
#include <haproxy/chunk.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
void quic_transport_params_init(struct quic_transport_params *p, int server);
|
||||
int quic_transport_params_encode(unsigned char *buf,
|
||||
|
2
src/h3.c
2
src/h3.c
@ -35,11 +35,11 @@
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/qpack-dec.h>
|
||||
#include <haproxy/qpack-enc.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/stats-t.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
/* trace source and events */
|
||||
static void h3_trace(enum trace_level level, uint64_t mask,
|
||||
|
@ -115,6 +115,7 @@
|
||||
#include <haproxy/namespace.h>
|
||||
#include <haproxy/net_helper.h>
|
||||
#include <haproxy/openssl-compat.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/pattern.h>
|
||||
#include <haproxy/peers.h>
|
||||
@ -139,7 +140,6 @@
|
||||
#include <haproxy/uri_auth-t.h>
|
||||
#include <haproxy/vars.h>
|
||||
#include <haproxy/version.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
|
||||
/* array of init calls for older platforms */
|
||||
|
@ -10,12 +10,12 @@
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/qmux_http.h>
|
||||
#include <haproxy/qmux_trace.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_stream.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/ssl_sock-t.h>
|
||||
#include <haproxy/stconn.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
DECLARE_POOL(pool_head_qcc, "qcc", sizeof(struct qcc));
|
||||
DECLARE_POOL(pool_head_qcs, "qcs", sizeof(struct qcs));
|
||||
|
@ -42,12 +42,12 @@
|
||||
#include <haproxy/proto_quic.h>
|
||||
#include <haproxy/proto_udp.h>
|
||||
#include <haproxy/proxy-t.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_sock.h>
|
||||
#include <haproxy/sock.h>
|
||||
#include <haproxy/sock_inet.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
/* per-thread quic datagram handlers */
|
||||
struct quic_dghdlr *quic_dghdlrs;
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <haproxy/buf.h>
|
||||
#include <haproxy/chunk.h>
|
||||
#include <haproxy/quic_cc.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
#define TRACE_SOURCE &trace_quic
|
||||
|
||||
|
7173
src/quic_conn.c
Normal file
7173
src/quic_conn.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,11 +10,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <import/eb64tree.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/quic_frame.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
#define TRACE_SOURCE &trace_quic
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <import/eb64tree.h>
|
||||
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_loss.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
#include <haproxy/quic_tls-t.h>
|
||||
|
||||
#include <haproxy/atomic.h>
|
||||
#include <haproxy/list.h>
|
||||
|
@ -28,13 +28,13 @@
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/proto_quic.h>
|
||||
#include <haproxy/proxy-t.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_sock.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/session.h>
|
||||
#include <haproxy/stats-t.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
/* This function is called from the protocol layer accept() in order to
|
||||
* instantiate a new session on behalf of a given listener and frontend. It
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <haproxy/mux_quic-t.h>
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
|
||||
DECLARE_STATIC_POOL(pool_head_quic_stream_desc, "qc_stream_desc",
|
||||
sizeof(struct qc_stream_desc));
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <haproxy/buf.h>
|
||||
#include <haproxy/chunk.h>
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
|
||||
|
||||
DECLARE_POOL(pool_head_quic_tls_secret, "quic_tls_secret", QUIC_TLS_SECRET_LEN);
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <haproxy/global.h>
|
||||
#include <haproxy/ncbuf-t.h>
|
||||
#include <haproxy/net_helper.h>
|
||||
#include <haproxy/quic_conn-t.h>
|
||||
#include <haproxy/quic_enc.h>
|
||||
#include <haproxy/quic_tp.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_quic-t.h>
|
||||
|
||||
#define QUIC_MAX_UDP_PAYLOAD_SIZE 2048
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include <haproxy/proxy.h>
|
||||
#include <haproxy/sample.h>
|
||||
#include <haproxy/sc_strm.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_tp.h>
|
||||
#include <haproxy/server.h>
|
||||
#include <haproxy/shctx.h>
|
||||
@ -80,7 +81,6 @@
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/vars.h>
|
||||
#include <haproxy/xprt_quic.h>
|
||||
#include <haproxy/xxhash.h>
|
||||
#include <haproxy/istbuf.h>
|
||||
|
||||
|
7151
src/xprt_quic.c
7151
src/xprt_quic.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user