From owner-svn-ports-head@freebsd.org Wed Nov 7 19:41:03 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C6A3112D3AF; Wed, 7 Nov 2018 19:41:03 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C88BF76125; Wed, 7 Nov 2018 19:41:02 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A94441A079; Wed, 7 Nov 2018 19:41:02 +0000 (UTC) (envelope-from mfechner@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA7Jf2cA081068; Wed, 7 Nov 2018 19:41:02 GMT (envelope-from mfechner@FreeBSD.org) Received: (from mfechner@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA7Jf0BO081053; Wed, 7 Nov 2018 19:41:00 GMT (envelope-from mfechner@FreeBSD.org) Message-Id: <201811071941.wA7Jf0BO081053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mfechner set sender to mfechner@FreeBSD.org using -f From: Matthias Fechner Date: Wed, 7 Nov 2018 19:41:00 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r484406 - in head/net/rtg: . files X-SVN-Group: ports-head X-SVN-Commit-Author: mfechner X-SVN-Commit-Paths: in head/net/rtg: . files X-SVN-Commit-Revision: 484406 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C88BF76125 X-Spamd-Result: default: False [-106.85 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-1.00)[-1.000,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; IP_SCORE(-3.74)[ip: (-9.91), ipnet: 2610:1c1:1::/48(-4.91), asn: 11403(-3.77), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2018 19:41:04 -0000 Author: mfechner Date: Wed Nov 7 19:40:59 2018 New Revision: 484406 URL: https://svnweb.freebsd.org/changeset/ports/484406 Log: * Fix runtime PHP errors that stop the code working if short_opentag is disabled (default!) * Remove most PHP warnings/notices that go to error_log * Convert patches to new format where needed * Fix HTML output to be valid * Fix quoting of SQL objects * Fix escaping of user-provided SQL data (potential sql injection) * Widen fields in 95.php and 95.pl for interface and router names * Fix warnings in perl modules in newer perl versions * Fix createdb script to use CREATE USER/GRANT not manipulate user db directly * Add "Update_desc" config entry to auto-update port descriptions from snmp * Update default SNMP version to 2 * Although this doesn't reference any CVE's, it does contain fixes for potential security issues PR: 227376 Submitted by: freebsd-ports@dan.me.uk (maintainer) Reported by: freebsd-ports@dan.me.uk (maintainer) Reviewed by: mfechner Approved by: mentors (timeout), portmgr (timeout) MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D17637 Added: head/net/rtg/files/patch-cgilib-0.4_cgi.c - copied, changed from r484405, head/net/rtg/files/patch-cgilib-cgi.c head/net/rtg/files/patch-config_config.h.in - copied unchanged from r484405, head/net/rtg/files/patch-config-config.h.in head/net/rtg/files/patch-etc_95.php (contents, props changed) head/net/rtg/files/patch-etc_Makefile.in - copied unchanged from r484405, head/net/rtg/files/patch-etc-Makefile.in head/net/rtg/files/patch-etc_SNMP__util.pm (contents, props changed) head/net/rtg/files/patch-etc_createdb.in (contents, props changed) head/net/rtg/files/patch-etc_rtg.conf (contents, props changed) head/net/rtg/files/patch-etc_rtg.php (contents, props changed) head/net/rtg/files/patch-etc_rtgtargmkr.pl.in (contents, props changed) head/net/rtg/files/patch-etc_view.php (contents, props changed) head/net/rtg/files/patch-man_rtgplot.1 - copied unchanged from r484405, head/net/rtg/files/patch-man-rtgplot.1 head/net/rtg/files/patch-man_rtgpoll.1 - copied unchanged from r484405, head/net/rtg/files/patch-man-rtgpoll.1 head/net/rtg/files/patch-src_rtg.h - copied, changed from r484405, head/net/rtg/files/patch-src-rtg.h head/net/rtg/files/patch-src_rtgplot.c - copied unchanged from r484405, head/net/rtg/files/patch-src-rtgplot.c head/net/rtg/files/patch-src_rtgplot.h - copied, changed from r484405, head/net/rtg/files/patch-src-rtgplot.h head/net/rtg/files/patch-src_rtgpoll.c - copied unchanged from r484405, head/net/rtg/files/patch-src-rtgpoll.c head/net/rtg/files/patch-src_rtgutil.c (contents, props changed) Deleted: head/net/rtg/files/patch-cgilib-cgi.c head/net/rtg/files/patch-config-config.h.in head/net/rtg/files/patch-etc-95.php head/net/rtg/files/patch-etc-Makefile.in head/net/rtg/files/patch-etc-rtg.php head/net/rtg/files/patch-etc-rtgtargmkr.pl.in head/net/rtg/files/patch-etc-view.php head/net/rtg/files/patch-man-rtgplot.1 head/net/rtg/files/patch-man-rtgpoll.1 head/net/rtg/files/patch-src-rtg.h head/net/rtg/files/patch-src-rtgplot.c head/net/rtg/files/patch-src-rtgplot.h head/net/rtg/files/patch-src-rtgpoll.c Modified: head/net/rtg/Makefile head/net/rtg/files/patch-etc_95.pl head/net/rtg/files/patch-etc_common.php.in head/net/rtg/files/patch-etc_report.pl Modified: head/net/rtg/Makefile ============================================================================== --- head/net/rtg/Makefile Wed Nov 7 19:17:02 2018 (r484405) +++ head/net/rtg/Makefile Wed Nov 7 19:40:59 2018 (r484406) @@ -3,7 +3,7 @@ PORTNAME= rtg PORTVERSION= 0.7.4 -PORTREVISION= 14 +PORTREVISION= 15 CATEGORIES= net MASTER_SITES= SF \ ftp://ftpmirror.uk/freebsd-ports/rtg/ @@ -17,9 +17,13 @@ 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 @@ -30,18 +34,21 @@ CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME USERS= rtg GROUPS= rtg -OPTIONS_DEFINE= WEB MYSQL -OPTIONS_DEFAULT=WEB +.if ${FLAVOR:U} == web +USES+= php:web,flavors +USE_PHP= mysqli spl +.endif + +OPTIONS_DEFINE= MYSQL 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 Copied and modified: head/net/rtg/files/patch-cgilib-0.4_cgi.c (from r484405, head/net/rtg/files/patch-cgilib-cgi.c) ============================================================================== --- head/net/rtg/files/patch-cgilib-cgi.c Wed Nov 7 19:17:02 2018 (r484405, copy source) +++ head/net/rtg/files/patch-cgilib-0.4_cgi.c Wed Nov 7 19:40:59 2018 (r484406) @@ -1,5 +1,5 @@ ---- 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 +--- cgilib-0.4/cgi.c.orig 2003-09-25 15:21:06 UTC ++++ cgilib-0.4/cgi.c @@ -33,9 +33,12 @@ #ifdef HAVE_CTYPE_H # include Copied: head/net/rtg/files/patch-config_config.h.in (from r484405, head/net/rtg/files/patch-config-config.h.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-config_config.h.in Wed Nov 7 19:40:59 2018 (r484406, copy of r484405, head/net/rtg/files/patch-config-config.h.in) @@ -0,0 +1,27 @@ +--- config/config.h.in.orig 2003-09-25 15:21:14 UTC ++++ config/config.h.in +@@ -91,19 +91,19 @@ + #undef PACKAGE + + /* Define to the address where bug reports for this package should be sent. */ +-#undef PACKAGE_BUGREPORT ++#undef RTG_PACKAGE_BUGREPORT + + /* Define to the full name of this package. */ +-#undef PACKAGE_NAME ++#undef RTG_PACKAGE_NAME + + /* Define to the full name and version of this package. */ +-#undef PACKAGE_STRING ++#undef RTG_PACKAGE_STRING + + /* Define to the one symbol short name of this package. */ +-#undef PACKAGE_TARNAME ++#undef RTG_PACKAGE_TARNAME + + /* Define to the version of this package. */ +-#undef PACKAGE_VERSION ++#undef RTG_PACKAGE_VERSION + + /* Define as the return type of signal handlers (`int' or `void'). */ + #undef RETSIGTYPE Added: head/net/rtg/files/patch-etc_95.php ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-etc_95.php Wed Nov 7 19:40:59 2018 (r484406) @@ -0,0 +1,288 @@ +--- etc/95.php.orig 2003-09-24 20:40:57 UTC ++++ etc/95.php +@@ -1,41 +1,37 @@ + \n\n\n"; ++ print "\n\n\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 "RTG: "; +- if ($customer) print "$customer\n"; ++ print "<title>RTG: "; ++ if ($customer != "") print "$customer\n"; + ?> + +- +- +- +- +- +- +-

++ ++ ++ ++[RTG Home Page] ++

+ + counter; + $sample_secs = $selectRow->unixtime; + $total += $counter; +@@ -83,132 +79,136 @@ function int_stats($statement, $dbc) { + } + ?> + +-


+-Report: 95th percentile
++
++Report: 95th percentile
+ + \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 "
\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
\n"; ++ echo "Customer: $customer
\n"; + print strftime("Period: %m/%d/%Y %H:%M - ", $bt); + print strftime("%m/%d/%Y %H:%M

\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 "
No Such Customer Found.
\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 "
No Such Customer Found.
\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 "\n"; +- echo "\n"; +- echo "
InterfaceCurrent RateMax Rate95th %\n"; ++ echo "\n"; ++ echo "\n"; ++ echo "\n"; + if ($debug) +- echo "\n"; +- echo "\n"; ++ echo "\n"; ++ echo "\n"; ++ echo "\n"; + if ($debug) +- echo "\n"; ++ echo "\n"; ++ echo "\n"; ++ echo "\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 ""; + +- $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("", $avgin/1000000); ++ printf("", $avgout/1000000); ++ printf("", $maxin/1000000); ++ printf("", $maxout/1000000); ++ printf("", $nfin/1000000); ++ printf("", $nfout/1000000); + if ($debug) { +- echo ""; + } +- if ($yellow) echo "\n"; +- else echo "\n"; ++ echo "\n"; ++ if ($yellow) echo "\n"; ++ else echo "\n"; + } +- echo "
InterfaceCurrent RateMax Rate95th %SamplesIgnore Top\n"; +- echo "
NameDescriptionRouterIn (Mbps)Out (Mbps)InOutInOut\n"; ++ echo "SamplesIgnore Top
NameDescriptionRouterIn (Mbps)Out (Mbps)InOutInOutInOutInOut\n"; +- echo "
InOutInOut
$name$desc[$iid]$router"; ++ echo "$name$desc[$iid]$router%2.2f", $avgin/1000000); +- printf("%2.2f", $avgout/1000000); +- printf("%2.2f", $maxin/1000000); +- printf("%2.2f", $maxout/1000000); +- printf("%2.2f", $nfin/1000000); +- printf("%2.2f", $nfout/1000000); ++ printf("%2.2f%2.2f%2.2f%2.2f%2.2f%2.2f$insamples$outsamples$inignore$outignore"; ++ echo "$insamples$outsamples$inignore$outignore
\n"; ++ echo "
\n"; + } + } else { +- echo "Customer Name:
\n"; +- echo "

\n"; +- echo "\n"; ++ echo "\n"; ++ echo "\n"; ++ echo "
From: \n"; +- echo "
\n"; ++ echo "

\n"; ++ echo "\n"; ++ echo "\n"; ++ echo "\n"; + +- echo "\n"; ++ echo "\n"; ++ echo "
From: / \n"; +- echo " / \n"; ++ echo " / \n"; +- echo " / \n"; ++ echo "\n"; +- echo ":\n"; +- echo ":\n"; ++ echo "\n"; ++ echo "\" />
To: \n"; +- echo "To: / \n"; +- echo " / \n"; ++ echo " / \n"; +- echo " / \n"; ++ echo "\n"; +- echo ":\n"; +- echo ":\n"; ++ echo "\n"; +- echo "
Debug: \n"; +- echo "\n"; +- echo "
\n"; ++ echo "\" />

Debug:
\n"; + +- echo "

"; ++ echo "

"; + } + +- if ($dbc) mysql_close($dbc); +- echo "

\n"; ++ if ($dbc) mysqli_close($dbc); ++ echo "\n"; + ?> +-
+-
+- ++
++
++ + RTG Version $VERSION"; ++ print "RTG Version $VERSION
"; + ?> +- +- ++ ++ Modified: head/net/rtg/files/patch-etc_95.pl ============================================================================== --- head/net/rtg/files/patch-etc_95.pl Wed Nov 7 19:17:02 2018 (r484405) +++ head/net/rtg/files/patch-etc_95.pl Wed Nov 7 19:40:59 2018 (r484406) @@ -1,4 +1,4 @@ ---- etc/95.pl.orig 2016-11-04 16:36:01 UTC +--- etc/95.pl.orig 2018-04-02 20:14:41 UTC +++ etc/95.pl @@ -31,7 +31,7 @@ $pass="rtgdefault"; $onedaysec=60*60*24; @@ -9,3 +9,52 @@ 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 + . Copied: head/net/rtg/files/patch-etc_Makefile.in (from r484405, head/net/rtg/files/patch-etc-Makefile.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-etc_Makefile.in Wed Nov 7 19:40:59 2018 (r484406, copy of r484405, head/net/rtg/files/patch-etc-Makefile.in) @@ -0,0 +1,49 @@ +--- etc/Makefile.in.orig 2003-10-02 15:59:32 UTC ++++ etc/Makefile.in +@@ -84,19 +84,19 @@ am__quote = @am__quote@ + install_sh = @install_sh@ + + top_builddir = .. +-etcdir = /etc +-webdir = /web +-reportsdir = /bin ++etcdir = @etcdir@ ++webdir = @webdir@ ++reportsdir = @bindir@ + +-ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \ ++ETC = rtg.conf.sample rtgtargmkr.pl routers.sample createdb BER.pm \ + SNMP_Session.pm SNMP_util.pm + + WEB = rtg.php 95.php view.php common.php rtg.png rtgback.png + REPORTS = report.pl 95.pl + + EXTRA_DIST = rtgtargmkr.pl.in report.pl 95.pl createdb.in \ +- BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf \ +- routers rtg.php 95.php view.php common.php.in rtg.png rtgback.png ++ BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf.sample \ ++ routers.sample rtg.php 95.php view.php common.php.in rtg.png rtgback.png + + subdir = etc + mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am + all: + + install: installdirs +- @for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(etcdir) ; echo "install: installed $$i in $(prefix)$(etcdir)" ; done +- @for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(webdir) ; echo "install: installed $$i in $(prefix)$(webdir)" ; done +- @for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(reportsdir) ; echo "install: installed $$i in $(prefix)$(reportsdir)" ; done ++ @for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(etcdir) ; echo "install: installed $$i in $(DESTDIR)$(etcdir)" ; done ++ @for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(webdir) ; echo "install: installed $$i in $(DESTDIR)$(webdir)" ; done ++ @for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(reportsdir) ; echo "install: installed $$i in $(DESTDIR)$(reportsdir)" ; done + + installdirs: +- $(mkinstalldirs) $(prefix)$(etcdir) +- $(mkinstalldirs) $(prefix)$(webdir) +- $(mkinstalldirs) $(prefix)$(reportsdir) ++ $(mkinstalldirs) $(DESTDIR)$(etcdir) ++ $(mkinstalldirs) $(DESTDIR)$(webdir) ++ $(mkinstalldirs) $(DESTDIR)$(reportsdir) + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: Added: head/net/rtg/files/patch-etc_SNMP__util.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-etc_SNMP__util.pm Wed Nov 7 19:40:59 2018 (r484406) @@ -0,0 +1,22 @@ +--- 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; Modified: head/net/rtg/files/patch-etc_common.php.in ============================================================================== --- head/net/rtg/files/patch-etc_common.php.in Wed Nov 7 19:17:02 2018 (r484405) +++ head/net/rtg/files/patch-etc_common.php.in Wed Nov 7 19:40:59 2018 (r484406) @@ -1,5 +1,11 @@ --- etc/common.php.in.orig 2003-09-26 15:52:29 UTC +++ etc/common.php.in +@@ -1,4 +1,4 @@ +-/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 </tmp/rtg.sql +@@ -35,81 +32,81 @@ cat </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." Modified: head/net/rtg/files/patch-etc_report.pl ============================================================================== --- head/net/rtg/files/patch-etc_report.pl Wed Nov 7 19:17:02 2018 (r484405) +++ head/net/rtg/files/patch-etc_report.pl Wed Nov 7 19:40:59 2018 (r484406) @@ -1,4 +1,4 @@ ---- etc/report.pl.orig 2016-11-04 16:36:08 UTC +--- etc/report.pl.orig 2018-04-02 20:14:41 UTC +++ etc/report.pl @@ -30,7 +30,7 @@ $pass="rtgdefault"; $onedaysec=60*60*24; @@ -9,3 +9,52 @@ 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 + . Added: head/net/rtg/files/patch-etc_rtg.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-etc_rtg.conf Wed Nov 7 19:40:59 2018 (r484406) @@ -0,0 +1,10 @@ +--- 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 ++ Added: head/net/rtg/files/patch-etc_rtg.php ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/rtg/files/patch-etc_rtg.php Wed Nov 7 19:40:59 2018 (r484406) @@ -0,0 +1,389 @@ +--- etc/rtg.php.orig 2003-09-24 20:42:03 UTC ++++ etc/rtg.php +@@ -1,146 +1,152 @@ + \n\n\n"; ++ print "\n\n\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 "RTG: "; +- if ($rid && $iid) echo "$router: $name"; +- else if ($rid && !$iid) echo "$router"; +- echo "\n"; ++ echo "RTG: "; ++ if (($rid != "") && ($iid != "")) echo "$router: $name"; ++ else if (($rid != "") && ($iid == "")) echo "$router"; ++ echo "\n"; + ?> + +- +- +- +- +- +-

++ ++ ++ ++

+ + \n"; ++echo "

\n"; + +-if (!$rid && !$iid) { +- echo "\n"; ++ $selectQuery="SELECT DISTINCT `name`, `rid` FROM `router` ORDER BY `name`"; ++ $selectResult=mysqli_query($dbc, $selectQuery); ++ while ($selectRow=mysqli_fetch_object($selectResult)){ ++ echo "\n"; + } +- echo "\n"; ++ echo "\n"; + } + +-if ($smonth != "" && $iid == "") { +- echo "
\n"; ++if (($smonth != "") && ($iid == "")) { ++ echo "
\n"; + echo "Please select an interface!\n"; +- echo "
\n"; ++ echo "
\n"; + } + +-if ($rid && !$iid) { +- echo "\n"; ++if (($rid != "") && ($iid == "")) { ++ echo "\n"; + +- echo "\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 "\n"; + } +- echo "\n"; ++ echo "\n"; + +- echo "

\n"; +- echo ""; ++ echo "\n"; ++ ++ echo "\n"; ++ echo "\n"; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From: \n"; +- echo "\n"; ++ echo "\n"; ++ echo ""; ++ echo "\n"; + +- echo "\n"; ++ echo "
From: / \n"; +- echo " / \n"; ++ echo " / \n"; +- echo " / \n"; ++ echo "\n"; +- echo ":\n"; +- echo "\n"; ++ echo "\" />\n"; ++ echo ":\n"; ++ echo "\n"; ++ echo "
To: \n"; +- echo "To: / \n"; +- echo " / \n"; ++ echo " / \n"; +- echo " / \n"; ++ echo "\n"; +- echo ":\n"; +- echo "\n"; +- echo "
Aggregate Interfaces: \n"; +- echo "\n"; +- echo "
th Percentile: \n"; +- echo "\n"; +- echo "
Fit to Data: \n"; +- echo "\n"; +- echo "
Fit to Speed: \n"; +- echo "\n"; +- echo "
X Size: \n"; +- echo "\n"; +- echo "
Y Size: \n"; +- echo "\n"; +- echo "
BorderB: \n"; +- echo "\n"; +- echo "
\n"; ++ echo "\" />\n"; ++ echo "
:\n"; ++ echo "\n"; ++ echo "
Aggregate Interfaces: