From: Peter Müller Date: Sat, 25 Jul 2020 19:08:07 +0000 (+0000) Subject: network-functions.pl: fix network membership test X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6386584baa5669755ebae9507a50ef71321b47aa;p=people%2Fpmueller%2Fipfire-2.x.git network-functions.pl: fix network membership test This is based on an orphaned patch provided by Tim FitzGeorge and _finally_ fixes incorrect network membership calculations. Those were are usability pain in the ass deluxe, as they rendered some combinations of configuring OpenVPN and IPsec services unusable. Fixes: #11235 Fixes: #12263 Cc: Tim FitzGeorge Cc: Michael Tremer Cc: Alexander Marx Signed-off-by: Peter Müller Signed-off-by: Arne Fitzenreiter --- diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 8649d05023..b6f994522e 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -115,7 +115,7 @@ sub network_equal { return undef; } - if ($bin1[0] eq $bin2[0] && $bin1[1] eq $bin2[1]) { + if ($bin1[0] == $bin2[0] && $bin1[1] == $bin2[1]) { return 1; } @@ -295,7 +295,7 @@ sub ip_address_in_network($$) { # Find end address my $broadcast_bin = $network_bin ^ (~$netmask_bin % 2 ** 32); - return (($address_bin ge $network_bin) && ($address_bin le $broadcast_bin)); + return (($address_bin >= $network_bin) && ($address_bin <= $broadcast_bin)); } sub setup_upstream_proxy() {