]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
traffic.cgi: Do not use hard-coded red interface name
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 7 Mar 2023 11:53:49 +0000 (12:53 +0100)
committerPeter Müller <peter.mueller@ipfire.org>
Sat, 11 Mar 2023 16:29:43 +0000 (16:29 +0000)
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@ipfire.org>
html/cgi-bin/traffic.cgi

index 2f28537d0616c5757c724a4cb1fb49f302130298..67cea7c2ec53c8194318fa5ee9cd668d17d2d653 100644 (file)
@@ -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)