This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, next has been updated
via ed91d763e6851923d5d5e3b044776ae7194ac2b8 (commit)
via 3713af1e276dfb167abf29783ee85a64e865e845 (commit)
via 8f23ce8e53d5b016cbb05e24566739983c89894a (commit)
via ff6cc71107ae50e913c87a9bc77b3af4b31ec932 (commit)
via 4f857eea41e1e5cce0bd7a48f1e0d6bafc33cb7e (commit)
from 00d2007b040fdddd3455e4172bb7a19409d95ca2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ed91d763e6851923d5d5e3b044776ae7194ac2b8
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Wed Jan 11 17:21:46 2017 +0000
core109: Ship recently updated perl files
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 3713af1e276dfb167abf29783ee85a64e865e845
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Wed Jan 11 17:18:46 2017 +0000
network-functions.pl: Add tests for the new equals function
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 8f23ce8e53d5b016cbb05e24566739983c89894a
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Wed Jan 11 17:09:42 2017 +0000
network-functions.pl: Fix code formatting
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit ff6cc71107ae50e913c87a9bc77b3af4b31ec932
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date: Tue Jan 10 15:13:58 2017 +0100
BUG11278: enable creation from subnets of internal networks
In firewallgroups it was not possible to create new networks that are subnets of
IPFire internal networks. Now this is possible for all internal networks.
Signed-off-by: Alexander Marx <alexander.marx(a)ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 4f857eea41e1e5cce0bd7a48f1e0d6bafc33cb7e
Author: Alexander Marx <alexander.marx(a)ipfire.org>
Date: Tue Jan 10 14:12:27 2017 +0100
BUG11278: Cleanup function for network check
Deleted some code which is also used in another function
Signed-off-by: Alexander Marx <alexander.marx(a)ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
-----------------------------------------------------------------------
Summary of changes:
config/cfgroot/general-functions.pl | 18 +++++++-----------
config/cfgroot/network-functions.pl | 30 ++++++++++++++++++++++++++++++
config/rootfiles/core/109/filelists/files | 2 ++
3 files changed, 39 insertions(+), 11 deletions(-)
Difference in files:
diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index 298e68c..081e4e3 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -540,13 +540,9 @@ sub checksubnets
return $errormessage;
}
}
-
- #check if we use one of ipfire's networks (green,orange,blue)
- &readhash("${General::swroot}/ethernet/settings", \%ownnet);
- if (($ownnet{'GREEN_NETADDRESS'} ne '' && $ownnet{'GREEN_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'GREEN_NETADDRESS'},&iporsubtodec($ownnet{'GREEN_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
- if (($ownnet{'ORANGE_NETADDRESS'} ne '' && $ownnet{'ORANGE_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'ORANGE_NETADDRESS'},&iporsubtodec($ownnet{'ORANGE_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
- if (($ownnet{'BLUE_NETADDRESS'} ne '' && $ownnet{'BLUE_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'BLUE_NETADDRESS'},&iporsubtodec($ownnet{'BLUE_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
- if (($ownnet{'RED_NETADDRESS'} ne '' && $ownnet{'RED_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'RED_NETADDRESS'},&iporsubtodec($ownnet{'RED_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
+
+ #call check_net_internal
+ &General::check_net_internal($ccdnet);
}
sub check_net_internal{
@@ -557,10 +553,10 @@ sub check_net_internal{
$cidr=&iporsubtocidr($cidr);
#check if we use one of ipfire's networks (green,orange,blue)
&readhash("${General::swroot}/ethernet/settings", \%ownnet);
- if (($ownnet{'GREEN_NETADDRESS'} ne '' && $ownnet{'GREEN_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'GREEN_NETADDRESS'},&iporsubtodec($ownnet{'GREEN_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
- if (($ownnet{'ORANGE_NETADDRESS'} ne '' && $ownnet{'ORANGE_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'ORANGE_NETADDRESS'},&iporsubtodec($ownnet{'ORANGE_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
- if (($ownnet{'BLUE_NETADDRESS'} ne '' && $ownnet{'BLUE_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'BLUE_NETADDRESS'},&iporsubtodec($ownnet{'BLUE_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
- if (($ownnet{'RED_NETADDRESS'} ne '' && $ownnet{'RED_NETADDRESS'} ne '0.0.0.0') && &IpInSubnet($ip,$ownnet{'RED_NETADDRESS'},&iporsubtodec($ownnet{'RED_NETMASK'}))){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
+ if (($ownnet{'GREEN_NETADDRESS'} ne '' && $ownnet{'GREEN_NETADDRESS'} ne '0.0.0.0') && &Network::network_equal("$ownnet{'GREEN_NETADDRESS'}/$ownnet{'GREEN_NETMASK'}",$network)){ $errormessage=$Lang::tr{'ccd err green'};return $errormessage;}
+ if (($ownnet{'ORANGE_NETADDRESS'} ne '' && $ownnet{'ORANGE_NETADDRESS'} ne '0.0.0.0') && &Network::network_equal("$ownnet{'ORANGE_NETADDRESS'}/$ownnet{'ORANGE_NETMASK'}",$network)){ $errormessage=$Lang::tr{'ccd err orange'};return $errormessage;}
+ if (($ownnet{'BLUE_NETADDRESS'} ne '' && $ownnet{'BLUE_NETADDRESS'} ne '0.0.0.0') && &Network::network_equal("$ownnet{'BLUE_NETADDRESS'}/$ownnet{'BLUE_NETMASK'}",$network)){ $errormessage=$Lang::tr{'ccd err blue'};return $errormessage;}
+ if (($ownnet{'RED_NETADDRESS'} ne '' && $ownnet{'RED_NETADDRESS'} ne '0.0.0.0') && &Network::network_equal("$ownnet{'RED_NETADDRESS'}/$ownnet{'RED_NETMASK'}",$network)){ $errormessage=$Lang::tr{'ccd err red'};return $errormessage;}
}
sub validport
diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl
index 70fa5ed..5f53704 100644
--- a/config/cfgroot/network-functions.pl
+++ b/config/cfgroot/network-functions.pl
@@ -102,6 +102,22 @@ sub bin2ip($) {
return $address;
}
+# Takes two network addresses, compares them against each other
+# and returns true if equal or false if not
+sub network_equal {
+ my $network1 = shift;
+ my $network2 = shift;
+
+ my $bin1 = &network2bin($network1);
+ my $bin2 = &network2bin($network2);
+
+ if ($bin1 eq $bin2) {
+ return 1;
+ }
+
+ return 0;
+}
+
# Takes a network in either a.b.c.d/a.b.c.d or a.b.c.d/e notation
# and will return an 32 bit integer representing the start
# address and an other one representing the network mask.
@@ -352,12 +368,26 @@ sub testsuite() {
$result = &find_next_ip_address("1.2.3.4", 2);
assert($result eq "1.2.3.6");
+ $result = &network_equal("192.168.0.0/24", "192.168.0.0/255.255.255.0");
+ assert($result);
+
+ $result = &network_equal("192.168.0.0/24", "192.168.0.0/25");
+ assert(!$result);
+
+ $result = &network_equal("192.168.0.0/24", "192.168.0.128/25");
+ assert(!$result);
+
+ $result = &network_equal("192.168.0.1/24", "192.168.0.XXX/24");
+ assert($result);
+
$result = &ip_address_in_network("10.0.1.4", "10.0.0.0/8");
assert($result);
$result = &ip_address_in_network("192.168.30.11", "192.168.30.0/255.255.255.0");
assert($result);
+ print "Testsuite completed successfully!\n";
+
return 0;
}
diff --git a/config/rootfiles/core/109/filelists/files b/config/rootfiles/core/109/filelists/files
index 182b816..0d5de8f 100644
--- a/config/rootfiles/core/109/filelists/files
+++ b/config/rootfiles/core/109/filelists/files
@@ -5,3 +5,5 @@ lib/udev/network-hotplug-bridges
lib/udev/network-hotplug-rename
usr/local/bin/backupiso
usr/local/bin/syslogdctrl
+var/ipfire/general-functions.pl
+var/ipfire/network-functions.pl
hooks/post-receive
--
IPFire 2.x development tree