From patchwork Thu Feb 15 06:35:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1667 Return-Path: Received: from mail01.ipfire.org (mail01.ipfire.org [IPv6:2001:470:7183:25::1]) by web02.i.ipfire.org (Postfix) with ESMTP id 172BD60C10 for ; Wed, 14 Feb 2018 20:36:14 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id BC18B105FC87; Wed, 14 Feb 2018 19:36:18 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 492F1108C3BC for ; Wed, 14 Feb 2018 19:35:54 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MA9Yv-1exLNy1kYz-00BMLR for ; Wed, 14 Feb 2018 20:35:31 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v3 1/4] Network::network_equal: fix check if array is fully defined Date: Wed, 14 Feb 2018 20:35:19 +0100 Message-Id: <20180214193522.26880-2-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@g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uZiawaAgF9otO/pEashszYYUVFoK5JAUIjY Cg8TgnKWAQf5TTeUzZS37IhZ4fA9w== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Correctly check length of list. Credit to Bernhard Bitsch for pointing in the right direction. --- config/cfgroot/network-functions.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 2902aabb0..070e14d0f 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -111,8 +111,9 @@ sub network_equal { my @bin1 = &network2bin($network1); my @bin2 = &network2bin($network2); - if (!defined $bin1 || !defined $bin2) { - return undef; + unless (scalar @bin1 == 2 && + scalar @bin2 == 2) { + return; } if ($bin1[0] eq $bin2[0] && $bin1[1] eq $bin2[1]) { From patchwork Thu Feb 15 06:35:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1663 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id 8B93960C10 for ; Wed, 14 Feb 2018 20:35:54 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 018DC105FC87; Wed, 14 Feb 2018 19:35:58 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4F097105FC89 for ; Wed, 14 Feb 2018 19:35:53 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MDhny-1f0vl73QOU-00H7lm for ; Wed, 14 Feb 2018 20:35:32 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v3 2/4] Network::network2bin: return an empty list in case of error Date: Wed, 14 Feb 2018 20:35:20 +0100 Message-Id: <20180214193522.26880-3-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@gmx.de> X-Provags-ID: V03:K0:4Mmzl/PuuOW3xo105PV/5Wp96mqIuuHynJkWRFfJpOxHG7xTZq2 PtB1ze3/lTIK14/9dZPdhusfPWgQXAEERjzgwDkCrfnJo+/iiqo5KfbpPOjvXKUqyuL3VBD LvC6I5ub4kdo6yPtQ8sLqUDJWIn6BBKQvkVVqdAbiH8NtMfo3T38G4mxgRd4exrbJ8amQ7u +EBrZuTdeCc61727s644Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:iTZBmL9e75c=:c6wveJwb8FO0NyX1ztAOTZ POfaInrdxXRURadwnZgtiUNjPYLAR3le2vNlyyiYoMka6t+GsLy2TMdLf9UMvYyZ3gXB7Cc1v eZkPM7Kh8d+Px99+b3OFfJ1nvHJk5L2eoWrRmIghaIS4tNH6twapUDEwBDunuodl6l8tUW3n7 b7aqsHjyEXrPUVgYviPSwMN2MLU3mMb8QFx4/qUAtPpzVlSQMbU9iTvSeNR5oWwiuIX+k4OW8 hSGJ8HUIrdkky/dn9mq2VHkCzCk5JuuOxJ45eP7yxxcEMX4BQilnBLhFHMdjx3Bf4/F/D/iOB LiCd1RX6Ik6GSw7VoA9ymwKpsaMnqp/qWVIJM5lP6HWSQ+afRuC2tSGaXbwXnvmp1opW6X3oR d1hDnnTPJSO+20NHz3DF+oBCHUT32Im2nC4hNDIq5KNCLRuqbEXcpgjnhHJpTulKYN7/bDqlP zzKilbLUYmw/sTro2tAbJZ+s0cDseErvUqZupTssC6MkcVxbKfwRk2lbTGNkP7t9femTpueN2 yckqde/9XukXr3L5Qmad4ZmncoP+otKLZ4CG3LsVkTGEpxjTvH4qhBzVUvzik0DJPggza77H4 NMdMEoywbDRvaCOYFeWNDmn2ePuRbap5T6odW678Qhj/f58BRDAyBHqTJbzZuG4IOcs+CKtet I0JA+1ZRc17RyCp0kFRl74ffgj9ZbPaQIqvoEklVEhNCIvW4o2iuV1TvHv4BktVSHZMkUtfON cNWIvP3fVQmOCp6CYyvTsCUuROL9zjfgWGergY20z6m1s7J0B26EMdZlp2SzgwhxaSU92BKjh /ZlRAIiFpPKAGjUxfIS3yNLNvZW1w== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 'return undef;' will always return a single value 'undef' even in list context. sub foo { return undef } if ( my @x = foo() ) { print "oops, we think we got a result"; } --- config/cfgroot/network-functions.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 070e14d0f..7cd56f799 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -139,7 +139,7 @@ sub network2bin($) { my $netmask_bin = &ip2bin($netmask); if (!defined $address_bin || !defined $netmask_bin) { - return undef; + return (); } my $network_start = $address_bin & $netmask_bin; From patchwork Thu Feb 15 06:35:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1666 Return-Path: Received: from mail01.ipfire.org (mail01.ipfire.org [IPv6:2001:470:7183:25::1]) by web02.i.ipfire.org (Postfix) with ESMTP id 9DDB460C10 for ; Wed, 14 Feb 2018 20:36:09 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 438FB105FC87; Wed, 14 Feb 2018 19:36:14 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 3772A1063DFA for ; Wed, 14 Feb 2018 19:35:54 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MSuMn-1fBiTJ0tld-00Rnpt for ; Wed, 14 Feb 2018 20:35:32 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v3 3/4] proxy.cgi: strip newline from subnet parameters Date: Wed, 14 Feb 2018 20:35:21 +0100 Message-Id: <20180214193522.26880-4-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@gmx.de> X-Provags-ID: V03:K0:AGdA2+wVMkrRiWCSUWP1xkh51Y89P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6wIlctpXHw== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" The subnets in @templist end with newlines. Theses have to be removed before printing and comparison with other subnets. --- html/cgi-bin/proxy.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 6aa14e15a..d565ffbdc 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -3061,6 +3061,8 @@ END close(SUBNETS); } + chomp(@templist); + foreach (@templist) { @temp = split(/\//); @@ -3069,7 +3071,6 @@ END ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'}) ) { - chomp $temp[1]; print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))"; } } From patchwork Thu Feb 15 06:35:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1665 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id F2AF960C10 for ; Wed, 14 Feb 2018 20:36:04 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 98489108B8B9; Wed, 14 Feb 2018 19:36:09 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=development-bounces@lists.ipfire.org X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 061FC1063DF9 for ; Wed, 14 Feb 2018 19:35:54 +0000 (GMT) Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=berny156@gmx.de Received: from quad.berny.local ([46.244.233.56]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lt2BW-1efwxa2J6w-012VIQ for ; Wed, 14 Feb 2018 20:35:32 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v3 4/4] proxy.cgi: fix subnet comparison for proxy.pac generation Date: Wed, 14 Feb 2018 20:35:22 +0100 Message-Id: <20180214193522.26880-5-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180214193522.26880-1-berny156@gmx.de> References: <20180214193522.26880-1-berny156@gmx.de> X-Provags-ID: V03:K0:Cuxg0fhiJKFbUeX339gC9gPWaF3/0NqULD10qUxhg3aDzsNMVST UVa7Fr8GjIVAqnSnUzrVcSaI6SaXk7UvA5srzTffbyUScgLoIKsEo4XxyjeV38bqEQIxdts ZCox2aPUB5t7Sw9dO8chKLXhOWm7OL9R00Uvj1IQi2P9v3nuoIUWTe4sZQ7uZ3J248rOZuG bhOlEnJlXc9oO/94+9/ow== X-UI-Out-Filterresults: notjunk:1; V01:K0:QQYJdDLz7Ls=:Dtb9qoj85OXQDPF6EriWBz sgb63bqZFCwW2PiJKMtcqGJfWUTBNWOlj5Ae9dYkKi7Jud+/JEvA/P0muv/M6ALr2BTBqm8We /kkVKggRxDN59RK9mJGDsXqKugYGFn3H2rLEK4obJMSaJZsnyfLCoL4PniujB0ffKAA0778II kh9WB8QhFVji0MJIcxBVonialnyT2734xOVmwikUFQgkssWv+cEQamqcA78nWa2dmEPH45m2j 0Cd1AbP0Zhx6FSfp/h5iyh/sjqojWsIrwJln7YB6IJVmDCwosgI1vWbvdzMwiPM5Ljvz+Dcdo 7Jr693ck3AJu+iPmphZ6qjhqPlkTYiByL5BBA7CiedSwNcyMCzC/CEpPvqAP19GXQi8yjgVns 1DHUg5XTJHjPRCcFcBsAfScbzQcLehdBuWUZPfoL8LDaEKbcOGB80NU1XTohA3tCTRxT0lJ1A 0lEFgwCZLrE3dLnFVHSIXaIpTXW2Nn+yMCsCdt+qQm4RmGRDDj0VaBp8dP+Peu5Sr8zmIudcp /hpI5Xn3G6vH11oGJlcMJXVx+/pqt7ZdyGIXOhFzWZq9UJkL1lXrUuPQU/BJjxYV+X6nuzJWQ TBG/SgYyUE/h9T5BMGIy4HHtYYVUiBYYYD4oLQdDWVV83jAiIJyLeyGIiOipl/HFN68F+gZVs CtgQiPsXOzIKSyqW+Ajr3KCGlxuEDr/VduQXcTScp9aPH/y7TPDal03DXFdd46/CT9Zq4j12D y8vktRm6QPSFtC5+YVZCiiZfqkijcHX1jICglNwm0hxmzThUomJ2T4l7dabd8GKRCXFdU37AW wLaPmAJZOUqJbmzWczw4w5XFU5Syw== X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" The logic of subnet comparison is broken. E.g. if the blue netmask is 255.255.255.0, it's impossible to add a VPN subnet with the same netmask. The fix simplifies the logic by using Network::network_equal. --- html/cgi-bin/proxy.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index d565ffbdc..d641c3df9 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -3066,9 +3066,10 @@ END foreach (@templist) { @temp = split(/\//); - if ( - ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) && - ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'}) + unless ( + # GREEN or BLUE networks are already added to "DIRECT". Check if given network is different from these. + &Network::network_equal("$temp[0]/$temp[1]", "$netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'}") || + &Network::network_equal("$temp[0]/$temp[1]", "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}") ) { print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))";