[GH-ISSUE #101] October patches broke 3.10 compatibility #60

Closed
opened 2026-10-13 21:06:08 +00:00 by bsakaguchi · 10 comments
Owner

Originally created by @achpile on GitHub (Oct 9, 2025).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/101

Originally assigned to: @ygurov on GitHub.

Good day!
Latest patches broke compatibility with 3.10 kernel:
9eb888d250
e939553f72
e543fc2d7f

Because of using functions like:

  • skb_queue_empty_lockless
  • get_unaligned_be64
  • nla_strdup
  • ktime_get_real_seconds

Also using mcgrps and n_mcgrps in struct genl_family
And src/netlink.c:1055:8: error: too many arguments to function ‘genlmsg_multicast_netns’

PS: I used version 1.0.20240711 before.

Originally created by @achpile on GitHub (Oct 9, 2025). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/101 Originally assigned to: @ygurov on GitHub. Good day! Latest patches broke compatibility with 3.10 kernel: 9eb888d250ac53e14af5130bea374479aa65c42e e939553f7225e131849c2a1e8c73c6844cbda4ce e543fc2d7f8f667d7948f8502bdcff56edc24891 Because of using functions like: - skb_queue_empty_lockless - get_unaligned_be64 - nla_strdup - ktime_get_real_seconds Also using `mcgrps` and `n_mcgrps` in `struct genl_family` And `src/netlink.c:1055:8: error: too many arguments to function ‘genlmsg_multicast_netns’` PS: I used version `1.0.20240711` before.
Author
Owner

@saqie1393 commented on GitHub (Oct 14, 2025):

awg2 also not compatibale in 3.10.100+?

<!-- gh-comment-id:3402240094 --> @saqie1393 commented on GitHub (Oct 14, 2025): awg2 also not compatibale in 3.10.100+?
Author
Owner

@ygurov commented on GitHub (Oct 14, 2025):

Hi @saqie1393,
Basically, no. Bugfix is planned, so standby

<!-- gh-comment-id:3402255885 --> @ygurov commented on GitHub (Oct 14, 2025): Hi @saqie1393, Basically, no. Bugfix is planned, so standby
Author
Owner

@ygurov commented on GitHub (Oct 19, 2025):

fixed in #112

<!-- gh-comment-id:3419601101 --> @ygurov commented on GitHub (Oct 19, 2025): fixed in #112
Author
Owner

@achpile commented on GitHub (Oct 22, 2025):

Good day! Seems like I cannot reopen this issue, but there are still compilation errors.

After 9eb888d :

src/compat/compat.h: In function 'dev_sw_netstats_rx_add':
include/asm-generic/percpu.h:79:10: error: dereferencing pointer to incomplete type 'struct pcpu_tstats'
  (typeof(*(__p)) __kernel __force *)(__p); \
          ^~~~~~

So additional files should be included in this block (src/compat/compat.h:1275)

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len) {
	struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);

	u64_stats_update_begin(&tstats->syncp);
	++tstats->rx_packets;
	tstats->rx_bytes += len;
	u64_stats_update_end(&tstats->syncp);
	put_cpu_ptr(tstats);
}
#endif
#include <linux/if.h>
#include <linux/if_tunnel.h>

Next is src/netlink.c

src/netlink.c:1062:8: error: too many arguments to function 'genlmsg_multicast_netns'
  ret = genlmsg_multicast_netns(&genl_family, dev_net(wg->dev), skb, 0, 0, GFP_KERNEL);
        ^~~~~~~~~~~~~~~~~~~~~~~

genlmsg_multicast_netns got struct genl_family *family argument only in 3.13.0 so this should help:

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
#define genlmsg_multicast_netns(a, b, c, d, e, f) genlmsg_multicast_netns(b, c, d, e, f)
#endif

And finally struct genl_family did not have mcgrps and n_mcgrps member. So also thing like this should help:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
	.mcgrps = wg_genl_mcgrps,
	.n_mcgrps = ARRAY_SIZE(wg_genl_mcgrps)
#endif

I also attached a full patch with what I've done.

amneziawg-linux-kernel-module.3-10-compat.patch

<!-- gh-comment-id:3432097132 --> @achpile commented on GitHub (Oct 22, 2025): Good day! Seems like I cannot reopen this issue, but there are still compilation errors. After 9eb888d : ``` src/compat/compat.h: In function 'dev_sw_netstats_rx_add': include/asm-generic/percpu.h:79:10: error: dereferencing pointer to incomplete type 'struct pcpu_tstats' (typeof(*(__p)) __kernel __force *)(__p); \ ^~~~~~ ``` So additional files should be included in this block (src/compat/compat.h:1275) ``` #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len) { struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); u64_stats_update_begin(&tstats->syncp); ++tstats->rx_packets; tstats->rx_bytes += len; u64_stats_update_end(&tstats->syncp); put_cpu_ptr(tstats); } #endif ``` ``` #include <linux/if.h> #include <linux/if_tunnel.h> ``` Next is src/netlink.c ``` src/netlink.c:1062:8: error: too many arguments to function 'genlmsg_multicast_netns' ret = genlmsg_multicast_netns(&genl_family, dev_net(wg->dev), skb, 0, 0, GFP_KERNEL); ^~~~~~~~~~~~~~~~~~~~~~~ ``` `genlmsg_multicast_netns` got `struct genl_family *family` argument only in `3.13.0` so this should help: ``` #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) #define genlmsg_multicast_netns(a, b, c, d, e, f) genlmsg_multicast_netns(b, c, d, e, f) #endif ``` And finally `struct genl_family` did not have `mcgrps` and `n_mcgrps` member. So also thing like this should help: ``` #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) .mcgrps = wg_genl_mcgrps, .n_mcgrps = ARRAY_SIZE(wg_genl_mcgrps) #endif ``` I also attached a full patch with what I've done. [amneziawg-linux-kernel-module.3-10-compat.patch](https://github.com/user-attachments/files/23053271/amneziawg-linux-kernel-module.3-10-compat.patch)
Author
Owner

@ygurov commented on GitHub (Oct 22, 2025):

Hi @achpile,
Apoligize, must have missed the places. Thank you for your investigation and patch.
Will have a look on it this week

<!-- gh-comment-id:3434293824 --> @ygurov commented on GitHub (Oct 22, 2025): Hi @achpile, Apoligize, must have missed the places. Thank you for your investigation and patch. Will have a look on it this week
Author
Owner

@saqie1393 commented on GitHub (Oct 23, 2025):

also add in compat.h for armv7 router

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
struct netlink_ext_ack {};
#endif
<!-- gh-comment-id:3437145278 --> @saqie1393 commented on GitHub (Oct 23, 2025): also add in compat.h for armv7 router ``` #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) struct netlink_ext_ack {}; #endif ```
Author
Owner

@ygurov commented on GitHub (Oct 23, 2025):

Hi @saqie1393,
Do we have a problem with specific kernels or is it a patched one?

<!-- gh-comment-id:3438022802 --> @ygurov commented on GitHub (Oct 23, 2025): Hi @saqie1393, Do we have a problem with specific kernels or is it a patched one?
Author
Owner

@saqie1393 commented on GitHub (Oct 24, 2025):

@ygurov it's for Huawei router running a 3.x kernel the kernel dosent include netlink_ext_ack

<!-- gh-comment-id:3441947195 --> @saqie1393 commented on GitHub (Oct 24, 2025): @ygurov it's for Huawei router running a 3.x kernel the kernel dosent include **netlink_ext_ack**
Author
Owner

@achpile commented on GitHub (Oct 24, 2025):

Could you please also add a version tag after my patch is applied?
Thanks :)

<!-- gh-comment-id:3442289466 --> @achpile commented on GitHub (Oct 24, 2025): Could you please also add a version tag after my patch is applied? Thanks :)
Author
Owner

@ygurov commented on GitHub (Nov 4, 2025):

Hi
Apologize for the delays happened. The changes were merged and the tag v1.0.20251104 was introduced.

<!-- gh-comment-id:3485506089 --> @ygurov commented on GitHub (Nov 4, 2025): Hi Apologize for the delays happened. The changes were merged and the tag v1.0.20251104 was introduced.
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#60
No description provided.