How wireguard/wireguard-linux-compat works
This repository is an out-of-tree Linux kernel module backport of WireGuard, a secure network tunnel. Its principal workflow is configuring a tunnel and peers through the Generic Netlink UAPI, then sending and receiving encrypted packets over UDP; the protocol includes Noise handshakes, key management, peer routing, and packet queues. The graph includes compatibility support and Zinc cryptography as internal layers. The README documents the backport but not detailed subsystem wiring, so relationships without direct excerpt evidence are omitted or marked unverified.
Main entry points: main.c Module lifecycle · receive.c Packet receiving · noise.c Noise handshake · send.c Packet sending
Components 22
Module and configuration
- Module lifecycle
src/main.c - Generic Netlink
src/netlink.c - Netlink UAPI
src/uapi/wireguard.h - Tunnel device
src/device.c
Peer and protocol
- Peer lifecycle
src/peer.c - Noise handshake
src/noise.c - Cookie checks
src/cookie.c - Peer lookup
src/peerlookup.c - Allowed IP routing
src/allowedips.c - Wire messages
src/messages.h
Packet transport
- Packet sending
src/send.c - Packet receiving
src/receive.c - Packet queues
src/queueing.h - UDP sockets
src/socket.c - Peer timers
src/timers.c
Cryptography
- Zinc crypto
src/crypto/zinc.h - ChaCha20-Poly1305
src/crypto/zinc/chacha20poly1305.c - Crypto self-tests
src/crypto/zinc/selftest/chacha20poly1305.c
Compatibility support
- Kernel API shims
src/compat/compat.h - UDP tunnel shim
src/compat/udp_tunnel/udp_tunnel_partial_compat.h - Checksum shim
src/compat/checksum/checksum_partial_compat.h
Other components
- Kernel module
Connections 14
- Kernel module → Module lifecycle: loads module
src/main.c - Module lifecycle → Zinc crypto: initializes crypto
src/main.c - Module lifecycle → Tunnel device: initializes device
src/main.c - Module lifecycle → Peer lifecycle: initializes peers
src/main.c - Module lifecycle → Generic Netlink: registers interface
src/main.c - Module lifecycle → Allowed IP routing: initializes routing
src/main.c - Noise handshake → ChaCha20-Poly1305: encrypts handshake
src/noise.c - Packet receiving → Noise handshake: consumes handshake
src/receive.c - Packet receiving → Peer timers: updates timers
src/receive.c - Packet receiving → Packet sending: sends replies
src/receive.c - Packet receiving → Packet queues: uses packet queues
src/receive.c - Netlink UAPI → Generic Netlink: configures tunnel
src/netlink.c - Packet sending → UDP sockets: transmits UDP
- Crypto self-tests → ChaCha20-Poly1305: tests implementation
src/crypto/zinc/chacha20poly1305.c