net: In-kernel QUIC implementation with Userspace handshake
Subsystems (7)
cover net: In-kernel QUIC implementation with Userspace handshake
Introduction
============
This is an implementation of the QUIC protocol as defined in RFC9000. QUIC is an UDP-Based Multiplexed and Secure Transport protocol, and it provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances.
This implementation of QUIC in the kernel space enables users to utilize the QUIC protocol through common socket APIs in user space. Additionally, kernel subsystems like SMB and NFS can seamlessly operate over the QUIC protocol after handshake using net/handshake APIs.
Note that In-Kernel QUIC implementation does NOT target Crypto Offload support for existing Userland QUICs, and Crypto Offload intended for Userland QUICs can NOT be utilized for Kernel consumers, such as SMB. Therefore, there is no conflict between In-Kernel QUIC and Crypto Offload for Userland QUICs.
This implementation offers fundamental support for the following RFCs:
- RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport
- RFC9001 - Using TLS to Secure QUIC
- RFC9002 - QUIC Loss Detection and Congestion Control
- RFC9221 - An Unreliable Datagram Extension to QUIC
- RFC9287 - Greasing the QUIC Bit
- RFC9368 - Compatible Version Negotiation for QUIC
- RFC9369 - QUIC Version 2
- Handshake APIs for tlshd Use - SMB/NFS over QUIC
Implementation
==============
The central idea is to implement QUIC within the kernel, incorporating an userspace handshake approach.
Only the processing and creation of raw TLS Handshake Messages, facilitated by a tls library like gnutls, take place in userspace. These messages are exchanged through sendmsg/recvmsg() mechanisms, with cryptographic details carried in the control message (cmsg).
The entirety of QUIC protocol, excluding TLS Handshake Messages processing and creation, resides in the kernel. Instead of utilizing a User Level Protocol (ULP) layer, it establishes a socket of IPPROTO_QUIC type (similar to IPPROTO_MPTCP) operating over UDP tunnels.
Kernel consumers can initiate a handshake request from kernel to userspace via the existing net/handshake netlink. The userspace component, tlshd from ktls-utils, manages the QUIC handshake request processing.
- Handshake Architecture:
+------+ +------+
| APP1 | | APP2 | ...
+------+ +------+
+-------------------------------------------------+
| libquic (ktls-utils) |<--------------+
| {quic_handshake_server/client/param()} | |
+-------------------------------------------------+ +---------------------+
{send/recvmsg()} {set/getsockopt()} | tlshd (ktls-utils) |
[CMSG handshake_info] [SOCKOPT_CRYPTO_SECRET] +---------------------+
[SOCKOPT_TRANSPORT_PARAM_EXT]
| ^ | ^ | ^
Userspace | | | | | |
------------|-|----------------------------|-|------------------------|-|--------------
Kernel | | | | | |
v | v | v |
+--------------------------------------------------+ +-------------+
| socket (IPPRTOTO_QUIC) | protocol |<----+ | handshake |
+--------------------------------------------------+ | | netlink APIs|
| inqueue | outqueue | cong | path | connection_id | | +-------------+
+--------------------------------------------------+ | | |
| packet | frame | crypto | pnmap | | +-----+ +-----+
+--------------------------------------------------+ | | | | |
| input | output | |---| SMB | | NFS | ...
+--------------------------------------------------+ | | | | |
| UDP tunnels | | +-----+ +--+--+
+--------------------------------------------------+ +--------------|- Post Handshake Architecture:
+------+ +------+
| APP1 | | APP2 | ...
+------+ +------+
{send/recvmsg()} {set/getsockopt()}
[CMSG stream_info] [SOCKOPT_KEY_UPDATE]
[SOCKOPT_CONNECTION_MIGRATION]
[SOCKOPT_STREAM_OPEN/RESET/STOP_SENDING]
[...]
| ^ | ^
Userspace | | | |
------------|-|----------------------------|-|----------------
Kernel | | | |
v | v |
+--------------------------------------------------+
| socket (IPPRTOTO_QUIC) | protocol |<----+ {kernel_send/recvmsg()}
+--------------------------------------------------+ | {kernel_set/getsockopt()}
| inqueue | outqueue | cong | path | connection_id | |
+--------------------------------------------------+ |
| packet | frame | crypto | pnmap | | +-----+ +-----+
+--------------------------------------------------+ | | | | |
| input | output | |---| SMB | | NFS | ...
+--------------------------------------------------+ | | | | |
| UDP tunnels | | +-----+ +--+--+
+--------------------------------------------------+ +--------------|Usage
=====
This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd = socket(IPPROTO_QUIC) listenfd = socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd) quic_server_handshake(sockfd, cert)
sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)
Please note that quic_client_handshake() and quic_server_handshake() functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.
For utilization by kernel consumers, it is essential to have the tlshd service (from ktls-utils) installed and running in userspace. This service receives and manages kernel handshake requests for kernel sockets. In kernel, the APIs closely resemble those used in userspace:
Client Server
------------------------------------------------------------------------
__sock_create(IPPROTO_QUIC, &sock) __sock_create(IPPROTO_QUIC, &sock)
kernel_bind(sock) kernel_bind(sock)
kernel_listen(sock)
kernel_connect(sock)
tls_client_hello_x509(args:{sock})
kernel_accept(sock, &newsock)
tls_server_hello_x509(args:{newsock})
kernel_sendmsg(sock) kernel_recvmsg(newsock)
sock_release(sock) sock_release(newsock)
sock_release(sock)Please be aware that tls_client_hello_x509() and tls_server_hello_x509() are APIs from net/handshake/. They are employed to dispatch the handshake request to the userspace tlshd service and subsequently block until the handshake process is completed.
For advanced usage,
see man doc: https://github.com/lxin/quic/wiki/man
and examples: https://github.com/lxin/quic/tree/main/tests
The QUIC module is currently labeled as "EXPERIMENTAL".
Xin Long (5):
net: define IPPROTO_QUIC and SOL_QUIC constants for QUIC protocol
net: include quic.h in include/uapi/linux for QUIC protocol
net: implement QUIC protocol code in net/quic directory
net: integrate QUIC build configuration into Kconfig and Makefile
Documentation: introduce quic.rst to provide description of QUIC
protocol
Documentation/networking/quic.rst | 160 +++ include/linux/socket.h | 1 + include/uapi/linux/in.h | 2 + include/uapi/linux/quic.h | 189 +++ net/Kconfig | 1 + net/Makefile | 1 + net/quic/Kconfig | 34 + net/quic/Makefile | 20 + net/quic/cong.c | 229 ++++ net/quic/cong.h | 84 ++ net/quic/connection.c | 172 +++ net/quic/connection.h | 117 ++ net/quic/crypto.c | 979 ++++++++++++++++ net/quic/crypto.h | 140 +++ net/quic/frame.c | 1803 ++++++++++++++++++++++++++++ net/quic/frame.h | 162 +++ net/quic/hashtable.h | 125 ++ net/quic/input.c | 693 +++++++++++ net/quic/input.h | 169 +++ net/quic/number.h | 174 +++ net/quic/output.c | 638 ++++++++++ net/quic/output.h | 194 +++ net/quic/packet.c | 1179 +++++++++++++++++++ net/quic/packet.h | 99 ++ net/quic/path.c | 434 +++++++ net/quic/path.h | 131 +++ net/quic/pnmap.c | 217 ++++ net/quic/pnmap.h | 134 +++ net/quic/protocol.c | 711 +++++++++++ net/quic/protocol.h | 56 + net/quic/sample_test.c | 339 ++++++ net/quic/socket.c | 1823 +++++++++++++++++++++++++++++ net/quic/socket.h | 293 +++++ net/quic/stream.c | 248 ++++ net/quic/stream.h | 147 +++ net/quic/timer.c | 241 ++++ net/quic/timer.h | 29 + net/quic/unit_test.c | 1024 ++++++++++++++++ 38 files changed, 13192 insertions(+) create mode 100644 Documentation/networking/quic.rst create mode 100644 include/uapi/linux/quic.h create mode 100644 net/quic/Kconfig create mode 100644 net/quic/Makefile create mode 100644 net/quic/cong.c create mode 100644 net/quic/cong.h create mode 100644 net/quic/connection.c create mode 100644 net/quic/connection.h create mode 100644 net/quic/crypto.c create mode 100644 net/quic/crypto.h create mode 100644 net/quic/frame.c create mode 100644 net/quic/frame.h create mode 100644 net/quic/hashtable.h create mode 100644 net/quic/input.c create mode 100644 net/quic/input.h create mode 100644 net/quic/number.h create mode 100644 net/quic/output.c create mode 100644 net/quic/output.h create mode 100644 net/quic/packet.c create mode 100644 net/quic/packet.h create mode 100644 net/quic/path.c create mode 100644 net/quic/path.h create mode 100644 net/quic/pnmap.c create mode 100644 net/quic/pnmap.h create mode 100644 net/quic/protocol.c create mode 100644 net/quic/protocol.h create mode 100644 net/quic/sample_test.c create mode 100644 net/quic/socket.c create mode 100644 net/quic/socket.h create mode 100644 net/quic/stream.c create mode 100644 net/quic/stream.h create mode 100644 net/quic/timer.c create mode 100644 net/quic/timer.h create mode 100644 net/quic/unit_test.c
Signature · 1 line
2.43.0
RFC PATCH 1/5 net: define IPPROTO_QUIC and SOL_QUIC constants for QUIC protocol
This patch adds IPPROTO_QUIC and SOL_QUIC constants to the networking subsystem. These definitions are essential for applications to set socket options and protocol identifiers related to the QUIC protocol.
QUIC does not possess a protocol number allocated from IANA, and like IPPROTO_MPTCP, IPPROTO_QUIC is merely a value used when opening a QUIC socket with:
socket(AF_INET, SOCK_STREAM, IPPROTO_QUIC);
Note we did not opt for UDP ULP for QUIC implementation due to several considerations:
- QUIC's connection Migration requires at least 2 UDP sockets for one QUIC connection at the same time, not to mention the multipath feature in one of its draft RFCs.
- In-Kernel QUIC, as a Transport Protocol, wants to provide users with the TCP or SCTP like Socket APIs, like connect()/listen()/accept()... Note that a single UDP socket might even be used for multiple QUIC connections.
The use of IPPROTO_QUIC type sockets over UDP tunnel will effectively address these challenges and provides a more flexible and scalable solution.
--- include/linux/socket.h | 1 + include/uapi/linux/in.h | 2 ++ 2 files changed, 3 insertions(+)
include/linux/socket.h +1 -0
@@ -384,6 +384,7 @@ struct ucred {#define SOL_MCTP 285#define SOL_SMC 286#define SOL_VSOCK 287 +#define SOL_QUIC 288/* IPX options */ #define IPX_TYPE 1
include/uapi/linux/in.h +2 -0
@@ -81,6 +81,8 @@ enum {#define IPPROTO_ETHERNET IPPROTO_ETHERNET IPPROTO_RAW = 255, /* Raw IP packets */#define IPPROTO_RAW IPPROTO_RAW + IPPROTO_QUIC = 261, /* A UDP-Based Multiplexed and Secure Transport */ +#define IPPROTO_QUIC IPPROTO_QUIC IPPROTO_MPTCP = 262, /* Multipath TCP connection */#define IPPROTO_MPTCP IPPROTO_MPTCPIPPROTO_MAX
Signature · 1 line
2.43.0
RFC PATCH 2/5 net: include quic.h in include/uapi/linux for QUIC protocol
In reply to Xin LongThis commit introduces quic.h to the include/uapi/linux directory, providing header file with necessary definitions for QUIC. Including quic.h enables both user space applications and kernel consumers to access QUIC-related Send/Receive Control Messages, Socket Options and Events/Notifications APIs.
--- include/uapi/linux/quic.h | 189 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 include/uapi/linux/quic.h
include/uapi/linux/quic.h new file +189 -0
@@ -0,0 +1,189 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* QUIC kernel implementation +* (C) Copyright Red Hat Corp. 2023 +* +* This file is part of the QUIC kernel implementation +* +* Written or modified by: +* Xin Long <[email protected]> +*/ + +#ifndef __uapi_quic_h__ +#define __uapi_quic_h__ + +#include <linux/socket.h> +#ifdef __KERNEL__ +#include <linux/types.h> +#else +#include <stdint.h> +#endif + +/* Send or Receive Options APIs */ +enum quic_cmsg_type { +QUIC_STREAM_INFO , +QUIC_HANDSHAKE_INFO , +}; + +#define QUIC_STREAM_TYPE_SERVER_MASK 0x01 +#define QUIC_STREAM_TYPE_UNI_MASK 0x02 +#define QUIC_STREAM_TYPE_MASK 0x03 + +enum { +QUIC_STREAM_FLAG_NEW = (1 <<0 ), +QUIC_STREAM_FLAG_FIN = (1 <<1 ), +QUIC_STREAM_FLAG_UNI = (1 <<2 ), +QUIC_STREAM_FLAG_ASYNC = (1 <<3 ), +QUIC_STREAM_FLAG_NOTIFICATION = (1 <<4 ), +QUIC_STREAM_FLAG_DATAGRAM = (1 <<5 ), +}; + +enum quic_crypto_level { +QUIC_CRYPTO_APP , +QUIC_CRYPTO_INITIAL , +QUIC_CRYPTO_HANDSHAKE , +QUIC_CRYPTO_EARLY , +QUIC_CRYPTO_MAX , +}; + +struct quic_handshake_info { +uint8_t crypto_level; +}; + +struct quic_stream_info { +uint64_t stream_id; +uint32_t stream_flag; +}; + +enum quic_msg_flags { +MSG_NOTIFICATION =0x8000 , +MSG_STREAM_UNI =0x800 , +MSG_DATAGRAM =0x10 , +}; + +/* Socket Options APIs */ +#define QUIC_SOCKOPT_EVENT 0 +#define QUIC_SOCKOPT_STREAM_OPEN 1 +#define QUIC_SOCKOPT_STREAM_RESET 2 +#define QUIC_SOCKOPT_STREAM_STOP_SENDING 3 +#define QUIC_SOCKOPT_CONNECTION_CLOSE 4 +#define QUIC_SOCKOPT_CONNECTION_MIGRATION 5 +#define QUIC_SOCKOPT_KEY_UPDATE 6 +#define QUIC_SOCKOPT_TRANSPORT_PARAM 7 +#define QUIC_SOCKOPT_TOKEN 8 +#define QUIC_SOCKOPT_ALPN 9 +#define QUIC_SOCKOPT_SESSION_TICKET 10 +#define QUIC_SOCKOPT_CRYPTO_SECRET 11 +#define QUIC_SOCKOPT_TRANSPORT_PARAM_EXT 12 +#define QUIC_SOCKOPT_RETIRE_CONNECTION_ID 13 +#define QUIC_SOCKOPT_ACTIVE_CONNECTION_ID 14 + +#define QUIC_VERSION_V1 0x1 +#define QUIC_VERSION_V2 0x6b3343cf + +struct quic_transport_param { +uint8_t remote; +uint8_t disable_active_migration; +uint8_t grease_quic_bit; +uint8_t stateless_reset; +uint8_t disable_1rtt_encryption; +uint8_t disable_compatible_version; +uint64_t max_udp_payload_size; +uint64_t ack_delay_exponent; +uint64_t max_ack_delay; +uint64_t active_connection_id_limit; +uint64_t max_idle_timeout; +uint64_t max_datagram_frame_size; +uint64_t max_data; +uint64_t max_stream_data_bidi_local; +uint64_t max_stream_data_bidi_remote; +uint64_t max_stream_data_uni; +uint64_t max_streams_bidi; +uint64_t max_streams_uni; +uint64_t initial_smoothed_rtt; +uint32_t plpmtud_probe_timeout; +uint8_t validate_peer_address; +uint8_t receive_session_ticket; +uint8_t certificate_request; +uint8_t congestion_control_alg; +uint32_t payload_cipher_type; +uint32_t version; +}; + +struct quic_crypto_secret { +uint8_t level;/* crypto level */ +uint16_t send;/* send or recv */ +uint32_t type;/* TLS_CIPHER_* */ +uint8_t secret[48 ]; +}; + +enum { +QUIC_CONG_ALG_RENO , +QUIC_CONG_ALG_MAX , +}; + +struct quic_errinfo { +uint64_t stream_id; +uint32_t errcode; +}; + +struct quic_connection_id_info { +uint32_t source; +uint32_t dest; +}; + +struct quic_event_option { +uint8_t type; +uint8_t on; +}; + +/* Event APIs */ +enum quic_event_type { +QUIC_EVENT_NONE , +QUIC_EVENT_STREAM_UPDATE , +QUIC_EVENT_STREAM_MAX_STREAM , +QUIC_EVENT_CONNECTION_CLOSE , +QUIC_EVENT_CONNECTION_MIGRATION , +QUIC_EVENT_KEY_UPDATE , +QUIC_EVENT_NEW_TOKEN , +QUIC_EVENT_END , +QUIC_EVENT_MAX =QUIC_EVENT_END -1 , +}; + +enum { +QUIC_STREAM_SEND_STATE_READY , +QUIC_STREAM_SEND_STATE_SEND , +QUIC_STREAM_SEND_STATE_SENT , +QUIC_STREAM_SEND_STATE_RECVD , +QUIC_STREAM_SEND_STATE_RESET_SENT , +QUIC_STREAM_SEND_STATE_RESET_RECVD , + +QUIC_STREAM_RECV_STATE_RECV , +QUIC_STREAM_RECV_STATE_SIZE_KNOWN , +QUIC_STREAM_RECV_STATE_RECVD , +QUIC_STREAM_RECV_STATE_READ , +QUIC_STREAM_RECV_STATE_RESET_RECVD , +QUIC_STREAM_RECV_STATE_RESET_READ , +}; + +struct quic_stream_update { +uint64_t id; +uint32_t state; +uint32_t errcode; +uint64_t finalsz; +}; + +struct quic_connection_close { +uint32_t errcode; +uint8_t frame; +uint8_t phrase[]; +}; + +union quic_event { +struct quic_stream_update update; +struct quic_connection_close close; +uint64_t max_stream; +uint8_t local_migration; +uint8_t key_update_phase; +}; + +#endif /* __uapi_quic_h__ */
Signature · 1 line
2.43.0
RFC PATCH 4/5 net: integrate QUIC build configuration into Kconfig and Makefile
In reply to Xin LongThis commit introduces build configurations for QUIC within the networking subsystem. The Kconfig and Makefile files in the net directory are updated to include options and rules necessary for building QUIC protocol support.
To enable building the QUIC module, include the following configurations in your .config file:
CONFIG_IP_QUIC=m
CONFIG_IP_QUIC_TEST=m
--- net/Kconfig | 1 + net/Makefile | 1 + 2 files changed, 2 insertions(+)
net/Kconfig +1 -0
@@ -235,6 +235,7 @@ endif source "net/dccp/Kconfig" source "net/sctp/Kconfig" +source "net/quic/Kconfig" source "net/rds/Kconfig" source "net/tipc/Kconfig" source "net/atm/Kconfig"
net/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-y += 8021q/ endif obj-$(CONFIG_IP_DCCP) += dccp/ obj-$(CONFIG_IP_SCTP) += sctp/ +obj-$(CONFIG_IP_QUIC) += quic/ obj-$(CONFIG_RDS) += rds/ obj-$(CONFIG_WIRELESS) += wireless/ obj-$(CONFIG_MAC80211) += mac80211/
Signature · 1 line
2.43.0
RFC PATCH 3/5 net: implement QUIC protocol code in net/quic directory
In reply to Xin LongThis commit adds the initial implementation of the QUIC protocol code. The new net/quic directory contains the necessary source files to handle QUIC functionality within the networking subsystem:
- protocol.c: module init/exit and family_ops for inet and inet6.
- socket.c: definition of functions within the 'quic_prot' struct.
- connection.c: management of source and dest connection IDs.
- stream.c: bidi/unidirectional stream handling and management.
- cong.c: RTT measurement and congestion control mechanisms.
- timer.c: definition of essential timers including RTX/PROBE/IDLE/ACK.
- packet.c: creation and processing of various of short/long packets.
- frame.c: creation and processing of diverse types of frames.
- crypto.c: key derivation/update and header/payload de/encryption.
- pnmap.c: packet number namespaces and SACK range handling.
- input.c: socket lookup and stream/event frames enqueuing to userspace.
- output.c: frames enqueuing for send/resend as well as acknowledgment.
- path.c: src/dst path management including UDP tunnels and PLPMTUD.
- unit_test.c: tests for the APIs defined in some of the above files.
- sample_test.c: a sample showcasing the usage from the kernel space.
It introduces fundamental support for the following RFCs:
RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport RFC9001 - Using TLS to Secure QUIC
RFC9002 - QUIC Loss Detection and Congestion Control RFC9221 - An Unreliable Datagram Extension to QUIC RFC9287 - Greasing the QUIC Bit
RFC9368 - Compatible Version Negotiation for QUIC RFC9369 - QUIC Version 2
The QUIC module is currently labeled as "EXPERIMENTAL".
--- net/quic/Kconfig | 34 + net/quic/Makefile | 20 + net/quic/cong.c | 229 +++++ net/quic/cong.h | 84 ++ net/quic/connection.c | 172 ++++ net/quic/connection.h | 117 +++ net/quic/crypto.c | 979 +++++++++++++++++++++ net/quic/crypto.h | 140 +++ net/quic/frame.c | 1803 +++++++++++++++++++++++++++++++++++++++ net/quic/frame.h | 162 ++++ net/quic/hashtable.h | 125 +++ net/quic/input.c | 693 +++++++++++++++ net/quic/input.h | 169 ++++ net/quic/number.h | 174 ++++ net/quic/output.c | 638 ++++++++++++++ net/quic/output.h | 194 +++++ net/quic/packet.c | 1179 ++++++++++++++++++++++++++ net/quic/packet.h | 99 +++ net/quic/path.c | 434 ++++++++++ net/quic/path.h | 131 +++ net/quic/pnmap.c | 217 +++++ net/quic/pnmap.h | 134 +++ net/quic/protocol.c | 711 ++++++++++++++++ net/quic/protocol.h | 56 ++ net/quic/sample_test.c | 339 ++++++++ net/quic/socket.c | 1823 ++++++++++++++++++++++++++++++++++++++++ net/quic/socket.h | 293 +++++++ net/quic/stream.c | 248 ++++++ net/quic/stream.h | 147 ++++ net/quic/timer.c | 241 ++++++ net/quic/timer.h | 29 + net/quic/unit_test.c | 1024 ++++++++++++++++++++++ 32 files changed, 12838 insertions(+) create mode 100644 net/quic/Kconfig create mode 100644 net/quic/Makefile create mode 100644 net/quic/cong.c create mode 100644 net/quic/cong.h create mode 100644 net/quic/connection.c create mode 100644 net/quic/connection.h create mode 100644 net/quic/crypto.c create mode 100644 net/quic/crypto.h create mode 100644 net/quic/frame.c create mode 100644 net/quic/frame.h create mode 100644 net/quic/hashtable.h create mode 100644 net/quic/input.c create mode 100644 net/quic/input.h create mode 100644 net/quic/number.h create mode 100644 net/quic/output.c create mode 100644 net/quic/output.h create mode 100644 net/quic/packet.c create mode 100644 net/quic/packet.h create mode 100644 net/quic/path.c create mode 100644 net/quic/path.h create mode 100644 net/quic/pnmap.c create mode 100644 net/quic/pnmap.h create mode 100644 net/quic/protocol.c create mode 100644 net/quic/protocol.h create mode 100644 net/quic/sample_test.c create mode 100644 net/quic/socket.c create mode 100644 net/quic/socket.h create mode 100644 net/quic/stream.c create mode 100644 net/quic/stream.h create mode 100644 net/quic/timer.c create mode 100644 net/quic/timer.h create mode 100644 net/quic/unit_test.c
net/quic/Kconfig new file +34 -0
@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# QUIC configuration +# + +menuconfig IP_QUIC + tristate "QUIC: A UDP-Based Multiplexed and Secure Transport (Experimental)" + depends on INET + depends on IPV6 + select NET_UDP_TUNNEL + help + QUIC: A UDP-Based Multiplexed and Secure Transport + + From rfc9000 <https://www.rfc-editor.org/rfc/rfc9000.html>. + + QUIC provides applications with flow-controlled streams for structured + communication, low-latency connection establishment, and network path + migration. QUIC includes security measures that ensure + confidentiality, integrity, and availability in a range of deployment + circumstances. Accompanying documents describe the integration of + TLS for key negotiation, loss detection, and an exemplary congestion + control algorithm. + + To compile this protocol support as a module, choose M here: the + module will be called quic. Debug messages are handled by the + kernel's dynamic debugging framework. + + If in doubt, say N. + +if IP_QUIC +config IP_QUIC_TEST + depends on NET_HANDSHAKE || KUNIT + def_tristate m +endif
net/quic/Makefile new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Makefile for QUIC support code. +# + +obj-$(CONFIG_IP_QUIC) += quic.o + +quic-y := protocol.o socket.o connection.o stream.o path.o \ + packet.o frame.o input.o output.o crypto.o pnmap.o \ + timer.o cong.o + +ifdef CONFIG_KUNIT + obj-$(CONFIG_IP_QUIC_TEST) += quic_unit_test.o + quic_unit_test-y := unit_test.o +endif + +ifdef CONFIG_NET_HANDSHAKE + obj-$(CONFIG_IP_QUIC_TEST) += quic_sample_test.o + quic_sample_test-y := sample_test.o +endif
net/quic/cong.c new file +229 -0
229 lines not on this page · raw message
net/quic/cong.h new file +84 -0
84 lines not on this page · raw message
net/quic/connection.c new file +172 -0
172 lines not on this page · raw message
net/quic/connection.h new file +117 -0
117 lines not on this page · raw message
net/quic/crypto.c new file +979 -0
979 lines not on this page · raw message
net/quic/crypto.h new file +140 -0
140 lines not on this page · raw message
net/quic/frame.c new file +1803 -0
1,225 lines not on this page · raw message
net/quic/frame.h new file +162 -0
162 lines not on this page · raw message
net/quic/hashtable.h new file +125 -0
125 lines not on this page · raw message
net/quic/input.c new file +693 -0
693 lines not on this page · raw message
net/quic/input.h new file +169 -0
169 lines not on this page · raw message
net/quic/number.h new file +174 -0
174 lines not on this page · raw message
net/quic/output.c new file +638 -0
638 lines not on this page · raw message
net/quic/output.h new file +194 -0
194 lines not on this page · raw message
net/quic/packet.c new file +1179 -0
1,179 lines not on this page · raw message
net/quic/packet.h new file +99 -0
99 lines not on this page · raw message
net/quic/path.c new file +434 -0
434 lines not on this page · raw message
net/quic/path.h new file +131 -0
131 lines not on this page · raw message
net/quic/pnmap.c new file +217 -0
217 lines not on this page · raw message
net/quic/pnmap.h new file +134 -0
134 lines not on this page · raw message
net/quic/protocol.c new file +711 -0
711 lines not on this page · raw message
net/quic/protocol.h new file +56 -0
56 lines not on this page · raw message
net/quic/sample_test.c new file +339 -0
339 lines not on this page · raw message
net/quic/socket.c new file +1823 -0
1,823 lines not on this page · raw message
net/quic/socket.h new file +293 -0
293 lines not on this page · raw message
net/quic/stream.c new file +248 -0
248 lines not on this page · raw message
net/quic/stream.h new file +147 -0
147 lines not on this page · raw message
net/quic/timer.c new file +241 -0
241 lines not on this page · raw message
net/quic/unit_test.c new file +1024 -0
1,024 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
RFC PATCH 5/5 Documentation: introduce quic.rst to provide description of QUIC protocol
In reply to Xin LongThis commit adds quic.rst to the documentation directory, providing comprehensive information about the QUIC protocol. This new file serves as a reference for users and developers seeking details on QUIC implementation and usage.
--- Documentation/networking/quic.rst | 160 ++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Documentation/networking/quic.rst
Documentation/networking/quic.rst new file +160 -0
@@ -0,0 +1,160 @@ +.. SPDX-License-Identifier: GPL-2.0 + +================= +Linux Kernel QUIC +================= + +Introduction +============ + +This is an implementation of the QUIC protocol as defined in RFC9000. QUIC +is an UDP-Based Multiplexed and Secure Transport protocol, and it provides +applications with flow-controlled streams for structured communication, +low-latency connection establishment, and network path migration. QUIC +includes security measures that ensure confidentiality, integrity, and +availability in a range of deployment circumstances. + +This implementation of QUIC in the kernel space enables users to utilize +the QUIC protocol through common socket APIs in user space. Additionally, +kernel subsystems like SMB and NFS can seamlessly operate over the QUIC +protocol after handshake using net/handshake APIs. + +This implementation offers fundamental support for the following RFCs: + +- RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport +- RFC9001 - Using TLS to Secure QUIC +- RFC9002 - QUIC Loss Detection and Congestion Control +- RFC9221 - An Unreliable Datagram Extension to QUIC +- RFC9287 - Greasing the QUIC Bit +- RFC9368 - Compatible Version Negotiation for QUIC +- RFC9369 - QUIC Version 2 +- Handshake APIs for tlshd Use - NFS/SMB over QUIC + +Implementation +============== + +The central idea is to implement QUIC within the kernel, incorporating an +userspace handshake approach. + +Only the processing and creation of raw TLS Handshake Messages, facilitated +by a tls library like gnutls, take place in userspace. These messages are +exchanged through sendmsg/recvmsg() mechanisms, with cryptographic details +carried in the control message (cmsg). + +The entirety of QUIC protocol, excluding TLS Handshake Messages processing +and creation, resides in the kernel. Instead of utilizing a User Level +Protocol (ULP) layer, it establishes a socket of IPPROTO_QUIC type (similar +to IPPROTO_MPTCP) operating over UDP tunnels. + +Kernel consumers can initiate a handshake request from kernel to userspace +via the existing net/handshake netlink. The userspace component, tlshd from +ktls-utils, manages the QUIC handshake request processing. + +- Handshake Architecture: + + +------+ +------+ + | APP1 | | APP2 | ... + +------+ +------+ + +-------------------------------------------------+ + | libquic (ktls-utils) |<--------------+ + | {quic_handshake_server/client/param()} | | + +-------------------------------------------------+ +---------------------+ + {send/recvmsg()} {set/getsockopt()} | tlshd (ktls-utils) | + [CMSG handshake_info] [SOCKOPT_CRYPTO_SECRET] +---------------------+ + [SOCKOPT_TRANSPORT_PARAM_EXT] + | ^ | ^ | ^ + Userspace | | | | | | + ------------|-|----------------------------|-|------------------------|-|-------------- + Kernel | | | | | | + v | v | v | + +--------------------------------------------------+ +-------------+ + | socket (IPPRTOTO_QUIC) | protocol |<----+ | handshake | + +--------------------------------------------------+ | | netlink APIs| + | inqueue | outqueue | cong | path | connection_id | | +-------------+ + +--------------------------------------------------+ | | | + | packet | frame | crypto | pnmap | | +-----+ +-----+ + +--------------------------------------------------+ | | | | | + | input | output | |---| SMB | | NFS | ... + +--------------------------------------------------+ | | | | | + | UDP tunnels | | +-----+ +--+--+ + +--------------------------------------------------+ +--------------| + +- Post Handshake Architecture: + + +------+ +------+ + | APP1 | | APP2 | ... + +------+ +------+ + {send/recvmsg()} {set/getsockopt()} + [CMSG stream_info] [SOCKOPT_KEY_UPDATE] + [SOCKOPT_CONNECTION_MIGRATION] + [SOCKOPT_STREAM_OPEN/RESET/STOP_SENDING] + [...] + | ^ | ^ + Userspace | | | | + ------------|-|----------------------------|-|---------------- + Kernel | | | | + v | v | + +--------------------------------------------------+ + | socket (IPPRTOTO_QUIC) | protocol |<----+ {kernel_send/recvmsg()} + +--------------------------------------------------+ | {kernel_set/getsockopt()} + | inqueue | outqueue | cong | path | connection_id | | + +--------------------------------------------------+ | + | packet | frame | crypto | pnmap | | +-----+ +-----+ + +--------------------------------------------------+ | | | | | + | input | output | |---| SMB | | NFS | ... + +--------------------------------------------------+ | | | | | + | UDP tunnels | | +-----+ +--+--+ + +--------------------------------------------------+ +--------------| + +Usage +===== + +This implementation supports a mapping of QUIC into sockets APIs. Similar +to TCP and SCTP, a typical Server and Client use the following system call +sequence to communicate: + + Client Server + ------------------------------------------------------------------ + sockfd = socket(IPPROTO_QUIC) listenfd = socket(IPPROTO_QUIC) + bind(sockfd) bind(listenfd) + listen(listenfd) + connect(sockfd) + quic_client_handshake(sockfd) + sockfd = accecpt(listenfd) + quic_server_handshake(sockfd, cert) + + sendmsg(sockfd) recvmsg(sockfd) + close(sockfd) close(sockfd) + close(listenfd) + +Please note that quic_client_handshake() and quic_server_handshake() functions +are currently sourced from libquic in the github lxin/quic repository, and might +be integrated into ktls-utils in the future. These functions are responsible for +receiving and processing the raw TLS handshake messages until the completion of +the handshake process. + +For utilization by kernel consumers, it is essential to have the tlshd service +(from ktls-utils) installed and running in userspace. This service receives +and manages kernel handshake requests for kernel sockets. In kernel, the APIs +closely resemble those used in userspace: + + Client Server + ------------------------------------------------------------------------ + __sock_create(IPPROTO_QUIC, &sock) __sock_create(IPPROTO_QUIC, &sock) + kernel_bind(sock) kernel_bind(sock) + kernel_listen(sock) + kernel_connect(sock) + tls_client_hello_x509(args:{sock}) + kernel_accept(sock, &newsock) + tls_server_hello_x509(args:{newsock}) + + kernel_sendmsg(sock) kernel_recvmsg(newsock) + sock_release(sock) sock_release(newsock) + sock_release(sock) + +Please be aware that tls_client_hello_x509() and tls_server_hello_x509() are +APIs from net/handshake/. They are employed to dispatch the handshake request +to the userspace tlshd service and subsequently block until the handshake +process is completed. + +The QUIC module is currently labeled as "EXPERIMENTAL".
Signature · 1 line
2.43.0
cover net: In-kernel QUIC implementation with Userspace handshake
In reply to Xin LongFYI.
Patchset Link:
https://lore.kernel.org/netdev/[email protected]/
Thanks.
---------- Forwarded message ---------
From: Xin Long <[email protected]>
Date: Mon, Mar 11, 2024 at 12:19 PM
Subject: [RFC PATCH net-next 0/5] net: In-kernel QUIC implementation with Userspace handshake
To: network dev <[email protected]>
Cc: <[email protected]>, <[email protected]>, Eric Dumazet <[email protected]>, Paolo Abeni <[email protected]>, Steve French <[email protected]>, Namjae Jeon <[email protected]>, Chuck Lever III <[email protected]>, Jeff Layton <[email protected]>, Sabrina Dubroca <[email protected]>, Tyler Fanelli <[email protected]>, Pengtao He <[email protected]>
Introduction
============
This is an implementation of the QUIC protocol as defined in RFC9000. QUIC is an UDP-Based Multiplexed and Secure Transport protocol, and it provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances.
This implementation of QUIC in the kernel space enables users to utilize the QUIC protocol through common socket APIs in user space. Additionally, kernel subsystems like SMB and NFS can seamlessly operate over the QUIC protocol after handshake using net/handshake APIs.
Note that In-Kernel QUIC implementation does NOT target Crypto Offload support for existing Userland QUICs, and Crypto Offload intended for Userland QUICs can NOT be utilized for Kernel consumers, such as SMB. Therefore, there is no conflict between In-Kernel QUIC and Crypto Offload for Userland QUICs.
This implementation offers fundamental support for the following RFCs:
- RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport
- RFC9001 - Using TLS to Secure QUIC
- RFC9002 - QUIC Loss Detection and Congestion Control
- RFC9221 - An Unreliable Datagram Extension to QUIC
- RFC9287 - Greasing the QUIC Bit
- RFC9368 - Compatible Version Negotiation for QUIC
- RFC9369 - QUIC Version 2
- Handshake APIs for tlshd Use - SMB/NFS over QUIC
Implementation
==============
The central idea is to implement QUIC within the kernel, incorporating an userspace handshake approach.
Only the processing and creation of raw TLS Handshake Messages, facilitated by a tls library like gnutls, take place in userspace. These messages are exchanged through sendmsg/recvmsg() mechanisms, with cryptographic details carried in the control message (cmsg).
The entirety of QUIC protocol, excluding TLS Handshake Messages processing and creation, resides in the kernel. Instead of utilizing a User Level Protocol (ULP) layer, it establishes a socket of IPPROTO_QUIC type (similar to IPPROTO_MPTCP) operating over UDP tunnels.
Kernel consumers can initiate a handshake request from kernel to userspace via the existing net/handshake netlink. The userspace component, tlshd from ktls-utils, manages the QUIC handshake request processing.
- Handshake Architecture:
+------+ +------+
| APP1 | | APP2 | ...
+------+ +------+
+-------------------------------------------------+
| libquic (ktls-utils) |<--------------+
| {quic_handshake_server/client/param()} | |
+-------------------------------------------------+
+---------------------+
{send/recvmsg()} {set/getsockopt()} | tlshd
(ktls-utils) |
[CMSG handshake_info] [SOCKOPT_CRYPTO_SECRET]
+---------------------+
[SOCKOPT_TRANSPORT_PARAM_EXT]
| ^ | ^ | ^
Userspace | | | | | |
------------|-|----------------------------|-|------------------------|-|--------------
Kernel | | | | | |
v | v | v |
+--------------------------------------------------+
+-------------+
| socket (IPPRTOTO_QUIC) | protocol |<----+ |
handshake |
+--------------------------------------------------+ | |
netlink APIs|
| inqueue | outqueue | cong | path | connection_id | |
+-------------+
+--------------------------------------------------+ | | |
| packet | frame | crypto | pnmap | |
+-----+ +-----+
+--------------------------------------------------+ | |
| | |
| input | output | |---|
SMB | | NFS | ...
+--------------------------------------------------+ | |
| | |
| UDP tunnels | |
+-----+ +--+--+
+--------------------------------------------------+ +--------------|- Post Handshake Architecture:
+------+ +------+
| APP1 | | APP2 | ...
+------+ +------+
{send/recvmsg()} {set/getsockopt()}
[CMSG stream_info] [SOCKOPT_KEY_UPDATE]
[SOCKOPT_CONNECTION_MIGRATION]
[SOCKOPT_STREAM_OPEN/RESET/STOP_SENDING]
[...]
| ^ | ^
Userspace | | | |
------------|-|----------------------------|-|----------------
Kernel | | | |
v | v |
+--------------------------------------------------+
| socket (IPPRTOTO_QUIC) | protocol |<----+
{kernel_send/recvmsg()}
+--------------------------------------------------+ |
{kernel_set/getsockopt()}
| inqueue | outqueue | cong | path | connection_id | |
+--------------------------------------------------+ |
| packet | frame | crypto | pnmap | |
+-----+ +-----+
+--------------------------------------------------+ | |
| | |
| input | output | |---|
SMB | | NFS | ...
+--------------------------------------------------+ | |
| | |
| UDP tunnels | |
+-----+ +--+--+
+--------------------------------------------------+ +--------------|Usage
=====
This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd = socket(IPPROTO_QUIC) listenfd = socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd) quic_server_handshake(sockfd, cert)
sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)
Please note that quic_client_handshake() and quic_server_handshake() functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.
For utilization by kernel consumers, it is essential to have the tlshd service (from ktls-utils) installed and running in userspace. This service receives and manages kernel handshake requests for kernel sockets. In kernel, the APIs closely resemble those used in userspace:
Client Server
------------------------------------------------------------------------
__sock_create(IPPROTO_QUIC, &sock) __sock_create(IPPROTO_QUIC, &sock)
kernel_bind(sock) kernel_bind(sock)
kernel_listen(sock)
kernel_connect(sock)
tls_client_hello_x509(args:{sock})
kernel_accept(sock, &newsock)
tls_server_hello_x509(args:{newsock})
kernel_sendmsg(sock) kernel_recvmsg(newsock)
sock_release(sock) sock_release(newsock)
sock_release(sock)Please be aware that tls_client_hello_x509() and tls_server_hello_x509() are APIs from net/handshake/. They are employed to dispatch the handshake request to the userspace tlshd service and subsequently block until the handshake process is completed.
For advanced usage,
see man doc: https://github.com/lxin/quic/wiki/man
and examples: https://github.com/lxin/quic/tree/main/tests
The QUIC module is currently labeled as "EXPERIMENTAL".
Xin Long (5):
net: define IPPROTO_QUIC and SOL_QUIC constants for QUIC protocol
net: include quic.h in include/uapi/linux for QUIC protocol
net: implement QUIC protocol code in net/quic directory
net: integrate QUIC build configuration into Kconfig and Makefile
Documentation: introduce quic.rst to provide description of QUIC
protocol
Documentation/networking/quic.rst | 160 +++ include/linux/socket.h | 1 + include/uapi/linux/in.h | 2 + include/uapi/linux/quic.h | 189 +++ net/Kconfig | 1 + net/Makefile | 1 + net/quic/Kconfig | 34 + net/quic/Makefile | 20 + net/quic/cong.c | 229 ++++ net/quic/cong.h | 84 ++ net/quic/connection.c | 172 +++ net/quic/connection.h | 117 ++ net/quic/crypto.c | 979 ++++++++++++++++ net/quic/crypto.h | 140 +++ net/quic/frame.c | 1803 ++++++++++++++++++++++++++++ net/quic/frame.h | 162 +++ net/quic/hashtable.h | 125 ++ net/quic/input.c | 693 +++++++++++ net/quic/input.h | 169 +++ net/quic/number.h | 174 +++ net/quic/output.c | 638 ++++++++++ net/quic/output.h | 194 +++ net/quic/packet.c | 1179 +++++++++++++++++++ net/quic/packet.h | 99 ++ net/quic/path.c | 434 +++++++ net/quic/path.h | 131 +++ net/quic/pnmap.c | 217 ++++ net/quic/pnmap.h | 134 +++ net/quic/protocol.c | 711 +++++++++++ net/quic/protocol.h | 56 + net/quic/sample_test.c | 339 ++++++ net/quic/socket.c | 1823 +++++++++++++++++++++++++++++ net/quic/socket.h | 293 +++++ net/quic/stream.c | 248 ++++ net/quic/stream.h | 147 +++ net/quic/timer.c | 241 ++++ net/quic/timer.h | 29 + net/quic/unit_test.c | 1024 ++++++++++++++++ 38 files changed, 13192 insertions(+) create mode 100644 Documentation/networking/quic.rst create mode 100644 include/uapi/linux/quic.h create mode 100644 net/quic/Kconfig create mode 100644 net/quic/Makefile create mode 100644 net/quic/cong.c create mode 100644 net/quic/cong.h create mode 100644 net/quic/connection.c create mode 100644 net/quic/connection.h create mode 100644 net/quic/crypto.c create mode 100644 net/quic/crypto.h create mode 100644 net/quic/frame.c create mode 100644 net/quic/frame.h create mode 100644 net/quic/hashtable.h create mode 100644 net/quic/input.c create mode 100644 net/quic/input.h create mode 100644 net/quic/number.h create mode 100644 net/quic/output.c create mode 100644 net/quic/output.h create mode 100644 net/quic/packet.c create mode 100644 net/quic/packet.h create mode 100644 net/quic/path.c create mode 100644 net/quic/path.h create mode 100644 net/quic/pnmap.c create mode 100644 net/quic/pnmap.h create mode 100644 net/quic/protocol.c create mode 100644 net/quic/protocol.h create mode 100644 net/quic/sample_test.c create mode 100644 net/quic/socket.c create mode 100644 net/quic/socket.h create mode 100644 net/quic/stream.c create mode 100644 net/quic/stream.h create mode 100644 net/quic/timer.c create mode 100644 net/quic/timer.h create mode 100644 net/quic/unit_test.c
--
2.43.0
kernel test robot
build botRe: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile
In reply to Xin Longkernel test robot noticed the following build errors:
Hi Xin,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Xin-Long/net-define-IPPROTO_QUIC-and-SOL_QUIC-constants-for-QUIC-protocol/20240312-002959 base: net-next/main patch link: https://lore.kernel.org/r/f5678996612dc82c990da0dbceb19dcd062d97bd.1710173427.git.lucien.xin%40gmail.com patch subject: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240312/[email protected]/config) compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 503c55e17037436dcd45ac69dea8967e67e3f5e8) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240312/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
692 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
700 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
708 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
717 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
726 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
735 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
In file included from net/quic/frame.c:13:
In file included from net/quic/socket.h:15:
In file included from include/net/udp_tunnel.h:5:
In file included from include/net/ip_tunnels.h:6:
In file included from include/linux/netdevice.h:45:
In file included from include/uapi/linux/neighbour.h:6:
In file included from include/linux/netlink.h:9:
In file included from include/net/scm.h:9:
In file included from include/linux/security.h:35:
include/linux/bpf.h:736:48: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
736 | ARG_PTR_TO_MAP_VALUE_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_MAP_VALUE,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:737:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
737 | ARG_PTR_TO_MEM_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_MEM,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
include/linux/bpf.h:738:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
738 | ARG_PTR_TO_CTX_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_CTX,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
include/linux/bpf.h:739:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
739 | ARG_PTR_TO_SOCKET_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_SOCKET,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
include/linux/bpf.h:740:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
740 | ARG_PTR_TO_STACK_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_STACK,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
include/linux/bpf.h:741:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
741 | ARG_PTR_TO_BTF_ID_OR_NULL = PTR_MAYBE_NULL | ARG_PTR_TO_BTF_ID,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
include/linux/bpf.h:745:38: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
745 | ARG_PTR_TO_UNINIT_MEM = MEM_UNINIT | ARG_PTR_TO_MEM,
| ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
include/linux/bpf.h:747:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
747 | ARG_PTR_TO_FIXED_SIZE_MEM = MEM_FIXED_SIZE | ARG_PTR_TO_MEM,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
include/linux/bpf.h:770:48: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
770 | RET_PTR_TO_MAP_VALUE_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_MAP_VALUE,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:771:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
771 | RET_PTR_TO_SOCKET_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_SOCKET,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
include/linux/bpf.h:772:47: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
772 | RET_PTR_TO_TCP_SOCK_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_TCP_SOCK,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:773:50: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
773 | RET_PTR_TO_SOCK_COMMON_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_SOCK_COMMON,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:775:49: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
775 | RET_PTR_TO_DYNPTR_MEM_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_MEM,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
include/linux/bpf.h:776:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
776 | RET_PTR_TO_BTF_ID_OR_NULL = PTR_MAYBE_NULL | RET_PTR_TO_BTF_ID,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
include/linux/bpf.h:777:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
777 | RET_PTR_TO_BTF_ID_TRUSTED = PTR_TRUSTED | RET_PTR_TO_BTF_ID,
| ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
include/linux/bpf.h:888:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
888 | PTR_TO_MAP_VALUE_OR_NULL = PTR_MAYBE_NULL | PTR_TO_MAP_VALUE,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
include/linux/bpf.h:889:42: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
889 | PTR_TO_SOCKET_OR_NULL = PTR_MAYBE_NULL | PTR_TO_SOCKET,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
include/linux/bpf.h:890:46: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
890 | PTR_TO_SOCK_COMMON_OR_NULL = PTR_MAYBE_NULL | PTR_TO_SOCK_COMMON,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
include/linux/bpf.h:891:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
891 | PTR_TO_TCP_SOCK_OR_NULL = PTR_MAYBE_NULL | PTR_TO_TCP_SOCK,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
include/linux/bpf.h:892:42: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
892 | PTR_TO_BTF_ID_OR_NULL = PTR_MAYBE_NULL | PTR_TO_BTF_ID,
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
>> net/quic/frame.c:1345:2: error: a randomized struct can only be initialized with a designated initializer
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:214:1: note: expanded from here
214 | quic_frame_padding_create
| ^
net/quic/frame.c:1346:2: error: a randomized struct can only be initialized with a designated initializer
1346 | quic_frame_create_and_process(ping),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:218:1: note: expanded from here
218 | quic_frame_ping_create
| ^
net/quic/frame.c:1347:2: error: a randomized struct can only be initialized with a designated initializer
1347 | quic_frame_create_and_process(ack),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:222:1: note: expanded from here
222 | quic_frame_ack_create
| ^
net/quic/frame.c:1348:2: error: a randomized struct can only be initialized with a designated initializer
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:226:1: note: expanded from here
226 | quic_frame_ack_create
| ^
net/quic/frame.c:1349:2: error: a randomized struct can only be initialized with a designated initializer
1349 | quic_frame_create_and_process(reset_stream),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:230:1: note: expanded from here
230 | quic_frame_reset_stream_create
| ^
net/quic/frame.c:1350:2: error: a randomized struct can only be initialized with a designated initializer
1350 | quic_frame_create_and_process(stop_sending),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:234:1: note: expanded from here
234 | quic_frame_stop_sending_create
| ^
net/quic/frame.c:1351:2: error: a randomized struct can only be initialized with a designated initializer
1351 | quic_frame_create_and_process(crypto),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:238:1: note: expanded from here
238 | quic_frame_crypto_create
| ^
net/quic/frame.c:1352:2: error: a randomized struct can only be initialized with a designated initializer
1352 | quic_frame_create_and_process(new_token),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:242:1: note: expanded from here
242 | quic_frame_new_token_create
| ^
net/quic/frame.c:1353:2: error: a randomized struct can only be initialized with a designated initializer
1353 | quic_frame_create_and_process(stream),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:4:1: note: expanded from here
4 | quic_frame_stream_create
| ^
net/quic/frame.c:1354:2: error: a randomized struct can only be initialized with a designated initializer
1354 | quic_frame_create_and_process(stream),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^
<scratch space>:8:1: note: expanded from here
8 | quic_frame_stream_create
| ^
net/quic/frame.c:1355:2: error: a randomized struct can only be initialized with a designated initializer
1355 | quic_frame_create_and_process(stream),
| ^
net/quic/frame.c:1342:3: note: expanded from macro 'quic_frame_create_and_process'
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^ <scratch space>:12:1: note: expanded from here
12 | quic_frame_stream_create
| ^
net/quic/frame.c:1356:2: error: a randomized struct can only be initialized with a designated initializer
1356 | quic_frame_create_and_process(stream),
vim +1345 net/quic/frame.c
b53fc4edb7faf3 Xin Long 2024-03-11 1340
b53fc4edb7faf3 Xin Long 2024-03-11 1341 #define quic_frame_create_and_process(type) \
b53fc4edb7faf3 Xin Long 2024-03-11 1342 {quic_frame_##type##_create, quic_frame_##type##_process}
b53fc4edb7faf3 Xin Long 2024-03-11 1343
b53fc4edb7faf3 Xin Long 2024-03-11 1344 static struct quic_frame_ops quic_frame_ops[QUIC_FRAME_MAX + 1] = {
b53fc4edb7faf3 Xin Long 2024-03-11 @1345 quic_frame_create_and_process(padding), /* 0x00 */
b53fc4edb7faf3 Xin Long 2024-03-11 1346 quic_frame_create_and_process(ping),
b53fc4edb7faf3 Xin Long 2024-03-11 1347 quic_frame_create_and_process(ack),
b53fc4edb7faf3 Xin Long 2024-03-11 1348 quic_frame_create_and_process(ack), /* ack_ecn */
b53fc4edb7faf3 Xin Long 2024-03-11 1349 quic_frame_create_and_process(reset_stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1350 quic_frame_create_and_process(stop_sending),
b53fc4edb7faf3 Xin Long 2024-03-11 1351 quic_frame_create_and_process(crypto),
b53fc4edb7faf3 Xin Long 2024-03-11 1352 quic_frame_create_and_process(new_token),
b53fc4edb7faf3 Xin Long 2024-03-11 1353 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1354 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1355 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1356 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1357 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1358 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1359 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1360 quic_frame_create_and_process(stream),
b53fc4edb7faf3 Xin Long 2024-03-11 1361 quic_frame_create_and_process(max_data), /* 0x10 */
b53fc4edb7faf3 Xin Long 2024-03-11 1362 quic_frame_create_and_process(max_stream_data),
b53fc4edb7faf3 Xin Long 2024-03-11 1363 quic_frame_create_and_process(max_streams_bidi),
b53fc4edb7faf3 Xin Long 2024-03-11 1364 quic_frame_create_and_process(max_streams_uni),
b53fc4edb7faf3 Xin Long 2024-03-11 1365 quic_frame_create_and_process(data_blocked),
b53fc4edb7faf3 Xin Long 2024-03-11 1366 quic_frame_create_and_process(stream_data_blocked),
b53fc4edb7faf3 Xin Long 2024-03-11 1367 quic_frame_create_and_process(streams_blocked_bidi),
b53fc4edb7faf3 Xin Long 2024-03-11 1368 quic_frame_create_and_process(streams_blocked_uni),
b53fc4edb7faf3 Xin Long 2024-03-11 1369 quic_frame_create_and_process(new_connection_id),
b53fc4edb7faf3 Xin Long 2024-03-11 1370 quic_frame_create_and_process(retire_connection_id),
b53fc4edb7faf3 Xin Long 2024-03-11 1371 quic_frame_create_and_process(path_challenge),
b53fc4edb7faf3 Xin Long 2024-03-11 1372 quic_frame_create_and_process(path_response),
b53fc4edb7faf3 Xin Long 2024-03-11 1373 quic_frame_create_and_process(connection_close),
b53fc4edb7faf3 Xin Long 2024-03-11 1374 quic_frame_create_and_process(connection_close),
b53fc4edb7faf3 Xin Long 2024-03-11 1375 quic_frame_create_and_process(handshake_done),
b53fc4edb7faf3 Xin Long 2024-03-11 1376 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1377 quic_frame_create_and_process(invalid), /* 0x20 */
b53fc4edb7faf3 Xin Long 2024-03-11 1378 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1379 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1380 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1381 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1382 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1383 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1384 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1385 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1386 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1387 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1388 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1389 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1390 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1391 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1392 quic_frame_create_and_process(invalid),
b53fc4edb7faf3 Xin Long 2024-03-11 1393 quic_frame_create_and_process(datagram), /* 0x30 */
b53fc4edb7faf3 Xin Long 2024-03-11 1394 quic_frame_create_and_process(datagram),
b53fc4edb7faf3 Xin Long 2024-03-11 1395 };b53fc4edb7faf3 Xin Long 2024-03-11 1396
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile
In reply to Xin Longkernel test robot noticed the following build warnings:
Hi Xin,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Xin-Long/net-define-IPPROTO_QUIC-and-SOL_QUIC-constants-for-QUIC-protocol/20240312-002959 base: net-next/main patch link: https://lore.kernel.org/r/f5678996612dc82c990da0dbceb19dcd062d97bd.1710173427.git.lucien.xin%40gmail.com patch subject: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240312/[email protected]/config) compiler: sh4-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240312/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
net/quic/crypto.c: In function 'quic_crypto_set_secret':
>> net/quic/crypto.c:560:29: warning: variable 'keylen' set but not used [-Wunused-but-set-variable]
560 | int err, secretlen, keylen;
| ^~~~~~vim +/keylen +560 net/quic/crypto.c
b53fc4edb7faf3 Xin Long 2024-03-11 556
b53fc4edb7faf3 Xin Long 2024-03-11 557 int quic_crypto_set_secret(struct quic_crypto *crypto, struct quic_crypto_secret *srt,
b53fc4edb7faf3 Xin Long 2024-03-11 558 u32 version, u8 flag)
b53fc4edb7faf3 Xin Long 2024-03-11 559 {
b53fc4edb7faf3 Xin Long 2024-03-11 @560 int err, secretlen, keylen;
b53fc4edb7faf3 Xin Long 2024-03-11 561 struct quic_cipher *cipher;
b53fc4edb7faf3 Xin Long 2024-03-11 562 void *tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 563
b53fc4edb7faf3 Xin Long 2024-03-11 564 if (!crypto->cipher) {
b53fc4edb7faf3 Xin Long 2024-03-11 565 crypto->version = version;
b53fc4edb7faf3 Xin Long 2024-03-11 566 if (srt->type < QUIC_CIPHER_MIN || srt->type > QUIC_CIPHER_MAX)
b53fc4edb7faf3 Xin Long 2024-03-11 567 return -EINVAL;
b53fc4edb7faf3 Xin Long 2024-03-11 568
b53fc4edb7faf3 Xin Long 2024-03-11 569 cipher = &ciphers[srt->type - QUIC_CIPHER_MIN];
b53fc4edb7faf3 Xin Long 2024-03-11 570 tfm = crypto_alloc_shash(cipher->shash, 0, 0);
b53fc4edb7faf3 Xin Long 2024-03-11 571 if (IS_ERR(tfm))
b53fc4edb7faf3 Xin Long 2024-03-11 572 return PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 573 crypto->secret_tfm = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 574
b53fc4edb7faf3 Xin Long 2024-03-11 575 tfm = crypto_alloc_aead(cipher->aead, 0, CRYPTO_ALG_ASYNC);
b53fc4edb7faf3 Xin Long 2024-03-11 576 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 577 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 578 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 579 }
b53fc4edb7faf3 Xin Long 2024-03-11 580 crypto->tag_tfm = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 581 crypto->cipher = cipher;
b53fc4edb7faf3 Xin Long 2024-03-11 582 crypto->cipher_type = srt->type;
b53fc4edb7faf3 Xin Long 2024-03-11 583 }
b53fc4edb7faf3 Xin Long 2024-03-11 584
b53fc4edb7faf3 Xin Long 2024-03-11 585 cipher = crypto->cipher;
b53fc4edb7faf3 Xin Long 2024-03-11 586 secretlen = cipher->secretlen;
b53fc4edb7faf3 Xin Long 2024-03-11 587 keylen = cipher->keylen;
b53fc4edb7faf3 Xin Long 2024-03-11 588 if (!srt->send) {
b53fc4edb7faf3 Xin Long 2024-03-11 589 memcpy(crypto->rx_secret, srt->secret, secretlen);
b53fc4edb7faf3 Xin Long 2024-03-11 590 tfm = crypto_alloc_aead(cipher->aead, 0, flag);
b53fc4edb7faf3 Xin Long 2024-03-11 591 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 592 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 593 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 594 }
b53fc4edb7faf3 Xin Long 2024-03-11 595 crypto->rx_tfm[0] = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 596 tfm = crypto_alloc_aead(cipher->aead, 0, flag);
b53fc4edb7faf3 Xin Long 2024-03-11 597 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 598 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 599 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 600 }
b53fc4edb7faf3 Xin Long 2024-03-11 601 crypto->rx_tfm[1] = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 602 tfm = crypto_alloc_sync_skcipher(cipher->skc, 0, 0);
b53fc4edb7faf3 Xin Long 2024-03-11 603 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 604 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 605 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 606 }
b53fc4edb7faf3 Xin Long 2024-03-11 607 crypto->rx_hp_tfm = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 608
b53fc4edb7faf3 Xin Long 2024-03-11 609 err = quic_crypto_rx_keys_derive_and_install(crypto);
b53fc4edb7faf3 Xin Long 2024-03-11 610 if (err)
b53fc4edb7faf3 Xin Long 2024-03-11 611 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 612 crypto->recv_ready = 1;
b53fc4edb7faf3 Xin Long 2024-03-11 613 return 0;
b53fc4edb7faf3 Xin Long 2024-03-11 614 }
b53fc4edb7faf3 Xin Long 2024-03-11 615
b53fc4edb7faf3 Xin Long 2024-03-11 616 memcpy(crypto->tx_secret, srt->secret, secretlen);
b53fc4edb7faf3 Xin Long 2024-03-11 617 tfm = crypto_alloc_aead(cipher->aead, 0, flag);
b53fc4edb7faf3 Xin Long 2024-03-11 618 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 619 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 620 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 621 }
b53fc4edb7faf3 Xin Long 2024-03-11 622 crypto->tx_tfm[0] = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 623 tfm = crypto_alloc_aead(cipher->aead, 0, flag);
b53fc4edb7faf3 Xin Long 2024-03-11 624 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 625 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 626 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 627 }
b53fc4edb7faf3 Xin Long 2024-03-11 628 crypto->tx_tfm[1] = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 629 tfm = crypto_alloc_sync_skcipher(cipher->skc, 0, 0);
b53fc4edb7faf3 Xin Long 2024-03-11 630 if (IS_ERR(tfm)) {
b53fc4edb7faf3 Xin Long 2024-03-11 631 err = PTR_ERR(tfm);
b53fc4edb7faf3 Xin Long 2024-03-11 632 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 633 }
b53fc4edb7faf3 Xin Long 2024-03-11 634 crypto->tx_hp_tfm = tfm;
b53fc4edb7faf3 Xin Long 2024-03-11 635 err = quic_crypto_tx_keys_derive_and_install(crypto);
b53fc4edb7faf3 Xin Long 2024-03-11 636 if (err)
b53fc4edb7faf3 Xin Long 2024-03-11 637 goto err;
b53fc4edb7faf3 Xin Long 2024-03-11 638 crypto->send_ready = 1;
b53fc4edb7faf3 Xin Long 2024-03-11 639 return 0;
b53fc4edb7faf3 Xin Long 2024-03-11 640 err:
b53fc4edb7faf3 Xin Long 2024-03-11 641 quic_crypto_destroy(crypto);
b53fc4edb7faf3 Xin Long 2024-03-11 642 return err;
b53fc4edb7faf3 Xin Long 2024-03-11 643 }
b53fc4edb7faf3 Xin Long 2024-03-11 644 EXPORT_SYMBOL_GPL(quic_crypto_set_secret);
b53fc4edb7faf3 Xin Long 2024-03-11 645 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile
In reply to Xin Longkernel test robot noticed the following build errors:
Hi Xin,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Xin-Long/net-define-IPPROTO_QUIC-and-SOL_QUIC-constants-for-QUIC-protocol/20240312-002959 base: net-next/main patch link: https://lore.kernel.org/r/f5678996612dc82c990da0dbceb19dcd062d97bd.1710173427.git.lucien.xin%40gmail.com patch subject: [RFC PATCH net-next 4/5] net: integrate QUIC build configuration into Kconfig and Makefile config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240312/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240312/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[0]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[0].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[0]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[0].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1345:9: note: in expansion of macro 'quic_frame_create_and_process'
1345 | quic_frame_create_and_process(padding), /* 0x00 */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[1]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[1].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[1]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[1].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1346:9: note: in expansion of macro 'quic_frame_create_and_process'
1346 | quic_frame_create_and_process(ping),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[2]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[2].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[2]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[2].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1347:9: note: in expansion of macro 'quic_frame_create_and_process'
1347 | quic_frame_create_and_process(ack),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[3]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[3].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[3]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[3].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1348:9: note: in expansion of macro 'quic_frame_create_and_process'
1348 | quic_frame_create_and_process(ack), /* ack_ecn */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[4]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[4].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[4]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[4].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1349:9: note: in expansion of macro 'quic_frame_create_and_process'
1349 | quic_frame_create_and_process(reset_stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[5]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[5].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[5]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[5].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1350:9: note: in expansion of macro 'quic_frame_create_and_process'
1350 | quic_frame_create_and_process(stop_sending),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[6]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[6].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[6]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[6].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1351:9: note: in expansion of macro 'quic_frame_create_and_process'
1351 | quic_frame_create_and_process(crypto),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[7]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[7].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[7]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[7].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1352:9: note: in expansion of macro 'quic_frame_create_and_process'
1352 | quic_frame_create_and_process(new_token),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[8]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[8].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[8]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[8].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1353:9: note: in expansion of macro 'quic_frame_create_and_process'
1353 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[9]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[9].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[9]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[9].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1354:9: note: in expansion of macro 'quic_frame_create_and_process'
1354 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[10]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[10].<anonymous>')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[10]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: error: initialization of 'struct sk_buff * (*)(struct sock *, void *, u8)' {aka 'struct sk_buff * (*)(struct sock *, void *, unsigned char)'} from incompatible pointer type 'int (*)(struct sock *, struct sk_buff *, u8)' {aka 'int (*)(struct sock *, struct sk_buff *, unsigned char)'} [-Werror=incompatible-pointer-types]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:38: note: (near initialization for 'quic_frame_ops[10].frame_create')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1355:9: note: in expansion of macro 'quic_frame_create_and_process'
1355 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1356:9: note: in expansion of macro 'quic_frame_create_and_process'
1356 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: note: (near initialization for 'quic_frame_ops[11]')
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~
net/quic/frame.c:1356:9: note: in expansion of macro 'quic_frame_create_and_process'
1356 | quic_frame_create_and_process(stream),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/quic/frame.c:1342:10: error: invalid initializer
1342 | {quic_frame_##type##_create, quic_frame_##type##_process}
| ^~~~~~~~~~~ net/quic/frame.c:1356:9: note: in expansion of macro 'quic_frame_create_and_process'
1356 | quic_frame_create_and_process(stream),
vim +1342 net/quic/frame.c
b53fc4edb7faf3 Xin Long 2024-03-11 1340b53fc4edb7faf3 Xin Long 2024-03-11 1341 #define quic_frame_create_and_process(type) \b53fc4edb7faf3 Xin Long 2024-03-11 @1342 {quic_frame_##type##_create, quic_frame_##type##_process}b53fc4edb7faf3 Xin Long 2024-03-11 1343
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Xin Long,
first many thanks for working on this topic!
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)
Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
So the server application should have a way to specify the desired ALPN before or during the bind() call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.
This needs to work indepented of kernel or userspace application.
We may want ksmbd (kernel smb server) and apache or smbd (Samba's userspace smb server) together with apache. And maybe event ksmbd with one certificate for ksmbd.example.com and smbd with a certificate for smbd.example.com
both on ALPN "smb", while apache uses "h3" with a certificate for apache.example.com and nginx with "h3" and a certificate for nginx.example.com.
But also smbd with "smb" as well as apache with "h3" both using a certificate for quic.example.com.
I guess TLS Server Name Indication also works for QUIC, correct?
For the client side I guess dynamic udp ports are used and there's no problem with multiple applications...
metze
Quoted 5 lines · Stefan Metzmacher
Hi Xin Long,
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.
Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 7 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.
On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Let me know if I don't make it clear.
Quoted 10 lines
This needs to work indepented of kernel or userspace application.
We may want ksmbd (kernel smb server) and apache or smbd (Samba's userspace smb server) together with apache. And maybe event ksmbd with one certificate for ksmbd.example.com and smbd with a certificate for smbd.example.com
both on ALPN "smb", while apache uses "h3" with a certificate for apache.example.com and nginx with "h3" and a certificate for nginx.example.com.
Quoted 4 lines
But also smbd with "smb" as well as apache with "h3" both using a certificate for quic.example.com.
I guess TLS Server Name Indication also works for QUIC, correct?
Yes, QUIC is secured by TLS 1.3, almost all extensions in TLS1.3 are supported in QUIC.
In userspace I believe we can use gnutls_server_name_set() to set SNI on client and process SNI on server after getting SNI via gnutls_server_name_get() in .post_client_hello_cb().
I think this would be able to work out the multiple certificates (with different hostnames) used by one smbd server.
Quoted 4 lines
For the client side I guess dynamic udp ports are used and there's no problem with multiple applications...
Right.
Thanks again for your comment.
Am 13.03.24 um 17:03 schrieb Xin Long:
Quoted 42 lines · Stefan Metzmacher
Quoted 5 lines
Hi Xin Long,
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
Quoted 7 lines
We do provide a sockopt to set ALPN before bind or handshaking:
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Quoted 3 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Quoted 9 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Quoted 10 lines
Quoted 7 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 5 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the accept() to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?
Maybe it would be possible to optionally have socket option to register ALPNs with certificates so that tls_server_hello_x509() could be called automatically before accept returns (even for userspace consumers).
It may mean the tlshd protocol needs to be extended...
metze
Quoted 46 lines · Stefan Metzmacher
Am 13.03.24 um 17:03 schrieb Xin Long:
Quoted 44 lines · Stefan Metzmacher
Quoted 5 lines
Hi Xin Long,
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
Quoted 7 lines
Quoted 5 lines
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Just note that, with a bit change in the current libquic, it still allows users to use ALPN to find the correct function or thread in the *same* process, usage be like:
listenfd = socket(IPPROTO_QUIC);
/* match all during handshake with wildcard ALPN */ setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "*"); bind(listenfd)
listen(listenfd)
while (1) {
sockfd = accept(listenfd);
/* the alpn from client will be set to sockfd during handshake */ quic_server_handshake(sockfd, cert);
getsockopt(sockfd, QUIC_SOCKOPT_ALPN, alpn);
switch (alpn) {
case "smbd": smbd_thread(sockfd);
case "h3": h3_thread(sockfd);
case "ksmbd": ksmbd_thread(sockfd); }
}
Quoted 6 lines
Quoted 4 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Got you. This can be done by also moving TLS 1.3 message exchange to kernel where we can get the ALPN before looking up the listening socket. However, In-kernel TLS 1.3 Handshake had been NACKed by both kernel netdev maintainers and userland ssl lib developers with good reasons.
Quoted 11 lines
Quoted 10 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 5 lines
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Honestly, I don't think any userland QUIC can use ALPN to lookup for different sockets used by different servers/processes. As such thing can be only done in Kernel Space.
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 4 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Quoted 5 lines
Quoted 1 line
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the
accept()to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?
Good question!
The first "new" QUIC pdu will cause to create a 'request sock' (contains 4-tuple and connection IDs only) and queue up to reqsk list of the listen sock (if validate_peer_address param is not set), and this pdu is enqueued in the inq->backlog_list of the listen sock.
When accept() is called, in Kernel, it dequeues the "request sock" from the reqsk list of the listen sock, and creates the accept socket based on this reqsk. Then it processes the pdu for this new accept socket from the inq->backlog_list of the listen sock, including *decrypting* QUIC packet and decoding CRYPTO frame, then deliver the raw/cleartext TLS message to the Userspace libquic.
Then in Userspace libquic, it handles the received TLS message and creates a new raw/cleartext TLS message for response via libgnutls, and delivers to kernel. In kernel, it will encode this message to a CRYPTO frame in a QUIC packet and then *encrypt* this QUIC packet and send it out.
So as you can see, there's no en/decryption happening in Userspace. In Userspace libquic, it only does raw/cleartext TLS message exchange. ALL en/decryption happens in Kernel Space, as these en/decryption are done against QUIC packets, not directly against the TLS messages.
Quoted 8 lines
Maybe it would be possible to optionally have socket option to register ALPNs with certificates so that
tls_server_hello_x509()could be called automatically before accept returns (even for userspace consumers).It may mean the tlshd protocol needs to be extended...
so that userspace consumers don't need quic_client/server_handshake(), and accept() returns a socket that already has the handshake done, right?
We didn't do that, as:
1. It's not a good idea for Userspace consumers' applications to reply on a daemon like tlshd, not convenient for users, also a bit weird for userspace app to ask another userspace app to help do the handshake.
2. It's too complex to implement, especially if we also want to call tls_client_hello_x509() before connect() returns on client side.
3. For Kernel usage, I prefer leaving this to the kernel consumers for more flexibility for handshake requests.
As for the ALPNs with certificates, not sure if I understand correctly. But if you want the server to select certificates according to the ALPN received from the client during handshake. I think it could be done in userspace libquic. But yes, tlshd service may also need to extend.
Am 13.03.24 um 20:39 schrieb Xin Long:
Quoted 64 lines · Stefan Metzmacher
Quoted 46 lines
Am 13.03.24 um 17:03 schrieb Xin Long:
Quoted 44 lines · Stefan Metzmacher
Quoted 5 lines
Hi Xin Long,
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
Quoted 7 lines
Quoted 5 lines
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Just note that, with a bit change in the current libquic, it still allows users to use ALPN to find the correct function or thread in the *same* process, usage be like:
listenfd =
socket(IPPROTO_QUIC);
/* match all during handshake with wildcard ALPN */setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "*"); bind(listenfd)
listen(listenfd)
Quoted 6 lines
while (1) {
sockfd = accept(listenfd);
/* the alpn from client will be set to sockfd during handshake */
quic_server_handshake(sockfd, cert);
getsockopt(sockfd, QUIC_SOCKOPT_ALPN, alpn);Would quic_server_handshake() call setsockopt()?
Quoted 6 lines
switch (alpn) {
case "smbd": smbd_thread(sockfd);
case "h3": h3_thread(sockfd);
case "ksmbd": ksmbd_thread(sockfd);
}
}Ok, but that would mean all application need to be aware of each other, but it would be possible and socket fds could be passed to other processes.
Quoted 61 lines
Quoted 6 lines
Quoted 4 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Got you. This can be done by also moving TLS 1.3 message exchange to kernel where we can get the ALPN before looking up the listening socket. However, In-kernel TLS 1.3 Handshake had been NACKed by both kernel netdev maintainers and userland ssl lib developers with good reasons.
Quoted 11 lines
Quoted 10 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 5 lines
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Honestly, I don't think any userland QUIC can use ALPN to lookup for different sockets used by different servers/processes. As such thing can be only done in Kernel Space.
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 4 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Quoted 5 lines
Quoted 1 line
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the
accept()to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?Good question!
The first "new" QUIC pdu will cause to create a 'request sock' (contains 4-tuple and connection IDs only) and queue up to reqsk list of the listen sock (if
validate_peer_addressparam is not set), and this pdu is enqueued in theinq->backlog_listof the listen sock.
Quoted 6 lines
When
accept()is called, in Kernel, it dequeues the "request sock" from the reqsk list of the listen sock, and creates the accept socket based on this reqsk. Then it processes the pdu for this new accept socket from theinq->backlog_listof the listen sock, including *decrypting* QUIC packet and decoding CRYPTO frame, then deliver the raw/cleartext TLS message to the Userspace libquic.
Ok, when the kernel already decrypts it could already look find the ALPN. It doesn't mean it should do the full handshake, but parse enough to find the ALPN.
But I don't yet understand how the kernel gets the key to do the initlal decryption, I'd assume some call before listen() need to tell the kernel about the keys.
Quoted 31 lines
Then in Userspace libquic, it handles the received TLS message and creates a new raw/cleartext TLS message for response via libgnutls, and delivers to kernel. In kernel, it will encode this message to a CRYPTO frame in a QUIC packet and then *encrypt* this QUIC packet and send it out.
So as you can see, there's no en/decryption happening in Userspace. In Userspace libquic, it only does raw/cleartext TLS message exchange. ALL en/decryption happens in Kernel Space, as these en/decryption are done against QUIC packets, not directly against the TLS messages.
Quoted 8 lines
Maybe it would be possible to optionally have socket option to register ALPNs with certificates so that
tls_server_hello_x509()could be called automatically before accept returns (even for userspace consumers).It may mean the tlshd protocol needs to be extended...
so that userspace consumers don't need quic_client/server_handshake(), and
accept()returns a socket that already has the handshake done, right?We didn't do that, as:
1. It's not a good idea for Userspace consumers' applications to reply on a daemon like tlshd, not convenient for users, also a bit weird for userspace app to ask another userspace app to help do the handshake.
2. It's too complex to implement, especially if we also want to calltls_client_hello_x509()beforeconnect()returns on client side.
3. For Kernel usage, I prefer leaving this to the kernel consumers for more flexibility for handshake requests.
Quoted 4 lines
As for the ALPNs with certificates, not sure if I understand correctly. But if you want the server to select certificates according to the ALPN received from the client during handshake. I think it could be done in userspace libquic. But yes, tlshd service may also need to extend.
I was just brainstorming for ideas...
metze
Quoted 66 lines · Stefan Metzmacher
Am 13.03.24 um 20:39 schrieb Xin Long:
Quoted 64 lines · Stefan Metzmacher
Quoted 46 lines
Am 13.03.24 um 17:03 schrieb Xin Long:
Quoted 44 lines · Stefan Metzmacher
Quoted 5 lines
Hi Xin Long,
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
Quoted 7 lines
Quoted 5 lines
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Just note that, with a bit change in the current libquic, it still allows users to use ALPN to find the correct function or thread in the *same* process, usage be like:
listenfd =
socket(IPPROTO_QUIC);
/* match all during handshake with wildcard ALPN */setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "*"); bind(listenfd)
listen(listenfd)
Quoted 8 lines
Quoted 6 lines
while (1) { sockfd = accept(listenfd); /* the alpn from client will be set to sockfd during handshake */ quic_server_handshake(sockfd, cert); getsockopt(sockfd, QUIC_SOCKOPT_ALPN, alpn);Would
quic_server_handshake()callsetsockopt()?
Yes, I just made a bit change in the userspace libquic:
https://github.com/lxin/quic/commit/9c75bd42769a8cbc1652e2f4c8d77780f23afde6
So you can set up multple ALPNs on listen sock:
setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "smbd, h3, ksmbd");
Then during handshake, the matched ALPN from client will be set into the accept socket, then users can get it later after handshake.
Note that userspace libquic is a very light lib (a couple of hundred lines of code), you can add more TLS related support without touching Kernel code, including the SNI support you mentioned.
Quoted 11 lines
Quoted 7 lines
switch (alpn) { case "smbd": smbd_thread(sockfd); case "h3": h3_thread(sockfd); case "ksmbd": ksmbd_thread(sockfd); } }Ok, but that would mean all application need to be aware of each other, but it would be possible and socket fds could be passed to other processes.
It doesn't sound common to me, but yes, I think Unix Domain Sockets can pass it to another process.
Quoted 69 lines
Quoted 62 lines
Quoted 7 lines
Quoted 5 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Got you. This can be done by also moving TLS 1.3 message exchange to kernel where we can get the ALPN before looking up the listening socket. However, In-kernel TLS 1.3 Handshake had been NACKed by both kernel netdev maintainers and userland ssl lib developers with good reasons.
Quoted 11 lines
Quoted 10 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 5 lines
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Honestly, I don't think any userland QUIC can use ALPN to lookup for different sockets used by different servers/processes. As such thing can be only done in Kernel Space.
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 4 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Quoted 5 lines
Quoted 1 line
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the
accept()to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?Good question!
The first "new" QUIC pdu will cause to create a 'request sock' (contains 4-tuple and connection IDs only) and queue up to reqsk list of the listen sock (if
validate_peer_addressparam is not set), and this pdu is enqueued in theinq->backlog_listof the listen sock.Quoted 6 lines
When
accept()is called, in Kernel, it dequeues the "request sock" from the reqsk list of the listen sock, and creates the accept socket based on this reqsk. Then it processes the pdu for this new accept socket from theinq->backlog_listof the listen sock, including *decrypting* QUIC packet and decoding CRYPTO frame, then deliver the raw/cleartext TLS message to the Userspace libquic.
Quoted 3 lines
Ok, when the kernel already decrypts it could already look find the ALPN. It doesn't mean it should do the full handshake, but parse enough to find the ALPN.
Correct, in-kernel QUIC should only do the QUIC related things, and all TLS handshake msgs must be handled in Userspace. This won't cause "layering violation", as Nick Banks said.
Quoted 4 lines
But I don't yet understand how the kernel gets the key to do the initlal decryption, I'd assume some call before
listen()need to tell the kernel about the keys.
For initlal decryption, the keys can be derived with the initial packet. basically, it only needs the dst_connection_id from the client initial packet. see:
https://datatracker.ietf.org/doc/html/rfc9001#name-initial-secrets
so we don't need to set up anything to kernel for initial's keys.
But for the handshake, application or early_data keys, they will be set up into kernel during handshake via:
setsockopt(QUIC_SOCKOPT_CRYPTO_SECRET)
Thanks.
Quoted 40 lines
Quoted 32 lines
Then in Userspace libquic, it handles the received TLS message and creates a new raw/cleartext TLS message for response via libgnutls, and delivers to kernel. In kernel, it will encode this message to a CRYPTO frame in a QUIC packet and then *encrypt* this QUIC packet and send it out.
So as you can see, there's no en/decryption happening in Userspace. In Userspace libquic, it only does raw/cleartext TLS message exchange. ALL en/decryption happens in Kernel Space, as these en/decryption are done against QUIC packets, not directly against the TLS messages.
Quoted 8 lines
Maybe it would be possible to optionally have socket option to register ALPNs with certificates so that
tls_server_hello_x509()could be called automatically before accept returns (even for userspace consumers).It may mean the tlshd protocol needs to be extended...
so that userspace consumers don't need quic_client/server_handshake(), and
accept()returns a socket that already has the handshake done, right?We didn't do that, as:
1. It's not a good idea for Userspace consumers' applications to reply on a daemon like tlshd, not convenient for users, also a bit weird for userspace app to ask another userspace app to help do the handshake.
2. It's too complex to implement, especially if we also want to calltls_client_hello_x509()beforeconnect()returns on client side.
3. For Kernel usage, I prefer leaving this to the kernel consumers for more flexibility for handshake requests.Quoted 4 lines
As for the ALPNs with certificates, not sure if I understand correctly. But if you want the server to select certificates according to the ALPN received from the client during handshake. I think it could be done in userspace libquic. But yes, tlshd service may also need to extend.
I was just brainstorming for ideas...
metze
Hi,
This series looks very interesting- I was just wondering if you had done any performance testing of this vs. a userspace QUIC implementation?
Thanks,
-Jason
Quoted 247 lines · Xin Long
Introduction
============This is an implementation of the QUIC protocol as defined in RFC9000. QUIC is an UDP-Based Multiplexed and Secure Transport protocol, and it provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances.
This implementation of QUIC in the kernel space enables users to utilize the QUIC protocol through common socket APIs in user space. Additionally, kernel subsystems like SMB and NFS can seamlessly operate over the QUIC protocol after handshake using net/handshake APIs.
Note that In-Kernel QUIC implementation does NOT target Crypto Offload support for existing Userland QUICs, and Crypto Offload intended for Userland QUICs can NOT be utilized for Kernel consumers, such as SMB. Therefore, there is no conflict between In-Kernel QUIC and Crypto Offload for Userland QUICs.
This implementation offers fundamental support for the following RFCs:
- RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport
- RFC9001 - Using TLS to Secure QUIC
- RFC9002 - QUIC Loss Detection and Congestion Control
- RFC9221 - An Unreliable Datagram Extension to QUIC
- RFC9287 - Greasing the QUIC Bit
- RFC9368 - Compatible Version Negotiation for QUIC
- RFC9369 - QUIC Version 2
- Handshake APIs for tlshd Use - SMB/NFS over QUICImplementation
==============The central idea is to implement QUIC within the kernel, incorporating an userspace handshake approach.
Only the processing and creation of raw TLS Handshake Messages, facilitated by a tls library like gnutls, take place in userspace. These messages are exchanged through sendmsg/recvmsg() mechanisms, with cryptographic details carried in the control message (cmsg).
The entirety of QUIC protocol, excluding TLS Handshake Messages processing and creation, resides in the kernel. Instead of utilizing a User Level Protocol (ULP) layer, it establishes a socket of
IPPROTO_QUICtype (similar toIPPROTO_MPTCP) operating over UDP tunnels.Kernel consumers can initiate a handshake request from kernel to userspace via the existing net/handshake netlink. The userspace component, tlshd from ktls-utils, manages the QUIC handshake request processing.
- Handshake Architecture:
+------+ +------+ | APP1 | | APP2 | ... +------+ +------+ +-------------------------------------------------+ | libquic (ktls-utils) |<--------------+ | {quic_handshake_server/client/param()} | | +-------------------------------------------------+ +---------------------+ {send/recvmsg()} {set/getsockopt()} | tlshd (ktls-utils) | [CMSG handshake_info] [SOCKOPT_CRYPTO_SECRET] +---------------------+ [SOCKOPT_TRANSPORT_PARAM_EXT] | ^ | ^ | ^ Userspace | | | | | | ------------|-|----------------------------|-|------------------------|-|-------------- Kernel | | | | | | v | v | v | +--------------------------------------------------+ +-------------+ | socket (IPPRTOTO_QUIC) | protocol |<----+ | handshake | +--------------------------------------------------+ | | netlink APIs| | inqueue | outqueue | cong | path | connection_id | | +-------------+ +--------------------------------------------------+ | | | | packet | frame | crypto | pnmap | | +-----+ +-----+ +--------------------------------------------------+ | | | | | | input | output | |---| SMB | | NFS | ... +--------------------------------------------------+ | | | | | | UDP tunnels | | +-----+ +--+--+ +--------------------------------------------------+ +--------------|- Post Handshake Architecture:
+------+ +------+ | APP1 | | APP2 | ... +------+ +------+ {send/recvmsg()} {set/getsockopt()} [CMSG stream_info] [SOCKOPT_KEY_UPDATE] [SOCKOPT_CONNECTION_MIGRATION] [SOCKOPT_STREAM_OPEN/RESET/STOP_SENDING] [...] | ^ | ^ Userspace | | | | ------------|-|----------------------------|-|---------------- Kernel | | | | v | v | +--------------------------------------------------+ | socket (IPPRTOTO_QUIC) | protocol |<----+ {kernel_send/recvmsg()} +--------------------------------------------------+ | {kernel_set/getsockopt()} | inqueue | outqueue | cong | path | connection_id | | +--------------------------------------------------+ | | packet | frame | crypto | pnmap | | +-----+ +-----+ +--------------------------------------------------+ | | | | | | input | output | |---| SMB | | NFS | ... +--------------------------------------------------+ | | | | | | UDP tunnels | | +-----+ +--+--+ +--------------------------------------------------+ +--------------|Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.For utilization by kernel consumers, it is essential to have the tlshd service (from ktls-utils) installed and running in userspace. This service receives and manages kernel handshake requests for kernel sockets. In kernel, the APIs closely resemble those used in userspace:
Client Server ------------------------------------------------------------------------ __sock_create(IPPROTO_QUIC, &sock) __sock_create(IPPROTO_QUIC, &sock) kernel_bind(sock) kernel_bind(sock) kernel_listen(sock) kernel_connect(sock) tls_client_hello_x509(args:{sock}) kernel_accept(sock, &newsock) tls_server_hello_x509(args:{newsock}) kernel_sendmsg(sock) kernel_recvmsg(newsock) sock_release(sock) sock_release(newsock) sock_release(sock)Please be aware that
tls_client_hello_x509()andtls_server_hello_x509()are APIs fromnet/handshake/. They are employed to dispatch the handshake request to the userspace tlshd service and subsequently block until the handshake process is completed.For advanced usage,
see man doc: https://urldefense.com/v3/__https://github.com/lxin/quic/wiki/man__;!!GjvTz_vk!UsLPnlAN5OZvmKIETR2k4xtGO49kJw5h_my6mmoYzVfohMrtGl2Be1zG9WOV3L7scd5SspyzNzYcUkjf$
and examples: https://urldefense.com/v3/__https://github.com/lxin/quic/tree/main/tests__;!!GjvTz_vk!UsLPnlAN5OZvmKIETR2k4xtGO49kJw5h_my6mmoYzVfohMrtGl2Be1zG9WOV3L7scd5SspyzNy4xr52Q$The QUIC module is currently labeled as "EXPERIMENTAL".
Xin Long (5):
net: defineIPPROTO_QUICandSOL_QUICconstants for QUIC protocol
net: includequic.hininclude/uapi/linuxfor QUIC protocol
net: implement QUIC protocol code in net/quic directory
net: integrate QUIC build configuration intoKconfigandMakefile
Documentation: introducequic.rstto provide description of QUIC
protocolDocumentation/networking/quic.rst | 160 +++ include/linux/socket.h | 1 + include/uapi/linux/in.h | 2 + include/uapi/linux/quic.h | 189 +++ net/Kconfig | 1 + net/Makefile | 1 + net/quic/Kconfig | 34 + net/quic/Makefile | 20 + net/quic/cong.c | 229 ++++ net/quic/cong.h | 84 ++ net/quic/connection.c | 172 +++ net/quic/connection.h | 117 ++ net/quic/crypto.c | 979 ++++++++++++++++ net/quic/crypto.h | 140 +++ net/quic/frame.c | 1803 ++++++++++++++++++++++++++++ net/quic/frame.h | 162 +++ net/quic/hashtable.h | 125 ++ net/quic/input.c | 693 +++++++++++ net/quic/input.h | 169 +++ net/quic/number.h | 174 +++ net/quic/output.c | 638 ++++++++++ net/quic/output.h | 194 +++ net/quic/packet.c | 1179 +++++++++++++++++++ net/quic/packet.h | 99 ++ net/quic/path.c | 434 +++++++ net/quic/path.h | 131 +++ net/quic/pnmap.c | 217 ++++ net/quic/pnmap.h | 134 +++ net/quic/protocol.c | 711 +++++++++++ net/quic/protocol.h | 56 + net/quic/sample_test.c | 339 ++++++ net/quic/socket.c | 1823 +++++++++++++++++++++++++++++ net/quic/socket.h | 293 +++++ net/quic/stream.c | 248 ++++ net/quic/stream.h | 147 +++ net/quic/timer.c | 241 ++++ net/quic/timer.h | 29 + net/quic/unit_test.c | 1024 ++++++++++++++++ 38 files changed, 13192 insertions(+)create mode 100644
Documentation/networking/quic.rstcreate mode 100644include/uapi/linux/quic.hcreate mode 100644net/quic/Kconfig
create mode 100644net/quic/Makefile
create mode 100644net/quic/cong.c
create mode 100644net/quic/cong.h
create mode 100644net/quic/connection.ccreate mode 100644net/quic/connection.hcreate mode 100644net/quic/crypto.c
create mode 100644net/quic/crypto.h
create mode 100644net/quic/frame.c
create mode 100644net/quic/frame.h
create mode 100644net/quic/hashtable.hcreate mode 100644net/quic/input.c
create mode 100644net/quic/input.h
create mode 100644net/quic/number.h
create mode 100644net/quic/output.c
create mode 100644net/quic/output.h
create mode 100644net/quic/packet.c
create mode 100644net/quic/packet.h
create mode 100644net/quic/path.c
create mode 100644net/quic/path.h
create mode 100644net/quic/pnmap.c
create mode 100644net/quic/pnmap.h
create mode 100644net/quic/protocol.ccreate mode 100644net/quic/protocol.hcreate mode 100644net/quic/sample_test.ccreate mode 100644net/quic/socket.c
create mode 100644net/quic/socket.h
create mode 100644net/quic/stream.c
create mode 100644net/quic/stream.h
create mode 100644net/quic/timer.c
create mode 100644net/quic/timer.h
create mode 100644net/quic/unit_test.c
Quoted 5 lines · Jason Baron
Hi,
This series looks very interesting- I was just wondering if you had done any performance testing of this vs. a userspace QUIC implementation?
Hi, Jason,
I only did the testing vs kTLS with adapt iperf:
https://github.com/lxin/quic?tab=readme-ov-file#build-and-install-iperf-for-performance-tests
For userspace QUIC implementations, it's not using common socket APIs. I couldn't find a tool to do the performance testing for them.
Thanks.
Quoted 253 lines
Thanks,
-Jason
Quoted 247 lines · Xin Long
Introduction
============This is an implementation of the QUIC protocol as defined in RFC9000. QUIC is an UDP-Based Multiplexed and Secure Transport protocol, and it provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances.
This implementation of QUIC in the kernel space enables users to utilize the QUIC protocol through common socket APIs in user space. Additionally, kernel subsystems like SMB and NFS can seamlessly operate over the QUIC protocol after handshake using net/handshake APIs.
Note that In-Kernel QUIC implementation does NOT target Crypto Offload support for existing Userland QUICs, and Crypto Offload intended for Userland QUICs can NOT be utilized for Kernel consumers, such as SMB. Therefore, there is no conflict between In-Kernel QUIC and Crypto Offload for Userland QUICs.
This implementation offers fundamental support for the following RFCs:
- RFC9000 - QUIC: A UDP-Based Multiplexed and Secure Transport
- RFC9001 - Using TLS to Secure QUIC
- RFC9002 - QUIC Loss Detection and Congestion Control
- RFC9221 - An Unreliable Datagram Extension to QUIC
- RFC9287 - Greasing the QUIC Bit
- RFC9368 - Compatible Version Negotiation for QUIC
- RFC9369 - QUIC Version 2
- Handshake APIs for tlshd Use - SMB/NFS over QUICImplementation
==============The central idea is to implement QUIC within the kernel, incorporating an userspace handshake approach.
Only the processing and creation of raw TLS Handshake Messages, facilitated by a tls library like gnutls, take place in userspace. These messages are exchanged through sendmsg/recvmsg() mechanisms, with cryptographic details carried in the control message (cmsg).
The entirety of QUIC protocol, excluding TLS Handshake Messages processing and creation, resides in the kernel. Instead of utilizing a User Level Protocol (ULP) layer, it establishes a socket of
IPPROTO_QUICtype (similar toIPPROTO_MPTCP) operating over UDP tunnels.Kernel consumers can initiate a handshake request from kernel to userspace via the existing net/handshake netlink. The userspace component, tlshd from ktls-utils, manages the QUIC handshake request processing.
- Handshake Architecture:
+------+ +------+ | APP1 | | APP2 | ... +------+ +------+ +-------------------------------------------------+ | libquic (ktls-utils) |<--------------+ | {quic_handshake_server/client/param()} | | +-------------------------------------------------+ +---------------------+ {send/recvmsg()} {set/getsockopt()} | tlshd (ktls-utils) | [CMSG handshake_info] [SOCKOPT_CRYPTO_SECRET] +---------------------+ [SOCKOPT_TRANSPORT_PARAM_EXT] | ^ | ^ | ^ Userspace | | | | | | ------------|-|----------------------------|-|------------------------|-|-------------- Kernel | | | | | | v | v | v | +--------------------------------------------------+ +-------------+ | socket (IPPRTOTO_QUIC) | protocol |<----+ | handshake | +--------------------------------------------------+ | | netlink APIs| | inqueue | outqueue | cong | path | connection_id | | +-------------+ +--------------------------------------------------+ | | | | packet | frame | crypto | pnmap | | +-----+ +-----+ +--------------------------------------------------+ | | | | | | input | output | |---| SMB | | NFS | ... +--------------------------------------------------+ | | | | | | UDP tunnels | | +-----+ +--+--+ +--------------------------------------------------+ +--------------|- Post Handshake Architecture:
+------+ +------+ | APP1 | | APP2 | ... +------+ +------+ {send/recvmsg()} {set/getsockopt()} [CMSG stream_info] [SOCKOPT_KEY_UPDATE] [SOCKOPT_CONNECTION_MIGRATION] [SOCKOPT_STREAM_OPEN/RESET/STOP_SENDING] [...] | ^ | ^ Userspace | | | | ------------|-|----------------------------|-|---------------- Kernel | | | | v | v | +--------------------------------------------------+ | socket (IPPRTOTO_QUIC) | protocol |<----+ {kernel_send/recvmsg()} +--------------------------------------------------+ | {kernel_set/getsockopt()} | inqueue | outqueue | cong | path | connection_id | | +--------------------------------------------------+ | | packet | frame | crypto | pnmap | | +-----+ +-----+ +--------------------------------------------------+ | | | | | | input | output | |---| SMB | | NFS | ... +--------------------------------------------------+ | | | | | | UDP tunnels | | +-----+ +--+--+ +--------------------------------------------------+ +--------------|Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.For utilization by kernel consumers, it is essential to have the tlshd service (from ktls-utils) installed and running in userspace. This service receives and manages kernel handshake requests for kernel sockets. In kernel, the APIs closely resemble those used in userspace:
Client Server ------------------------------------------------------------------------ __sock_create(IPPROTO_QUIC, &sock) __sock_create(IPPROTO_QUIC, &sock) kernel_bind(sock) kernel_bind(sock) kernel_listen(sock) kernel_connect(sock) tls_client_hello_x509(args:{sock}) kernel_accept(sock, &newsock) tls_server_hello_x509(args:{newsock}) kernel_sendmsg(sock) kernel_recvmsg(newsock) sock_release(sock) sock_release(newsock) sock_release(sock)Please be aware that
tls_client_hello_x509()andtls_server_hello_x509()are APIs fromnet/handshake/. They are employed to dispatch the handshake request to the userspace tlshd service and subsequently block until the handshake process is completed.For advanced usage,
see man doc: https://urldefense.com/v3/__https://github.com/lxin/quic/wiki/man__;!!GjvTz_vk!UsLPnlAN5OZvmKIETR2k4xtGO49kJw5h_my6mmoYzVfohMrtGl2Be1zG9WOV3L7scd5SspyzNzYcUkjf$
and examples: https://urldefense.com/v3/__https://github.com/lxin/quic/tree/main/tests__;!!GjvTz_vk!UsLPnlAN5OZvmKIETR2k4xtGO49kJw5h_my6mmoYzVfohMrtGl2Be1zG9WOV3L7scd5SspyzNy4xr52Q$The QUIC module is currently labeled as "EXPERIMENTAL".
Xin Long (5):
net: defineIPPROTO_QUICandSOL_QUICconstants for QUIC protocol
net: includequic.hininclude/uapi/linuxfor QUIC protocol
net: implement QUIC protocol code in net/quic directory
net: integrate QUIC build configuration intoKconfigandMakefile
Documentation: introducequic.rstto provide description of QUIC
protocolDocumentation/networking/quic.rst | 160 +++ include/linux/socket.h | 1 + include/uapi/linux/in.h | 2 + include/uapi/linux/quic.h | 189 +++ net/Kconfig | 1 + net/Makefile | 1 + net/quic/Kconfig | 34 + net/quic/Makefile | 20 + net/quic/cong.c | 229 ++++ net/quic/cong.h | 84 ++ net/quic/connection.c | 172 +++ net/quic/connection.h | 117 ++ net/quic/crypto.c | 979 ++++++++++++++++ net/quic/crypto.h | 140 +++ net/quic/frame.c | 1803 ++++++++++++++++++++++++++++ net/quic/frame.h | 162 +++ net/quic/hashtable.h | 125 ++ net/quic/input.c | 693 +++++++++++ net/quic/input.h | 169 +++ net/quic/number.h | 174 +++ net/quic/output.c | 638 ++++++++++ net/quic/output.h | 194 +++ net/quic/packet.c | 1179 +++++++++++++++++++ net/quic/packet.h | 99 ++ net/quic/path.c | 434 +++++++ net/quic/path.h | 131 +++ net/quic/pnmap.c | 217 ++++ net/quic/pnmap.h | 134 +++ net/quic/protocol.c | 711 +++++++++++ net/quic/protocol.h | 56 + net/quic/sample_test.c | 339 ++++++ net/quic/socket.c | 1823 +++++++++++++++++++++++++++++ net/quic/socket.h | 293 +++++ net/quic/stream.c | 248 ++++ net/quic/stream.h | 147 +++ net/quic/timer.c | 241 ++++ net/quic/timer.h | 29 + net/quic/unit_test.c | 1024 ++++++++++++++++ 38 files changed, 13192 insertions(+)create mode 100644
Documentation/networking/quic.rstcreate mode 100644include/uapi/linux/quic.hcreate mode 100644net/quic/Kconfig
create mode 100644net/quic/Makefile
create mode 100644net/quic/cong.c
create mode 100644net/quic/cong.h
create mode 100644net/quic/connection.ccreate mode 100644net/quic/connection.hcreate mode 100644net/quic/crypto.c
create mode 100644net/quic/crypto.h
create mode 100644net/quic/frame.c
create mode 100644net/quic/frame.h
create mode 100644net/quic/hashtable.hcreate mode 100644net/quic/input.c
create mode 100644net/quic/input.h
create mode 100644net/quic/number.h
create mode 100644net/quic/output.c
create mode 100644net/quic/output.h
create mode 100644net/quic/packet.c
create mode 100644net/quic/packet.h
create mode 100644net/quic/path.c
create mode 100644net/quic/path.h
create mode 100644net/quic/pnmap.c
create mode 100644net/quic/pnmap.h
create mode 100644net/quic/protocol.ccreate mode 100644net/quic/protocol.hcreate mode 100644net/quic/sample_test.ccreate mode 100644net/quic/socket.c
create mode 100644net/quic/socket.h
create mode 100644net/quic/stream.c
create mode 100644net/quic/stream.h
create mode 100644net/quic/timer.c
create mode 100644net/quic/timer.h
create mode 100644net/quic/unit_test.c
Hi Xin Long,
Quoted 88 lines
Quoted 57 lines
Quoted 57 lines
Quoted 40 lines
Quoted 40 lines
Quoted 2 lines
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
Quoted 7 lines
Quoted 5 lines
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Just note that, with a bit change in the current libquic, it still allows users to use ALPN to find the correct function or thread in the *same* process, usage be like:
listenfd =
socket(IPPROTO_QUIC);
/* match all during handshake with wildcard ALPN */setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "*"); bind(listenfd)
listen(listenfd)Quoted 8 lines
Quoted 6 lines
while (1) { sockfd = accept(listenfd); /* the alpn from client will be set to sockfd during handshake */ quic_server_handshake(sockfd, cert); getsockopt(sockfd, QUIC_SOCKOPT_ALPN, alpn);Would
quic_server_handshake()callsetsockopt()?Yes, I just made a bit change in the userspace libquic:
https://github.com/lxin/quic/commit/9c75bd42769a8cbc1652e2f4c8d77780f23afde6So you can set up multple ALPNs on listen sock:
setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "smbd, h3, ksmbd");Then during handshake, the matched ALPN from client will be set into the accept socket, then users can get it later after handshake.
Note that userspace libquic is a very light lib (a couple of hundred lines of code), you can add more TLS related support without touching Kernel code, including the SNI support you mentioned.
Quoted 8 lines
Quoted 7 lines
switch (alpn) { case "smbd": smbd_thread(sockfd); case "h3": h3_thread(sockfd); case "ksmbd": ksmbd_thread(sockfd); } }
Quoted 5 lines
Quoted 3 lines
Ok, but that would mean all application need to be aware of each other, but it would be possible and socket fds could be passed to other processes.
It doesn't sound common to me, but yes, I think Unix Domain Sockets can pass it to another process.
I think it will be extremely common to have multiple services based on udp port 443.
People will expect to find web services, smb and maybe more behind the same dnshost name. And multiple dnshostnames pointing to the same ip address is also very likely.
With plain tcp/udp it's also possible to independent sockets per port. There's no single userspace daemon that listens on 'tcp' and will dispatch into different process base on the port.
And with QUIC the port space is the ALPN and/or SNI combination.
And I think this should be addressed before this becomes an unchangeable kernel ABI, written is stone.
Quoted 67 lines
Quoted 67 lines
Quoted 66 lines
Quoted 5 lines
Quoted 3 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Got you. This can be done by also moving TLS 1.3 message exchange to kernel where we can get the ALPN before looking up the listening socket. However, In-kernel TLS 1.3 Handshake had been NACKed by both kernel netdev maintainers and userland ssl lib developers with good reasons.
Quoted 11 lines
Quoted 10 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 5 lines
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Honestly, I don't think any userland QUIC can use ALPN to lookup for different sockets used by different servers/processes. As such thing can be only done in Kernel Space.
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 4 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Quoted 5 lines
Quoted 1 line
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the
accept()to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?Good question!
The first "new" QUIC pdu will cause to create a 'request sock' (contains 4-tuple and connection IDs only) and queue up to reqsk list of the listen sock (if
validate_peer_addressparam is not set), and this pdu is enqueued in theinq->backlog_listof the listen sock.When
accept()is called, in Kernel, it dequeues the "request sock" from the reqsk list of the listen sock, and creates the accept socket based on this reqsk. Then it processes the pdu for this new accept socket from theinq->backlog_listof the listen sock, including *decrypting* QUIC packet and decoding CRYPTO frame, then deliver the raw/cleartext TLS message to the Userspace libquic.
Quoted 6 lines
Quoted 3 lines
Ok, when the kernel already decrypts it could already look find the ALPN. It doesn't mean it should do the full handshake, but parse enough to find the ALPN.
Correct, in-kernel QUIC should only do the QUIC related things, and all TLS handshake msgs must be handled in Userspace. This won't cause "layering violation", as Nick Banks said.
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And quic_do_listen_rcv() would need to find the correct logical listening socket and call quic_request_sock_enqueue() on the logical socket not the lowlevel udo socket. The same for all stuff happening after quic_request_sock_enqueue() at the end of quic_do_listen_rcv.
Quoted 10 lines
Quoted 3 lines
But I don't yet understand how the kernel gets the key to do the initlal decryption, I'd assume some call before
listen()need to tell the kernel about the keys.For initlal decryption, the keys can be derived with the initial packet. basically, it only needs the
dst_connection_idfrom the client initial packet. see:https://datatracker.ietf.org/doc/html/rfc9001#name-initial-secrets
so we don't need to set up anything to kernel for initial's keys.
I got it thanks!
metze
Quoted 193 lines · Stefan Metzmacher
Hi Xin Long,
Quoted 88 lines
Quoted 57 lines
Quoted 57 lines
Quoted 40 lines
Quoted 40 lines
Quoted 2 lines
first many thanks for working on this topic!
Hi, Stefan
Thanks for the comment!
Quoted 27 lines
Quoted 21 lines
Usage
=====This implementation supports a mapping of QUIC into sockets APIs. Similar to TCP and SCTP, a typical Server and Client use the following system call sequence to communicate:
Client Server
------------------------------------------------------------------
sockfd =socket(IPPROTO_QUIC)listenfd =socket(IPPROTO_QUIC)
bind(sockfd) bind(listenfd)
listen(listenfd)
connect(sockfd)
quic_client_handshake(sockfd)
sockfd = accecpt(listenfd)quic_server_handshake(sockfd, cert)sendmsg(sockfd) recvmsg(sockfd)
close(sockfd) close(sockfd)
close(listenfd)Quoted 5 lines
Please note that
quic_client_handshake()andquic_server_handshake()functions are currently sourced from libquic in the github lxin/quic repository, and might be integrated into ktls-utils in the future. These functions are responsible for receiving and processing the raw TLS handshake messages until the completion of the handshake process.Quoted 5 lines
I see a problem with this design for the server, as one reason to have SMB over QUIC is to use udp port 443 in order to get through firewalls. As QUIC has the concept of ALPN it should be possible let a conumer only listen on a specif ALPN, so that the smb server and web server on "h3" could both accept connections.
We do provide a sockopt to set ALPN before bind or handshaking:
Quoted 7 lines
Quoted 5 lines
https://github.com/lxin/quic/wiki/man#quic_sockopt_alpn
But it's used more like to verify if the ALPN set on the server matches the one received from the client, instead of to find the correct server.
Ah, ok.
Just note that, with a bit change in the current libquic, it still allows users to use ALPN to find the correct function or thread in the *same* process, usage be like:
listenfd =
socket(IPPROTO_QUIC);
/* match all during handshake with wildcard ALPN */setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "*"); bind(listenfd)
listen(listenfd)Quoted 8 lines
Quoted 6 lines
while (1) { sockfd = accept(listenfd); /* the alpn from client will be set to sockfd during handshake */ quic_server_handshake(sockfd, cert); getsockopt(sockfd, QUIC_SOCKOPT_ALPN, alpn);Would
quic_server_handshake()callsetsockopt()?Yes, I just made a bit change in the userspace libquic:
https://github.com/lxin/quic/commit/9c75bd42769a8cbc1652e2f4c8d77780f23afde6So you can set up multple ALPNs on listen sock:
setsockopt(listenfd, QUIC_SOCKOPT_ALPN, "smbd, h3, ksmbd");Then during handshake, the matched ALPN from client will be set into the accept socket, then users can get it later after handshake.
Note that userspace libquic is a very light lib (a couple of hundred lines of code), you can add more TLS related support without touching Kernel code, including the SNI support you mentioned.
Quoted 8 lines
Quoted 7 lines
switch (alpn) { case "smbd": smbd_thread(sockfd); case "h3": h3_thread(sockfd); case "ksmbd": ksmbd_thread(sockfd); } }Quoted 5 lines
Quoted 3 lines
Ok, but that would mean all application need to be aware of each other, but it would be possible and socket fds could be passed to other processes.
It doesn't sound common to me, but yes, I think Unix Domain Sockets can pass it to another process.
I think it will be extremely common to have multiple services based on udp port 443.
People will expect to find web services, smb and maybe more behind the same dnshost name. And multiple dnshostnames pointing to the same ip address is also very likely.
With plain tcp/udp it's also possible to independent sockets per port. There's no single userspace daemon that listens on 'tcp' and will dispatch into different process base on the port.
And with QUIC the port space is the ALPN and/or SNI combination.
And I think this should be addressed before this becomes an unchangeable kernel ABI, written is stone.
Quoted 67 lines
Quoted 67 lines
Quoted 66 lines
Quoted 5 lines
Quoted 3 lines
So you expect (k)smbd server and web server both to listen on UDP port 443 on the same host, and which APP server accepts the request from a client depends on ALPN, right?
yes.
Got you. This can be done by also moving TLS 1.3 message exchange to kernel where we can get the ALPN before looking up the listening socket. However, In-kernel TLS 1.3 Handshake had been NACKed by both kernel netdev maintainers and userland ssl lib developers with good reasons.
Quoted 11 lines
Quoted 10 lines
Currently, in Kernel, this implementation doesn't process any raw TLS MSG/EXTs but deliver them to userspace after decryption, and the accept socket is created before processing handshake.
I'm actually curious how userland QUIC handles this, considering that the UDP sockets('listening' on the same IP:PORT) are used in two different servers' processes. I think socket lookup with ALPN has to be done in Kernel Space. Do you know any userland QUIC implementation for this?
Quoted 5 lines
I don't now, but I guess QUIC is only used for http so far and maybe dns, but that seems to use port 853.
So there's no strict need for it and the web server would handle all relevant ALPNs.
Honestly, I don't think any userland QUIC can use ALPN to lookup for different sockets used by different servers/processes. As such thing can be only done in Kernel Space.
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
So the server application should have a way to specify the desired ALPN before or during the
bind()call. I'm not sure if the ALPN is available in cleartext before any crypto is needed, so if the ALPN is encrypted it might be needed to also register a server certificate and key together with the ALPN. Because multiple application may not want to share the same key.On send side, ALPN extension is in raw TLS messages created in userspace and passed into the kernel and encoded into QUIC crypto frame and then *encrypted* before sending out.
Ok.
Quoted 4 lines
On recv side, after decryption, the raw TLS messages are decoded from the QUIC crypto frame and then delivered to userspace, so in userspace it processes certificate validation and also see cleartext ALPN.
Quoted 5 lines
Quoted 1 line
Let me know if I don't make it clear.
But the first "new" QUIC pdu from will trigger the
accept()to
return and userspace (or the kernel helper function) will to
all crypto? Or does the first decryption happen in kernel (before accept returns)?Good question!
The first "new" QUIC pdu will cause to create a 'request sock' (contains 4-tuple and connection IDs only) and queue up to reqsk list of the listen sock (if
validate_peer_addressparam is not set), and this pdu is enqueued in theinq->backlog_listof the listen sock.When
accept()is called, in Kernel, it dequeues the "request sock" from the reqsk list of the listen sock, and creates the accept socket based on this reqsk. Then it processes the pdu for this new accept socket from theinq->backlog_listof the listen sock, including *decrypting* QUIC packet and decoding CRYPTO frame, then deliver the raw/cleartext TLS message to the Userspace libquic.Quoted 6 lines
Quoted 3 lines
Ok, when the kernel already decrypts it could already look find the ALPN. It doesn't mean it should do the full handshake, but parse enough to find the ALPN.
Correct, in-kernel QUIC should only do the QUIC related things, and all TLS handshake msgs must be handled in Userspace. This won't cause "layering violation", as Nick Banks said.
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.
The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Currently, if your 3 quic applications listen to the same address:port with SO_REUSEPORT socket option set, the incoming connection will choose one of your applications randomly with hash(client_addr+port) via reuseport_select_sock() in quic_sock_lookup().
It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
The problem is to parse the TLS Client_Hello message to get the ALPN in quic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.
Will you be able to work around this by using Unix Domain Sockets pass the sockfd to another process?
(Note that we're assuming all your 3 applications are using in-kernel QUIC)
Quoted 15 lines
Quoted 10 lines
Quoted 3 lines
But I don't yet understand how the kernel gets the key to do the initlal decryption, I'd assume some call before
listen()need to tell the kernel about the keys.For initlal decryption, the keys can be derived with the initial packet. basically, it only needs the
dst_connection_idfrom the client initial packet. see:https://datatracker.ietf.org/doc/html/rfc9001#name-initial-secrets
so we don't need to set up anything to kernel for initial's keys.
I got it thanks!
metze
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.
Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
Quoted 2 lines
Will you be able to work around this by using Unix Domain Sockets pass the sockfd to another process?
Not really. As that would strict coordination between a lot of independent projects.
Quoted 1 line
(Note that we're assuming all your 3 applications are using in-kernel QUIC)
Sure, but I guess for servers using port 443 that the only long term option. and I don't think it will be less performant than a userspace implementation.
Thanks!
metze
Quoted 28 lines · Stefan Metzmacher
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In quic_inq_handshake_tail() in kernel, for Client Initial packet is processed when calling accept(), this is the path:
quic_accept()-> quic_accept_sock_init() -> quic_packet_process() -> quic_packet_handshake_process() -> quic_frame_process() -> quic_frame_crypto_process() -> quic_inq_handshake_tail().
Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook in reuseport_select_sock() is meant to do such selection.
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
BTW, for the TLS message parse, I have some prototype code for TLS Handshake:
https://github.com/lxin/tls_hs/blob/master/crypto/tls_hs.c#L2084
The path to get ALPN:tls_msg_handle() -> tls_msg_ch_handle() -> tls_ext_handle()
Hope it may be helpful to you.
Quoted 11 lines
Quoted 3 lines
Will you be able to work around this by using Unix Domain Sockets pass the sockfd to another process?
Not really. As that would strict coordination between a lot of independent projects.
Quoted 1 line
(Note that we're assuming all your 3 applications are using in-kernel QUIC)
Sure, but I guess for servers using port 443 that the only long term option. and I don't think it will be less performant than a userspace implementation.
Cool.
Quoted 56 lines · Xin Long
Quoted 28 lines · Stefan Metzmacher
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In
quic_inq_handshake_tail()in kernel, for Client Initial packet is processed when callingaccept(), this is the path:quic_accept()->
quic_accept_sock_init()->quic_packet_process()->quic_packet_handshake_process()->quic_frame_process()->quic_frame_crypto_process()->quic_inq_handshake_tail().Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook inreuseport_select_sock()is meant to do such selection.
Quoted 6 lines
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
I created this patch:
https://github.com/lxin/quic/commit/aee0b7c77df3f39941f98bb901c73fdc560befb8
to do this decryption in quic_sock_look() before calling reuseport_select_sock(), so that it provides the bpf selector with a plain-text QUIC initial packet:
https://datatracker.ietf.org/doc/html/rfc9000#section-17.2.2
If it's complex for you to do the decryption for the initial packet in the bpf selector, I will apply this patch. Please let me know.
Thanks.
Quoted 22 lines
BTW, for the TLS message parse, I have some prototype code for TLS Handshake:
https://github.com/lxin/tls_hs/blob/master/crypto/tls_hs.c#L2084The path to get ALPN:
tls_msg_handle()->tls_msg_ch_handle()->tls_ext_handle()Hope it may be helpful to you.
Quoted 11 lines
Quoted 3 lines
Will you be able to work around this by using Unix Domain Sockets pass the sockfd to another process?
Not really. As that would strict coordination between a lot of independent projects.
Quoted 1 line
(Note that we're assuming all your 3 applications are using in-kernel QUIC)
Sure, but I guess for servers using port 443 that the only long term option. and I don't think it will be less performant than a userspace implementation.
Cool.
Am 20.04.24 um 21:32 schrieb Xin Long:
Quoted 67 lines · Xin Long
Quoted 56 lines · Stefan Metzmacher
Quoted 28 lines
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In
quic_inq_handshake_tail()in kernel, for Client Initial packet is processed when callingaccept(), this is the path:quic_accept()->
quic_accept_sock_init()->quic_packet_process()->quic_packet_handshake_process()->quic_frame_process()->quic_frame_crypto_process()->quic_inq_handshake_tail().Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook inreuseport_select_sock()is meant to do such selection.Quoted 6 lines
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
I created this patch:
https://github.com/lxin/quic/commit/aee0b7c77df3f39941f98bb901c73fdc560befb8
Quoted 8 lines
to do this decryption in
quic_sock_look()before callingreuseport_select_sock(), so that it provides the bpf selector with a plain-text QUIC initial packet:https://datatracker.ietf.org/doc/html/rfc9000#section-17.2.2
If it's complex for you to do the decryption for the initial packet in the bpf selector, I will apply this patch. Please let me know.
I guess in addition to quic_server_handshake(), which is called after accept(), there should be quic_server_prepare_listen() (and something similar for in kernel servers) that setup the reuseport magic for the socket, so that it's not needed in every application.
It seems there is only a single ebpf program possible per reuseport group, so there has to be just a single one.
But is it possible for in kernel servers to also register an epbf program?
metze
Quoted 75 lines · Stefan Metzmacher
Am 20.04.24 um 21:32 schrieb Xin Long:
Quoted 73 lines · Xin Long
Quoted 56 lines · Stefan Metzmacher
Quoted 28 lines
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In
quic_inq_handshake_tail()in kernel, for Client Initial packet is processed when callingaccept(), this is the path:quic_accept()->
quic_accept_sock_init()->quic_packet_process()->quic_packet_handshake_process()->quic_frame_process()->quic_frame_crypto_process()->quic_inq_handshake_tail().Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook inreuseport_select_sock()is meant to do such selection.Quoted 6 lines
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
I created this patch:
https://github.com/lxin/quic/commit/aee0b7c77df3f39941f98bb901c73fdc560befb8
to do this decryption in
quic_sock_look()before callingreuseport_select_sock(), so that it provides the bpf selector with a plain-text QUIC initial packet:https://datatracker.ietf.org/doc/html/rfc9000#section-17.2.2
Quoted 7 lines
Quoted 2 lines
If it's complex for you to do the decryption for the initial packet in the bpf selector, I will apply this patch. Please let me know.
I guess in addition to
quic_server_handshake(), which is called afteraccept(), there should bequic_server_prepare_listen()(and something similar for in kernel servers) that setup the reuseport magic for the socket, so that it's not needed in every application.
It's done when calling listen(), see quic_inet_listen()->quic_hash() where only listening sockets with its sk_reuseport set will be added into the reuseport group.
It means SO_REUSEPORT sockopt must be set for every socket before calling listen().
Quoted 3 lines
It seems there is only a single ebpf program possible per reuseport group, so there has to be just a single one.
Yes, a single ebpf program per reuseport group should work. see prepare_sk_fds() in kernel selftests for select_reuseport bfp.
Quoted 2 lines
But is it possible for in kernel servers to also register an epbf program?
Good question. TBH, I don't really know much about epbf programming. I guess the real problem is how you pass the .o file to kernel space?
Another question is, in the selftests:tools/testing/selftests/bpf/prog_tests/select_reuseport.c tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
it created a global reuseport_array, and then added these sockets into this array for the later lookup, but these sockets are all created in the same process.
But your case is that the sockets are created in different processes. I'm not sure if it's possible to add sockets from different processes into the same reuseport_array?
Added Martin who introduced BPF_PROG_TYPE_SK_REUSEPORT, I guess he may know the answers.
Thanks.
Quoted 83 lines · Stefan Metzmacher
Am 20.04.24 um 21:32 schrieb Xin Long:
Quoted 67 lines · Xin Long
Quoted 56 lines · Stefan Metzmacher
Quoted 28 lines
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In
quic_inq_handshake_tail()in kernel, for Client Initial packet is processed when callingaccept(), this is the path:quic_accept()->
quic_accept_sock_init()->quic_packet_process()->quic_packet_handshake_process()->quic_frame_process()->quic_frame_crypto_process()->quic_inq_handshake_tail().Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook inreuseport_select_sock()is meant to do such selection.Quoted 6 lines
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
I created this patch:
https://github.com/lxin/quic/commit/aee0b7c77df3f39941f98bb901c73fdc560befb8
Quoted 8 lines
to do this decryption in
quic_sock_look()before callingreuseport_select_sock(), so that it provides the bpf selector with a plain-text QUIC initial packet:https://datatracker.ietf.org/doc/html/rfc9000#section-17.2.2
If it's complex for you to do the decryption for the initial packet in the bpf selector, I will apply this patch. Please let me know.
I guess in addition to
quic_server_handshake(), which is called afteraccept(), there should bequic_server_prepare_listen()(and something similar for in kernel servers) that setup the reuseport magic for the socket, so that it's not needed in every application.
Quoted 5 lines
It seems there is only a single ebpf program possible per reuseport group, so there has to be just a single one.
But is it possible for in kernel servers to also register an epbf program?
Just confirmed from other ebpf experts, there are no in-kernel interfaces for loading and interacting with BPF maps/programs(other than from BPF itself).
It seems that we have to do this match in QUIC stack. In the latest QUIC code, I added quic_packet_get_alpn(), a 59-line function, to parse ALPNs and then it will search for the listen sock with these ALPNs in quic_sock_lookup().
I introduced 'alpn_match' module param, and it can be enabled when loading the module QUIC by:
# modprobe quic alpn_match=1
You can test it by tests/sample_test in the latest code:
Start 3 servers:
# ./sample_test server 0.0.0.0 1234 \
./keys/server-key.pem ./keys/server-cert.pem smbd
# ./sample_test server 0.0.0.0 1234 \
./keys/server-key.pem ./keys/server-cert.pem h3
# ./sample_test server 0.0.0.0 1234 \
./keys/server-key.pem ./keys/server-cert.pem ksmbdTry to connect on clients with:
# ./sample_test client 127.0.0.1 1234 ksmbd
# ./sample_test client 127.0.0.1 1234 smbd
# ./sample_test client 127.0.0.1 1234 h3to see if the corresponding server responds.
There might be some concerns but it's also a useful feature that can not be implemented in userland QUICs. The commit is here:
https://github.com/lxin/quic/commit/de82f8135f4e9196b503b4ab5b359d88f2b2097f
Please check if this is enough for SMB applications.
Note as a listen socket is now identified by [address + port + ALPN] when alpn_match=1, this feature does NOT require SO_REUSEPORT socket option to be set, unless one wants multiple sockets to listen to
the same [address + port + ALPN].
Thanks.
Martin KaFai Lau
reviewerQuoted 109 lines · Xin Long
Quoted 75 lines · Stefan Metzmacher
Am 20.04.24 um 21:32 schrieb Xin Long:
Quoted 73 lines · Xin Long
Quoted 56 lines · Stefan Metzmacher
Quoted 28 lines
Hi Xin Long,
Quoted 16 lines
Quoted 5 lines
But I think its unavoidable for the ALPN and SNI fields on the server side. As every service tries to use udp port 443 and somehow that needs to be shared if multiple services want to use it.
Quoted 8 lines
I guess on the acceptor side we would need to somehow detach low level udp struct sock from the logical listen struct sock.
And
quic_do_listen_rcv()would need to find the correct logical listening socket and callquic_request_sock_enqueue()on the logical socket not the lowlevel udo socket. The same for all stuff happening afterquic_request_sock_enqueue()at the end ofquic_do_listen_rcv.The implementation allows one low level UDP sock to serve for multiple QUIC socks.
Quoted 8 lines
Currently, if your 3 quic applications listen to the same address:port with
SO_REUSEPORTsocket option set, the incoming connection will choose one of your applications randomly withhash(client_addr+port)vireuseport_select_sock()inquic_sock_lookup().It should be easy to do a further match with ALPN between these 3 quic socks that listens to the same address:port to get the right quic sock, instead of that randomly choosing.
Quoted 8 lines
Ah, that sounds good.
Quoted 3 lines
The problem is to parse the TLS
Client_Hellomessage to get the ALPN inquic_sock_lookup(), which is not a proper thing to do in kernel, and might be rejected by networking maintainers, I need to check with them.Is the reassembling of CRYPTO frames done in the kernel or userspace? Can you point me to the place in the code?
In
quic_inq_handshake_tail()in kernel, for Client Initial packet is processed when callingaccept(), this is the path:quic_accept()->
quic_accept_sock_init()->quic_packet_process()->quic_packet_handshake_process()->quic_frame_process()->quic_frame_crypto_process()->quic_inq_handshake_tail().Note that it's with the accept sock, not the listen sock.
Quoted 5 lines
If it's really impossible to do in C code maybe registering a bpf function in order to allow a listener to check the intial quic packet and decide if it wants to serve that connection would be possible as last resort?
That's a smart idea! man.
I think the bpf hook inreuseport_select_sock()is meant to do such selection.Quoted 6 lines
For the Client initial packet (the only packet you need to handle), I double you will need to do the reassembling, as Client Hello TLS message is always less than 400 byte in my env.
But I think you need to do the decryption for the Client initial packet before decoding it then parsing the TLS message from its crypto frame.
I created this patch:
https://github.com/lxin/quic/commit/aee0b7c77df3f39941f98bb901c73fdc560befb8
to do this decryption in
quic_sock_look()before callingreuseport_select_sock(), so that it provides the bpf selector with a plain-text QUIC initial packet:https://datatracker.ietf.org/doc/html/rfc9000#section-17.2.2
Quoted 7 lines
Quoted 2 lines
If it's complex for you to do the decryption for the initial packet in the bpf selector, I will apply this patch. Please let me know.
I guess in addition to
quic_server_handshake(), which is called afteraccept(), there should bequic_server_prepare_listen()(and something similar for in kernel servers) that setup the reuseport magic for the socket, so that it's not needed in every application.It's done when calling
listen(), see quic_inet_listen()->quic_hash() where only listening sockets with itssk_reuseportset will be added into the reuseport group.It means
SO_REUSEPORTsockopt must be set for every socket before callinglisten().Quoted 3 lines
It seems there is only a single ebpf program possible per reuseport group, so there has to be just a single one.
Yes, a single ebpf program per reuseport group should work. see
prepare_sk_fds()in kernel selftests forselect_reuseportbfp.Quoted 2 lines
But is it possible for in kernel servers to also register an epbf program?
Good question. TBH, I don't really know much about epbf programming. I guess the real problem is how you pass the .o file to kernel space?
Another question is, in the selftests:
tools/testing/selftests/bpf/prog_tests/stools/testing/selftests/bpf/progs/test_select_reuseport_kern.cit created a global
reuseport_array, and then added these sockets into this array for the later lookup, but these sockets are all created in the same process.
Quoted 6 lines
But your case is that the sockets are created in different processes. I'm not sure if it's possible to add sockets from different processes into the same
reuseport_array?Added Martin who introduced
BPF_PROG_TYPE_SK_REUSEPORT, I guess he may know the answers.
I didn't read the patchset, so I don't know what wanted to be done.
From capturing the questions in this and next email:
the reuseport_array is a bpf map. Like any bpf map, it can be shared across different processes. Meaning different processes can add sk to the map.
The bpf prog that selects a sk from the reuseport_array is set by the userspace through setsockopt(SO_ATTACH_REUSEPORT_EBPF). It is the only way right now, iirc.
If you can summarize what want to be done, it could help to see if there are ways that work for the use case.
Quoted 3 lines
Thanks.
Hi Xin Long,
Quoted 33 lines
Quoted 1 line
Just confirmed from other ebpf experts, there are no in-kernel interfaces for loading and interacting with BPF maps/programs(other than from BPF itself).
It seems that we have to do this match in QUIC stack. In the latest QUIC code, I added
quic_packet_get_alpn(), a 59-line function, to parse ALPNs and then it will search for the listen sock with these ALPNs inquic_sock_lookup().I introduced '
alpn_match' module param, and it can be enabled when loading the module QUIC by:# modprobe quic alpn_match=1You can test it by tests/sample_test in the latest code:
Start 3 servers:
# ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem smbd # ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem h3 # ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem ksmbdTry to connect on clients with: # ./sample_test client 127.0.0.1 1234 ksmbd # ./sample_test client 127.0.0.1 1234 smbd # ./sample_test client 127.0.0.1 1234 h3 to see if the corresponding server responds.
Quoted 6 lines
There might be some concerns but it's also a useful feature that can not be implemented in userland QUICs. The commit is here:
https://github.com/lxin/quic/commit/de82f8135f4e9196b503b4ab5b359d88f2b2097f
Please check if this is enough for SMB applications.
It look great thanks!
Quoted 4 lines
Note as a listen socket is now identified by [address + port + ALPN] when alpn_match=1, this feature does NOT require
SO_REUSEPORTsocket option to be set, unless one wants multiple sockets to listen to
the same [address + port + ALPN].
I'd argue that this should be the default and be required before listen() or maybe before bind(), so that it can return EADDRINUSE. As EADDRINUSE should only happen for servers it might be useful to have a QUIC_SOCKOPT_LISTEN_ALPN instead of QUIC_SOCKOPT_ALPN. As QUIC_SOCKOPT_ALPN on a client socket should not generate let bind() care about the alpn value at all.
For listens on tcp you also need to specify an explicit port (at least in order to be useful).
And it would mean that all application would use it and not block other applications from using an explicit alpn.
Also an module parameter for this means the administrator would have to take care of it, which means it might be unuseable if loaded with it.
I hope to find some time in the next weeks to play with this. Should be relatively trivial create a prototype for samba's smbd.
Thanks!
metze
Quoted 50 lines · Stefan Metzmacher
Hi Xin Long,
Quoted 33 lines
Quoted 1 line
Just confirmed from other ebpf experts, there are no in-kernel interfaces for loading and interacting with BPF maps/programs(other than from BPF itself).
It seems that we have to do this match in QUIC stack. In the latest QUIC code, I added
quic_packet_get_alpn(), a 59-line function, to parse ALPNs and then it will search for the listen sock with these ALPNs inquic_sock_lookup().I introduced '
alpn_match' module param, and it can be enabled when loading the module QUIC by:# modprobe quic alpn_match=1You can test it by tests/sample_test in the latest code:
Start 3 servers:
# ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem smbd # ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem h3 # ./sample_test server 0.0.0.0 1234 \ ./keys/server-key.pem ./keys/server-cert.pem ksmbdTry to connect on clients with: # ./sample_test client 127.0.0.1 1234 ksmbd # ./sample_test client 127.0.0.1 1234 smbd # ./sample_test client 127.0.0.1 1234 h3 to see if the corresponding server responds.Quoted 6 lines
There might be some concerns but it's also a useful feature that can not be implemented in userland QUICs. The commit is here:
https://github.com/lxin/quic/commit/de82f8135f4e9196b503b4ab5b359d88f2b2097f
Please check if this is enough for SMB applications.
It look great thanks!
Quoted 4 lines
Note as a listen socket is now identified by [address + port + ALPN] when alpn_match=1, this feature does NOT require
SO_REUSEPORTsocket option to be set, unless one wants multiple sockets to listen to
the same [address + port + ALPN].
Quoted 5 lines
I'd argue that this should be the default and be required before
listen()or maybe beforebind(), so that it can return EADDRINUSE. As EADDRINUSE should only happen for servers it might be useful to have aQUIC_SOCKOPT_LISTEN_ALPNinstead ofQUIC_SOCKOPT_ALPN. AsQUIC_SOCKOPT_ALPNon a client socket should not generate letbind()care about the alpn value at all.
The latest patches have made it always do alpn_match in kernel, and also support multiple ALPNs(split by ',' when setting it via sockopt) on both server and client side. Feel free to check.
Note that:
1. As you expected, setsockopt(QUIC_SOCKOPT_ALPN) must be called before listen(), and it will return EADDRINUSE if there's a socket already listening to the same IP + PORT + ALPN.
2. ALPN bind/match is a *listening* sockets thing, so it checks ALPN only when adding listening sockets in quic_hash(), and it does ALPN only when looking up listening sockets in quic_sock_lookup().
By setting ALPNs in client sockets it will ONLY pack these ALPNs into the Client Initial Packet when starting connecting, no bind/match for these regular sockets, as these sockets can be found by 4-tuple or a source_connection_id. bind() doesn't need to care about ALPN for client/regular socket either.
So it's fine to use QUIC_SOCKOPT_ALPN sockopt for both listen and regular/client sockets, as in kernel it acts differently on ALPNs for listening and regular sockets. (sorry for confusing, I could have moved created another hashtable for listening sockets)
In other word, a listen socket is identified by
local_ip + local_port + ALPN(s)
while a regular socket (represents a quic connection) is identified by:
local_ip + local_port + remote_ip + remote_port
or any of those
source_connection_ids.
3. SO_REUSEPORT is still applied to do some load balance between multiple processes listening to the same IP + PORT + ALPN, like:
on server:
process A: skA = listen(127.0.0.1:1234:smbd)
process B: skB = listen(127.0.0.1:1234:smbd)
process C: skC = listen(127.0.0.1:1234:smbd)
on client:
connect(127.0.0.1:1234:smbd)
connect(127.0.0.1:1234:smbd)
...
on server it will select the sk among (skA, skB and skC) based on the source address + port in the request from client.
4. Not sure if multiple ALPNs support are useful to you, here is some example about how it works:
- Without SO_REUSEPORT set:
On server:
process A: skA = listen(127.0.0.1:1234:smbd,h3,ksmbd)
process B: skB = listen(127.0.0.1:1234:smbd,h3,ksmbd)
listen() in process B fails and returns EADDRINUSE. - with SO_REUSEPORT set:
On server:
process A: skA = listen(127.0.0.1:1234:smbd,h3,ksmbd)
process B: skB = listen(127.0.0.1:1234:smbd,h3,ksmbd)
listen() in process B works. - with or without SO_REUSEPORT set:
On server:
process A: skA = listen(127.0.0.1:1234:h3,ksmbd) process B: skB = listen(127.0.0.1:1234:h3,smbd). (there's overlap on ALPN list but not exact the same ALPNs)
listen() in process B fails and returns EADDRINUSE.
- the match priority for multiple ALPNs is based on the order on the
client ALPN list:
On server:
process A: skA = listen(127.0.0.1:1234:smbd)
process B: skB = listen(127.0.0.1:1234:h3)
process C: skC = listen(127.0.0.1:1234:ksmbd)
On client:
process X: skX = connect(27.0.0.1:1234:h3,ksmbd,smbd)
skB will be the one selected to accept the connection, as h3 is the
1st ALPN on the client ALPN list 'h3,ksmbd,smbd'.Quoted 9 lines
For listens on tcp you also need to specify an explicit port (at least in order to be useful).
And it would mean that all application would use it and not block other applications from using an explicit alpn.
Also an module parameter for this means the administrator would have to take care of it, which means it might be unuseable if loaded with it.
Agree, already dropped this param.
Quoted 3 lines
I hope to find some time in the next weeks to play with this. Should be relatively trivial create a prototype for samba's smbd.
Sounds Cool!
Thanks.