mirror of
https://github.com/amnezia-vpn/amneziawg-linux-kernel-module.git
synced 2026-10-13 21:34:34 +00:00
[PR #218] socket: fix udp_tunnel_sock_release/setup_udp_tunnel_sock ABI mismatch on newer kernels #241
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amneziawg-linux-kernel-module#241
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/218
Author: @VaisVaisov
Created: 8/17/2026
Status: 🔄 Open
Base:
master← Head:fix/udp-tunnel-newer-kernel-abi📝 Commits (1)
02789dbcompat: detect udp_tunnel_sock signature at compile time, not by kernel version📊 Changes
1 file changed (+29 additions, -4 deletions)
View changed files
📝
src/compat/compat.h(+29 -4)📄 Description
Root cause
Very recent kernel snapshots (not yet in an official release at the time of writing) changed the signature of
udp_tunnel_sock_release()andsetup_udp_tunnel_sock()from taking astruct socket *to taking astruct sock *. Some distro kernels (e.g. CachyOS) backport this early, under an unchangedLINUX_VERSION_CODE— so this can't reliably be gated by kernel version, only by the actual declared signature.Build failure on affected kernels:
Fix
Added two small wrappers (
wg_udp_tunnel_sock_release,wg_setup_udp_tunnel_sock) that detect the real parameter type at compile time via__builtin_types_compatible_p(typeof(&fn), ...), then call through an explicitly-cast function pointer matching whichever signature is actually declared. This avoids anyLINUX_VERSION_CODEguessing and works correctly regardless of which ABI the currently-built-against headers expose.Testing
Built via DKMS on a CachyOS system (kernel
7.1.8-1-cachyos, where this previously failed to build at all). Build now succeeds and the module loads and passes real traffic. Also confirmed it still builds and works correctly against an older/unaffected kernel (Ubuntu 24.04,6.17.0-1014-oracle), so both ABI variants are covered.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.