[wireguard-linux-compat] fallthrough macro breaks pre-5.4 kernel compatibility?

Dan George dgeor8 at gmail.com
Tue Mar 8 07:31:28 UTC 2022

Hi all,

I just tried compiling the latest wireguard-linux-compat kernel module
v1.0.20211208 for kernel 4.4 [1] and encountered the following error:
"net/wireguard/compat/siphash/siphash.c:112:36: error: ‘fallthrough’
undeclared (first use in this function)"
The previous version v1.0.20210606 compiles and runs fine.

Some (inexpert) digging suggests that this is because a recent patch
[2] modified siphash.c to use 'fallthrough', which is a Linux kernel
compiler macro that was only added in kernel 5.4 [3].

In which case, presumably, either 'fallthrough' needs to be removed
again, or the macro added in wireguard-linux-compat somewhere. I'm
happy to submit a patch for either (although would appreciate some
guidance if the second option), or someone with more experience can.

In my immediate case, removing all instances of 'fallthrough' from
siphash.c has fixed compilation.


[1] Specifically, in case this becomes relevant, cross-compiling for
the Synology RT2600AC router (armv7l, kernel 4.4.60) from Ubuntu
20.04.4 x64 using gcc 4.9.3 according to the steps at
[2] https://git.zx2c4.com/wireguard-linux-compat/commit/?id=ea6b8e7be5072553b37df4b0b8ee6e0a37134738
[3] https://github.com/torvalds/linux/commit/294f69e662d1570703e9b56e95be37a9fd3afba5

More information about the WireGuard mailing list