[GH-ISSUE #252] Build failure for amneziawg 1.0.0 on Proxmox kernel 7.0.14-17-pve / 7.0.14-19-pve (setup_udp_tunnel_sock incompatible pointer type) #137

Open
opened 2026-10-13 21:06:54 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @papagruz on GitHub (Sep 21, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/252

Description

I'm trying to build the amneziawg DKMS module on Proxmox VE 9 with kernel 7.0.14-17-pve and 7.0.14-19-pve, but the build fails. It worked fine on previous Proxmox kernels.

Environment

  • OS: Proxmox VE 9
  • Kernel: 7.0.14-17-pve (also fails on 7.0.14-19-pve)
  • amneziawg version: 1.0.0
  • DKMS version: 3.2.2
  • Headers: pve-headers-7.0.14-17-pve, pve-headers-7.0.14-19-pve

Steps to reproduce

  1. Install Proxmox VE 9.
  2. Install kernel headers:
    apt install pve-headers-$(uname -r)
    
  3. Install amneziawg via DKMS:
    dkms install amneziawg/1.0.0
    
    Or simply run apt upgrade, which triggers DKMS autoinstall for the new kernel.
  4. Observe the build failure.

Expected behavior

The module builds and installs successfully.

Actual behavior

The build fails with an incompatible pointer type error in setup_udp_tunnel_sock.

Relevant excerpt from make.log:

DKMS (dkms-3.2.2) make.log for amneziawg/1.0.0 for kernel 7.0.14-17-pve (x86_64)
...
  CC [M]  socket.o
socket.c: In function ‘wg_socket_init’:
./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types]
 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
socket.c:434:9: note: in expansion of macro ‘setup_udp_tunnel_sock’
  434 |         setup_udp_tunnel_sock(net, new4->sk, &cfg);
      |         ^~~~~~~~~~~~~~~~~~~~~
In file included from ./././compat/compat.h:1448:
/usr/src/linux-headers-7.0.14-17-pve/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’
   98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk,
      |                                             ~~~~~~~~~~~~~^~
...
make[3]: *** [/usr/src/linux-headers-7.0.14-17-pve/scripts/Makefile.build:289: socket.o] Error 1
make[2]: *** [/usr/src/linux-headers-7.0.14-17-pve/Makefile:2139: .] Error 2
make[1]: *** [/usr/src/linux-headers-7.0.14-17-pve/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Full make.log is attached.

Additional context

  • The kernel header include/net/udp_tunnel.h now expects struct sock * as the second argument of setup_udp_tunnel_sock, but compat/compat.h passes sk->sk_socket, which is struct socket *.
  • It seems compat.h needs an update to handle this API change for newer Proxmox kernels.
  • The same failure occurs on both 7.0.14-17-pve and 7.0.14-19-pve.
  • I can test patches if needed.

Attachments:

  • make.log
  • pveversion -v
  • uname -r
  • dkms status

dkms.txt
uname.txt
pveversion.txt
make.log

Originally created by @papagruz on GitHub (Sep 21, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/252 **Description** I'm trying to build the amneziawg DKMS module on Proxmox VE 9 with kernel 7.0.14-17-pve and 7.0.14-19-pve, but the build fails. It worked fine on previous Proxmox kernels. **Environment** - OS: Proxmox VE 9 - Kernel: 7.0.14-17-pve (also fails on 7.0.14-19-pve) - amneziawg version: 1.0.0 - DKMS version: 3.2.2 - Headers: pve-headers-7.0.14-17-pve, pve-headers-7.0.14-19-pve **Steps to reproduce** 1. Install Proxmox VE 9. 2. Install kernel headers: ```bash apt install pve-headers-$(uname -r) ``` 3. Install amneziawg via DKMS: ```bash dkms install amneziawg/1.0.0 ``` Or simply run `apt upgrade`, which triggers DKMS autoinstall for the new kernel. 4. Observe the build failure. **Expected behavior** The module builds and installs successfully. **Actual behavior** The build fails with an incompatible pointer type error in `setup_udp_tunnel_sock`. Relevant excerpt from `make.log`: ``` DKMS (dkms-3.2.2) make.log for amneziawg/1.0.0 for kernel 7.0.14-17-pve (x86_64) ... CC [M] socket.o socket.c: In function ‘wg_socket_init’: ./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types] 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) socket.c:434:9: note: in expansion of macro ‘setup_udp_tunnel_sock’ 434 | setup_udp_tunnel_sock(net, new4->sk, &cfg); | ^~~~~~~~~~~~~~~~~~~~~ In file included from ./././compat/compat.h:1448: /usr/src/linux-headers-7.0.14-17-pve/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’ 98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk, | ~~~~~~~~~~~~~^~ ... make[3]: *** [/usr/src/linux-headers-7.0.14-17-pve/scripts/Makefile.build:289: socket.o] Error 1 make[2]: *** [/usr/src/linux-headers-7.0.14-17-pve/Makefile:2139: .] Error 2 make[1]: *** [/usr/src/linux-headers-7.0.14-17-pve/Makefile:248: __sub-make] Error 2 make: *** [Makefile:248: __sub-make] Error 2 ``` Full `make.log` is attached. **Additional context** - The kernel header `include/net/udp_tunnel.h` now expects `struct sock *` as the second argument of `setup_udp_tunnel_sock`, but `compat/compat.h` passes `sk->sk_socket`, which is `struct socket *`. - It seems `compat.h` needs an update to handle this API change for newer Proxmox kernels. - The same failure occurs on both 7.0.14-17-pve and 7.0.14-19-pve. - I can test patches if needed. Attachments: - `make.log` - `pveversion -v` - `uname -r` - `dkms status` [dkms.txt](https://github.com/user-attachments/files/32484676/dkms.txt) [uname.txt](https://github.com/user-attachments/files/32484675/uname.txt) [pveversion.txt](https://github.com/user-attachments/files/32484677/pveversion.txt) [make.log](https://github.com/user-attachments/files/32484678/make.log)
Author
Owner

@papagruz commented on GitHub (Sep 22, 2026):

I found the cause and tested a working workaround.

The compatibility code in src/compat/compat.h currently contains:

#define setup_udp_tunnel_sock(net, sk, sock_cfg) \
        setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
Proxmox kernels use two different APIs:

7.0.14-16-pve: expects struct socket *
7.0.14-17-pve and newer: expect struct sock *
Therefore, checking only LINUX_VERSION_CODE is not sufficient. Proxmox backported this API change while keeping the same kernel version.

The compatibility layer should detect the function signature during compilation, or use a Proxmox-specific version check. A possible implementation is:

#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 1, 5)
#include <net/udp_tunnel.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
#define setup_udp_tunnel_sock(net, sk, sock_cfg) \
        setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
#endif

#define udp_tunnel_sock_release(sk) \
        udp_tunnel_sock_release(sk->sk_socket)
#endif
However, this version check does not distinguish 7.0.14-16-pve from 7.0.14-17-pve. The preferred fix is a compile-time compatibility test that determines whether setup_udp_tunnel_sock() accepts struct socket * or struct sock *, then defines the wrapper accordingly.

For example, the compatibility code needs to produce equivalent calls:

/* Old API */
setup_udp_tunnel_sock(net, sk->sk_socket, &cfg);

/* New API */
setup_udp_tunnel_sock(net, sk, &cfg);
I confirmed that the patched DKMS package builds successfully on:

7.0.14-19-pve
The original upstream package fails with:

error: passing argument 2 of ‘setup_udp_tunnel_sock’
from incompatible pointer type
The fix should support both API variants so DKMS can rebuild against systems where old and new Proxmox headers are installed simultaneously.
<!-- gh-comment-id:5772774293 --> @papagruz commented on GitHub (Sep 22, 2026): I found the cause and tested a working workaround. The compatibility code in `src/compat/compat.h` currently contains: ```c #define setup_udp_tunnel_sock(net, sk, sock_cfg) \ setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) Proxmox kernels use two different APIs: 7.0.14-16-pve: expects struct socket * 7.0.14-17-pve and newer: expect struct sock * Therefore, checking only LINUX_VERSION_CODE is not sufficient. Proxmox backported this API change while keeping the same kernel version. The compatibility layer should detect the function signature during compilation, or use a Proxmox-specific version check. A possible implementation is: #if LINUX_VERSION_CODE < KERNEL_VERSION(7, 1, 5) #include <net/udp_tunnel.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0) #define setup_udp_tunnel_sock(net, sk, sock_cfg) \ setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) #endif #define udp_tunnel_sock_release(sk) \ udp_tunnel_sock_release(sk->sk_socket) #endif However, this version check does not distinguish 7.0.14-16-pve from 7.0.14-17-pve. The preferred fix is a compile-time compatibility test that determines whether setup_udp_tunnel_sock() accepts struct socket * or struct sock *, then defines the wrapper accordingly. For example, the compatibility code needs to produce equivalent calls: /* Old API */ setup_udp_tunnel_sock(net, sk->sk_socket, &cfg); /* New API */ setup_udp_tunnel_sock(net, sk, &cfg); I confirmed that the patched DKMS package builds successfully on: 7.0.14-19-pve The original upstream package fails with: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type The fix should support both API variants so DKMS can rebuild against systems where old and new Proxmox headers are installed simultaneously.
Author
Owner

@MrFree commented on GitHub (Oct 2, 2026):

The same behavior on Ubuntu 26.04.1 LTS / linux-image-7.0.0-38-generic, on the previous (7.0.0-34) version everything works fine.

make.log

DKMS (dkms-3.4.1) make.log for amneziawg/1.0.0 for kernel 7.0.0-38-generic (x86_64)
пт 02 окт 2026 18:20:59 +10

Building module(s)
 command: make -j16 KERNELRELEASE=7.0.0-38-generic -C /lib/modules/7.0.0-38-generic/build M=/var/lib/dkms/amneziawg/1.0.0/build
make: вход в каталог «/usr/src/linux-headers-7.0.0-38-generic»
make[1]: вход в каталог «/var/lib/dkms/amneziawg/1.0.0/build»
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0
  You are using:           gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0
  CC [M]  main.o
  CC [M]  noise.o
  CC [M]  device.o
  CC [M]  peer.o
  CC [M]  timers.o
  CC [M]  queueing.o
  CC [M]  send.o
  CC [M]  receive.o
  CC [M]  socket.o
  CC [M]  peerlookup.o
  CC [M]  allowedips.o
  CC [M]  ratelimiter.o
  CC [M]  cookie.o
  CC [M]  netlink.o
  CC [M]  junk.o
  CC [M]  header_protection.o
In file included from <command-line>:
socket.c: In function ‘wg_socket_init’:
./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types]
 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
socket.c:434:9: note: in expansion of macro ‘setup_udp_tunnel_sock’
  434 |         setup_udp_tunnel_sock(net, new4->sk, &cfg);
      |         ^~~~~~~~~~~~~~~~~~~~~
In file included from ./././compat/compat.h:1448:
/usr/src/linux-headers-7.0.0-38-generic/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’
   98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk,
      |                                             ~~~~~~~~~~~~~^~
./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types]
 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
socket.c:449:17: note: in expansion of macro ‘setup_udp_tunnel_sock’
  449 |                 setup_udp_tunnel_sock(net, new6->sk, &cfg);
      |                 ^~~~~~~~~~~~~~~~~~~~~
/usr/src/linux-headers-7.0.0-38-generic/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’
   98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk,
      |                                             ~~~~~~~~~~~~~^~
make[3]: *** [/usr/src/linux-headers-7.0.0-38-generic/scripts/Makefile.build:289: socket.o] Ошибка 1
make[3]: *** Ожидание завершения заданий…
make[2]: *** [/usr/src/linux-headers-7.0.0-38-generic/Makefile:2139: .] Ошибка 2
make[1]: *** [/usr/src/linux-headers-7.0.0-38-generic/Makefile:248: __sub-make] Ошибка 2
make[1]: выход из каталога «/var/lib/dkms/amneziawg/1.0.0/build»
make: *** [Makefile:248: __sub-make] Ошибка 2
make: выход из каталога «/usr/src/linux-headers-7.0.0-38-generic»

exit code: 2
elapsed time: 00:00:03
----------------------------------------------------------------

<!-- gh-comment-id:5948193035 --> @MrFree commented on GitHub (Oct 2, 2026): The same behavior on Ubuntu 26.04.1 LTS / linux-image-7.0.0-38-generic, on the previous (7.0.0-34) version everything works fine. make.log ``` DKMS (dkms-3.4.1) make.log for amneziawg/1.0.0 for kernel 7.0.0-38-generic (x86_64) пт 02 окт 2026 18:20:59 +10 Building module(s) command: make -j16 KERNELRELEASE=7.0.0-38-generic -C /lib/modules/7.0.0-38-generic/build M=/var/lib/dkms/amneziawg/1.0.0/build make: вход в каталог «/usr/src/linux-headers-7.0.0-38-generic» make[1]: вход в каталог «/var/lib/dkms/amneziawg/1.0.0/build» warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0 You are using: gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0 CC [M] main.o CC [M] noise.o CC [M] device.o CC [M] peer.o CC [M] timers.o CC [M] queueing.o CC [M] send.o CC [M] receive.o CC [M] socket.o CC [M] peerlookup.o CC [M] allowedips.o CC [M] ratelimiter.o CC [M] cookie.o CC [M] netlink.o CC [M] junk.o CC [M] header_protection.o In file included from <command-line>: socket.c: In function ‘wg_socket_init’: ./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types] 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) socket.c:434:9: note: in expansion of macro ‘setup_udp_tunnel_sock’ 434 | setup_udp_tunnel_sock(net, new4->sk, &cfg); | ^~~~~~~~~~~~~~~~~~~~~ In file included from ./././compat/compat.h:1448: /usr/src/linux-headers-7.0.0-38-generic/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’ 98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk, | ~~~~~~~~~~~~~^~ ./././compat/compat.h:1449:79: error: passing argument 2 of ‘setup_udp_tunnel_sock’ from incompatible pointer type [-Wincompatible-pointer-types] 1449 | #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) socket.c:449:17: note: in expansion of macro ‘setup_udp_tunnel_sock’ 449 | setup_udp_tunnel_sock(net, new6->sk, &cfg); | ^~~~~~~~~~~~~~~~~~~~~ /usr/src/linux-headers-7.0.0-38-generic/include/net/udp_tunnel.h:98:58: note: expected ‘struct sock *’ but argument is of type ‘struct socket *’ 98 | void setup_udp_tunnel_sock(struct net *net, struct sock *sk, | ~~~~~~~~~~~~~^~ make[3]: *** [/usr/src/linux-headers-7.0.0-38-generic/scripts/Makefile.build:289: socket.o] Ошибка 1 make[3]: *** Ожидание завершения заданий… make[2]: *** [/usr/src/linux-headers-7.0.0-38-generic/Makefile:2139: .] Ошибка 2 make[1]: *** [/usr/src/linux-headers-7.0.0-38-generic/Makefile:248: __sub-make] Ошибка 2 make[1]: выход из каталога «/var/lib/dkms/amneziawg/1.0.0/build» make: *** [Makefile:248: __sub-make] Ошибка 2 make: выход из каталога «/usr/src/linux-headers-7.0.0-38-generic» exit code: 2 elapsed time: 00:00:03 ---------------------------------------------------------------- ```
Author
Owner

@toxa70x4 commented on GitHub (Oct 2, 2026):

/usr/src/amneziawg-1.0.0/compat/compat.h

#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 1, 5)
#include <net/udp_tunnel.h>
#define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
#define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket)
#endif

+ #if defined(UTS_UBUNTU_RELEASE_ABI) && UTS_UBUNTU_RELEASE_ABI < 38
+ #include <net/udp_tunnel.h>
+ #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg)
+ #define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket)
+ #else
+ #include <net/udp_tunnel.h>
+ #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk, sock_cfg)
+ #define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket)
+ #endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 18, 0)
#define WQ_PERCPU 0
#endif

Нужно привести конец файла к такому виду. Если у Вас два ядра в ubuntu, 7.0.0-34 (или ниже) и 7.0.0-38

<!-- gh-comment-id:5952037797 --> @toxa70x4 commented on GitHub (Oct 2, 2026): /usr/src/amneziawg-1.0.0/compat/compat.h ``` #if LINUX_VERSION_CODE < KERNEL_VERSION(7, 1, 5) #include <net/udp_tunnel.h> #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) #define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket) #endif + #if defined(UTS_UBUNTU_RELEASE_ABI) && UTS_UBUNTU_RELEASE_ABI < 38 + #include <net/udp_tunnel.h> + #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk->sk_socket, sock_cfg) + #define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket) + #else + #include <net/udp_tunnel.h> + #define setup_udp_tunnel_sock(net, sk, sock_cfg) setup_udp_tunnel_sock(net, sk, sock_cfg) + #define udp_tunnel_sock_release(sk) udp_tunnel_sock_release(sk->sk_socket) + #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 18, 0) #define WQ_PERCPU 0 #endif ``` Нужно привести конец файла к такому виду. Если у Вас два ядра в ubuntu, 7.0.0-34 (или ниже) и 7.0.0-38
Author
Owner

@papagruz commented on GitHub (Oct 2, 2026):

Я проверил проблему на Ubuntu 26.04 с ядрами 7.0.0-34 и 7.0.0-38. В upstream amneziawg 1.0.0 макрос совместимости всегда передаёт sk->sk_socket, но начиная с 7.0.0-38 функция setup_udp_tunnel_sock() ожидает struct sock *. Из-за этого DKMS-модуль не собирается на новом ядре.

Исправил compat.h, чтобы учитывать API обоих ядер: для Ubuntu ABI ниже 38 передавать sk->sk_socket, а для ABI 38 и новее — sk. После этого собрал пакет amneziawg-dkms 1.0.0+pve7fix3 и установил его через локальный подписанный APT-репозиторий.

Проверка успешна: модуль собрался для обоих установленных ядер — 7.0.0-34-generic и 7.0.0-38-generic. Это подтверждает, что исправление позволяет обновляться, сохраняя оба ядра установленными. Предупреждения DKMS о REMAKE_INITRD и Secure Boot на сборку не повлияли.

<!-- gh-comment-id:5952470516 --> @papagruz commented on GitHub (Oct 2, 2026): Я проверил проблему на Ubuntu 26.04 с ядрами 7.0.0-34 и 7.0.0-38. В upstream amneziawg 1.0.0 макрос совместимости всегда передаёт sk->sk_socket, но начиная с 7.0.0-38 функция setup_udp_tunnel_sock() ожидает struct sock *. Из-за этого DKMS-модуль не собирается на новом ядре. Исправил compat.h, чтобы учитывать API обоих ядер: для Ubuntu ABI ниже 38 передавать sk->sk_socket, а для ABI 38 и новее — sk. После этого собрал пакет amneziawg-dkms 1.0.0+pve7fix3 и установил его через локальный подписанный APT-репозиторий. Проверка успешна: модуль собрался для обоих установленных ядер — 7.0.0-34-generic и 7.0.0-38-generic. Это подтверждает, что исправление позволяет обновляться, сохраняя оба ядра установленными. Предупреждения DKMS о REMAKE_INITRD и Secure Boot на сборку не повлияли.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#137
No description provided.