How lxin/quic works
Project Type and Purpose
• This is a hybrid full-stack/networking project that implements the QUIC protocol partly in user space (libquic) for TLS handshake and entirely in kernel space (modules/net/quic) for the core QUIC transport and integration with Linux socket APIs.
• The README confirms its goal: expose IPPROTO_QUIC sockets in the kernel, offload TLS handshake messages to user space via netlink, and provide zero-copy, ALPN routing, and crypto offloading capabilities.
High-Level Components
a. Userspace Layer
• Applications (APP1, APP2, etc.)
• libquic: wraps gnutls to create/process raw TLS handshake messages
• tlshd (ktls-utils): daemon handling kernel handshake requests via netlink
b. Kernel Layer
• Socket interface: IPPROTO_QUIC socket type over UDP tunnels
• Protocol core (modules/net/quic): submodules for packet, frame, crypto, connid, stream, congestion control, pnspace, path, timer, input/output queues
• Netlink handshake API: upcalls from kernel to tlshd for TLS handshake
• Kernel consumers: SMB, NFS, other kernel subsystems using QUIC sockets
c. External/Infrastructure
• gnutls library in user space
• NIC crypto offload (future)
• Docker-based interop test environments (tests/interop)
Component Relationships and Data Flows
• Application → libquic (send/recvmsg + cmsg handshake info) → kernel QUIC socket
• Kernel QUIC socket → protocol core → UDP tunnels → network
• For handshake: Kernel issues netlink calls → tlshd → gnutls handshake → netlink response → kernel completes QUIC handshake
• Kernel consumers (SMB, NFS) call kernel QUIC APIs like sendmsg/recvmsg or the up-call handshake netlink
Architectural Patterns and Design Principles
• Layered architecture: clear separation between handshake (user space) and transport (kernel space)
• Protocol module within Linux net stack: analogous to TCP/MPTCP but under a new protocol family
• Extensibility: modular subcomponents (crypto, congestion, packetization, streams)
• Zero-copy & offload-friendly: socket buffer reuse, CMSG/SOCKOPT for secrets, future NIC offload hooks
Detail
• Every major subcomponent as its own block in the Protocol Core