Bug 14039 - Bug in WireGuard Keepalive Interval validation (66-99 returns invalid)
Summary: Bug in WireGuard Keepalive Interval validation (66-99 returns invalid)
Status: NEW
Alias: None
Product: IPFire
Classification: Unclassified
Component: --- (show other bugs)
Version: 2
Hardware: all All
: - Unknown - - Unknown -
Assignee: Assigned to nobody - feel free to grab it and work on it
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-08-14 10:06 UTC by apr3020 ipf
Modified: 2026-08-14 10:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description apr3020 ipf 2026-08-14 10:06:42 UTC
[Original post](https://community.ipfire.org/t/bug-in-wireguard-keepalive-interval-validation-66-99-returns-invalid/16079)

Hi everyone,

In the version IPFire 2.29 (x86_64) - Core-Update 203, I found a bug in the WireGuard Keepalive Interval field. If you enter a value between 66 to 99, it throws this error:

Oops, something went wrong...Invalid Keepalive Interval (Must be between 0 and 65535)


I dig into /var/ipfire/wireguard-functions.pl and found the issue. It’s currently using Perl's string comparison operators:

# Must be between 0 and 65535 (inclusive)
return 0 if ($keepalive lt 0);
return 0 if ($keepalive gt 65535);

Below is the analysis by Deepseek:

Since lt and gt compare strings character by character, "66" is considered greater than "65535" (because the second character '6' > '5'). This means any value from 66-99 gets falsely flagged as invalid. (Fun fact: single digits like 7, 8, 9 would probably fail for the same reason!)

The fix is simple, just switch to use numeric comparison:

# Must be between 0 and 65535 (inclusive)
return 0 if ($keepalive < 0);
return 0 if ($keepalive > 65535);

I’ve tested the fix, and it works perfectly now.