From: Michael Tremer Date: Sat, 23 Mar 2024 14:49:54 +0000 (+0100) Subject: general-functions.pl: Remove getlastip/getnextip X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11e75894ce2b22cfa696b8996fc5cd6244b23f86;p=people%2Fms%2Fipfire-2.x.git general-functions.pl: Remove getlastip/getnextip Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index d65955a03..350481441 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