From patchwork Tue Feb 13 09:19:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1658 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id CADEB61920 for ; Mon, 12 Feb 2018 23:20:16 +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 A84101140A3B; Mon, 12 Feb 2018 22:20:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org A84101140A3B 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 939FB1140A3C for ; Mon, 12 Feb 2018 22:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org 939FB1140A3C 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.228.114]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MHX0m-1eofpd1XMy-003JjS for ; Mon, 12 Feb 2018 23:19:37 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v2 1/4] Network::network_equal: fix check if array is fully defined Date: Mon, 12 Feb 2018 23:19:29 +0100 Message-Id: <20180212221932.29122-2-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180212221932.29122-1-berny156@gmx.de> References: <20180212221932.29122-1-berny156@gmx.de> X-Provags-ID: V03:K0:EU94Jza+K8+oWkpoCEPeyTQefbREyUWycHCP757RcW340TSilun QSBnRAvB3ZvRllMCvbqTCI/10HdS6bB32i8TVgXri00n4HOSBT/Lio4HAgccIDlErRPN5bC DBJf6XgrQge8POqwyffA7ZSHeiRGvztbtpD+jlqOtGebAYSRy4fC2wsXYdxKn1TE487Eejf SbXoy1PFXl43jiww/Kl8A== X-UI-Out-Filterresults: notjunk:1; V01:K0:DAED/JTEi2w=:orT2yM1TbPHxhXK94BcKaq Unur9QMEjStUQilVcDvRd2P8Lv4Wx0k9USBIL7MaCs6P5NkqTx1Ouae0AMIqf+5inp3Uf6Dgy q8ZgjD2PYR5zyfj4uHmLv+ze8Qltp5xXBXDlL0rvr5I0wWL5NrUvuVxQu/oBZ4S+26MhkNORf iDJDCIJH7rNkWU0bz8rG6n09WjHch+a3z40Q6tPS2LOP3rCaAwGPsANry1BsmU+sJw14O7I/e LH4/cGNMaGPcEvTbfmf2Cc8d2H5oDR8pG3jetlZHKXL4P8sXwyWptbinnf738ec+IWAOCL+p3 j3Rpa1cCv5y54luyvzYYsUpXSMuh5xLp2eftn6bn3pRFNVijSRq+btDuagFPs0jYi4YLfSN6Z 8q0Zs8akUzWFn3af0TScWam/J3BrNB1qCl1KIbU7N+okcq48j/urKSFBu/a5yKITnTlwbZo0L 9d0+aB7KNbBbt4AnDI0m9pk6jG7q01r6gp8XOizpG3wKOlL7rP6b5zd/i+nHK4nqYieaA+TYv Ck5eNAwUGCMHa+7trtbUbi+U9MZ9ouuOBHh39hgHgq4zDytDKXukD3d/OSVzNcCjplYA9clPb rz6LNacw49m7JQoN/FKW530s4JNTTV7IkGpGGsOdD+k5X5hmjNkVA6/ijkjlyxsragSTj4FZx slOr6IZHUf4SDwBC944MefgOZChlzGWaTL5i47fS4Opd7kJdGe6kvzHvUulGeiBlJkglmcaGi KtFI2QTrj/DWVX+7f7skOQjOEeQedBKl85NQ5WNLOmV4bt5joQzGcxtagFsw9vSjXAT3pM9v7 ILGIbAz3BwqHtoGNEUSPA62KR2cvw== 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..93bb646a6 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 Tue Feb 13 09:19:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1656 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 A827161917 for ; Mon, 12 Feb 2018 23:20:11 +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 ED01D1140A38; Mon, 12 Feb 2018 22:20:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org ED01D1140A38 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 85ADB1140A3B for ; Mon, 12 Feb 2018 22:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org 85ADB1140A3B 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.228.114]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LnOve-1eJRXr2Px0-00haUe for ; Mon, 12 Feb 2018 23:19:37 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v2 2/4] Network::network2bin: return an empty list in case of error Date: Mon, 12 Feb 2018 23:19:30 +0100 Message-Id: <20180212221932.29122-3-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180212221932.29122-1-berny156@gmx.de> References: <20180212221932.29122-1-berny156@gmx.de> X-Provags-ID: V03:K0:LvPV6hA7XIY+zLw8cJyvwp5OgaPQIUOAl/zdx/i4CqxH0gOlEpz zkIk0TI6fM3mCIwruOc7NIeJKLp6GIrddTRvZ33kl6llH5ONQ7zrNqgF6OBWS567UWXoICl owacNAU3/+5nRdEyMMQ6TLZRWYpUWnXj2J8Z/Uet/71VpFVGJ+rxt4n2ge9j2uu1OxnX0Zj lF4NpF2CRtOoPKStq0KtQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:KkJSyCitrQ4=:duzA5nmGz9eCLaN9BLSpjm TwFuyh5SfSX4PFKMcJMd9AXpdlC6bY/9ZPUaHC+rqjA5cJ36fiViTGzYSKGF3Xi+qhW/4VqPd emiIcBtMtv0m9w57gyrHojCo1JCws6R7KTkkdRk586RJ4PbP38FgXeCHB3G9JSftLHykrdAxL L6pPhAgYELDGORUTNfOJG0JB9CbpxLgQw1+cdHQjKxLnnHHnfStKHnwIsgrRm4W8TciTtuMYc wt3i8Ti+g5FMCsUV5oaa1Tw2VodTqjYz9JHabBCedTyhRSGXc0/kLuJ0fkn6USxO/MDijGeuz zURzYdrKPbYP8cQm93iKqVtLn+c0SFKK3husvtRFGCQkZH1NwA0+rQUozYA4/Dc5rjimLp9t4 n5j8mh0XVjrMJvIP4dfcUbzwgLSmM6UZighY+Wy+P1H20b+asCy45RRUjJooZFmuDAS9zDki5 hQcjNX52fP3it3c/6J1jw1FvvN/j/N+BekdJ1hXe7w9f28pu4FFXk2Zfy0vf2+55zgm1QN8MD VxeR1RK1ogQGsXFFf/C2IKuYD19NQVHA+9IjZry6EAeUHDCB0bAcrzHbiG9BJkDyy8c02cBzQ gv7zH6dOuLW/nX/L4Ijbg7377Q5OO+kPwA1dAsIGMWs7IQQ7HKoYOuFgAvbfffEnxZktqKTkk /uNOpWq5VAtS4197vayY8mvOXaeQy46CwOoaV2nZlZM8F5NRyJkYFSLdlHAMNtKx/GBcxnIz+ dCE79TK3ln3GjhdBoLEnXVARJbZjOHt0sArIKirg+ImLGJ3Ch8KRmkbtKLWnszYqIslWV5vFR uIHIYTJymY1vo+U//3dt8EdYOIHTw== 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 93bb646a6..41d36a194 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 Tue Feb 13 09:19:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1659 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 02FD461922 for ; Mon, 12 Feb 2018 23:20:28 +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 D9E181140A3F; Mon, 12 Feb 2018 22:20:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org D9E181140A3F 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 EC4031140A3E for ; Mon, 12 Feb 2018 22:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org EC4031140A3E 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.228.114]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lkx9B-1eDgFw3MPt-00ajfz for ; Mon, 12 Feb 2018 23:19:37 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v2 3/4] proxy.cgi: strip newline from subnet parameter Date: Mon, 12 Feb 2018 23:19:31 +0100 Message-Id: <20180212221932.29122-4-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180212221932.29122-1-berny156@gmx.de> References: <20180212221932.29122-1-berny156@gmx.de> X-Provags-ID: V03:K0:+M2wSmrqLdasQ/dNAJ94qg+Vieum4AEIx4SnQLU6VXAjZuYH5Am +/MKhJQMXOfE7UykpW7Wg56AV7SPYqudghKwy3ymg0CkMkf0NnTtbSDxRHdcjoOOKBzgYDD 4ZeuborOChaIOnNEzNbN/R8MoJ2J3L4TYes+NRpPih94x0E9wdEFIzTKw5ko4Hs+Kw58nlY W9ln2cdsY/U8D296a7aoQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:EuXeltn1iSw=:zkNnli1eVJmWatWjzwkGET sMnSwZflptyuIE6kdSmH9GNH4uD0lWNhaNyuaZHRjvGMkQYAwJdTlprL0ugejPhraHcfY/fyL gbqoWZK9FbBw9milhFG3e9tSxL82rwDmYgy0bQ+vvXK32zszsBbemFnVQNfeat2aSDXirJ5Xi MHANTnQbR+aQBQ//VrxkyOaFniLsRP1+FyVynxgD3MvjCGIGwWpBDUOj11hEjfozDGTqUXkp2 UTyTAPY6+F2J6qR9VQZFFLtSPOlx6Zz5m+b5yHITtlycqavXC6NbGLXNhU4OK3x2/jX4Eu3G6 vuChQIJfrkH4oZJZzLNR5MbDIZxqTG1wJsXs1SFpm9udgDJagfR59gbwA4im5OA8aKzNdN0Uj A+o8vl4lV1/pfoRfOX+s731/14TgITKfCYaOP+rHbxjun8LpdaRQKrW5eQfuz5vgtXAN4oZkn N3AxMN0maZaXCp5CUsm7dcAah42uKPVAVHdnc4Ap1ea/lBxpR1YB/qN3poxsy4dbj1CbdVCYH uDJR6H/S7geyUgf503vbc8zTfAnat71QcAMmZa/L5i1u+EtRomxDcfxCoTnmxpDcoh2984My2 06tuTTOrmrrmaKC/YgFxFlcS8uWCalijDO1CtjFRnX8SxP5++51OW6dP7VxyQoBsH0G+3LUJl nq7pDhJhB6G3m9izMBwxloV/8bwki2tm0RVtEIZAFmfd5z1DLtXwHnsC4DuMT7QSlKz9vUwMk jrTVZ+o6/iSdbOa2S1NngRpuuqOz0bA6eO2SB3Dw3/rtr71UjZxcIl0QQMX7TUu21Rdkxiegh 018/5P3qwx/+p5Nlmw3mSKtZ//feg== 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" $temp[1] might end with a newline; this is unavoidable when specifying serveral subnets. Thus, 'chomp $temp[1];' has to be moved before the comparisons with the green and blue subnets. Otherwise the comparison might always be wrong due to the newline. --- html/cgi-bin/proxy.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 6aa14e15a..ea3b41126 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -3064,12 +3064,12 @@ END foreach (@templist) { @temp = split(/\//); + chomp $temp[1]; 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'}) ) { - chomp $temp[1]; print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))"; } } From patchwork Tue Feb 13 09:19:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Held X-Patchwork-Id: 1657 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 AE80561921 for ; Mon, 12 Feb 2018 23:20:21 +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 90A011018AFF; Mon, 12 Feb 2018 22:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org 90A011018AFF 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 D8F3B1140A3D for ; Mon, 12 Feb 2018 22:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org D8F3B1140A3D 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.228.114]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MLujU-1et3Xq0IFo-007hRe for ; Mon, 12 Feb 2018 23:19:38 +0100 From: Bernhard Held To: development@lists.ipfire.org Subject: [PATCH v2 4/4] proxy.cgi: fix subnet comparison for proxy.pac generation Date: Mon, 12 Feb 2018 23:19:32 +0100 Message-Id: <20180212221932.29122-5-berny156@gmx.de> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180212221932.29122-1-berny156@gmx.de> References: <20180212221932.29122-1-berny156@gmx.de> X-Provags-ID: V03:K0:7zO9ZWGM6SBLQPCahmUVPvLDrpWWAWG0cuHpilS1bGC09cc6ikx XE9Oo1GeGQ3JgapmiO3xtlEFPxMC+VjWffs2fgIiIBOF8HyCqrJrChUH0htDsMn+AIt3tgU 8WRXiFyeUGN9wIiRPWrryMhn9WbinjbjjgxY0XXsjXK2DO3uOby4F0N+KOwaxXi5EisdoDO tQ6eUyMmD7tsqJG3y2D4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ktAWzCpBtzs=:Am7iEqGHdlTg5bBaYuUVg3 BcozFj3/Ef1KcxPXfdg8c16IDIfUvG9GmjC2xHaA7EziKoDoURQPzSjs8ACALnd3DBQ4fvHQb JmmvtchIkxFCi8kL6f4I77Rxc0Kvb9Fe0/W1LET5JgkMf7kyWpqJs4rHBVPWYNO4eMfKpfcEc vo/Ar0DTTiVsW0M41JP1LlA7kvy+0HGG5OzhOuzvMR2cePSuA6ZnF7gJuK4ss7q9VLjYziecr xDyBwKAmZpXgir0nL62Do5kgDmQ1tNhEuP1Pfk/+tnluG2vxGtE3URuOFD3rTWBdEWg7pEL4D Gvbx1+5F2Ch/N+cwx2tf8Yabop6psWv8+3xL7u+bzcMLhLEC7rFIi1PxrTeShgIxRbn0nHYBy h548CNaEAsdYC22/Va6zqv51AlHDRpbKIvhQsVJKiWoX8X7KMcVaZaWdQ6ruUJB/a/FcE5xTL jT2kjDUK+qPcIGLBYB/CAGAPZ6RO5Xluk9T15WVGrXz/RghOQTV0qDmTAzJy3R/UyGMB5IAWL 49Ef3O4IEhZu/kJpffWEG4zPTsktMI6ohnLBrIM77UGQTG426td53wzb3FEf4VtWr176oP4qa jtCM3rrj+YWS/AH77YlVKr2ul7jTp/+6LWMEOwKJnIeHSrdn2ja6BD/9sRFjPTQeO04oHuYLs bqv+S9bhMwTn5ZiUKSOSc/s/H++Aa+FGqoqx7bQ3FkV4I2GYqbha9SXLIwHJCSYQdpa4PLrVu /6cffUC8CiICHuo/HrNP+yfwqpFm4n3pKWbbj7e2MxaJ/cJwFEhzlEpAlWELdEevktPsQcpTo sNJp/iZ+EogwdzvOL7IMGT70IDtBA== 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 ea3b41126..df436595b 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -3065,9 +3065,10 @@ END { @temp = split(/\//); chomp $temp[1]; - 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]\"))";