From patchwork Wed Mar 9 14:12:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 5325 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 4KDDg640TZz3xpF for ; Wed, 9 Mar 2022 14:12:50 +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 4KDDg32kt8z5S7; Wed, 9 Mar 2022 14:12:47 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KDDg32FBfz30HK; Wed, 9 Mar 2022 14:12:47 +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 4KDDg03RpXz30H6 for ; Wed, 9 Mar 2022 14:12:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KDDg01Cqqz3xM; Wed, 9 Mar 2022 14:12:44 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1646835164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cz7ZswVo3LFwdpT8nWz6G2pK4CoXttTACEyPPiPCmec=; b=n2847SDfD0MQfR0jVmnhj+xd4eZbv+jd0o4Cd39gFQCrp4FKxT9VleOPX8PISi82Lk24le aeGBbD8YkAZCM0Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1646835164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cz7ZswVo3LFwdpT8nWz6G2pK4CoXttTACEyPPiPCmec=; b=pi+AADi5SKG91AonEGr+wn2/PmhvslDNb2yp+ia+WfbxdP5iOS0VzCXtvERibZe/ElOK/E t9s8HsYssLwqhdW4t4PoHaO6jyB9DdrP74jt5gJvMToDhm+yFAGBkb4VhNOX0zALUm0BVI H2mIBpiR/YrJqoeEifDqWfHE2av4TXBCvyhB7x6fYtZrFYX8grfCGN01gyXkOuW8DZyutb mAfr3k8LAVoq01Ijh8yt51Jf3AbTBZNiqJPrgOUe+k+MYz2D1BejCb9CUAKCStn7R3rRQt bFxwyuMKaXCARFgJVR9JYcPWwhmBhJqv1SIPxPuHqKQ2hvDOLIR74jlsTgBceQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 4/4] general-functions.pl: Do not die if no red interface could be determined. Date: Wed, 9 Mar 2022 15:12:32 +0100 Message-Id: <20220309141232.2401848-4-stefan.schantl@ipfire.org> In-Reply-To: <20220309141232.2401848-1-stefan.schantl@ipfire.org> References: <20220309141232.2401848-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 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" Signed-off-by: Stefan Schantl --- config/cfgroot/general-functions.pl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 5118a9d69..6f49585dc 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1228,12 +1228,15 @@ sub firewall_reload() { # Function which will return the used interface for the red network zone (red0, ppp0, etc). # if you change this also check speed.cgi that include a local copy for systemload reasons sub get_red_interface() { - - open(IFACE, "${General::swroot}/red/iface") or die "Could not open /var/ipfire/red/iface"; - - my $interface = ; - close(IFACE); - chomp $interface; + my $interface; + my $red_iface_file = "${General::swroot}/red/iface"; + + if (-e $red_iface_file) { + open(IFACE, "$red_iface_file") or die "Could not open $red_iface_file"; + $interface = ; + close(IFACE); + chomp $interface; + } return $interface; }