From 61a4d3cf49ae48896663af0cfee094b1f04df83f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 6 Dec 2024 14:30:20 +0100 Subject: [PATCH] wireguard.cgi: Fix connection status for RW connections Signed-off-by: Michael Tremer --- html/cgi-bin/wireguard.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/wireguard.cgi b/html/cgi-bin/wireguard.cgi index c07acb5f9..d27efc8ee 100644 --- a/html/cgi-bin/wireguard.cgi +++ b/html/cgi-bin/wireguard.cgi @@ -602,6 +602,9 @@ END END + # Dump all RW peers + my %DUMP = &Wireguard::dump("wg0"); + # Iterate through all peers... foreach my $key (sort { $Wireguard::peers{$a}[2] cmp $Wireguard::peers{$b}[2] } keys %Wireguard::peers) { my $enabled = $Wireguard::peers{$key}[0]; @@ -623,7 +626,7 @@ END my @status = ("status"); # Fetch the dump - my %dump = &Wireguard::dump("wg$key"); + my %dump = ($type eq "net") ? &Wireguard::dump("wg$key") : %DUMP; # Fetch the status of the peer (if possible) my $status = $dump{$pubkey} || (); -- 2.39.5