From patchwork Tue Mar 7 11:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6670 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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PWDPP05q7z3wk3 for ; Tue, 7 Mar 2023 11:54:00 +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 4PWDPM367Nzmr; Tue, 7 Mar 2023 11:53:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PWDPM2397z2yHd; Tue, 7 Mar 2023 11:53:59 +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 4PWDPL0lywz2xHD for ; Tue, 7 Mar 2023 11:53:58 +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 4PWDPK21jNzQw; Tue, 7 Mar 2023 11:53:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1678190037; 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; bh=wgz/wvBogZ/IOjNCiknfsIzOUQ1pw+xeedVq4lnA84I=; b=JzbS74h6SnUNUrzz2zbGHoT7cd/lGZ03xH6qMzDRGEhz1qey/79ia7Eh0L7m0eyzo68EqW 6cakGU/R68gL36Bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1678190037; 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; bh=wgz/wvBogZ/IOjNCiknfsIzOUQ1pw+xeedVq4lnA84I=; b=WtmO9T9L8bM/0/6IYYZtR5+kmd84Bo868DjwbWRLoT5qD57l608gLRcmL6+w8inKYVUWWS s93vezFDAwE9Pps0gwjqoHQ9rUE3v1okY/axkPLIeplpTvew2xcIib0QlsaF2v9lPxsXT1 zHzGjQChPovjCz1L4fIV07R2dGRijeN2cQqqto8H87EEYiOoEcndjYzvz3CxH/IuXhJthF SOT+MyFQMpaQJGHsMIeed+77WslDRxD9K4MIdrEbPVuXX2yqeuyYP60RUtrr1UKh+bSilo P4lKpIxz4s4v9gmGgp6BehVc1VSjuO/FntnGqT0JQXCw/NfpIW7idcP/4Xs8ug== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] traffic.cgi: Do not use hard-coded red interface name Date: Tue, 7 Mar 2023 12:53:49 +0100 Message-Id: <20230307115349.5739-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" If QMI is used the dial in mode has to be set as ppp dialin but the interface name is red. In such a case the old code tried to display the stats for the ppp0 interface which is wrong. This patch fixes this issue by calling the handy function to get the correct interface name for red. Signed-off-by: Stefan Schantl Acked-by: Peter Müller --- html/cgi-bin/traffic.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/html/cgi-bin/traffic.cgi b/html/cgi-bin/traffic.cgi index 2f28537d0..67cea7c2e 100644 --- a/html/cgi-bin/traffic.cgi +++ b/html/cgi-bin/traffic.cgi @@ -55,12 +55,12 @@ display_vnstat($netsettings{'GREEN_DEV'}); # Display external network / check if it is PPP or ETH # and dont display if RED_DEV=GREEN_DEV (green only mode) -if ($netsettings{'RED_TYPE'} ne 'PPPOE') { - if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}) { - display_vnstat($netsettings{'RED_DEV'}); - } -} else { - display_vnstat("ppp0"); +if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}) { + # Omit the red interface name. + my $red_iface = &General::get_red_interface(); + + # Display the red stats if a device could be grabbed. + display_vnstat($red_iface) if ($red_iface); } # Check config and display aditional Networks (BLUE and ORANGE)