From mboxrd@z Thu Jan  1 00:00:00 1970
From: Peter =?utf-8?q?M=C3=BCller?= <peter.mueller@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 1/2] network-functions.pl: fix network membership test
Date: Sat, 25 Jul 2020 19:08:07 +0000
Message-ID: <6bc37aaf-4096-9ec6-030b-3781a015fc11@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1301782408186994097=="
List-Id: <development.lists.ipfire.org>

--===============1301782408186994097==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

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 <ipfr(a)tfitzgeorge.me.uk>
Cc: Michael Tremer <michael.tremer(a)ipfire.org>
Cc: Alexander Marx <alexander.marx(a)ipfire.org>
Signed-off-by: Peter M=C3=BCller <peter.mueller(a)ipfire.org>
---
 config/cfgroot/network-functions.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-fun=
ctions.pl
index 8649d0502..b6f994522 100644
--- a/config/cfgroot/network-functions.pl
+++ b/config/cfgroot/network-functions.pl
@@ -115,7 +115,7 @@ sub network_equal {
 		return undef;
 	}
=20
-	if ($bin1[0] eq $bin2[0] && $bin1[1] eq $bin2[1]) {
+	if ($bin1[0] =3D=3D $bin2[0] && $bin1[1] =3D=3D $bin2[1]) {
 		return 1;
 	}
=20
@@ -295,7 +295,7 @@ sub ip_address_in_network($$) {
 	# Find end address
 	my $broadcast_bin =3D $network_bin ^ (~$netmask_bin % 2 ** 32);
=20
-	return (($address_bin ge $network_bin) && ($address_bin le $broadcast_bin));
+	return (($address_bin >=3D $network_bin) && ($address_bin <=3D $broadcast_b=
in));
 }
=20
 sub setup_upstream_proxy() {
--=20
2.26.2

--===============1301782408186994097==--