From: Arne Fitzenreiter <git@ipfire.org>
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. a8dd6e98ba04b8dc0e7642beab16c9efeaee6e33
Date: Mon, 25 Oct 2021 10:59:59 +0000 [thread overview]
Message-ID: <4HdBmw05Dfz2y8g@people01.haj.ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 4714 bytes --]
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, next has been updated
via a8dd6e98ba04b8dc0e7642beab16c9efeaee6e33 (commit)
from 36b00b8ed130601a9aab14036c81c2ea788aa000 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a8dd6e98ba04b8dc0e7642beab16c9efeaee6e33
Author: Arne Fitzenreiter <arne_f(a)ipfire.org>
Date: Mon Oct 25 12:58:10 2021 +0200
speed.cgi: replave parsing of ip show output
latest ipfroute2 update change the output so this repkace it by reading /sys/class/net/*/statistics
Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>
-----------------------------------------------------------------------
Summary of changes:
config/qos/makeqosscripts.pl | 2 +-
html/cgi-bin/speed.cgi | 47 ++++++++++----------------------------------
2 files changed, 11 insertions(+), 38 deletions(-)
Difference in files:
diff --git a/config/qos/makeqosscripts.pl b/config/qos/makeqosscripts.pl
index 0694bb78c..878e4bb43 100644
--- a/config/qos/makeqosscripts.pl
+++ b/config/qos/makeqosscripts.pl
@@ -4,7 +4,7 @@
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2021 IPFire Team <info(a)ipfire.org> #
# #
-# This program is free software: you can redistribute it and/or modify #
+# This program is free software: you c:an redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi
index 651c3c0b3..d4b83df4f 100644
--- a/html/cgi-bin/speed.cgi
+++ b/html/cgi-bin/speed.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2007-2021 IPFire Twan <info(a)ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -25,28 +25,6 @@
# high system load #
###########################################OA##################################
#
-# Returns the output of a shell command
-sub General__system_output($) {
- my @command = @_;
- my $pid;
- my @output = ();
-
- unless ($pid = open(OUTPUT, "-|")) {
- open(STDERR, ">&STDOUT");
- exec { ${command[0]} } @command;
- die "Could not execute @command: $!";
- }
-
- waitpid($pid, 0);
-
- while (<OUTPUT>) {
- push(@output, $_);
- }
-
- close(OUTPUT);
- return @output;
-}
-#
# Function which will return the used interface for the red network zone (red0, ppp0, etc).
sub General__get_red_interface() {
@@ -79,21 +57,16 @@ foreach $field (@fields) {
}
my $interface = &General__get_red_interface();
-my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface");
-my $lastline;
-my $rxb_now = 0;
-my $txb_now = 0;
-foreach (@data_now) {
- if ( $lastline =~ /RX/ ) {
- @fields = split(/ /, $_);
- $rxb_now = $fields[4];
- } elsif ( $lastline =~ /TX/ ) {
- @fields = split(/ /, $_);
- $txb_now = $fields[4];
- }
- $lastline = $_;
-}
+open(RX, "/sys/class/net/$interface/statistics/rx_bytes") or die "Could not open /sys/class/net/$interface/statistics/rx_bytes";
+my $rxb_now = <RX>;
+close(RX);
+chomp $rxb_now;
+
+open(TX, "/sys/class/net/$interface/statistics/tx_bytes") or die "Could not open /sys/class/net/$interface/statistics/tx_bytes";
+my $txb_now = <TX>;
+close(TX);
+chomp $txb_now;
my ($rx_kbs, $tx_kbs);
my $rxb_diff = $rxb_now - $rxb_last;
hooks/post-receive
--
IPFire 2.x development tree
reply other threads:[~2021-10-25 10:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4HdBmw05Dfz2y8g@people01.haj.ipfire.org \
--to=git@ipfire.org \
--cc=ipfire-scm@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