From: Michael Tremer Date: Fri, 25 Apr 2025 12:06:36 +0000 (+0200) Subject: wireguard-functions.pl: Fix collecting used IP addresses X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3948ba05ec12cddf75a70174baa75097107c407b;p=people%2Fstevee%2Fipfire-2.x.git wireguard-functions.pl: Fix collecting used IP addresses Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/wireguard-functions.pl b/config/cfgroot/wireguard-functions.pl index 219f9282d..c8af939b5 100644 --- a/config/cfgroot/wireguard-functions.pl +++ b/config/cfgroot/wireguard-functions.pl @@ -340,13 +340,14 @@ sub free_pool_addresses($$) { # Collect all used addresses foreach my $key (keys %peers) { - my $type = $peers{$key}[1]; - my $address = $peers{$key}[6]; + my $peer = &load_peer($key); # Only check hosts - next if ($type ne "host"); + next if ($peer->{"TYPE"} ne "host"); - push(@used_addresses, &Network::ip2bin($address)); + foreach my $address (@{ $peer->{"CLIENT_ADDRESS"} }) { + push(@used_addresses, &Network::ip2bin($address)); + } } # Fetch the first address