aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2018-11-07 20:24:10 +0000
committerMathieu Arnold <mat@FreeBSD.org>2018-11-07 20:24:10 +0000
commit3b0d4c8935a177bac1cdcc92598b9b16f1e913dc (patch)
tree6db17a946474e5759c1b5d600c0ace4a292c4f36
parent9afffe967cf404dbcb10b2eec44bcd50cbf4ba82 (diff)
Notes
-rw-r--r--net/rtg/Makefile25
-rw-r--r--net/rtg/files/patch-cgilib-cgi.c (renamed from net/rtg/files/patch-cgilib-0.4_cgi.c)4
-rw-r--r--net/rtg/files/patch-config-config.h.in (renamed from net/rtg/files/patch-config_config.h.in)0
-rw-r--r--net/rtg/files/patch-etc-95.php72
-rw-r--r--net/rtg/files/patch-etc-Makefile.in (renamed from net/rtg/files/patch-etc_Makefile.in)0
-rw-r--r--net/rtg/files/patch-etc-rtg.php122
-rw-r--r--net/rtg/files/patch-etc-rtgtargmkr.pl.in29
-rw-r--r--net/rtg/files/patch-etc-view.php117
-rw-r--r--net/rtg/files/patch-etc_95.php288
-rw-r--r--net/rtg/files/patch-etc_95.pl51
-rw-r--r--net/rtg/files/patch-etc_SNMP__util.pm22
-rw-r--r--net/rtg/files/patch-etc_common.php.in6
-rw-r--r--net/rtg/files/patch-etc_createdb.in146
-rw-r--r--net/rtg/files/patch-etc_report.pl51
-rw-r--r--net/rtg/files/patch-etc_rtg.conf10
-rw-r--r--net/rtg/files/patch-etc_rtg.php389
-rw-r--r--net/rtg/files/patch-etc_rtgtargmkr.pl.in110
-rw-r--r--net/rtg/files/patch-etc_view.php258
-rw-r--r--net/rtg/files/patch-man-rtgplot.1 (renamed from net/rtg/files/patch-man_rtgplot.1)0
-rw-r--r--net/rtg/files/patch-man-rtgpoll.1 (renamed from net/rtg/files/patch-man_rtgpoll.1)0
-rw-r--r--net/rtg/files/patch-src-rtg.h (renamed from net/rtg/files/patch-src_rtg.h)7
-rw-r--r--net/rtg/files/patch-src-rtgplot.c (renamed from net/rtg/files/patch-src_rtgplot.c)0
-rw-r--r--net/rtg/files/patch-src-rtgplot.h (renamed from net/rtg/files/patch-src_rtgplot.h)8
-rw-r--r--net/rtg/files/patch-src-rtgpoll.c (renamed from net/rtg/files/patch-src_rtgpoll.c)0
-rw-r--r--net/rtg/files/patch-src_rtgutil.c10
25 files changed, 359 insertions, 1366 deletions
diff --git a/net/rtg/Makefile b/net/rtg/Makefile
index 9ba19c74c060..b48279fcb90b 100644
--- a/net/rtg/Makefile
+++ b/net/rtg/Makefile
@@ -3,7 +3,7 @@
PORTNAME= rtg
PORTVERSION= 0.7.4
-PORTREVISION= 15
+PORTREVISION= 16
CATEGORIES= net
MASTER_SITES= SF \
ftp://ftpmirror.uk/freebsd-ports/rtg/
@@ -17,13 +17,9 @@ LIB_DEPENDS= libnetsnmp.so:net-mgmt/net-snmp
RUN_DEPENDS= p5-DBI>=0:databases/p5-DBI \
p5-DBD-mysql>=0:databases/p5-DBD-mysql
-FLAVORS= web noweb
-noweb_PKGNAMESUFFIX= poller
-web_PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX}
-
-USES= shebangfix perl5 mysql:client ssl
USE_RC_SUBR= rtgpoll
-
+WANT_PERL= yes
+USES= shebangfix mysql:client ssl
SHEBANG_FILES= etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
SUB_FILES= pkg-message
GNU_CONFIGURE= yes
@@ -34,22 +30,19 @@ CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME} \
USERS= rtg
GROUPS= rtg
-.if ${FLAVOR:U} == web
-USES+= php:web,flavors
-USE_PHP= mysqli spl
-.endif
-
-OPTIONS_DEFINE= MYSQL
+OPTIONS_DEFINE= WEB MYSQL
+OPTIONS_DEFAULT=WEB
MYSQL_DESC= Pull MySQL server in as a dependancy for local setups
+WEB_DESC= Include PHP-based web client interface pre-requisites
MYSQL_USES= mysql:server
+WEB_USES= php
+USE_PHP= mysqli spl
+
CFLAGS+= -fstack-protector
LDFLAGS+= -fstack-protector
-pre-configure:
- ${REINPLACE_CMD} -e 's/my_thread_init/mysql_thread_init/' ${WRKSRC}/configure
-
post-patch:
@${MV} ${WRKSRC}/etc/rtg.conf ${WRKSRC}/etc/rtg.conf.sample
@${MV} ${WRKSRC}/etc/routers ${WRKSRC}/etc/routers.sample
diff --git a/net/rtg/files/patch-cgilib-0.4_cgi.c b/net/rtg/files/patch-cgilib-cgi.c
index 7d55f8780b06..b50c913a03b4 100644
--- a/net/rtg/files/patch-cgilib-0.4_cgi.c
+++ b/net/rtg/files/patch-cgilib-cgi.c
@@ -1,5 +1,5 @@
---- cgilib-0.4/cgi.c.orig 2003-09-25 15:21:06 UTC
-+++ cgilib-0.4/cgi.c
+--- cgilib-0.4/cgi.c.orig Thu Sep 25 08:21:06 2003
++++ cgilib-0.4/cgi.c Sat May 14 01:28:33 2005
@@ -33,9 +33,12 @@
#ifdef HAVE_CTYPE_H
# include <ctype.h>
diff --git a/net/rtg/files/patch-config_config.h.in b/net/rtg/files/patch-config-config.h.in
index 3c624c4c1b14..3c624c4c1b14 100644
--- a/net/rtg/files/patch-config_config.h.in
+++ b/net/rtg/files/patch-config-config.h.in
diff --git a/net/rtg/files/patch-etc-95.php b/net/rtg/files/patch-etc-95.php
new file mode 100644
index 000000000000..9831f54f01cc
--- /dev/null
+++ b/net/rtg/files/patch-etc-95.php
@@ -0,0 +1,72 @@
+--- etc/95.php.orig 2003-09-24 20:40:57 UTC
++++ etc/95.php
+@@ -4,10 +4,8 @@
+ print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
+
+ /* Connect to RTG MySQL Database */
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+ die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
+
+ if ($PHP_SELF == "") {
+ $PHP_SELF = "95.php";
+@@ -50,8 +48,8 @@ function int_stats($statement, $dbc) {
+ $max = $avg = $nintyfifth = 0;
+ $rate = array();
+
+- $selectResult=mysql_query($statement, $dbc);
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ $selectResult=mysqli_query($dbc, $statement);
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ $counter = $selectRow->counter;
+ $sample_secs = $selectRow->unixtime;
+ $total += $counter;
+@@ -89,9 +87,8 @@ Report: 95th percentile<BR>
+ <?php
+ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
+ if (($bt || $smonth)) {
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
++ die ("MySQL Connection Failed, Check Configuration.");
+ /* Format into GNU date syntax */
+ if ($bt == "") {
+ $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
+@@ -104,11 +101,11 @@ Report: 95th percentile<BR>
+ $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
+
+ $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- if (mysql_num_rows($selectResult) <= 0)
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ if (mysqli_num_rows($selectResult) <= 0)
+ print "<BR>No Such Customer Found.<BR>\n";
+ else {
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ $ids[$selectRow->id] = $selectRow->name;
+ $rids[$selectRow->id] = $selectRow->rid;
+ $desc[$selectRow->id] = $selectRow->description;
+@@ -127,8 +124,8 @@ Report: 95th percentile<BR>
+ foreach($ids as $iid=>$name) {
+
+ $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
+ $router = $selectRow->name;
+
+ if ($yellow) $yellow = 0;
+@@ -201,7 +198,7 @@ Report: 95th percentile<BR>
+ echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
+ }
+
+- if ($dbc) mysql_close($dbc);
++ if ($dbc) mysqli_close($dbc);
+ echo "</FORM>\n";
+ ?>
+ <BR>
diff --git a/net/rtg/files/patch-etc_Makefile.in b/net/rtg/files/patch-etc-Makefile.in
index b7e64a203715..b7e64a203715 100644
--- a/net/rtg/files/patch-etc_Makefile.in
+++ b/net/rtg/files/patch-etc-Makefile.in
diff --git a/net/rtg/files/patch-etc-rtg.php b/net/rtg/files/patch-etc-rtg.php
new file mode 100644
index 000000000000..524ce7699fc5
--- /dev/null
+++ b/net/rtg/files/patch-etc-rtg.php
@@ -0,0 +1,122 @@
+--- etc/rtg.php.orig 2003-09-24 20:42:03 UTC
++++ etc/rtg.php
+@@ -4,10 +4,8 @@
+ print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
+
+ /* Connect to RTG MySQL Database */
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+ die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
+
+ if ($PHP_SELF == "") {
+ $PHP_SELF = "rtg.php";
+@@ -37,17 +35,17 @@
+ # Determine router, interface names as necessary
+ if ($rid && $iid) {
+ $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid[0]";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
+- $interfaces = mysql_num_rows($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
++ $interfaces = mysqli_num_rows($selectResult);
+ $name = $selectRow->name;
+ $description = $selectRow->description;
+ $speed = ($selectRow->speed)/1000000;
+ $router = $selectRow->router;
+ } else if ($rid && !$iid) {
+ $selectQuery="SELECT name AS router from router where rid=$rid";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
+ $router = $selectRow->router;
+ }
+
+@@ -71,8 +69,8 @@ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=
+ if (!$rid && !$iid) {
+ echo "<SELECT NAME=\"rid\" SIZE=10>\n";
+ $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
+ }
+ echo "</SELECT>\n";
+@@ -91,8 +89,8 @@ if ($rid && !$iid) {
+
+ echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n";
+ $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
+ }
+ echo "</SELECT>\n";
+@@ -152,8 +150,8 @@ if (($bt || $smonth) && $iid) {
+ $range="$range AND id=$iid[0]";
+
+ $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
+ echo "<TABLE BORDER=0>\n";
+ echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
+ echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
+@@ -165,12 +163,15 @@ if (($bt || $smonth) && $iid) {
+ echo "<P>\n";
+
+ #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
+- #$selectResult=mysql_query($selectQuery, $dbc);
+- #if (mysql_num_rows($selectResult) <= 0) {
++ #$selectResult=mysqli_query($dbc, $selectQuery);
++ #if (mysqli_num_rows($selectResult) <= 0) {
+ # print "<BR>No Data Found on Interface for Given Range.<BR>\n";
+ #}
+ #else {
+ $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8";
++ $args .= "&title=" . urlencode($selectRow->description);
++ $args .= "&t1_name=" . urlencode("Input Octets");
++ $args .= "&t2_name=" . urlencode("Output Octets");
+ foreach ($iid as $value) {
+ $args="$args&iid=$value";
+ }
+@@ -181,8 +182,11 @@ if (($bt || $smonth) && $iid) {
+ if ($borderb) $args = "$args&borderb=$borderb";
+ if ($aggr) $args = "$args&aggr=yes";
+ if ($percentile) $args = "$args&percentile=$nth";
+- print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n";
+ $args = "t1=ifInUcastPkts_$rid&t2=ifOutUcastPkts_$rid&begin=$bt&end=$et&units=pkts/s";
++ $args .= "&title=" . urlencode($selectRow->description);
++ $args .= "&t1_name=" . urlencode("Input Packets");
++ $args .= "&t2_name=" . urlencode("Output Packets");
+ foreach ($iid as $value) {
+ $args="$args&iid=$value";
+ }
+@@ -192,13 +196,17 @@ if (($bt || $smonth) && $iid) {
+ if ($borderb) $args = "$args&borderb=$borderb";
+ if ($aggr) $args = "$args&aggr=yes";
+ if ($percentile) $args = "$args&percentile=$nth";
+- print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n";
+ if ($errors)
+- print "<IMG SRC=rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes>\n";
++ {
++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes";
++ print "&title=" . urlencode($selectRow->description);
++ print "&t1_name=" . urlencode("Errors") . ">\n";
++ }
+ # }
+ }
+
+-mysql_close($dbc);
++mysqli_close($dbc);
+ ?>
+
+ <P>
diff --git a/net/rtg/files/patch-etc-rtgtargmkr.pl.in b/net/rtg/files/patch-etc-rtgtargmkr.pl.in
new file mode 100644
index 000000000000..4664faecbacf
--- /dev/null
+++ b/net/rtg/files/patch-etc-rtgtargmkr.pl.in
@@ -0,0 +1,29 @@
+--- etc/rtgtargmkr.pl.in.orig 2016-11-04 16:36:53 UTC
++++ etc/rtgtargmkr.pl.in
+@@ -126,7 +126,7 @@ sub find_router_id {
+ &sql_insert($sql);
+ $rid = &find_router_id($router);
+ foreach $mib ( keys %mibs_of_interest ) {
+- $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
++ $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime), KEY id_dtime_idx (id,dtime))";
+ &sql_insert($sql);
+ }
+ }
+@@ -289,7 +289,7 @@ sub main {
+ $year + 1900, $hour, $min;
+ print CFG "# Host\tOID\tBits\tCommunity\tTable\tID\tDescription\n";
+
+- foreach $router (@routers) {
++ POKE: foreach $router (@routers) {
+ $bits = $counterBits{$router};
+ # Sanity check bits
+ $bits = $defbits if ( ( $bits != 32 ) && ( $bits != 64 ) );
+@@ -304,7 +304,7 @@ sub main {
+ $system = join ( ' ', @result );
+ print "System: $system\n" if $DEBUG;
+ $session = SNMP_Session->open( $router, $communities{$router}, 161 )
+- || die "Error opening SNMP session to $router";
++ || ( print "Error opening SNMP session to $router" and next POKE );
+ if ( $system =~ /.*Cisco.*WS-.*/ ) {
+ $system = "Catalyst";
+ $session->map_table( $catalyst, \&process );
diff --git a/net/rtg/files/patch-etc-view.php b/net/rtg/files/patch-etc-view.php
new file mode 100644
index 000000000000..1642c221c356
--- /dev/null
+++ b/net/rtg/files/patch-etc-view.php
@@ -0,0 +1,117 @@
+--- etc/view.php.orig 2003-09-26 15:58:34 UTC
++++ etc/view.php
+@@ -11,10 +11,8 @@
+ print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
+
+ /* Connect to RTG MySQL Database */
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+ die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
+
+ # Global variables off by default in newer versions of PHP
+ if (!$PHP_SELF) {
+@@ -26,17 +24,17 @@
+ # Determine router, interface names as necessary
+ if ($rid && $iid) {
+ $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
+- $interfaces = mysql_num_rows($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
++ $interfaces = mysqli_num_rows($selectResult);
+ $name = $selectRow->name;
+ $description = $selectRow->description;
+ $speed = ($selectRow->speed)/1000000;
+ $router = $selectRow->router;
+ } else if ($rid && !$iid) {
+ $selectQuery="SELECT name AS router from router where rid=$rid";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
+ $router = $selectRow->router;
+ }
+
+@@ -68,12 +66,12 @@
+ if (!$rid) {
+ print "Monitored Devices: <P>\n";
+ $selectQuery="SELECT rid, name FROM router";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- if (mysql_num_rows($selectResult) <= 0)
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ if (mysqli_num_rows($selectResult) <= 0)
+ print "<BR>No Routers Found.<BR>\n";
+ else {
+ print "<UL>\n";
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">";
+ print "$selectRow->name</A><BR>\n";
+ }
+@@ -95,19 +93,22 @@
+
+ $bt = $et - (60*60*24);
+ print "<B>Day View:</B><BR>\n";
+- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
+ print "<BR><B>$router: $name ($description)</B>\n";
+ print "<BR><HR>\n";
+
+ $bt = $et - (60*60*24*7);
+ print "<B>Week View:</B><BR>\n";
+- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
+ print "<BR><B>$router: $name ($description)</B>\n";
+ print "<BR><HR>\n";
+
+ $bt = $et - (60*60*24*30);
+ print "<B>Month View:</B><BR>\n";
+- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
+ print "<BR><B>$router: $name ($description)</B>\n";
+ print "<BR><BR>\n";
+ }
+@@ -116,8 +117,8 @@
+
+ if ($rid && !$iid) {
+ $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $interfaces = mysql_num_rows($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $interfaces = mysqli_num_rows($selectResult);
+ if ($interfaces <= 0)
+ print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n";
+ else {
+@@ -129,12 +130,15 @@
+ print gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
+ print "</TABLE><HR>\n";
+ print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n";
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ $ids[$selectRow->id] = $selectRow->name;
+ $desc[$selectRow->id] = $selectRow->description;
+ $iid = $selectRow->id;
+ print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n";
+- print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
++ print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid;
++ print "&title=" . urlencode("$router: " . $selectRow->name . " (" . $selectRow->description . ")");
++ print "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets");
++ print "&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
+ print "</A><BR>\n";
+ print "<B>$selectRow->name ($selectRow->description)</B>\n";
+ if ($even) {
+@@ -148,7 +152,7 @@
+ print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
+ }
+
+- if ($dbc) mysql_close($dbc);
++ if ($dbc) mysqli_close($dbc);
+ echo "</FORM>\n";
+ ?>
+
diff --git a/net/rtg/files/patch-etc_95.php b/net/rtg/files/patch-etc_95.php
deleted file mode 100644
index 7e870b7d2d27..000000000000
--- a/net/rtg/files/patch-etc_95.php
+++ /dev/null
@@ -1,288 +0,0 @@
---- etc/95.php.orig 2003-09-24 20:40:57 UTC
-+++ etc/95.php
-@@ -1,41 +1,37 @@
- <?php
- include('./common.php');
-
-- print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
-+ print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
-
- /* Connect to RTG MySQL Database */
-- $dbc=@mysql_connect ($host, $user, $pass) or
-- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
-+ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
- die ("MySQL Connection Failed, Check Configuration.");
-- mysql_select_db($db,$dbc);
-
-- if ($PHP_SELF == "") {
-+ if (!isset($PHP_SELF) || ($PHP_SELF == "")) {
- $PHP_SELF = "95.php";
-- $customer = $_GET['customer'];
-- $syear = $_GET['syear'];
-- $eyear = $_GET['eyear'];
-- $smonth = $_GET['smonth'];
-- $emonth = $_GET['emonth'];
-- $sday = $_GET['sday'];
-- $eday = $_GET['eday'];
-- $shour = $_GET['shour'];
-- $ehour = $_GET['ehour'];
-- $smin = $_GET['smin'];
-- $emin = $_GET['emin'];
-- $debug = $_GET['debug'];
-+ $customer = isset($_GET['customer'])?$_GET['customer']:"";
-+ $syear = isset($_GET['syear'])?$_GET['syear']:"";
-+ $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
-+ $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
-+ $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
-+ $sday = isset($_GET['sday'])?$_GET['sday']:"";
-+ $eday = isset($_GET['eday'])?$_GET['eday']:"";
-+ $shour = isset($_GET['shour'])?$_GET['shour']:"";
-+ $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
-+ $smin = isset($_GET['smin'])?$_GET['smin']:"";
-+ $emin = isset($_GET['emin'])?$_GET['emin']:"";
-+ $debug = isset($_GET['debug'])?$_GET['debug']:"";
- }
-
-- print "<TITLE>RTG: ";
-- if ($customer) print "$customer\n";
-+ print "<title>RTG: ";
-+ if ($customer != "") print "$customer\n";
- ?>
-
--</TITLE>
--</HEAD>
--<BODY BGCOLOR="ffffff">
--<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
--<IMG SRC="rtg.png" BORDER="0">
--</A>
--<P>
-+</title>
-+</head>
-+<body bgcolor="ffffff">
-+<a href="http://rtg.sourceforge.net"><img src="rtg.png" border="0" alt="[RTG Home Page]" /></a>
-+<p>
-
- <?php
- function cmp($c1, $c2) {
-@@ -50,8 +46,8 @@ function int_stats($statement, $dbc) {
- $max = $avg = $nintyfifth = 0;
- $rate = array();
-
-- $selectResult=mysql_query($statement, $dbc);
-- while ($selectRow=mysql_fetch_object($selectResult)){
-+ $selectResult=mysqli_query($dbc, $statement);
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
- $counter = $selectRow->counter;
- $sample_secs = $selectRow->unixtime;
- $total += $counter;
-@@ -83,132 +79,136 @@ function int_stats($statement, $dbc) {
- }
- ?>
-
--<HR>
--Report: 95th percentile<BR>
-+<hr />
-+Report: 95th percentile<br />
-
- <?php
-- echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
-- if (($bt || $smonth)) {
-- $dbc=@mysql_connect ($host, $user, $pass) or
-- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
-- mysql_select_db($db,$dbc);
-+ echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
-+ if (($bt != "") || ($smonth != "")) {
-+ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
-+ die ("MySQL Connection Failed, Check Configuration.");
- /* Format into GNU date syntax */
- if ($bt == "") {
- $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
- $et = strtotime("$eyear-$emonth-$eday $ehour:$emin:59");
- }
-- echo "Customer: $customer <BR>\n";
-+ echo "Customer: $customer <br />\n";
- print strftime("Period: %m/%d/%Y %H:%M - ", $bt);
- print strftime("%m/%d/%Y %H:%M<P>\n", $et);
-
-- $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
-+ $range="`dtime`>FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $bt) .
-+ ") AND `dtime`<=FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $et) . ")";
-
-- $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- if (mysql_num_rows($selectResult) <= 0)
-- print "<BR>No Such Customer Found.<BR>\n";
-+ $selectQuery="SELECT `id`, `name`, `description`, `rid` FROM `interface` WHERE " .
-+ "`description` LIKE \"%" . mysqli_real_escape_string($dbc, $customer) . "%\"";
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ if (mysqli_num_rows($selectResult) <= 0)
-+ print "<br />No Such Customer Found.<br />\n";
- else {
-- while ($selectRow=mysql_fetch_object($selectResult)){
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
- $ids[$selectRow->id] = $selectRow->name;
- $rids[$selectRow->id] = $selectRow->rid;
- $desc[$selectRow->id] = $selectRow->description;
- }
-- echo "<TABLE BORDER=\"1\">\n";
-- echo "<TR BGCOLOR=\"#E0E0E0\">\n";
-- echo "<TH COLSPAN=\"3\">Interface<TH COLSPAN=\"2\">Current Rate<TH COLSPAN=\"2\">Max Rate<TH COLSPAN=\"2\">95th %\n";
-+ echo "<table border=\"1\">\n";
-+ echo "<tr bgcolor=\"#E0E0E0\">\n";
-+ echo "<th colspan=\"3\">Interface</th><th colspan=\"2\">Current Rate</th><th colspan=\"2\">Max Rate</th><th colspan=\"2\">95th %</th>\n";
- if ($debug)
-- echo "<TH COLSPAN=\"2\">Samples<TH COLSPAN=\"2\">Ignore Top\n";
-- echo "<TR BGCOLOR=\"#E0E0E0\">\n";
-- echo "<TH>Name<TH>Description<TH>Router<TH>In (Mbps)<TH>Out (Mbps)<TH>In<TH>Out<TH>In<TH>Out\n";
-+ echo "<th colspan=\"2\">Samples</th><th colspan=\"2\">Ignore Top</th>\n";
-+ echo "</tr>\n";
-+ echo "<tr bgcolor=\"#E0E0E0\">\n";
-+ echo "<th>Name</th><th>Description</th><th>Router</th><th>In (Mbps)</th><th>Out (Mbps)</th><th>In</th><th>Out</th><th>In</th><th>Out</th>\n";
- if ($debug)
-- echo "<TH>In<TH>Out<TH>In<TH>Out\n";
-- echo "<TR BGCOLOR=\"#ffffcc\">\n";
-+ echo "<th>In</th><th>Out</th><th>In</th><th>Out</th>\n";
-+ echo "</tr>\n";
-+ echo "<tr bgcolor=\"#ffffcc\">\n";
- $yellow = 1;
- foreach($ids as $iid=>$name) {
-
-- $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-+ $selectQuery="SELECT `name` FROM `router` WHERE `rid`=$rids[$iid]";
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
- $router = $selectRow->name;
-
- if ($yellow) $yellow = 0;
- else $yellow = 1;
-
-- echo "<TD>$name<TD>$desc[$iid]<TD>$router";
-+ echo "<td>$name</td><td>$desc[$iid]</td><td>$router</td>";
-
-- $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifInOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
-+ $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifInOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
- list ($intbytes_in, $maxin, $avgin, $nfin,$insamples,$inignore) = int_stats($selectQuery, $dbc);
- $bytesin = round($intbytes_in/1000000);
-
-- $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifOutOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
-+ $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifOutOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
- list ($intbytes_out, $maxout, $avgout, $nfout,$outsamples,$outignore) = int_stats($selectQuery, $dbc);
- $bytesout = round($intbytes_in/1000000);
-
-- printf("<TD ALIGN=\"right\">%2.2f", $avgin/1000000);
-- printf("<TD ALIGN=\"right\">%2.2f", $avgout/1000000);
-- printf("<TD ALIGN=\"right\">%2.2f", $maxin/1000000);
-- printf("<TD ALIGN=\"right\">%2.2f", $maxout/1000000);
-- printf("<TD ALIGN=\"right\">%2.2f", $nfin/1000000);
-- printf("<TD ALIGN=\"right\">%2.2f", $nfout/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $avgin/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $avgout/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $maxin/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $maxout/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $nfin/1000000);
-+ printf("<td align=\"right\">%2.2f</td>", $nfout/1000000);
- if ($debug) {
-- echo "<TD ALIGN=\"right\">$insamples<TD ALIGN=\"right\">$outsamples<TD ALIGN=\"right\">$inignore<TD ALIGN=\"right\">$outignore";
-+ echo "<td align=\"right\">$insamples</td><td align=\"right\">$outsamples</td><td align=\"right\">$inignore</td><td align=\"right\">$outignore</td>";
- }
-- if ($yellow) echo "<TR BGCOLOR=\"#ffffcc\">\n";
-- else echo "<TR BGCOLOR=\"#94D6E7\">\n";
-+ echo "</tr>\n";
-+ if ($yellow) echo "<tr bgcolor=\"#ffffcc\">\n";
-+ else echo "<tr bgcolor=\"#94D6E7\">\n";
- }
-- echo "</TABLE>\n";
-+ echo "</table>\n";
- }
- } else {
-- echo "Customer Name: <INPUT TYPE=\"text\" NAME=\"customer\"><BR>\n";
-- echo "<P><TABLE>\n";
-- echo "<TD>From: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "Customer Name: <input type=\"text\" name=\"customer\" /><br />\n";
-+ echo "<p><table>\n";
-+ echo "<tr><td>From: </td>\n";
-+ echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("m"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
- printf("%02d", (date("d") - 1));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
- print (date("Y"));
-- echo "\">\n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /></td>\n";
-+ echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("H"));
-- echo "\">:\n";
-- echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" />:\n";
-+ echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("i"));
-- echo "\">\n";
-+ echo "\" /></td></tr>\n";
-
-- echo "<TR><TD>To: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "<tr><td>To: </td>\n";
-+ echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("m"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("d"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
- print (date("Y"));
-- echo "\">\n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /></td>\n";
-+ echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("H"));
-- echo "\">:\n";
-- echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" />:\n";
-+ echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("i"));
-- echo "\">\n";
-- echo "<TR><TD>Debug: \n";
-- echo "<TD><INPUT TYPE=CHECKBOX NAME=\"debug\">\n";
-- echo "</TABLE>\n";
-+ echo "\" /></td></tr>\n";
-+ echo "<tr><td>Debug: </td>\n";
-+ echo "<td><input type=\"checkbox\" name=\"debug\" /></td></tr>\n";
-+ echo "</table>\n";
-
-- echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
-+ echo "<p><input type=\"submit\" VALUE=\"Ok\" />";
- }
-
-- if ($dbc) mysql_close($dbc);
-- echo "</FORM>\n";
-+ if ($dbc) mysqli_close($dbc);
-+ echo "</form>\n";
- ?>
--<BR>
--<HR>
--<FONT FACE="Arial" SIZE="2">
-+<br />
-+<hr />
-+<font face="Arial" size="2">
- <?php
-- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
-+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
- ?>
--</BODY>
--</HTML>
-+</body>
-+</html>
diff --git a/net/rtg/files/patch-etc_95.pl b/net/rtg/files/patch-etc_95.pl
index 68240e611394..f780a3e8e57c 100644
--- a/net/rtg/files/patch-etc_95.pl
+++ b/net/rtg/files/patch-etc_95.pl
@@ -1,4 +1,4 @@
---- etc/95.pl.orig 2018-04-02 20:14:41 UTC
+--- etc/95.pl.orig 2016-11-04 16:36:01 UTC
+++ etc/95.pl
@@ -31,7 +31,7 @@ $pass="rtgdefault";
$onedaysec=60*60*24;
@@ -9,52 +9,3 @@
foreach $conf (@configs) {
if (open CONF, "<$conf") {
print "Reading [$conf].\n" if $DEBUG;
-@@ -207,13 +207,13 @@ print "Period: [", format_dt($startdate)
- write;
- ($name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout) = ("Connection", "", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps");
- write;
--print "--------------------------------------------------------------------------------\n";
-+print "----------------------------------------------------------------------------------------------------\n";
-
- $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
- $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
--$range="dtime>$startdate and dtime<=$enddate";
-+$range="`dtime`>$startdate AND `dtime`<=$enddate";
-
--$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
-+$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
- $sth = $dbh->prepare($statement)
- or die "Can't prepare $statement: $dbh->errstr\n";
- $rv = $sth->execute
-@@ -223,19 +223,19 @@ while (@row = $sth->fetchrow_array ()) {
- }
-
- foreach $interface (@interfaces) {
-- $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
-+ $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
- &run_query($statement);
- ($rid, $name, $speed) = @row;
-
-- $statement="SELECT rid, name FROM router WHERE rid=$rid";
-+ $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
- &run_query($statement);
- ($rid, $router) = @row;
-
-- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime";
-+ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`";
- ($intbytes_in, $maxin, $avgin, $nfin) = &interface_stats($statement);
- $bytesin = int($intbytes_in/1000000 + .5);
-
-- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime";
-+ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`";
- ($intbytes_out, $maxout, $avgout, $nfout) = &interface_stats($statement);
- $bytesout = int($intbytes_out/1000000 + .5);
-
-@@ -279,6 +279,6 @@ $rc = $dbh->disconnect;
- exit;
-
- format STDOUT =
--@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>>> @>>>>>>
-+@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>>> @>>>>>>
- $name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout
- .
diff --git a/net/rtg/files/patch-etc_SNMP__util.pm b/net/rtg/files/patch-etc_SNMP__util.pm
deleted file mode 100644
index 09c703fc7f84..000000000000
--- a/net/rtg/files/patch-etc_SNMP__util.pm
+++ /dev/null
@@ -1,22 +0,0 @@
---- etc/SNMP_util.pm.orig 2018-04-02 22:51:02 UTC
-+++ etc/SNMP_util.pm
-@@ -1129,16 +1129,16 @@ sub snmpMIB_to_OID ($) {
- $buf =~ s/OBJECT-GROUP/OBJECT IDENTIFIER/;
- $buf =~ s/MODULE-IDENTITY/OBJECT IDENTIFIER/;
- $buf =~ s/ IMPORTS .*\;//;
-- $buf =~ s/ SEQUENCE {.*}//;
-+ $buf =~ s/ SEQUENCE \{.*}//;
- $buf =~ s/ SYNTAX .*//;
- $buf =~ s/ [\w-]+ ::= OBJECT IDENTIFIER//;
-- $buf =~ s/ OBJECT IDENTIFIER .* ::= {/ OBJECT IDENTIFIER ::= {/;
-+ $buf =~ s/ OBJECT IDENTIFIER .* ::= \{/ OBJECT IDENTIFIER ::= {/;
- $buf =~ s/".*"//;
- if ($buf =~ /"/) {
- $quote = 1;
- }
-
-- if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= {([^}]+)}/) {
-+ if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= \{([^}]+)}/) {
- $var = $1;
- $buf = $2;
- undef $val;
diff --git a/net/rtg/files/patch-etc_common.php.in b/net/rtg/files/patch-etc_common.php.in
index b06f25c12d10..75772fb16866 100644
--- a/net/rtg/files/patch-etc_common.php.in
+++ b/net/rtg/files/patch-etc_common.php.in
@@ -1,11 +1,5 @@
--- etc/common.php.in.orig 2003-09-26 15:52:29 UTC
+++ etc/common.php.in
-@@ -1,4 +1,4 @@
--<?
-+<?php
- /* Begin with reasonable defaults */
- $VERSION = "@VERSION@";
- $host="localhost";
@@ -6,10 +6,13 @@
$pass="rtgdefault";
$db="rtg";
diff --git a/net/rtg/files/patch-etc_createdb.in b/net/rtg/files/patch-etc_createdb.in
deleted file mode 100644
index 4c9826397a6b..000000000000
--- a/net/rtg/files/patch-etc_createdb.in
+++ /dev/null
@@ -1,146 +0,0 @@
---- etc/createdb.in.orig 2018-04-02 22:52:32 UTC
-+++ etc/createdb.in
-@@ -23,11 +23,8 @@ echo ""
-
- # Create the necessary SQL in two /tmp files
- cat <<EOT >/tmp/mysql.sql
--INSERT INTO user (Host, User, Password) VALUES ('$HOST','$USER',PASSWORD("$RTGPASS"));
--INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
--Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv)
--VALUES ('$HOST','$DATABASE','$USER','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
--FLUSH PRIVILEGES;
-+CREATE USER '$USER'@'$HOST' IDENTIFIED BY '$RTG_PASS';
-+GRANT ALL ON '$DATABASE'.* TO '$USER'@'$HOST';
- EOT
-
- cat <<EOT >/tmp/rtg.sql
-@@ -35,81 +32,81 @@ cat <<EOT >/tmp/rtg.sql
- # Table structure for table 'router'
- #
-
--CREATE TABLE router (
-- rid int(11) unsigned NOT NULL auto_increment,
-- name char(120) NOT NULL default '',
-- pop char(10) NOT NULL default '',
-- popid tinyint(3) unsigned NOT NULL default '0',
-- PRIMARY KEY (rid)
-+CREATE TABLE `router` (
-+ `rid` int(11) unsigned NOT NULL auto_increment,
-+ `name` char(120) NOT NULL default '',
-+ `pop` char(10) NOT NULL default '',
-+ `popid` tinyint(3) unsigned NOT NULL default '0',
-+ PRIMARY KEY (`rid`)
- );
-
- #
- # Table structure for table 'interface'
- #
-
--CREATE TABLE interface (
-- id int(11) unsigned NOT NULL auto_increment,
-- name char(255) NOT NULL default '',
-- rid int(11) NOT NULL default '0',
-- speed bigint(11) default NULL,
-- description char(255) default NULL,
-- status enum('active','inactive') default 'active',
-- PRIMARY KEY (id)
-+CREATE TABLE `interface` (
-+ `id` int(11) unsigned NOT NULL auto_increment,
-+ `name` char(255) NOT NULL default '',
-+ `rid` int(11) NOT NULL default '0',
-+ `speed` bigint(11) default NULL,
-+ `description` char(255) default NULL,
-+ `status` enum('active','inactive') default 'active',
-+ PRIMARY KEY (`id`)
- );
-
- #
- # Table structure for table 'ifInOctets'
- #
-
--CREATE TABLE ifInOctets (
-- id int(11) NOT NULL default '0',
-- dtime datetime NOT NULL default '0000-00-00 00:00:00',
-- counter bigint(20) NOT NULL default '0',
-- KEY ifInOctets_idx (dtime)
-+CREATE TABLE `ifInOctets` (
-+ `id` int(11) NOT NULL default '0',
-+ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
-+ `counter` bigint(20) NOT NULL default '0',
-+ KEY `ifInOctets_idx` (`dtime`)
- );
-
- #
- # Table structure for table 'ifOutOctets'
- #
-
--CREATE TABLE ifOutOctets (
-- id int(11) NOT NULL default '0',
-- dtime datetime NOT NULL default '0000-00-00 00:00:00',
-- counter bigint(20) NOT NULL default '0',
-- KEY ifOutOctets_idx (dtime)
-+CREATE TABLE `ifOutOctets` (
-+ `id` int(11) NOT NULL default '0',
-+ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
-+ `counter` bigint(20) NOT NULL default '0',
-+ KEY `ifOutOctets_idx` (`dtime`)
- );
-
- #
- # Table structure for table 'ifInUcastPkts'
- #
-
--CREATE TABLE ifInUcastPkts (
-- id int(11) NOT NULL default '0',
-- dtime datetime NOT NULL default '0000-00-00 00:00:00',
-- counter bigint(20) NOT NULL default '0',
-- KEY ifInUcastPkts_idx (dtime)
-+CREATE TABLE `ifInUcastPkts` (
-+ `id` int(11) NOT NULL default '0',
-+ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
-+ `counter` bigint(20) NOT NULL default '0',
-+ KEY `ifInUcastPkts_idx` (`dtime`)
- );
-
- #
- # Table structure for table 'ifOutUcastPkts'
- #
-
--CREATE TABLE ifOutUcastPkts (
-- id int(11) NOT NULL default '0',
-- dtime datetime NOT NULL default '0000-00-00 00:00:00',
-- counter bigint(20) NOT NULL default '0',
-- KEY ifOutUcastPkts_idx (dtime)
-+CREATE TABLE `ifOutUcastPkts` (
-+ `id` int(11) NOT NULL default '0',
-+ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
-+ `counter` bigint(20) NOT NULL default '0',
-+ KEY `ifOutUcastPkts_idx` (`dtime`)
- );
-
- #
- # Table structure for table 'ifInErrors'
- #
-
--CREATE TABLE ifInErrors (
-- id int(11) NOT NULL default '0',
-- dtime datetime NOT NULL default '0000-00-00 00:00:00',
-- counter bigint(20) NOT NULL default '0',
-- KEY ifInErrors_idx (dtime)
-+CREATE TABLE `ifInErrors` (
-+ `id` int(11) NOT NULL default '0',
-+ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
-+ `counter` bigint(20) NOT NULL default '0',
-+ KEY `ifInErrors_idx` (`dtime`)
- );
- EOT
-
-@@ -117,8 +114,6 @@ echo "Adding user \"$USER\" to MySQL dat
- cat /tmp/mysql.sql | $MYSQLBIN/mysql -u root -p$ROOTPASS mysql
- echo "Creating RTG database \"$DATABASE\"..."
- $MYSQLBIN/mysqladmin -u root -p$ROOTPASS create $DATABASE
--echo "Reloading MySQL privileges..."
--$MYSQLBIN/mysqladmin -u root -p$ROOTPASS flush-privileges
- echo "Creating RTG tables..."
- cat /tmp/rtg.sql | $MYSQLBIN/mysql -u $USER -p$RTGPASS $DATABASE
- echo "Done."
diff --git a/net/rtg/files/patch-etc_report.pl b/net/rtg/files/patch-etc_report.pl
index 2256ca9b620a..5e30d12fbac7 100644
--- a/net/rtg/files/patch-etc_report.pl
+++ b/net/rtg/files/patch-etc_report.pl
@@ -1,4 +1,4 @@
---- etc/report.pl.orig 2018-04-02 20:14:41 UTC
+--- etc/report.pl.orig 2016-11-04 16:36:08 UTC
+++ etc/report.pl
@@ -30,7 +30,7 @@ $pass="rtgdefault";
$onedaysec=60*60*24;
@@ -9,52 +9,3 @@
foreach $conf (@configs) {
if (open CONF, "<$conf") {
print "Reading [$conf].\n" if $DEBUG;
-@@ -192,13 +192,13 @@ print "Period: [", format_dt($startdate)
- write;
- ($router,$name,$bytesin, $bytesout, $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout) = ("","Connection", "MBytes", "MBytes", "Mbps", "Mbps", "In %", "Out%", "Mbps", "Mbps", "In%", "Out%");
- write;
--print "----------------------------------------------------------------------------------------------------------\n";
-+print "------------------------------------------------------------------------------------------------------------------------------\n";
-
- $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
- $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
--$range="dtime>$startdate and dtime<=$enddate";
-+$range="`dtime`>$startdate and `dtime`<=$enddate";
-
--$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
-+$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
- $sth = $dbh->prepare($statement)
- or die "Can't prepare $statement: $dbh->errstr\n";
- $rv = $sth->execute
-@@ -209,19 +209,19 @@ while (@row = $sth->fetchrow_array ())
- }
-
- foreach $interface (@interfaces) {
-- $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
-+ $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
- &run_query($statement);
- ($rid, $name, $speed) = @row;
-
-- $statement="SELECT rid, name FROM router WHERE rid=$rid";
-+ $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
- &run_query($statement);
- ($rid, $router) = @row;
-
-- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime";
-+ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`";
- ($intbytes_in, $maxin, $avgin) = &interface_stats($statement);
- $bytesin = int($intbytes_in/1000000 + .5);
-
-- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime";
-+ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`";
- ($intbytes_out, $maxout, $avgout) = &interface_stats($statement);
- $bytesout = int($intbytes_out/1000000 + .5);
-
-@@ -267,6 +267,6 @@ $rc = $dbh->disconnect;
- exit;
-
- format STDOUT =
--@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
-+@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
- $name,$router,&commify($bytesin), &commify($bytesout), $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout
- .
diff --git a/net/rtg/files/patch-etc_rtg.conf b/net/rtg/files/patch-etc_rtg.conf
deleted file mode 100644
index 5cb1317f249a..000000000000
--- a/net/rtg/files/patch-etc_rtg.conf
+++ /dev/null
@@ -1,10 +0,0 @@
---- etc/rtg.conf.orig 2018-04-02 23:07:32 UTC
-+++ etc/rtg.conf
-@@ -12,3 +12,7 @@ DB_Database rtg
- DB_User snmp
- DB_Pass rtgdefault
- Threads 5
-+# Set Update_desc to 1 to cause rtgtargmkr.pl to auto-update descriptions from
-+# SNMP port data
-+Update_desc 0
-+
diff --git a/net/rtg/files/patch-etc_rtg.php b/net/rtg/files/patch-etc_rtg.php
deleted file mode 100644
index ee6843c44de7..000000000000
--- a/net/rtg/files/patch-etc_rtg.php
+++ /dev/null
@@ -1,389 +0,0 @@
---- etc/rtg.php.orig 2003-09-24 20:42:03 UTC
-+++ etc/rtg.php
-@@ -1,146 +1,152 @@
- <?php
- include('./common.php');
-
-- print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
-+ print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
-
- /* Connect to RTG MySQL Database */
-- $dbc=@mysql_connect ($host, $user, $pass) or
-- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
-+ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
- die ("MySQL Connection Failed, Check Configuration.");
-- mysql_select_db($db,$dbc);
-
-- if ($PHP_SELF == "") {
-+ if (!isset($PHP_SELF) || $PHP_SELF == "") {
- $PHP_SELF = "rtg.php";
-- $errors = $_GET['errors'];
-- $scalex = $_GET['scalex'];
-- $scaley = $_GET['scaley'];
-- $aggr = $_GET['aggr'];
-- $percentile = $_GET['percentile'];
-- $nth = $_GET['nth'];
-- $xplot = $_GET['xplot'];
-- $yplot = $_GET['yplot'];
-- $borderb = $_GET['borderb'];
-- $iid = $_GET['iid'];
-- $rid = $_GET['rid'];
-- $syear = $_GET['syear'];
-- $eyear = $_GET['eyear'];
-- $smonth = $_GET['smonth'];
-- $emonth = $_GET['emonth'];
-- $sday = $_GET['sday'];
-- $eday = $_GET['eday'];
-- $shour = $_GET['shour'];
-- $ehour = $_GET['ehour'];
-- $smin = $_GET['smin'];
-- $emin = $_GET['emin'];
-+ $errors = isset($_GET['errors'])?$_GET['errors']:"";
-+ $scalex = isset($_GET['scalex'])?$_GET['scalex']:"";
-+ $scaley = isset($_GET['scaley'])?$_GET['scaley']:"";
-+ $aggr = isset($_GET['aggr'])?$_GET['aggr']:"";
-+ $percentile = isset($_GET['percentile'])?$_GET['percentile']:"";
-+ $nth = isset($_GET['nth'])?$_GET['nth']:"";
-+ $xplot = isset($_GET['xplot'])?$_GET['xplot']:"";
-+ $yplot = isset($_GET['yplot'])?$_GET['yplot']:"";
-+ $borderb = isset($_GET['borderb'])?$_GET['borderb']:"";
-+ $iid = isset($_GET['iid'])?$_GET['iid']:"";
-+ $rid = isset($_GET['rid'])?$_GET['rid']:"";
-+ $syear = isset($_GET['syear'])?$_GET['syear']:"";
-+ $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
-+ $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
-+ $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
-+ $sday = isset($_GET['sday'])?$_GET['sday']:"";
-+ $eday = isset($_GET['eday'])?$_GET['eday']:"";
-+ $shour = isset($_GET['shour'])?$_GET['shour']:"";
-+ $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
-+ $smin = isset($_GET['smin'])?$_GET['smin']:"";
-+ $emin = isset($_GET['emin'])?$_GET['emin']:"";
- }
-
- # Determine router, interface names as necessary
-- if ($rid && $iid) {
-- $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid[0]";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-- $interfaces = mysql_num_rows($selectResult);
-+ if (($rid != "") && ($iid != "")) {
-+ $selectQuery="SELECT `a`.`name`, `a`.`description`, `a`.`speed`, `b`.`name` " .
-+ "AS `router` FROM `interface` `a`, `router` `b` WHERE `a`.`rid`=`b`.`rid` " .
-+ "AND `a`.`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" .
-+ mysqli_real_escape_string($dbc, $iid[0]);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
-+ $interfaces = mysqli_num_rows($selectResult);
- $name = $selectRow->name;
- $description = $selectRow->description;
- $speed = ($selectRow->speed)/1000000;
- $router = $selectRow->router;
-- } else if ($rid && !$iid) {
-- $selectQuery="SELECT name AS router from router where rid=$rid";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-+ } else if (($rid != "") && ($iid == "")) {
-+ $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" .
-+ mysqli_real_escape_string($dbc, $rid);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
- $router = $selectRow->router;
- }
-
- # Generate Title
-- echo "<TITLE>RTG: ";
-- if ($rid && $iid) echo "$router: $name";
-- else if ($rid && !$iid) echo "$router";
-- echo "</TITLE>\n";
-+ echo "<title>RTG: ";
-+ if (($rid != "") && ($iid != "")) echo "$router: $name";
-+ else if (($rid != "") && ($iid == "")) echo "$router";
-+ echo "</title>\n";
- ?>
-
--</HEAD>
--<BODY BACKGROUND="rtgback.png" BGCOLOR="ffffff">
--<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
--<IMG SRC="rtg.png" BORDER="0">
--</A>
--<P>
-+</head>
-+<body background="rtgback.png" bgcolor="ffffff">
-+<a href="http://rtg.sourceforge.net" alt="[RTG Home Page]"><img src="rtg.png" border="0" /></a>
-+<p>
-
- <?php
--echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"get\">\n";
-+echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
-
--if (!$rid && !$iid) {
-- echo "<SELECT NAME=\"rid\" SIZE=10>\n";
-- $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- while ($selectRow=mysql_fetch_object($selectResult)){
-- echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
-+if (($rid == "") && ($iid == "")) {
-+ echo "<select name=\"rid\" size=\"10\">\n";
-+ $selectQuery="SELECT DISTINCT `name`, `rid` FROM `router` ORDER BY `name`";
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
-+ echo "<option value=\"$selectRow->rid\">$selectRow->name</option>\n";
- }
-- echo "</SELECT>\n";
-+ echo "</select>\n";
- }
-
--if ($smonth != "" && $iid == "") {
-- echo "<BLOCKQUOTE><FONT SIZE=+1><STRONG>\n";
-+if (($smonth != "") && ($iid == "")) {
-+ echo "<blockquote><font size=\"+1\"><b>\n";
- echo "Please select an interface!\n";
-- echo "</FONT></STRONG></BLOCKQUOTE>\n";
-+ echo "</b></font></blockquote>\n";
- }
-
--if ($rid && !$iid) {
-- echo "<SELECT NAME=\"rid\" SIZE=10>\n";
-- echo "<OPTION SELECTED VALUE=\"$rid\">$router\n";
-- echo "</SELECT>\n";
-+if (($rid != "") && ($iid == "")) {
-+ echo "<select name=\"rid\" size=\"10\">\n";
-+ echo "<option selected value=\"$rid\">$router</option>\n";
-+ echo "</select>\n";
-
-- echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n";
-- $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- while ($selectRow=mysql_fetch_object($selectResult)){
-- echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
-+ echo "<select multiple name=\"iid[]\" size=\"10\">\n";
-+ $selectQuery="SELECT `id`, `name`, `description` FROM `interface` WHERE " .
-+ "`rid`=" . mysqli_real_escape_string($dbc, $rid) . " ORDER BY `name`";
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
-+ echo "<option value=\"$selectRow->id\">$selectRow->name ($selectRow->description)</option>\n";
- }
-- echo "</SELECT>\n";
-+ echo "</select>\n";
-
-- echo "<P><TABLE>\n";
-- echo "<TD>From: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "<p><table>\n";
-+ echo "<tr><td>From: </td>\n";
-+ echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("m"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("d"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
- print (date("Y"));
-- echo "\">\n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">:\n";
-- echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">\n";
-+ echo "\" />\n";
-+ echo "</td>";
-+ echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"00\" />:\n";
-+ echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"00\" />\n";
-+ echo "</td></tr>\n";
-
-- echo "<TR><TD>To: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "<tr><td>To: </td>\n";
-+ echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("m"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
- print (date("d"));
-- echo "\"> / \n";
-- echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
-+ echo "\" /> / \n";
-+ echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
- print (date("Y"));
-- echo "\">\n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"23\">:\n";
-- echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"59\">\n";
-- echo "<TR><TD>Aggregate Interfaces: \n";
-- echo "<TD><INPUT TYPE=CHECKBOX NAME=\"aggr\">\n";
-- echo "<TR><TD><INPUT TYPE=TEXT NAME=\"nth\" SIZE=2 MAXLENGTH=2 VALUE=\"95\">th Percentile: \n";
-- echo "<TD><INPUT TYPE=CHECKBOX NAME=\"percentile\">\n";
-- echo "<TR><TD>Fit to Data: \n";
-- echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scalex\">\n";
-- echo "<TR><TD>Fit to Speed: \n";
-- echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scaley\">\n";
-- echo "<TR><TD>X Size: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"xplot\" SIZE=3 VALUE=\"500\">\n";
-- echo "<TR><TD>Y Size: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"yplot\" SIZE=3 VALUE=\"150\">\n";
-- echo "<TR><TD>BorderB: \n";
-- echo "<TD><INPUT TYPE=TEXT NAME=\"borderb\" SIZE=3 VALUE=\"70\">\n";
-- echo "</TABLE>\n";
-+ echo "\" />\n";
-+ echo "</td>";
-+ echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"23\" />:\n";
-+ echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"59\" />\n";
-+ echo "</td></tr>\n";
-+
-+ echo "<tr><td>Aggregate Interfaces: </td>\n";
-+ echo "<td><input type=\"checkbox\" name=\"aggr\" /></td></tr>\n";
-+ echo "<tr><td><input type=\"text\" name=\"nth\" size=\"2\" maxlength=\"2\" value=\"95\" />th Percentile: </td>\n";
-+ echo "<td><input type=\"checkbox\" name=\"percentile\" /></td></tr>\n";
-+ echo "<tr><td>Fit to Data: </td>\n";
-+ echo "<td><input type=\"checkbox\" name=\"scalex\" /></td></tr>\n";
-+ echo "<tr><td>Fit to Speed: </td>\n";
-+ echo "<td><input type=\"checkbox\" name=\"scaley\" /></td></tr>\n";
-+ echo "<tr><td>X Size: </td>\n";
-+ echo "<td><input type=\"text\" name=\"xplot\" size=\"3\" value=\"500\" /></td></tr>\n";
-+ echo "<tr><td>Y Size: </td>\n";
-+ echo "<td><input type=\"text\" name=\"yplot\" size=\"3\" value=\"150\" /></td></tr>\n";
-+ echo "<tr><td>BorderB: </td>\n";
-+ echo "<td><input type=\"text\" name=\"borderb\" size=\"3\" value=\"70\" /></td></tr>\n";
-+ echo "</table>\n";
- }
-
--if (($bt || $smonth) && $iid) {
-+if (($bt != "" || $smonth != "") && ($iid != "")) {
-
- /* Format into GNU date syntax */
- if ($bt == "") {
-@@ -148,67 +154,84 @@ if (($bt || $smonth) && $iid) {
- $et = strtotime("$eyear-$emonth-$eday $ehour:$emin:59");
- }
-
-- $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
-- $range="$range AND id=$iid[0]";
-+ $range="`dtime`>FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $bt) . ") AND " .
-+ "`dtime`<=FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $et) . ") " .
-+ "AND `id`=" . mysqli_real_escape_string($dbc, $iid[0]);
-
-- $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-- echo "<TABLE BORDER=0>\n";
-- echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
-- echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
-- printf ("<TD><I>Speed</I>:</TD><TD>%2.3f Mbps</TD><TR>\n", $selectRow->speed / 1000000);
-- echo "<TD><I>Description</I>:</TD><TD>$selectRow->description</TD><TR>\n";
-- print strftime("<TD><I>Period</I>:</TD><TD>%m/%d/%Y %H:%M - ", $bt);
-- print strftime("%m/%d/%Y %H:%M</TD>\n", $et);
-- echo "</TABLE>\n";
-- echo "<P>\n";
-+ $selectQuery="SELECT `description`, `name`, `speed` FROM `interface` WHERE " .
-+ "`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `id`=" .
-+ mysqli_real_escape_string($dbc, $iid[0]);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
-+ echo "<table border=\"0\">\n";
-+ echo "<tr><td><i>Device</i>:</td><td>$router ($rid)</td></tr>\n";
-+ echo "<tr><td><i>Interface</i>:</td><td>$selectRow->name ($iid[0])</td></tr>\n";
-+ printf ("<tr><td><i>Speed</i>:</td><td>%2.3f Mbps</td></tr>\n", $selectRow->speed / 1000000);
-+ echo "<tr><td><i>Description</i>:</td><td>$selectRow->description</td></tr>\n";
-+ print strftime("<tr><td><i>Period</i>:</td><td>%m/%d/%Y %H:%M - ", $bt);
-+ print strftime("%m/%d/%Y %H:%M</td>\n", $et);
-+ echo "</tr>\n";
-+ echo "</table>\n";
-+ echo "<p>\n";
-
- #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
-- #$selectResult=mysql_query($selectQuery, $dbc);
-- #if (mysql_num_rows($selectResult) <= 0) {
-+ #$selectResult=mysqli_query($dbc, $selectQuery);
-+ #if (mysqli_num_rows($selectResult) <= 0) {
- # print "<BR>No Data Found on Interface for Given Range.<BR>\n";
- #}
- #else {
-- $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8";
-+ $args = "t1=ifInOctets_$rid&amp;t2=ifOutOctets_$rid&amp;begin=$bt&amp;";
-+ $args .= "end=$et&amp;units=bits/s&amp;factor=8";
-+ $args .= "&amp;title=" . urlencode($selectRow->description);
-+ $args .= "&amp;t1_name=" . urlencode("Input Octets");
-+ $args .= "&amp;t2_name=" . urlencode("Output Octets");
- foreach ($iid as $value) {
-- $args="$args&iid=$value";
-+ $args="$args&amp;iid=" . urlencode($value);
- }
-- if ($scalex) $args = "$args&scalex=yes";
-- if ($scaley) $args = "$args&scaley=yes";
-- if ($xplot) $args = "$args&xplot=$xplot";
-- if ($yplot) $args = "$args&yplot=$yplot";
-- if ($borderb) $args = "$args&borderb=$borderb";
-- if ($aggr) $args = "$args&aggr=yes";
-- if ($percentile) $args = "$args&percentile=$nth";
-- print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
-- $args = "t1=ifInUcastPkts_$rid&t2=ifOutUcastPkts_$rid&begin=$bt&end=$et&units=pkts/s";
-+ if ($scalex != "") $args = "$args&amp;scalex=yes";
-+ if ($scaley != "") $args = "$args&amp;scaley=yes";
-+ if ($xplot != "") $args = "$args&amp;xplot=$xplot";
-+ if ($yplot != "") $args = "$args&amp;yplot=$yplot";
-+ if ($borderb != "") $args = "$args&amp;borderb=$borderb";
-+ if ($aggr != "") $args = "$args&amp;aggr=yes";
-+ if ($percentile != "") $args = "$args&amp;percentile=$nth";
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?$args\" alt=\"graph\" /><br />\n";
-+ $args = "t1=ifInUcastPkts_$rid&amp;t2=ifOutUcastPkts_$rid&amp;begin=$bt&amp;";
-+ $args .= "end=$et&amp;units=pkts/s";
-+ $args .= "&amp;title=" . urlencode($selectRow->description);
-+ $args .= "&amp;t1_name=" . urlencode("Input Packets");
-+ $args .= "&amp;t2_name=" . urlencode("Output Packets");
- foreach ($iid as $value) {
-- $args="$args&iid=$value";
-+ $args="$args&amp;iid=" . urlencode($value);
-+ }
-+ if ($scalex != "") $args = "$args&amp;scalex=yes";
-+ if ($xplot != "") $args = "$args&amp;xplot=$xplot";
-+ if ($yplot != "") $args = "$args&amp;yplot=$yplot";
-+ if ($borderb != "") $args = "$args&amp;borderb=$borderb";
-+ if ($aggr != "") $args = "$args&amp;aggr=yes";
-+ if ($percentile != "") $args = "$args&amp;percentile=$nth";
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?$args\" alt=\"graph\" /><br />\n";
-+ if ($errors != "")
-+ {
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInErrors_$rid&amp;begin=$bt";
-+ print "&amp;end=$et&amp;units=errors&amp;impulses=yes";
-+ print "&amp;title=" . urlencode($selectRow->description);
-+ print "&amp;t1_name=" . urlencode("Errors") . "\" alt=\"graph\" />\n";
- }
-- if ($scalex) $args = "$args&scalex=yes";
-- if ($xplot) $args = "$args&xplot=$xplot";
-- if ($yplot) $args = "$args&yplot=$yplot";
-- if ($borderb) $args = "$args&borderb=$borderb";
-- if ($aggr) $args = "$args&aggr=yes";
-- if ($percentile) $args = "$args&percentile=$nth";
-- print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
-- if ($errors)
-- print "<IMG SRC=rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes>\n";
- # }
- }
-
--mysql_close($dbc);
-+mysqli_close($dbc);
- ?>
-
--<P>
--<INPUT TYPE="SUBMIT" VALUE="Ok">
--</FORM>
--<BR>
--<HR>
--<FONT FACE="Arial" SIZE="2">
-+<p>
-+<input type="submit" value="Ok" />
-+</form>
-+<br />
-+<hr />
-+<font face="Arial" size="2">
- <?php
-- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
--?>
--</BODY>
--</HTML>
-+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
-+?></p>
-+</body>
-+</html>
diff --git a/net/rtg/files/patch-etc_rtgtargmkr.pl.in b/net/rtg/files/patch-etc_rtgtargmkr.pl.in
deleted file mode 100644
index 0b38986d80f6..000000000000
--- a/net/rtg/files/patch-etc_rtgtargmkr.pl.in
+++ /dev/null
@@ -1,110 +0,0 @@
---- etc/rtgtargmkr.pl.in.orig 2018-04-02 20:14:41 UTC
-+++ etc/rtgtargmkr.pl.in
-@@ -10,10 +10,11 @@
- # Local customization
-
- $community = "public"; # Default SNMP community
--$defbits = 32; # Default OID bits: 32/64
-+$defbits = 64; # Default OID bits: 32/64
- $output = "targets.cfg"; # Output target file name
- $router_file = "routers"; # Input list of devices to poll
- $conf_file = "rtg.conf"; # RTGpoll and RTGplot configurations
-+$update_desc = 0; # Update interface descriptions
- $INFO = 1; # Print informational messages
- $DEBUG = 0; # Print debug messages
- $DBOFF = 0; # Turn database queries off (debug)
-@@ -77,7 +78,7 @@ $catalyst = [
- );
-
- # Default locations to find RTG configuration file
--@configs = ("rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
-+@configs = ("rtg.conf", "@RTG_HOME@/etc/rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
- foreach $conf (@configs) {
- if (open CONF, "<$conf") {
- print "Reading [$conf].\n" if $DEBUG;
-@@ -93,7 +94,9 @@ foreach $conf (@configs) {
- $db_db=$cVals[1];
- } elsif ($cVals[0] =~ /Interval/) {
- $interval=$cVals[1];
-- }
-+ } elsif ($cVals[0] =~ /Update_desc/) {
-+ $update_desc=$cVals[1];
-+ }
- }
- last;
- }
-@@ -113,7 +116,7 @@ sub sql_insert {
- # exist, create a new entry and corresponding tables.
- sub find_router_id {
- ($router) = @_;
-- $sql = "SELECT DISTINCT rid FROM router WHERE name=\"$router\"";
-+ $sql = "SELECT DISTINCT `rid` FROM `router` WHERE `name`=\"$router\"";
- print "SQL: $sql\n" if $DEBUG;
- my $sth = $dbh->prepare($sql)
- or die "Can't prepare $sql: $dbh->errstr\n";
-@@ -121,12 +124,12 @@ sub find_router_id {
- or die "can't execute the query: $sth->errstr\n";
- if ( $sth->rows == 0 ) {
- print "No router id found for $router...";
-- $sql = "INSERT INTO router (name) VALUES(\"$router\")";
-+ $sql = "INSERT INTO `router` (`name`) VALUES(\"$router\")";
- print "adding.\n";
- &sql_insert($sql);
- $rid = &find_router_id($router);
- foreach $mib ( keys %mibs_of_interest ) {
-- $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
-+ $sql = "CREATE TABLE `$mib"."_$rid` (`id` INT NOT NULL, `dtime` DATETIME NOT NULL, `counter` BIGINT NOT NULL, KEY `$mib"."_$rid". "_idx` (`dtime`), KEY `id_dtime_idx` (`id`,`dtime`))";
- &sql_insert($sql);
- }
- }
-@@ -143,7 +146,7 @@ sub find_router_id {
- sub find_interface_id {
- ( $rid, $int, $desc, $speed ) = @_;
- $desc =~ s/ +$//g; #remove trailing whitespace
-- $sql = "SELECT id, description FROM interface WHERE rid=$rid AND name=\"$int\"";
-+ $sql = "SELECT `id`, `description` FROM `interface` WHERE `rid`=$rid AND `name`=\"$int\"";
- print "SQL: $sql\n" if $DEBUG;
- my $sth = $dbh->prepare($sql)
- or die "Can't prepare $sql: $dbh->errstr\n";
-@@ -152,7 +155,7 @@ sub find_interface_id {
- if ( $sth->rows == 0 ) {
- print "No id found for $int on device $rid...";
- $desc =~ s/\"/\\\"/g; # Fix " in desc
-- $sql = "INSERT INTO interface (name, rid, speed, description) VALUES(\"$int\", $rid, $speed, \"$desc\")";
-+ $sql = "INSERT INTO `interface` (`name`, `rid`, `speed`, `description`) VALUES(\"$int\", $rid, $speed, \"$desc\")";
- print "adding.\n";
- &sql_insert($sql);
- $iid = &find_interface_id( $rid, $int, $desc, $speed );
-@@ -164,7 +167,13 @@ sub find_interface_id {
- print "Interface description changed.\n";
- print "Was: \"$row[1]\"\n";
- print "Now: \"$desc\"\n";
-- print "Suggest: UPDATE interface SET description='$desc' WHERE id=$iid\n";
-+ if ( $update_desc == 1 ) {
-+ $sql = "UPDATE `interface` SET `description`='$desc' WHERE `id`=$iid";
-+ &sql_insert($sql);
-+ print "Updated.\n";
-+ } else {
-+ print "Suggest: UPDATE `interface` SET `description`='$desc' WHERE `id`=$iid\n";
-+ }
- }
- }
- $sth->finish;
-@@ -289,7 +298,7 @@ sub main {
- $year + 1900, $hour, $min;
- print CFG "# Host\tOID\tBits\tCommunity\tTable\tID\tDescription\n";
-
-- foreach $router (@routers) {
-+ POKE: foreach $router (@routers) {
- $bits = $counterBits{$router};
- # Sanity check bits
- $bits = $defbits if ( ( $bits != 32 ) && ( $bits != 64 ) );
-@@ -304,7 +313,7 @@ sub main {
- $system = join ( ' ', @result );
- print "System: $system\n" if $DEBUG;
- $session = SNMP_Session->open( $router, $communities{$router}, 161 )
-- || die "Error opening SNMP session to $router";
-+ || ( print "Error opening SNMP session to $router" and next POKE );
- if ( $system =~ /.*Cisco.*WS-.*/ ) {
- $system = "Catalyst";
- $session->map_table( $catalyst, \&process );
diff --git a/net/rtg/files/patch-etc_view.php b/net/rtg/files/patch-etc_view.php
deleted file mode 100644
index 31afc067ffe7..000000000000
--- a/net/rtg/files/patch-etc_view.php
+++ /dev/null
@@ -1,258 +0,0 @@
---- etc/view.php.orig 2003-09-26 15:58:34 UTC
-+++ etc/view.php
-@@ -8,154 +8,163 @@
- header("Cache-Control: no-cache, must-revalidate");
- header("Pragma: no-cache");
-
-- print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
-+ print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
-
- /* Connect to RTG MySQL Database */
-- $dbc=@mysql_connect ($host, $user, $pass) or
-- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
-+ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
- die ("MySQL Connection Failed, Check Configuration.");
-- mysql_select_db($db,$dbc);
-
- # Global variables off by default in newer versions of PHP
-- if (!$PHP_SELF) {
-+ if (!isset($PHP_SELF) || ($PHP_SELF == "")) {
- $PHP_SELF = "view.php";
-- $rid = $_GET['rid'];
-- $iid = $_GET['iid'];
-+ $rid = isset($_GET['rid'])?$_GET['rid']:"";
-+ $iid = isset($_GET['iid'])?$_GET['iid']:"";
- }
-
- # Determine router, interface names as necessary
-- if ($rid && $iid) {
-- $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-- $interfaces = mysql_num_rows($selectResult);
-+ if (($rid != "") && ($iid != "")) {
-+ $selectQuery="SELECT `a`.`name`, `a`.`description`, `a`.`speed`, `b`.`name` " .
-+ "AS `router` FROM `interface` `a`, `router` `b` WHERE `a`.`rid`=`b`.`rid` " .
-+ "AND `a`.`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" .
-+ mysqli_real_escape_string($dbc, $iid);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
-+ $interfaces = mysqli_num_rows($selectResult);
- $name = $selectRow->name;
- $description = $selectRow->description;
- $speed = ($selectRow->speed)/1000000;
- $router = $selectRow->router;
-- } else if ($rid && !$iid) {
-- $selectQuery="SELECT name AS router from router where rid=$rid";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $selectRow=mysql_fetch_object($selectResult);
-+ } else if (($rid != "")&& ($iid == "")) {
-+ $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" .
-+ mysqli_real_escape_string($dbc, $rid);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $selectRow=mysqli_fetch_object($selectResult);
- $router = $selectRow->router;
- }
-
- # Generate Title
-- echo "<TITLE>RTG: ";
-- if ($rid && $iid) echo "$router: $name";
-- else if ($rid && !$iid) echo "$router";
-- echo "</TITLE>\n";
-+ echo "<title>RTG: ";
-+ if (($rid != "") && ($iid != "")) echo "$router: $name";
-+ else if (($rid != "")&& ($iid == "")) echo "$router";
-+ echo "</title>\n";
-
-- print "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"300\">\n";
-- print "<meta HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
-- print "<meta HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">\n";
-- print "<meta HTTP-EQUIV=\"Expires\" CONTENT=\"".gmdate('D, d M Y H:i:s \G\M\T', time() + 300)."\">\n";
-- print "<meta HTTP-EQUIV=\"Generator\" CONTENT=\"RTG $VERSION\">\n";
-- print "<meta HTTP-EQUIV=\"Date\" CONTENT=\"".gmdate('D, d M Y H:i:s \G\M\T', time())."\">\n";
-- print "<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
-+ print "<meta http-equiv=\"Refresh\" content=\"300\" />\n";
-+ print "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
-+ print "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
-+ print "<meta http-equiv=\"Expires\" content=\"".gmdate('D, d M Y H:i:s \G\M\T', time() + 300)."\" />\n";
-+ print "<meta http-equiv=\"Generator\" content=\"RTG $VERSION\" />\n";
-+ print "<meta http-equiv=\"Date\" content=\"".gmdate('D, d M Y H:i:s \G\M\T', time())."\" />\n";
-+ print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
- ?>
-
--</HEAD>
--<BODY BGCOLOR="ffffff">
--<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
--<IMG SRC="rtg.png" BORDER="0"></A><P><HR>
-+</head>
-+<body bgcolor="ffffff">
-+<a href="http://rtg.sourceforge.net"<img src="rtg.png" border="0" alt="[RTG Home Page]" /></a><p><hr />
-
- <?php
-- echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
-+ echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
-
- $et = time();
-
-- if (!$rid) {
-+ if ($rid == "") {
- print "Monitored Devices: <P>\n";
-- $selectQuery="SELECT rid, name FROM router";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- if (mysql_num_rows($selectResult) <= 0)
-- print "<BR>No Routers Found.<BR>\n";
-+ $selectQuery="SELECT `rid`, `name` FROM `router`";
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ if (mysqli_num_rows($selectResult) <= 0)
-+ print "<br />No Routers Found.<br />\n";
- else {
-- print "<UL>\n";
-- while ($selectRow=mysql_fetch_object($selectResult)){
-- print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">";
-- print "$selectRow->name</A><BR>\n";
-+ print "<ul>\n";
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
-+ print "<li><a href=\"$PHP_SELF?rid=$selectRow->rid\">";
-+ print "$selectRow->name</a></li><br />\n";
- }
-- print "</UL>\n";
-+ print "</ul>\n";
- }
- }
-
-- if ($rid && $iid) {
-+ if (($rid != "") && ($iid != "")) {
- if ($interfaces <= 0)
-- print "<BR>Interface $iid Not Found for Router $router (ID: $rid).<BR>\n";
-+ print "<br />Interface $iid Not Found for Router $router (ID: $rid).<br />\n";
- else {
-- print "<TABLE>\n";
-- print "<TD>System:<TD>$router\n";
-- print "<TR><TD>Interface:<TD>$name\n";
-- print "<TR><TD>Description:<TD>$description\n";
-- print "<TR><TD>Speed:<TD>$speed Mbps\n";
-- print "<TR><TD>Page Generated:<TD>".gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
-- print "</TABLE><HR>\n";
-+ print "<table>\n";
-+ print "<tr><td>System:</td><td>$router</td></tr>\n";
-+ print "<tr><td>Interface:</td><td>$name</td></tr>\n";
-+ print "<tr><td>Description:</td><td>$description</td></tr>\n";
-+ print "<tr><td>Speed:</td><td>$speed Mbps</td></tr>\n";
-+ print "<tr><td>Page Generated:</td><td>".gmdate('D, d M Y H:i:s \G\M\T', time())."</td></tr>\n";
-+ print "</table><hr />\n";
-
- $bt = $et - (60*60*24);
-- print "<B>Day View:</B><BR>\n";
-- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
-- print "<BR><B>$router: $name ($description)</B>\n";
-- print "<BR><HR>\n";
-+ print "<b>Day View:</b><br />\n";
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
-+ print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
-+ print "<br /><b>$router: $name ($description)</b>\n";
-+ print "<br /><hr />\n";
-
- $bt = $et - (60*60*24*7);
-- print "<B>Week View:</B><BR>\n";
-- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
-- print "<BR><B>$router: $name ($description)</B>\n";
-- print "<BR><HR>\n";
-+ print "<b>Week View:</b><br />\n";
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
-+ print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
-+ print "<br /><b>$router: $name ($description)</b>\n";
-+ print "<br /><hr />\n";
-
- $bt = $et - (60*60*24*30);
-- print "<B>Month View:</B><BR>\n";
-- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
-- print "<BR><B>$router: $name ($description)</B>\n";
-- print "<BR><BR>\n";
-+ print "<b>Month View:</b><br />\n";
-+ print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
-+ print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
-+ print "<br /><b>$router: $name ($description)</b>\n";
-+ print "<br /><br />\n";
- }
-- print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
-+ print "<input type=\"submit\" value=\"Back to Main\" />\n";
- }
-
-- if ($rid && !$iid) {
-- $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid";
-- $selectResult=mysql_query($selectQuery, $dbc);
-- $interfaces = mysql_num_rows($selectResult);
-+ if (($rid != "") && ($iid == "")) {
-+ $selectQuery="SELECT `id`, `name`, `description` FROM `interface` WHERE " .
-+ "`rid`=" . mysqli_real_escape_string($dbc, $rid);
-+ $selectResult=mysqli_query($dbc, $selectQuery);
-+ $interfaces = mysqli_num_rows($selectResult);
- if ($interfaces <= 0)
-- print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n";
-+ print "<br />No Interfaces Found for Router $router (ID: $rid).<br />\n";
- else {
- $bt = $et - (60*60*12);
-- print "<TABLE>\n";
-- print "<TD>System:<TD>$router\n";
-- print "<TR><TD>Interfaces:<TD>$interfaces\n";
-- print "<TR><TD>Page Generated:<TD>";
-- print gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
-- print "</TABLE><HR>\n";
-- print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n";
-- while ($selectRow=mysql_fetch_object($selectResult)){
-+ print "<table>\n";
-+ print "<tr><td>System:</td><td>$router</td></tr>\n";
-+ print "<tr><td>Interfaces:</td><td>$interfaces</td></tr>\n";
-+ print "<tr><td>Page Generated:</td><td>";
-+ print gmdate('D, d M Y H:i:s \G\M\T', time())."</td></tr>\n";
-+ print "</table><hr />\n";
-+ print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
-+ print "<tr>\n";
-+ while ($selectRow=mysqli_fetch_object($selectResult)){
- $ids[$selectRow->id] = $selectRow->name;
- $desc[$selectRow->id] = $selectRow->description;
- $iid = $selectRow->id;
-- print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n";
-- print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
-- print "</A><BR>\n";
-- print "<B>$selectRow->name ($selectRow->description)</B>\n";
-- if ($even) {
-+ print "<td><a href=\"$PHP_SELF?rid=$rid&amp;iid=$iid\">\n";
-+ print "<img height=\"135\" width=\"500\" src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid;
-+ print "&amp;title=" . urlencode("$router: " . $selectRow->name . " (" . $selectRow->description . ")");
-+ print "&amp;t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets");
-+ print "&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes\" border=\"0\" />\n";
-+ print "</a><br />\n";
-+ print "<b>$selectRow->name ($selectRow->description)</b>\n";
-+ if ($even == 1) {
- $even = 0;
-- print "<TR>\n";
-+ print "</tr><tr>\n";
- }
- else $even = 1;
- }
-- print "</TABLE>\n";
-+ print "</tr></table>\n";
- }
-- print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
-+ print "<input type=\"submit\" value=\"Back to Main\" />\n";
- }
-
-- if ($dbc) mysql_close($dbc);
-- echo "</FORM>\n";
-+ if ($dbc) mysqli_close($dbc);
-+ echo "</form>\n";
- ?>
-
--<HR>
--<FONT FACE="Arial" SIZE="2">
-+<hr />
-+<font face="Arial" size="2">
- <?php
-- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
-+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
- ?>
--</BODY>
--</HTML>
-+</body>
-+</html>
diff --git a/net/rtg/files/patch-man_rtgplot.1 b/net/rtg/files/patch-man-rtgplot.1
index 6ccca28ba90f..6ccca28ba90f 100644
--- a/net/rtg/files/patch-man_rtgplot.1
+++ b/net/rtg/files/patch-man-rtgplot.1
diff --git a/net/rtg/files/patch-man_rtgpoll.1 b/net/rtg/files/patch-man-rtgpoll.1
index 1c15b64d830c..1c15b64d830c 100644
--- a/net/rtg/files/patch-man_rtgpoll.1
+++ b/net/rtg/files/patch-man-rtgpoll.1
diff --git a/net/rtg/files/patch-src_rtg.h b/net/rtg/files/patch-src-rtg.h
index 7abb628c2dc8..72730abc7017 100644
--- a/net/rtg/files/patch-src_rtg.h
+++ b/net/rtg/files/patch-src-rtg.h
@@ -1,11 +1,8 @@
--- src/rtg.h.orig 2003-09-25 15:56:04 UTC
+++ src/rtg.h
-@@ -40,11 +40,9 @@
- #define DEFAULT_DB_DB "rtg"
- #define DEFAULT_DB_USER "snmp"
+@@ -42,9 +42,7 @@
#define DEFAULT_DB_PASS "rtgdefault"
--#define DEFAULT_SNMP_VER 1
-+#define DEFAULT_SNMP_VER 2
+ #define DEFAULT_SNMP_VER 1
#define DEFAULT_SNMP_PORT 161
-
-/* PID File */
diff --git a/net/rtg/files/patch-src_rtgplot.c b/net/rtg/files/patch-src-rtgplot.c
index 3808954e15f3..3808954e15f3 100644
--- a/net/rtg/files/patch-src_rtgplot.c
+++ b/net/rtg/files/patch-src-rtgplot.c
diff --git a/net/rtg/files/patch-src_rtgplot.h b/net/rtg/files/patch-src-rtgplot.h
index dc027aae2a2e..a71f64b8ace1 100644
--- a/net/rtg/files/patch-src_rtgplot.h
+++ b/net/rtg/files/patch-src-rtgplot.h
@@ -1,5 +1,5 @@
---- src/rtgplot.h.orig 2003-09-24 14:43:39 UTC
-+++ src/rtgplot.h
+--- src/rtgplot.h 2003-09-24 15:43:39.000000000 +0100
++++ src/rtgplot.h.new 2010-04-20 21:41:37.131774833 +0100
@@ -11,6 +11,7 @@
#include <gd.h>
@@ -8,7 +8,7 @@
#include <strings.h>
#define XPLOT_AREA 500
-@@ -95,6 +96,7 @@ typedef struct graph_struct {
+@@ -95,6 +96,7 @@
int scaley;
range_t range;
image_t image;
@@ -16,7 +16,7 @@
} graph_t;
/* A linked list of colors that we iterate through each line */
-@@ -106,6 +108,7 @@ typedef struct color_struct {
+@@ -106,6 +108,7 @@
typedef struct arguments_struct {
char *table[MAXTABLES];
diff --git a/net/rtg/files/patch-src_rtgpoll.c b/net/rtg/files/patch-src-rtgpoll.c
index c55df98b6aa1..c55df98b6aa1 100644
--- a/net/rtg/files/patch-src_rtgpoll.c
+++ b/net/rtg/files/patch-src-rtgpoll.c
diff --git a/net/rtg/files/patch-src_rtgutil.c b/net/rtg/files/patch-src_rtgutil.c
deleted file mode 100644
index a430502355a8..000000000000
--- a/net/rtg/files/patch-src_rtgutil.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/rtgutil.c.orig 2018-04-02 23:03:54 UTC
-+++ src/rtgutil.c
-@@ -37,6 +37,7 @@ int read_rtg_config(char *file, config_t
- else if (!strcasecmp(p1, "DB_Database")) strncpy(set->dbdb, p2, sizeof(set->dbdb));
- else if (!strcasecmp(p1, "DB_User")) strncpy(set->dbuser, p2, sizeof(set->dbuser));
- else if (!strcasecmp(p1, "DB_Pass")) strncpy(set->dbpass, p2, sizeof(set->dbpass));
-+ else if (!strcasecmp(p1, "Update_desc")) ; // no-op
-
- /* Long longs not ANSI C. If OS doesn't support atoll() use default. */
- else if (!strcasecmp(p1, "OutOfRange"))