Message ID | 20211022080532.3195-1-arne_f@ipfire.org |
---|---|
State | Accepted |
Commit | 110d4c81060c6663cdb562ee10afc7626c2d489b |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> 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 4HbH3W3djTz3wd1 for <patchwork@web04.haj.ipfire.org>; Fri, 22 Oct 2021 08:05:59 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4HbH3V0W5Vz2cK; Fri, 22 Oct 2021 08:05:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4HbH3T5jT8z2yXQ; Fri, 22 Oct 2021 08:05:57 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4HbH3R6SHxz2xCY for <development@lists.ipfire.org>; Fri, 22 Oct 2021 08:05:55 +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 4HbH3R038pzlP; Fri, 22 Oct 2021 08:05:54 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1634889955; 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=CazcGBpY0teVzXYgBqsxcMAjFD5wc9QU8F9w2mIm6J0=; b=1/lRlGhP3VtLl4MkVemfMombkITBh0nNQRPKbydbJMYJlyWOPg90PPjFxB/OI4CLh2QoAN 2mwra93q/RuDJpBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1634889955; 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=CazcGBpY0teVzXYgBqsxcMAjFD5wc9QU8F9w2mIm6J0=; b=e2fT4uOdhLZ/I9cdjchkmz+5BSdCgvXcC4WCFVLQgIKfSjNjM4GpNOwjVLc4+vOAe19Mlf IbCYAXcQHjWLV6YiNkt8BFf284qlXFcgkryPjBalFbt7PtbWVtAwkoE5j9ThKZEKRiHmVr oSLAVQ8MVLhSZr+Xcda2GDQKaSYfgCYRGrGgzrn6sw/3u6bOwdsQDE8Hh3kGDQ9ke+UtJw pKHCmO2csmRRseS6d4qkmfgmWVWml8U82RjT9MC3OtVJC+RncUUszf/iEDeFDzYu8GghvN e+VAiQjjEwUm07t8gBJSoQ83kCQ+MpybEMMqPM6xgaRcM7P2CCwnOWvAeLgarA== From: Arne Fitzenreiter <arne_f@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH] speed.cgi: reduce system load by copying two general-functions. Date: Fri, 22 Oct 2021 10:05:32 +0200 Message-Id: <20211022080532.3195-1-arne_f@ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Cc: Arne Fitzenreiter <arne_f@ipfire.org> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
speed.cgi: reduce system load by copying two general-functions.
|
|
Commit Message
Arne Fitzenreiter
Oct. 22, 2021, 8:05 a.m. UTC
include general-functions.pl load and initialize many subfunctions that are not
needed by speed.cgi which was executed very ofthen.
So this reduce the system load significant if webif was open in browser
and ajax-speed display enabled.
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
---
config/cfgroot/general-functions.pl | 2 ++
html/cgi-bin/speed.cgi | 46 +++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 3 deletions(-)
Comments
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Am 22.10.2021 um 10:05 schrieb Arne Fitzenreiter: > include general-functions.pl load and initialize many subfunctions that are not > needed by speed.cgi which was executed very ofthen. > So this reduce the system load significant if webif was open in browser > and ajax-speed display enabled. > > Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org> > --- > config/cfgroot/general-functions.pl | 2 ++ > html/cgi-bin/speed.cgi | 46 +++++++++++++++++++++++++++-- > 2 files changed, 45 insertions(+), 3 deletions(-) > > diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl > index f72d6588c..c10a04faa 100644 > --- a/config/cfgroot/general-functions.pl > +++ b/config/cfgroot/general-functions.pl > @@ -53,6 +53,7 @@ sub system_background($) { > } > > # Returns the output of a shell command > +# if you change this also check speed.cgi that include a local copy for systemload reasons > sub system_output($) { > my @command = @_; > my $pid; > @@ -1227,6 +1228,7 @@ 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"; > diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi > index b550fda52..651c3c0b3 100644 > --- a/html/cgi-bin/speed.cgi > +++ b/html/cgi-bin/speed.cgi > @@ -19,7 +19,47 @@ > # # > ############################################################################### > > -require '/var/ipfire/general-functions.pl'; > +############################################################################### > +# functions copied from general-functions.pl for speed improvement because # > +# loading and initializing the whole general-functions.pl every second create # > +# 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() { > + > + open(IFACE, "/var/ipfire/red/iface") or die "Could not open /var/ipfire/red/iface"; > + > + my $interface = <IFACE>; > + close(IFACE); > + chomp $interface; > + > + return $interface; > +} > +# > +############################################################################### > > my $data_last = $ENV{'QUERY_STRING'}; > my $rxb_last = 0; > @@ -38,8 +78,8 @@ foreach $field (@fields) { > } > } > > -my $interface = &General::get_red_interface(); > -my @data_now = &General::system_output("ip", "-s", "link", "show", "$interface"); > +my $interface = &General__get_red_interface(); > +my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface"); > > my $lastline; > my $rxb_now = 0; >
Hello Arne, I do not think I am happy with this patch because it duplicates code. Whenever we change or fix anything in any of those copied functions, we *will* forget the copy in speed.cgi. What is the reason we cannot load general-funcions.pl in speed.cgi? Loading a slightly larger Perl file like general-functions.pl cannot impact the performance of the interpreter. If it does, the way should be to fix any slow parts in it. -Michael > On 22 Oct 2021, at 09:05, Arne Fitzenreiter <arne_f@ipfire.org> wrote: > > include general-functions.pl load and initialize many subfunctions that are not > needed by speed.cgi which was executed very ofthen. > So this reduce the system load significant if webif was open in browser > and ajax-speed display enabled. > > Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org> > --- > config/cfgroot/general-functions.pl | 2 ++ > html/cgi-bin/speed.cgi | 46 +++++++++++++++++++++++++++-- > 2 files changed, 45 insertions(+), 3 deletions(-) > > diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl > index f72d6588c..c10a04faa 100644 > --- a/config/cfgroot/general-functions.pl > +++ b/config/cfgroot/general-functions.pl > @@ -53,6 +53,7 @@ sub system_background($) { > } > > # Returns the output of a shell command > +# if you change this also check speed.cgi that include a local copy for systemload reasons > sub system_output($) { > my @command = @_; > my $pid; > @@ -1227,6 +1228,7 @@ 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"; > diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi > index b550fda52..651c3c0b3 100644 > --- a/html/cgi-bin/speed.cgi > +++ b/html/cgi-bin/speed.cgi > @@ -19,7 +19,47 @@ > # # > ############################################################################### > > -require '/var/ipfire/general-functions.pl'; > +############################################################################### > +# functions copied from general-functions.pl for speed improvement because # > +# loading and initializing the whole general-functions.pl every second create # > +# 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() { > + > + open(IFACE, "/var/ipfire/red/iface") or die "Could not open /var/ipfire/red/iface"; > + > + my $interface = <IFACE>; > + close(IFACE); > + chomp $interface; > + > + return $interface; > +} > +# > +############################################################################### > > my $data_last = $ENV{'QUERY_STRING'}; > my $rxb_last = 0; > @@ -38,8 +78,8 @@ foreach $field (@fields) { > } > } > > -my $interface = &General::get_red_interface(); > -my @data_now = &General::system_output("ip", "-s", "link", "show", "$interface"); > +my $interface = &General__get_red_interface(); > +my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface"); > > my $lastline; > my $rxb_now = 0; > -- > 2.25.1 >
Hi Michael, you are right from a formal sight. But testing the patch shows a reduction of system load in my system ( ~50% ). So the impact is not neglectable. Because we should not copy functions, as stated, we must review these Perl modules. This will be an ongoing process. I fear, we will find some copys scattered in various files. One thing I noticed while reading the various sources, is the relation of general-functions.pl and network-functions.pl. general-functions.pl includes the latter ( everytime ) and contains also network related functions. Maybe this is a start point for brushing up. Regards, Bernhard Am 22.10.2021 um 12:07 schrieb Michael Tremer: > Hello Arne, > > I do not think I am happy with this patch because it duplicates code. > > Whenever we change or fix anything in any of those copied functions, we *will* forget the copy in speed.cgi. > > What is the reason we cannot load general-funcions.pl in speed.cgi? > > Loading a slightly larger Perl file like general-functions.pl cannot impact the performance of the interpreter. If it does, the way should be to fix any slow parts in it. > > -Michael > >> On 22 Oct 2021, at 09:05, Arne Fitzenreiter <arne_f@ipfire.org> wrote: >> >> include general-functions.pl load and initialize many subfunctions that are not >> needed by speed.cgi which was executed very ofthen. >> So this reduce the system load significant if webif was open in browser >> and ajax-speed display enabled. >> >> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org> >> --- >> config/cfgroot/general-functions.pl | 2 ++ >> html/cgi-bin/speed.cgi | 46 +++++++++++++++++++++++++++-- >> 2 files changed, 45 insertions(+), 3 deletions(-) >> >> diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl >> index f72d6588c..c10a04faa 100644 >> --- a/config/cfgroot/general-functions.pl >> +++ b/config/cfgroot/general-functions.pl >> @@ -53,6 +53,7 @@ sub system_background($) { >> } >> >> # Returns the output of a shell command >> +# if you change this also check speed.cgi that include a local copy for systemload reasons >> sub system_output($) { >> my @command = @_; >> my $pid; >> @@ -1227,6 +1228,7 @@ 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"; >> diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi >> index b550fda52..651c3c0b3 100644 >> --- a/html/cgi-bin/speed.cgi >> +++ b/html/cgi-bin/speed.cgi >> @@ -19,7 +19,47 @@ >> # # >> ############################################################################### >> >> -require '/var/ipfire/general-functions.pl'; >> +############################################################################### >> +# functions copied from general-functions.pl for speed improvement because # >> +# loading and initializing the whole general-functions.pl every second create # >> +# 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() { >> + >> + open(IFACE, "/var/ipfire/red/iface") or die "Could not open /var/ipfire/red/iface"; >> + >> + my $interface = <IFACE>; >> + close(IFACE); >> + chomp $interface; >> + >> + return $interface; >> +} >> +# >> +############################################################################### >> >> my $data_last = $ENV{'QUERY_STRING'}; >> my $rxb_last = 0; >> @@ -38,8 +78,8 @@ foreach $field (@fields) { >> } >> } >> >> -my $interface = &General::get_red_interface(); >> -my @data_now = &General::system_output("ip", "-s", "link", "show", "$interface"); >> +my $interface = &General__get_red_interface(); >> +my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface"); >> >> my $lastline; >> my $rxb_now = 0; >> -- >> 2.25.1 >> >
Hello, > On 22 Oct 2021, at 11:30, Bernhard Bitsch <bbitsch@ipfire.org> wrote: > > Hi Michael, > > you are right from a formal sight. > But testing the patch shows a reduction of system load in my system ( ~50% ). This is insane that loading a Perl module takes that many resources. > So the impact is not neglectable. I didn’t dispute that :) > Because we should not copy functions, as stated, we must review these Perl modules. This will be an ongoing process. I fear, we will find some copys scattered in various files. > One thing I noticed while reading the various sources, is the relation of general-functions.pl and network-functions.pl. general-functions.pl includes the latter ( everytime ) and contains also network related functions. Maybe this is a start point for brushing up. Yes, generally it would be good to have functions where they should be. Unfortunately there are lots of “wrong” implementations that behave a certain way and the code that calls them does unexpected stuff when a function returns something else. This is a large mess and I would like to avoid making it any worse. -Michael > > Regards, > Bernhard > > > Am 22.10.2021 um 12:07 schrieb Michael Tremer: >> Hello Arne, >> I do not think I am happy with this patch because it duplicates code. >> Whenever we change or fix anything in any of those copied functions, we *will* forget the copy in speed.cgi. >> What is the reason we cannot load general-funcions.pl in speed.cgi? >> Loading a slightly larger Perl file like general-functions.pl cannot impact the performance of the interpreter. If it does, the way should be to fix any slow parts in it. >> -Michael >>> On 22 Oct 2021, at 09:05, Arne Fitzenreiter <arne_f@ipfire.org> wrote: >>> >>> include general-functions.pl load and initialize many subfunctions that are not >>> needed by speed.cgi which was executed very ofthen. >>> So this reduce the system load significant if webif was open in browser >>> and ajax-speed display enabled. >>> >>> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org> >>> --- >>> config/cfgroot/general-functions.pl | 2 ++ >>> html/cgi-bin/speed.cgi | 46 +++++++++++++++++++++++++++-- >>> 2 files changed, 45 insertions(+), 3 deletions(-) >>> >>> diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl >>> index f72d6588c..c10a04faa 100644 >>> --- a/config/cfgroot/general-functions.pl >>> +++ b/config/cfgroot/general-functions.pl >>> @@ -53,6 +53,7 @@ sub system_background($) { >>> } >>> >>> # Returns the output of a shell command >>> +# if you change this also check speed.cgi that include a local copy for systemload reasons >>> sub system_output($) { >>> my @command = @_; >>> my $pid; >>> @@ -1227,6 +1228,7 @@ 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"; >>> diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi >>> index b550fda52..651c3c0b3 100644 >>> --- a/html/cgi-bin/speed.cgi >>> +++ b/html/cgi-bin/speed.cgi >>> @@ -19,7 +19,47 @@ >>> # # >>> ############################################################################### >>> >>> -require '/var/ipfire/general-functions.pl'; >>> +############################################################################### >>> +# functions copied from general-functions.pl for speed improvement because # >>> +# loading and initializing the whole general-functions.pl every second create # >>> +# 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() { >>> + >>> + open(IFACE, "/var/ipfire/red/iface") or die "Could not open /var/ipfire/red/iface"; >>> + >>> + my $interface = <IFACE>; >>> + close(IFACE); >>> + chomp $interface; >>> + >>> + return $interface; >>> +} >>> +# >>> +############################################################################### >>> >>> my $data_last = $ENV{'QUERY_STRING'}; >>> my $rxb_last = 0; >>> @@ -38,8 +78,8 @@ foreach $field (@fields) { >>> } >>> } >>> >>> -my $interface = &General::get_red_interface(); >>> -my @data_now = &General::system_output("ip", "-s", "link", "show", "$interface"); >>> +my $interface = &General__get_red_interface(); >>> +my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface"); >>> >>> my $lastline; >>> my $rxb_now = 0; >>> -- >>> 2.25.1 >>>
diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index f72d6588c..c10a04faa 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -53,6 +53,7 @@ sub system_background($) { } # Returns the output of a shell command +# if you change this also check speed.cgi that include a local copy for systemload reasons sub system_output($) { my @command = @_; my $pid; @@ -1227,6 +1228,7 @@ 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"; diff --git a/html/cgi-bin/speed.cgi b/html/cgi-bin/speed.cgi index b550fda52..651c3c0b3 100644 --- a/html/cgi-bin/speed.cgi +++ b/html/cgi-bin/speed.cgi @@ -19,7 +19,47 @@ # # ############################################################################### -require '/var/ipfire/general-functions.pl'; +############################################################################### +# functions copied from general-functions.pl for speed improvement because # +# loading and initializing the whole general-functions.pl every second create # +# 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() { + + open(IFACE, "/var/ipfire/red/iface") or die "Could not open /var/ipfire/red/iface"; + + my $interface = <IFACE>; + close(IFACE); + chomp $interface; + + return $interface; +} +# +############################################################################### my $data_last = $ENV{'QUERY_STRING'}; my $rxb_last = 0; @@ -38,8 +78,8 @@ foreach $field (@fields) { } } -my $interface = &General::get_red_interface(); -my @data_now = &General::system_output("ip", "-s", "link", "show", "$interface"); +my $interface = &General__get_red_interface(); +my @data_now = &General__system_output("ip", "-s", "link", "show", "$interface"); my $lastline; my $rxb_now = 0;