]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
wireguard.cgi: Fix connection detection
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Apr 2024 17:19:14 +0000 (19:19 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Apr 2025 14:47:53 +0000 (16:47 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/wireguard.cgi

index c1cc7581d56fb17d837108bea09689a903b83dd0..d2bc80247a9e8f3a5d9eebe82dd33eed2954c188 100644 (file)
@@ -180,7 +180,7 @@ END
                my $status = $dump{$pubkey} || ();
 
                # WireGuard performs a handshake very two minutes, so we should be considered online then
-               my $is_connected = ($status && ($status->{"latest-handshake"} - time <= 120));
+               my $is_connected = (time - $status->{"latest-handshake"}) <= 120;
 
                if ($is_connected) {
                        push(@status, "is-connected");