]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
general-functions.pl: Remove getlastip/getnextip
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 23 Mar 2024 14:49:54 +0000 (15:49 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Apr 2024 17:33:55 +0000 (19:33 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index d65955a033abb9183b1872c62063728fbd495385..3504814416c273d51c8c8800b357a096fc9edcda 100644 (file)
@@ -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