]> git.ipfire.org Git - people/amarx/ipfire-2.x.git/commitdiff
BUG11466: Fix network_equal function BUG11466
authorAlexander Marx <alexander.marx@ipfire.org>
Tue, 7 Nov 2017 13:15:38 +0000 (14:15 +0100)
committerAlexander Marx <alexander.marx@ipfire.org>
Tue, 7 Nov 2017 13:15:38 +0000 (14:15 +0100)
The network_equal function only tested the subnet addresses of two given networks which lead to
errormessages saying "This is the green network"
The fix tests netwok and subnet IP's to fix this

config/cfgroot/network-functions.pl

index 93b8190305abb93a7d29e0c8a117e22d7e46b6e9..25f9af1cadb9223b2ef38c298560d0abe8a8e345 100644 (file)
@@ -108,10 +108,10 @@ sub network_equal {
        my $network1 = shift;
        my $network2 = shift;
 
-       my $bin1 = &network2bin($network1);
-       my $bin2 = &network2bin($network2);
+       my @bin1 = &network2bin($network1);
+       my @bin2 = &network2bin($network2);
 
-       if ($bin1 eq $bin2) {
+       if ($bin1[0] eq $bin2[0] && $bin1[1] eq $bin2[1]) {
                return 1;
        }
 
@@ -457,7 +457,7 @@ sub testsuite() {
        assert(!$result);
 
        $result = &network_equal("192.168.0.1/24", "192.168.0.XXX/24");
-       assert($result);
+       assert(!$result);
 
        $result = &ip_address_in_network("10.0.1.4", "10.0.0.0/8");
        assert($result);