From patchwork Thu Feb 18 14:30:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo-Andres Hofmann X-Patchwork-Id: 3899 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4DhHFL1MBmz3wps for ; Thu, 18 Feb 2021 14:31:02 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4DhHFK5skmz299; Thu, 18 Feb 2021 14:31:01 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4DhHFK5Fnjz2xqV; Thu, 18 Feb 2021 14:31:01 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4DhHFJ0FQ8z2xX7 for ; Thu, 18 Feb 2021 14:31:00 +0000 (UTC) Received: from arche.uberspace.de (arche.uberspace.de [185.26.156.147]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4DhHFH3HcPz11 for ; Thu, 18 Feb 2021 14:30:59 +0000 (UTC) Received: (qmail 28797 invoked from network); 18 Feb 2021 14:30:46 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by arche.uberspace.de with SMTP; 18 Feb 2021 14:30:46 -0000 From: Leo-Andres Hofmann To: development@lists.ipfire.org Subject: [PATCH v2 5/6] zoneconf.cgi: Import network-functions.pl Date: Thu, 18 Feb 2021 15:30:15 +0100 Message-Id: <20210218143016.972-5-hofmann@leo-andres.de> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20210218143016.972-1-hofmann@leo-andres.de> References: <20210218143016.972-1-hofmann@leo-andres.de> MIME-Version: 1.0 ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de; dmarc=none ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1613658659; a=rsa-sha256; cv=none; b=nmQ2/b/viFZRuhaJw8LzdxNfckkZ00PPvuWHaO+OtJNJOHsr20KNHe3jiLtmnlI/da6XBu Q9nO5lOjdQ80cbLPKlq6fOq5DEVw7DJBzjRG4ECtAIHpWexyJlYx9Wu0e8CjQg4+vzCyUt 1EVqDYW/dBJhkg4IIQYPipwqXDtssxGDXYwphuYiEwFH0swKBGiS/79nJrfCSvJHpW8Q74 bFu+9/rM8US3yonuA0Nyd2gZwIPlpnsNFwlqubkaAVoAM6GoIJm/LKuKSGU33zBfvPD/Jg taWp+rksbswB+wpSYmIdl1lus7W1PBbImhQiqsJgGYUCIR+0n9YUYs+1hU1ITA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1613658659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=atgqWCqDUrFs2M8mw8/htpqTc1zvPJ1+MRecEdREpDc=; b=pUTm8S3T3irFRXtZApR2YAhfOyIad9ovd46dsLyd2AUoEpF35SVphN42XmElvVeAo7n1Al H00QT8t7vEsv8ETI5mQ9EMr/5S8Q+DD7KnMMnLDHpy11IcKn4ssre2iejqqUztLlMTrHvx p1Hj0XXU4MJGC+dst7l+YSptDUUKbK7Y11+KTSM4r6xwiXyoeOIrLAXEjUU/Hk2RqMyl6C TWreBj0jaWCtFOdpi5Ax4pPWvi0WM2yWpIvX9vtkgNLUf8TPWQz9z/vbEwQIg0dGZZyDxR bHtZYFl9HrqCr0gv6tZBqnABMAt7xW/dPTa3U+FmaW4MOT1X8CD1Pt15ezOnxw== Authentication-Results: mail01.ipfire.org; dkim=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de; dmarc=none X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-0.01 / 11.00]; ARC_NA(0.00)[]; BAYES_HAM(-3.00)[99.99%]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_CONTAINS_FROM(1.00)[]; IP_REPUTATION_HAM(-1.71)[asn: 205766(-0.24), country: DE(-0.01), ip: 185.26.156.147(-0.61)]; DMARC_NA(0.00)[leo-andres.de]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:205766, ipnet:185.26.156.0/24, country:DE]; RCVD_COUNT_TWO(0.00)[2]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1] X-Rspamd-Queue-Id: 4DhHFH3HcPz11 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 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" Remove custom functions and use network-functions.pl instead to detect the available zones correctly. This also removes the requirement that a device must be assigned for a zone to become visible/configurable. Fixes: #12568 Signed-off-by: Leo-Andres Hofmann --- html/cgi-bin/zoneconf.cgi | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/html/cgi-bin/zoneconf.cgi b/html/cgi-bin/zoneconf.cgi index eb6cd0e66..9d01d06ce 100644 --- a/html/cgi-bin/zoneconf.cgi +++ b/html/cgi-bin/zoneconf.cgi @@ -25,6 +25,7 @@ use Scalar::Util qw(looks_like_number); require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/network-functions.pl"; ###--- HTML HEAD ---### my $extraHead = <$uc ($red_type)\n"; next; # We're done here @@ -436,12 +421,9 @@ foreach (@nics) { my $uc = uc $_; my $highlight = ""; - # If the zone is not activated, don't show it - next unless is_zone_activated($_); - if ($uc eq "RED") { # VLANs/Bridging is not possible if the RED interface is set to PPP, PPPoE, VDSL, ... - unless (is_zonetype_ip($ethsettings{"RED_TYPE"})) { + unless (Network::is_red_mode_ip()) { my $checked = ""; if ($mac eq $ethsettings{"${uc}_MACADDR"}) { @@ -519,12 +501,9 @@ my @stp_html = (); # form fields buffer (two rows) foreach (@zones) { # load settings and prepare form elements for each zone my $uc = uc $_; - # skip if zone is not activated - next unless is_zone_activated($_); - # STP is not available if the RED interface is set to PPP, PPPoE, VDSL, ... if ($uc eq "RED") { - unless (is_zonetype_ip($ethsettings{"RED_TYPE"})) { + unless (Network::is_red_mode_ip()) { push(@stp_html, ["\t\t\n", "\t\t\n"]); # print empty cell next; }