Michael fixed this in a telephone session --- config/cfgroot/network-functions.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 66f1ed5..41632c3 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -108,14 +108,22 @@ sub network_equal { my $network1 = shift; my $network2 = shift;
- my $bin1 = &network2bin($network1); - my $bin2 = &network2bin($network2); + my @bin1 = &network2bin($network1); + if (scalar @bin1 ne 2) { + return undef; + }
- if ($bin1 eq $bin2) { - return 1; + my @bin2 = &network2bin($network2); + if (scalar @bin2 ne 2) { + return undef; }
- return 0; + my $address1 = $bin1[0]; + my $netmask1 = $bin1[1]; + my $address2 = $bin2[0]; + my $netmask2 = $bin2[1]; + + return (($address1 eq $address2) && ($netmask1 eq $netmask2)); }
# Takes a network in either a.b.c.d/a.b.c.d or a.b.c.d/e notation