From de9bcad2f52b83d25b2ed555be068e895a087e10 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 23 Mar 2024 15:49:54 +0100 Subject: [PATCH] general-functions.pl: Remove getlastip/getnextip Signed-off-by: Michael Tremer --- config/cfgroot/general-functions.pl | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 5b75bf188..082db9186 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -172,12 +172,12 @@ sub setup_default_networks &readhash("${General::swroot}/vpn/settings", \%ipsecsettings); if($ipsecsettings{'RW_NET'} ne '') { - my ($ip,$sub) = split(/\//,$ipsecsettings{'RW_NET'}); - $sub=&General::iporsubtocidr($sub); - my @tempipsecsubnet = split("\/", $ipsecsettings{'RW_NET'}); - $defaultNetworks->{'IPsec RW (' .$ip."/".$sub.")"}{'ADR'} = $tempipsecsubnet[0]; - $defaultNetworks->{'IPsec RW (' .$ip."/".$sub.")"}{'NAME'} = "IPsec RW"; - $defaultNetworks->{'IPsec RW (' .$ip."/".$sub.")"}{'NET'} = &getnextip($ip); + my $netaddress = &Network::get_netaddress($ipsecsettings{'RW_NET'}); + my $prefix = &Network::get_prefix($ipsecsettings{'RW_NET'}); + + $defaultNetworks->{"IPsec RW (${netaddress}/${prefix})"}{'ADR'} = $netaddress; + $defaultNetworks->{"IPsec RW (${netaddress}/${prefix})"}{'NAME'} = "IPsec RW"; + $defaultNetworks->{"IPsec RW (${netaddress}/${prefix})"}{'NET'} = $netaddress; } } } @@ -448,14 +448,6 @@ sub dec2ip { return &Network::bin2ip(shift); } -sub getnextip { - return &Network::find_next_ip_address(shift, 4); -} - -sub getlastip { - return &Network::find_next_ip_address(shift, -1); -} - sub validipandmask { #Gets: Ip address in 192.168.0.0/24 or 192.168.0.0/255.255.255.0 and checks if subnet valid -- 2.39.5