From: "Peter Müller" <peter.mueller@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] traffic.cgi: Do not use hard-coded red interface name
Date: Sat, 11 Mar 2023 16:29:19 +0000 [thread overview]
Message-ID: <919adabe-465e-f89c-0ca1-cc01f07f6431@ipfire.org> (raw)
In-Reply-To: <20230307115349.5739-1-stefan.schantl@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]
Good catch, thank you!
Acked-by: Peter Müller <peter.mueller(a)ipfire.org>
> 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 <stefan.schantl(a)ipfire.org>
> ---
> 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)
prev parent reply other threads:[~2023-03-11 16:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 11:53 Stefan Schantl
2023-03-11 16:29 ` Peter Müller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=919adabe-465e-f89c-0ca1-cc01f07f6431@ipfire.org \
--to=peter.mueller@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox