mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 03:07:43 +02:00
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into monit
This commit is contained in:
@@ -120,10 +120,10 @@ iptables_init() {
|
||||
iptables -N IPTVFORWARD
|
||||
iptables -A FORWARD -j IPTVFORWARD
|
||||
|
||||
# filtering from GUI
|
||||
iptables -N GUIINPUT
|
||||
iptables -A INPUT -j GUIINPUT
|
||||
iptables -A GUIINPUT -p icmp --icmp-type 8 -j ACCEPT
|
||||
# Allow to ping the firewall.
|
||||
iptables -N ICMPINPUT
|
||||
iptables -A INPUT -j ICMPINPUT
|
||||
iptables -A ICMPINPUT -p icmp --icmp-type 8 -j ACCEPT
|
||||
|
||||
# Accept everything on loopback
|
||||
iptables -N LOOPBACK
|
||||
@@ -179,7 +179,10 @@ iptables_init() {
|
||||
iptables -t nat -A POSTROUTING -j IPSECNAT
|
||||
|
||||
# localhost and ethernet.
|
||||
iptables -A INPUT -i $GREEN_DEV -m conntrack --ctstate NEW -j ACCEPT ! -p icmp
|
||||
# Always allow accessing the web GUI from GREEN.
|
||||
iptables -N GUIINPUT
|
||||
iptables -A INPUT -j GUIINPUT
|
||||
iptables -A GUIINPUT -i "${GREEN_DEV}" -p tcp --dport 444 -j ACCEPT
|
||||
|
||||
# WIRELESS chains
|
||||
iptables -N WIRELESSINPUT
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/icecream
|
||||
#
|
||||
# Description : This is a script that starts the icecream daemon.
|
||||
#
|
||||
# Authors : Michael Tremer (mitch@ipfire.org)
|
||||
#
|
||||
# Version : 01.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
#SCHEDULER=minerva.ipfire.org
|
||||
ENABLE_SCHEDULER=on
|
||||
JOBS=8
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Starting Icecream Daemon..."
|
||||
ARGS="-d -m ${JOBS}"
|
||||
if [ -n "${SCHEDULER}" ]; then
|
||||
ARGS="${ARGS} -s ${SCHEDULER}"
|
||||
fi
|
||||
/opt/icecream/sbin/iceccd ${ARGS}
|
||||
evaluate_retval
|
||||
|
||||
if [ "${ENABLE_SCHEDULER}" = "on" ]; then
|
||||
/opt/icecream/sbin/icecc-scheduler -d
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
boot_mesg "Stopping Icecream Daemon..."
|
||||
killproc /opt/icecream/sbin/iceccd
|
||||
|
||||
if [ "${ENABLE_SCHEDULER}" = "on" ]; then
|
||||
killproc /opt/icecream/sbin/icecc-scheduler
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
${0} stop
|
||||
sleep 1
|
||||
${0} start
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc /opt/icecream/sbin/iceccd
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|reload|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/icecream
|
||||
@@ -43,10 +43,7 @@ case "$1" in
|
||||
(
|
||||
sleep 3
|
||||
pid=$(cat /var/run/sshd.pid 2>/dev/null)
|
||||
[ -n "${pid}" ] && [ -e "/proc/${pid}/oom_score_adj" ] && \
|
||||
echo "-16" > "/proc/${pid}/oom_score_adj" || \
|
||||
[ -e "/proc/${pid}/oom_adj" ] && \
|
||||
echo "-16" > "/proc/${pid}/oom_adj"
|
||||
[ -n "${pid}" ] && echo "-16" > "/proc/${pid}/oom_score_adj"
|
||||
) &
|
||||
;;
|
||||
|
||||
|
||||
@@ -321,10 +321,10 @@ int main(int argc, char *argv[])
|
||||
swap_file = memory / 4;
|
||||
|
||||
/* Calculating Root-Size dependend of Max Disk Space */
|
||||
if ( disk < 756 )
|
||||
root_partition = 200;
|
||||
else if ( disk >= 756 && disk <= 3072 )
|
||||
root_partition = 512;
|
||||
if ( disk < 2048 )
|
||||
root_partition = 1024;
|
||||
else if ( disk >= 2048 && disk <= 3072 )
|
||||
root_partition = 1536;
|
||||
else
|
||||
root_partition = 2048;
|
||||
|
||||
|
||||
@@ -23,7 +23,4 @@
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
extract_files
|
||||
mysqladmin --user=root -pmysqlfire create cacti
|
||||
mysql --user=root -pmysqlfire cacti < /usr/share/cacti/cacti.sql
|
||||
mysql --user=root -pmysqlfire -e "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';" mysql
|
||||
/etc/init.d/apache restart
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
stop_service vdr
|
||||
extract_files
|
||||
start_service --delay 90 --background icecream
|
||||
start_service --background vdr
|
||||
@@ -22,5 +22,6 @@
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
stop_service icecream
|
||||
stop_service vdr
|
||||
remove_files
|
||||
start_service vdr --background
|
||||
@@ -22,5 +22,5 @@
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
/etc/init.d/icecream stop
|
||||
./uninstall.sh
|
||||
./install.sh
|
||||
8166
src/patches/cacti/cacti-0.8.8a-legal.patch
Normal file
8166
src/patches/cacti/cacti-0.8.8a-legal.patch
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,607 @@
|
||||
Description: treeview has a license issue, cacti upstream is going to replace it
|
||||
with functionality from jquery.jstree.
|
||||
.
|
||||
This patch implements the changes needed for an upstream layout where the
|
||||
necessary code is in cacti/include/js/jquery/ but the code in that path is
|
||||
not included in this patch.
|
||||
.
|
||||
The necessary jquery scripts and theme info can come from cacti upstream and from
|
||||
debian packages (libjs-jquery and libjs-jquery-cookie) The version used when
|
||||
creating this patch can be found here:
|
||||
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.js?pathrev=7324
|
||||
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.jstree.js?pathrev=7324
|
||||
http://svn.cacti.net/viewvc/cacti/branches/main/include/js/jquery/themes/default/?pathrev=7324
|
||||
http://anonscm.debian.org/gitweb/?p=pkg-javascript/jquery-goodies.git;a=blob;f=cookie/jquery.cookie.js;hb=c50e1a2d599cb48893e8d77470e71e83e44dfdb5
|
||||
.
|
||||
This patch does NOT implement the changes needed for the Debian package of
|
||||
cacti.
|
||||
.
|
||||
This patch was updated with the patch from Jan Zalesak <zalesak@jaw.cz> in
|
||||
http://bugs.debian.org/702690 which was further improved to also cover
|
||||
lib/graph_export.php and to keep tag alignment consistent.
|
||||
Bug: http://bugs.cacti.net/view.php?id=2228
|
||||
Bug-Debian: http://bugs.debian.org/679980
|
||||
Author: Paul Gevers <elbrus@debian.org>
|
||||
Date: Sun, 31 Mar 2013 11:59:05 +0200
|
||||
|
||||
--- a/include/top_graph_header.php
|
||||
+++ b/include/top_graph_header.php
|
||||
@@ -84,8 +84,9 @@
|
||||
<link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
|
||||
<link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
|
||||
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
|
||||
- <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
|
||||
- <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
|
||||
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.js" language="javascript"></script>
|
||||
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.cookie.js" language="javascript"></script>
|
||||
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.jstree.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
|
||||
@@ -178,7 +179,6 @@
|
||||
<td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;background-repeat:repeat-y;background-color:#efefef;" bgcolor='#efefef' width='<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>' class='noprint'>
|
||||
<table border=0 cellpadding=0 cellspacing=0><tr><td><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td></tr></table>
|
||||
<?php grow_dhtml_trees(); ?>
|
||||
- <script type="text/javascript">initializeDocument();</script>
|
||||
|
||||
<?php if (isset($_GET["select_first"])) { ?>
|
||||
<script type="text/javascript">
|
||||
--- a/lib/graph_export.php
|
||||
+++ b/lib/graph_export.php
|
||||
@@ -1365,15 +1365,6 @@
|
||||
/* create the treeview representation for the html data */
|
||||
grow_dhtml_trees_export($fp,$tree_id);
|
||||
|
||||
- fwrite($fp,"<script type='text/javascript'>initializeDocument();</script>\n");
|
||||
- fwrite($fp,"<script type='text/javascript'>\n");
|
||||
- fwrite($fp,"var obj;\n");
|
||||
- fwrite($fp,"obj = findObj(1);\n");
|
||||
- fwrite($fp,"if (!obj.isOpen) {\n");
|
||||
- fwrite($fp,"clickOnNode(1);\n");
|
||||
- fwrite($fp,"}\n");
|
||||
- fwrite($fp,"clickOnLink(2,'','main');\n");
|
||||
- fwrite($fp,"</script>\n");
|
||||
fwrite($fp,"</td>\n");
|
||||
fwrite($fp,"<td valign='top'>\n");
|
||||
}
|
||||
@@ -1383,16 +1374,7 @@
|
||||
include_once($config["library_path"] . "/tree.php");
|
||||
include_once($config["library_path"] . "/data_query.php");
|
||||
|
||||
- fwrite($fp, "<script type='text/javascript'>\n");
|
||||
- fwrite($fp, "<!--
|
||||
- USETEXTLINKS = 1
|
||||
- STARTALLOPEN = 0
|
||||
- USEFRAMES = 0
|
||||
- USEICONS = 0
|
||||
- WRAPTEXT = 1
|
||||
- ICONPATH = 'treeview/'
|
||||
- PERSERVESTATE = 1
|
||||
- HIGHLIGHT = 1\n");
|
||||
+ fwrite($fp, "<div id=\"jtree\">\n");
|
||||
|
||||
if (read_config_option("export_tree_isolation") == "off") {
|
||||
$dhtml_tree_base = 0;
|
||||
@@ -1413,9 +1395,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
- fwrite($fp,"foldersTree.treeID = \"t2\"
|
||||
- //-->\n
|
||||
- </script>\n");
|
||||
+ fwrite($fp, "</div>\n");
|
||||
+ fwrite($fp, "<script type=\"text/javascript\">\n");
|
||||
+ fwrite($fp, "$(function () {
|
||||
+ $(\"#jtree\")
|
||||
+ .jstree({
|
||||
+ \"plugins\" : [\"ui\",\"themes\",\"html_data\",\"cookies\"],
|
||||
+ \"themes\" : {\"icons\" : false,
|
||||
+ \"url\" : \"./js/style.css\"},
|
||||
+ \"cookies\" : {
|
||||
+ \"save_opened\" : \"Cacti_jstree_open\",
|
||||
+ \"save_selected\" : \"Cacti_jstree_select\"
|
||||
+ }
|
||||
+
|
||||
+ })
|
||||
+
|
||||
+ // Make sure that the nodes are actually used as links
|
||||
+ // We need reselect to prevent endless loops
|
||||
+ // https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
|
||||
+ .bind(\"reselect.jstree\", function (e, data) {
|
||||
+ data.inst.get_container().bind(\"select_node.jstree\", function (e, data) {
|
||||
+ // data.rstl.obj is the object that was selected.
|
||||
+ document.location.href = data.rslt.obj.children(\"a\").attr(\"href\");
|
||||
+ });
|
||||
+ });
|
||||
+
|
||||
+});\n");
|
||||
+ fwrite($fp, "</script>\n");
|
||||
+
|
||||
}
|
||||
|
||||
/* get_graph_tree_array_export - returns a list of graph trees taking permissions into account if
|
||||
@@ -1478,8 +1485,7 @@
|
||||
$dhtml_tree = array();
|
||||
$dhtml_tree[0] = $start;
|
||||
$dhtml_tree[1] = read_graph_config_option("expand_hosts");
|
||||
- $dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
|
||||
- $i = 2;
|
||||
+ $i = 1;
|
||||
|
||||
$tree_list = get_graph_tree_array_export();
|
||||
|
||||
@@ -1499,7 +1505,6 @@
|
||||
if (((read_config_option("export_tree_isolation") == "on") && ($tree_id == $tree["id"])) ||
|
||||
(read_config_option("export_tree_isolation") == "off")) {
|
||||
|
||||
- $i++;
|
||||
|
||||
$hier_sql = "SELECT DISTINCT
|
||||
graph_tree_items.id,
|
||||
@@ -1522,19 +1527,53 @@
|
||||
$dhtml_tree_id = 0;
|
||||
|
||||
if (sizeof($hierarchy) > 0) {
|
||||
+ $last_tier = 1;
|
||||
+ $openli = false;
|
||||
+ $lasthost = false;
|
||||
+ $opentree = false;
|
||||
foreach ($hierarchy as $leaf) {
|
||||
if ($dhtml_tree_id <> $tree["id"]) {
|
||||
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
|
||||
+ if ($opentree) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
|
||||
+ }
|
||||
+ $i++;
|
||||
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
|
||||
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a>\n\t\t\t<ul>\n";
|
||||
+ $opentree = true;
|
||||
}
|
||||
$dhtml_tree_id = $tree["id"];
|
||||
|
||||
- $i++;
|
||||
$tier = tree_tier($leaf["order_key"]);
|
||||
|
||||
if ($leaf["host_id"] > 0) { //It's a host
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"Host: " . $leaf["hostname"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]) . ".html\"))\n";
|
||||
+ if ($tier > $last_tier) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
|
||||
+ } elseif ($tier < $last_tier) {
|
||||
+ if (!$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ }
|
||||
+ for ($x = $tier; $x < $last_tier; $x++) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ } elseif ($openli && !$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ $last_tier = $tier;
|
||||
+ $lasthost = true;
|
||||
+ $i++;
|
||||
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]);
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
|
||||
|
||||
if (read_config_option("export_tree_expand_hosts") == "on") {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t<ul>\n";
|
||||
if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
|
||||
$graph_templates = db_fetch_assoc("SELECT
|
||||
graph_templates.id,
|
||||
@@ -1552,7 +1591,8 @@
|
||||
if (sizeof($graph_templates) > 0) {
|
||||
foreach ($graph_templates as $graph_template) {
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $graph_template["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"]) . "_" . $graph_template["id"] . ".html\"))\n";
|
||||
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"] . "_" . $graph_template["id"]);
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($graph_template["name"]) . "</a></li>\n";
|
||||
}
|
||||
}
|
||||
}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
|
||||
@@ -1567,36 +1607,77 @@
|
||||
|
||||
array_push($data_queries, array(
|
||||
"id" => "0",
|
||||
- "name" => "Graph Template Based"
|
||||
+ "name" => "Non Query Based"
|
||||
));
|
||||
|
||||
if (sizeof($data_queries) > 0) {
|
||||
- foreach ($data_queries as $data_query) {
|
||||
- $i++;
|
||||
-
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $data_query["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . ".html\"))\n";
|
||||
+ foreach ($data_queries as $data_query) {
|
||||
+ $i++;
|
||||
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"] . "_" . $data_query["id"]);
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($data_query["name"]) . "</a>\n";
|
||||
|
||||
- /* fetch a list of field names that are sorted by the preferred sort field */
|
||||
- $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
|
||||
+ /* fetch a list of field names that are sorted by the preferred sort field */
|
||||
+ $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
|
||||
|
||||
- if ($data_query["id"] > 0) {
|
||||
- while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
|
||||
+ if ($data_query["id"] > 0) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t<ul>\n";
|
||||
+ while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
|
||||
+ $i++;
|
||||
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["id"] . "_" . $data_query["id"] . "_" . $snmp_index);
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($sort_field_value) . "</a></li>\n";
|
||||
+ }
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . $sort_field_value . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . "_" . $snmp_index . ".html\"))\n";
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t</ul>\n";
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
|
||||
}
|
||||
}
|
||||
- }
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
|
||||
}
|
||||
- }else {
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"" . $leaf["title"] . "\", \"" . clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]) . "_leaf.html\"))\n";
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ }else { //It's not a host
|
||||
+ if ($tier > $last_tier) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
|
||||
+ } elseif ($tier < $last_tier) {
|
||||
+ if (!$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "</li>\n";
|
||||
+ }
|
||||
+ for ($x = $tier; $x < $last_tier; $x++) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ } elseif ($openli && !$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ $last_tier = $tier;
|
||||
+ $i++;
|
||||
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]);
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . htmlspecialchars($leaf["title"]) . "</a>\n";
|
||||
+ $openli = true;
|
||||
+ $lasthost = false;
|
||||
}
|
||||
}
|
||||
+ for ($x = $last_tier; $x > 1; $x--) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ }
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
|
||||
}else{
|
||||
if ($dhtml_tree_id <> $tree["id"]) {
|
||||
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
|
||||
$i++;
|
||||
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
|
||||
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "_leaf\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a></li>\n\t</ul>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1612,10 +1693,10 @@
|
||||
$dir - the export directory where graphs will either be staged or located.
|
||||
*/
|
||||
function create_export_directory_structure($cacti_root_path, $dir) {
|
||||
- /* create the treeview sub-directory */
|
||||
- if (!is_dir("$dir/treeview")) {
|
||||
- if (!mkdir("$dir/treeview", 0755)) {
|
||||
- export_fatal("Create directory '" . $dir . "/treeview' failed. Can not continue");
|
||||
+ /* create the jquery sub-directory */
|
||||
+ if (!is_dir("$dir/js")) {
|
||||
+ if (!mkdir("$dir/js", 0755)) {
|
||||
+ export_fatal("Create directory '" . $dir . "/js' failed. Can not continue");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,8 +1707,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- $treeview_dir = $dir . "/treeview";
|
||||
-
|
||||
/* css */
|
||||
copy("$cacti_root_path/include/main.css", "$dir/main.css");
|
||||
|
||||
@@ -1639,18 +1718,15 @@
|
||||
copy("$cacti_root_path/images/shadow_gray.gif", "$dir/shadow_gray.gif");
|
||||
|
||||
/* java scripts for the tree */
|
||||
- copy("$cacti_root_path/include/treeview/ftiens4_export.js", "$treeview_dir/ftiens4.js");
|
||||
- copy("$cacti_root_path/include/treeview/ua.js", "$treeview_dir/ua.js");
|
||||
-
|
||||
- /* images for the tree */
|
||||
- copy("$cacti_root_path/include/treeview/ftv2blank.gif", "$treeview_dir/ftv2blank.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2lastnode.gif", "$treeview_dir/ftv2lastnode.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2mlastnode.gif", "$treeview_dir/ftv2mlastnode.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2mnode.gif", "$treeview_dir/ftv2mnode.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2node.gif", "$treeview_dir/ftv2node.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2plastnode.gif", "$treeview_dir/ftv2plastnode.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2pnode.gif", "$treeview_dir/ftv2pnode.gif");
|
||||
- copy("$cacti_root_path/include/treeview/ftv2vertline.gif", "$treeview_dir/ftv2vertline.gif");
|
||||
+ copy("$cacti_root_path/include/js/jquery/jquery.js", "$dir/js/jquery.js");
|
||||
+ copy("$cacti_root_path/include/js/jquery/jquery.jstree.js", "$dir/js/jquery.jstree.js");
|
||||
+ copy("$cacti_root_path/include/js/jquery/jquery.cookie.js", "$dir/js/jquery.cookie.js");
|
||||
+
|
||||
+ /* theme info for java scripts */
|
||||
+ copy("$cacti_root_path/include/js/jquery/themes/default/style.css", "$dir/js/style.css");
|
||||
+ copy("$cacti_root_path/include/js/jquery/themes/default/d.png", "$dir/js/d.png");
|
||||
+ copy("$cacti_root_path/include/js/jquery/themes/default/d.gif", "$dir/js/d.gif");
|
||||
+ copy("$cacti_root_path/include/js/jquery/themes/default/throbber.gif", "$dir/js/throbber.gif");
|
||||
}
|
||||
|
||||
function get_host_description($host_id) {
|
||||
@@ -1738,8 +1814,9 @@
|
||||
<meta http-equiv=refresh content='300'; url='index.html'>
|
||||
<meta http-equiv=Pragma content=no-cache>
|
||||
<meta http-equiv=cache-control content=no-cache>
|
||||
- <script type=\"text/javascript\" src=\"./treeview/ua.js\"></script>
|
||||
- <script type=\"text/javascript\" src=\"./treeview/ftiens4.js\"></script>
|
||||
+ <script type=\"text/javascript\" src=\"./js/jquery.js\" language=\"javascript\"></script>
|
||||
+ <script type=\"text/javascript\" src=\"./js/jquery.cookie.js\" language=\"javascript\"></script>
|
||||
+ <script type=\"text/javascript\" src=\"./js/jquery.jstree.js\" language=\"javascript\"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table style='width:100%;height:100%;' cellspacing='0' cellpadding='0'>
|
||||
--- a/lib/html_tree.php
|
||||
+++ b/lib/html_tree.php
|
||||
@@ -495,17 +495,9 @@
|
||||
include_once($config["library_path"] . "/data_query.php");
|
||||
|
||||
?>
|
||||
- <script type="text/javascript">
|
||||
- <!--
|
||||
- USETEXTLINKS = 1
|
||||
- STARTALLOPEN = 0
|
||||
- USEFRAMES = 0
|
||||
- USEICONS = 0
|
||||
- WRAPTEXT = 1
|
||||
- PERSERVESTATE = 1
|
||||
- HIGHLIGHT = 1
|
||||
<?php
|
||||
/* get current time */
|
||||
+/* Probably not needed anymore as jstree uses jquery.cookies
|
||||
list($micro,$seconds) = explode(" ", microtime());
|
||||
$current_time = $seconds + $micro;
|
||||
$expand_hosts = read_graph_config_option("expand_hosts");
|
||||
@@ -522,6 +514,8 @@
|
||||
$dhtml_tree = $_SESSION['dhtml_tree'];
|
||||
}
|
||||
}
|
||||
+*/
|
||||
+ $dhtml_tree = create_dhtml_tree();
|
||||
|
||||
$total_tree_items = sizeof($dhtml_tree) - 1;
|
||||
|
||||
@@ -529,8 +523,31 @@
|
||||
print $dhtml_tree[$i];
|
||||
}
|
||||
?>
|
||||
- //-->
|
||||
- </script>
|
||||
+<script type="text/javascript">
|
||||
+$(function () {
|
||||
+ $("#jtree")
|
||||
+ .jstree({
|
||||
+ "plugins" : ["ui","themes","html_data","cookies"],
|
||||
+ "themes" : {"icons" : false,
|
||||
+ "url" : "<?php echo $config['url_path']; ?>include/js/jquery/themes/default/style.css"},
|
||||
+ "cookies" : {
|
||||
+ "save_opened" : "Cacti_jstree_open",
|
||||
+ "save_selected" : "Cacti_jstree_select"
|
||||
+ }
|
||||
+ })
|
||||
+
|
||||
+ // Make sure that the nodes are actually used as links
|
||||
+ // We need reselect to prevent endless loops
|
||||
+ // https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
|
||||
+ .bind("reselect.jstree", function (e, data) {
|
||||
+ data.inst.get_container().bind("select_node.jstree", function (e, data) {
|
||||
+ // data.rstl.obj is the object that was selected.
|
||||
+ document.location.href = data.rslt.obj.children("a").attr("href");
|
||||
+ });
|
||||
+ });
|
||||
+
|
||||
+});
|
||||
+</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -543,9 +560,8 @@
|
||||
|
||||
$dhtml_tree[0] = $start;
|
||||
$dhtml_tree[1] = read_graph_config_option("expand_hosts");
|
||||
- $dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
|
||||
- $dhtml_tree[3] = "foldersTree.xID = \"root\"\n";
|
||||
- $i = 3;
|
||||
+ $dhtml_tree[2] = "\n<div id=\"jtree\">\n";
|
||||
+ $i = 2;
|
||||
|
||||
$tree_list = get_graph_tree_array();
|
||||
|
||||
@@ -567,7 +583,6 @@
|
||||
|
||||
if (sizeof($tree_list) > 0) {
|
||||
foreach ($tree_list as $tree) {
|
||||
- $i++;
|
||||
$hierarchy = db_fetch_assoc("select
|
||||
graph_tree_items.id,
|
||||
graph_tree_items.title,
|
||||
@@ -583,21 +598,45 @@
|
||||
and graph_tree_items.local_graph_id = 0
|
||||
order by graph_tree_items.order_key");
|
||||
|
||||
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . htmlspecialchars($tree["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\"))\n";
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou0.xID = \"tree_" . $tree["id"] . "\"\n";
|
||||
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\">" . htmlspecialchars($tree["name"]) . "</a>\n";
|
||||
|
||||
if (sizeof($hierarchy) > 0) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
|
||||
+ $last_tier = 1;
|
||||
+ $openli = false;
|
||||
+ $lasthost = false;
|
||||
foreach ($hierarchy as $leaf) {
|
||||
- $i++;
|
||||
$tier = tree_tier($leaf["order_key"]);
|
||||
|
||||
- if ($leaf["host_id"] > 0) {
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . "Host: " . htmlspecialchars($leaf["hostname"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
|
||||
+ if ($leaf["host_id"] > 0) { //It's a host
|
||||
+ if ($tier > $last_tier) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
|
||||
+ } elseif ($tier < $last_tier) {
|
||||
+ if (!$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ }
|
||||
+ for ($x = $tier; $x < $last_tier; $x++) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ } elseif ($openli && !$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ $last_tier = $tier;
|
||||
+ $lasthost = true;
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
|
||||
|
||||
if (read_graph_config_option("expand_hosts") == "on") {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t<ul>\n";
|
||||
if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
|
||||
$graph_templates = db_fetch_assoc("select
|
||||
graph_templates.id,
|
||||
@@ -612,9 +651,7 @@
|
||||
if (sizeof($graph_templates) > 0) {
|
||||
foreach ($graph_templates as $graph_template) {
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($graph_template["name"]) . "\", \"graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=graph_template:" . $graph_template["id"] . "\"))\n";
|
||||
- $i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_gt_" . $graph_template["id"] . "\"\n";
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_gt_" . $graph_template["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=graph_template:" . $graph_template["id"]) . "\">" . htmlspecialchars($graph_template["name"]) . "</a></li>\n";
|
||||
}
|
||||
}
|
||||
}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
|
||||
@@ -645,33 +682,71 @@
|
||||
if ((($data_query["id"] == 0) && ($non_template_graphs > 0)) ||
|
||||
(($data_query["id"] > 0) && (sizeof($sort_field_data) > 0))) {
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($data_query["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query:" . $data_query["id"]) . "\"))\n";
|
||||
- $i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dq_" . $data_query["id"] . "\"\n";
|
||||
-
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dq_" . $data_query["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query:" . $data_query["id"]) . "\">" . htmlspecialchars($data_query["name"]) . "</a>\n";
|
||||
if ($data_query["id"] > 0) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t<ul>\n";
|
||||
while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . htmlspecialchars($sort_field_value) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query_index:" . $data_query["id"] . ":" . urlencode($snmp_index)) . "\"))\n";
|
||||
- $i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier+2) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dqi" . $data_query["id"] . "_" . urlencode($snmp_index) . "\"\n";
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dqi" . $data_query["id"]) . "_" . urlencode($snmp_index) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query_index:" . $data_query["id"] . ":" . urlencode($snmp_index)) . "\">" . htmlspecialchars($sort_field_value) . "</a></li>\n";
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t</ul>\n";
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
|
||||
+ }
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
|
||||
+ }
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
|
||||
+ }else{ //It's not a host
|
||||
+ if ($tier > $last_tier) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
|
||||
+ } elseif ($tier < $last_tier) {
|
||||
+ if (!$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "</li>\n";
|
||||
}
|
||||
+ for ($x = $tier; $x < $last_tier; $x++) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ $openli = false;
|
||||
+ }
|
||||
+ } elseif ($openli && !$lasthost) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "</li>\n";
|
||||
+ $openli = false;
|
||||
}
|
||||
- }else{
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . htmlspecialchars($leaf["title"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
|
||||
+ $last_tier = $tier;
|
||||
$i++;
|
||||
- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">" . htmlspecialchars($leaf["title"]) . "</a>\n";
|
||||
+ $openli = true;
|
||||
+ $lasthost = false;
|
||||
}
|
||||
}
|
||||
+ for ($x = $last_tier; $x > 1; $x--) {
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
|
||||
+ }
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t\t</ul>\n";
|
||||
}
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "\t\t</li>\n\t</ul>\n";
|
||||
}
|
||||
}
|
||||
|
||||
+ $i++;
|
||||
+ $dhtml_tree[$i] = "</div>\n";
|
||||
+
|
||||
return $dhtml_tree;
|
||||
}
|
||||
|
||||
@@ -758,14 +833,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- print "<script type=\"text/javascript\">\n";
|
||||
- print "<!--\n";
|
||||
- print "myNode = findObj(\"$nodeid\")\n";
|
||||
- print "myNode.forceOpeningOfAncestorFolders();\n";
|
||||
- print "highlightObjLink(myNode)\n";
|
||||
- print "//-->\n";
|
||||
- print "</script>";
|
||||
-
|
||||
/* ================= input validation ================= */
|
||||
input_validate_input_number(get_request_var_post("graphs"));
|
||||
input_validate_input_number(get_request_var_post("page"));
|
||||
19
src/patches/cacti/cacti-0.8.8b-html-injection.patch
Normal file
19
src/patches/cacti/cacti-0.8.8b-html-injection.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
------------------------------------------------------------------------
|
||||
r7443 | rony | 2014-03-30 18:43:28 -0500 (Sun, 30 Mar 2014) | 2 lines
|
||||
|
||||
bug#0002431: CVE-2014-2326 Unspecified HTML Injection Vulnerability
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: branches/0.8.8/cdef.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/cdef.php (revision 7442)
|
||||
+++ branches/0.8.8/cdef.php (revision 7443)
|
||||
@@ -431,7 +431,7 @@
|
||||
<a class="linkEditMain" href="<?php print htmlspecialchars("cdef.php?action=item_edit&id=" . $cdef_item["id"] . "&cdef_id=" . $cdef["id"]);?>">Item #<?php print htmlspecialchars($i);?></a>
|
||||
</td>
|
||||
<td>
|
||||
- <em><?php $cdef_item_type = $cdef_item["type"]; print $cdef_item_types[$cdef_item_type];?></em>: <strong><?php print get_cdef_item_name($cdef_item["id"]);?></strong>
|
||||
+ <em><?php $cdef_item_type = $cdef_item["type"]; print $cdef_item_types[$cdef_item_type];?></em>: <strong><?php print htmlspecialchars(get_cdef_item_name($cdef_item["id"]));?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php print htmlspecialchars("cdef.php?action=item_movedown&id=" . $cdef_item["id"] . "&cdef_id=" . $cdef["id"]);?>"><img src="images/move_down.gif" border="0" alt="Move Down"></a>
|
||||
@@ -0,0 +1,28 @@
|
||||
------------------------------------------------------------------------
|
||||
r7442 | rony | 2014-03-30 18:41:56 -0500 (Sun, 30 Mar 2014) | 2 lines
|
||||
|
||||
bug#0002433: CVE-2014-2328 Unspecified Remote Command Execution Vulnerability
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: branches/0.8.8/lib/graph_export.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/lib/graph_export.php (revision 7441)
|
||||
+++ branches/0.8.8/lib/graph_export.php (revision 7442)
|
||||
@@ -339,7 +339,7 @@
|
||||
chdir($stExportDir);
|
||||
|
||||
/* set the initial command structure */
|
||||
- $stExecute = 'ncftpput -R -V -r 1 -u '.$aFtpExport['username'].' -p '.$aFtpExport['password'];
|
||||
+ $stExecute = 'ncftpput -R -V -r 1 -u ' . cacti_escapeshellarg($aFtpExport['username']) . ' -p ' . cacti_escapeshellarg($aFtpExport['password']);
|
||||
|
||||
/* if the user requested passive mode, use it */
|
||||
if ($aFtpExport['passive']) {
|
||||
@@ -347,7 +347,7 @@
|
||||
}
|
||||
|
||||
/* setup the port, server, remote directory and all files */
|
||||
- $stExecute .= ' -P ' . $aFtpExport['port'] . ' ' . $aFtpExport['server'] . ' ' . $aFtpExport['remotedir'] . ".";
|
||||
+ $stExecute .= ' -P ' . cacti_escapeshellarg($aFtpExport['port']) . ' ' . cacti_escapeshellarg($aFtpExport['server']) . ' ' . cacti_escapeshellarg($aFtpExport['remotedir']) . ".";
|
||||
|
||||
/* run the command */
|
||||
$iExecuteReturns = 0;
|
||||
42
src/patches/cacti/cacti-0.8.8b-rra-comments.patch
Normal file
42
src/patches/cacti/cacti-0.8.8b-rra-comments.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
------------------------------------------------------------------------
|
||||
r7418 | gandalf | 2013-08-13 13:32:49 -0600 (Tue, 13 Aug 2013) | 1 line
|
||||
|
||||
fix COMMENT handling, even in case COMMENT is empty, with or without HR and with variable substitution
|
||||
------------------------------------------------------------------------
|
||||
Index: branches/0.8.8/lib/rrd.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/lib/rrd.php (revision 7417)
|
||||
+++ branches/0.8.8/lib/rrd.php (revision 7418)
|
||||
@@ -1343,20 +1343,20 @@
|
||||
$need_rrd_nl = TRUE;
|
||||
|
||||
if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
|
||||
+ # perform variable substitution first (in case this will yield an empty results or brings command injection problems)
|
||||
+ $comment_arg = rrd_substitute_host_query_data($graph_variables["text_format"][$graph_item_id], $graph, $graph_item);
|
||||
+ # next, compute the argument of the COMMENT statement and perform injection counter measures
|
||||
+ if (trim($comment_arg) == '') { # an empty COMMENT must be treated with care
|
||||
+ $comment_arg = cacti_escapeshellarg(' ' . $hardreturn[$graph_item_id]);
|
||||
+ } else {
|
||||
+ $comment_arg = cacti_escapeshellarg($comment_arg . $hardreturn[$graph_item_id]);
|
||||
+ }
|
||||
+
|
||||
+ # create rrdtool specific command line
|
||||
if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
|
||||
- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id])) . " ";
|
||||
- if (trim($comment_string) == 'COMMENT:"\n"') {
|
||||
- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
|
||||
- } else if (trim($comment_string) != "COMMENT:\"\"") {
|
||||
- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
|
||||
- }
|
||||
+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", $comment_arg) . " ";
|
||||
}else {
|
||||
- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id]) . " ";
|
||||
- if (trim($comment_string) == 'COMMENT:"\n"') {
|
||||
- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
|
||||
- } else if (trim($comment_string) != "COMMENT:\"\"") {
|
||||
- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
|
||||
- }
|
||||
+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . $comment_arg . " ";
|
||||
}
|
||||
}elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
|
||||
$graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */
|
||||
155
src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch
Normal file
155
src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch
Normal file
@@ -0,0 +1,155 @@
|
||||
------------------------------------------------------------------------
|
||||
r7420 | cigamit | 2013-08-17 21:41:24 -0600 (Sat, 17 Aug 2013) | 1 line
|
||||
|
||||
Bug #0002383 : Sanitize the step and id variables
|
||||
------------------------------------------------------------------------
|
||||
Index: branches/0.8.8/host.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/host.php (revision 7419)
|
||||
+++ branches/0.8.8/host.php (revision 7420)
|
||||
@@ -149,6 +149,9 @@
|
||||
if ($_POST["snmp_version"] == 3 && ($_POST["snmp_password"] != $_POST["snmp_password_confirm"])) {
|
||||
raise_message(4);
|
||||
}else{
|
||||
+ input_validate_input_number(get_request_var_post("id"));
|
||||
+ input_validate_input_number(get_request_var_post("host_template_id"));
|
||||
+
|
||||
$host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
|
||||
trim($_POST["hostname"]), $_POST["snmp_community"], $_POST["snmp_version"],
|
||||
$_POST["snmp_username"], $_POST["snmp_password"],
|
||||
Index: branches/0.8.8/lib/api_device.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/lib/api_device.php (revision 7419)
|
||||
+++ branches/0.8.8/lib/api_device.php (revision 7420)
|
||||
@@ -107,7 +107,7 @@
|
||||
$_host_template_id = db_fetch_cell("select host_template_id from host where id=$id");
|
||||
}
|
||||
|
||||
- $save["id"] = $id;
|
||||
+ $save["id"] = form_input_validate($id, "id", "^[0-9]+$", false, 3);
|
||||
$save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+$", false, 3);
|
||||
$save["description"] = form_input_validate($description, "description", "", false, 3);
|
||||
$save["hostname"] = form_input_validate(trim($hostname), "hostname", "", false, 3);
|
||||
Index: branches/0.8.8/install/index.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/install/index.php (revision 7419)
|
||||
+++ branches/0.8.8/install/index.php (revision 7420)
|
||||
@@ -310,27 +310,28 @@
|
||||
}
|
||||
|
||||
/* pre-processing that needs to be done for each step */
|
||||
-if (empty($_REQUEST["step"])) {
|
||||
- $_REQUEST["step"] = 1;
|
||||
-}else{
|
||||
- if ($_REQUEST["step"] == "1") {
|
||||
- $_REQUEST["step"] = "2";
|
||||
- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "1")) {
|
||||
- $_REQUEST["step"] = "3";
|
||||
- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "3")) {
|
||||
- $_REQUEST["step"] = "8";
|
||||
- }elseif (($_REQUEST["step"] == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
|
||||
- $_REQUEST["step"] = "9";
|
||||
- }elseif ($_REQUEST["step"] == "8") {
|
||||
- $_REQUEST["step"] = "3";
|
||||
- }elseif ($_REQUEST["step"] == "9") {
|
||||
- $_REQUEST["step"] = "3";
|
||||
- }elseif ($_REQUEST["step"] == "3") {
|
||||
- $_REQUEST["step"] = "4";
|
||||
+if (isset($_REQUEST["step"]) && $_REQUEST["step"] > 0) {
|
||||
+ $step = intval($_REQUEST["step"]);
|
||||
+ if ($step == "1") {
|
||||
+ $step = "2";
|
||||
+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "1")) {
|
||||
+ $step = "3";
|
||||
+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "3")) {
|
||||
+ $step = "8";
|
||||
+ } elseif (($step == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
|
||||
+ $step = "9";
|
||||
+ } elseif ($step == "8") {
|
||||
+ $step = "3";
|
||||
+ } elseif ($step == "9") {
|
||||
+ $step = "3";
|
||||
+ } elseif ($step == "3") {
|
||||
+ $step = "4";
|
||||
}
|
||||
+} else {
|
||||
+ $step = 1;
|
||||
}
|
||||
|
||||
-if ($_REQUEST["step"] == "4") {
|
||||
+if ($step == "4") {
|
||||
include_once("../lib/data_query.php");
|
||||
include_once("../lib/utility.php");
|
||||
|
||||
@@ -366,7 +367,7 @@
|
||||
|
||||
header ("Location: ../index.php");
|
||||
exit;
|
||||
-}elseif (($_REQUEST["step"] == "8") && ($_REQUEST["install_type"] == "3")) {
|
||||
+}elseif (($step == "8") && ($_REQUEST["install_type"] == "3")) {
|
||||
/* if the version is not found, die */
|
||||
if (!is_int($old_version_index)) {
|
||||
print " <p style='font-family: Verdana, Arial; font-size: 16px; font-weight: bold; color: red;'>Error</p>
|
||||
@@ -505,7 +506,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" style="font-size: 12px;">
|
||||
- <?php if ($_REQUEST["step"] == "1") { ?>
|
||||
+ <?php if ($step == "1") { ?>
|
||||
|
||||
<p>Thanks for taking the time to download and install cacti, the complete graphing
|
||||
solution for your network. Before you can start making cool graphs, there are a few
|
||||
@@ -530,7 +531,7 @@
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.</p>
|
||||
|
||||
- <?php }elseif ($_REQUEST["step"] == "2") { ?>
|
||||
+ <?php }elseif ($step == "2") { ?>
|
||||
|
||||
<p>Please select the type of installation</p>
|
||||
|
||||
@@ -551,7 +552,7 @@
|
||||
print "Server Operating System Type: " . $config["cacti_server_os"] . "<br>"; ?>
|
||||
</p>
|
||||
|
||||
- <?php }elseif ($_REQUEST["step"] == "3") { ?>
|
||||
+ <?php }elseif ($step == "3") { ?>
|
||||
|
||||
<p>Make sure all of these values are correct before continuing.</p>
|
||||
<?php
|
||||
@@ -609,7 +610,7 @@
|
||||
is an upgrade. You can change any of the settings on this screen at a later
|
||||
time by going to "Cacti Settings" from within Cacti.</p>
|
||||
|
||||
- <?php }elseif ($_REQUEST["step"] == "8") { ?>
|
||||
+ <?php }elseif ($step == "8") { ?>
|
||||
|
||||
<p>Upgrade results:</p>
|
||||
|
||||
@@ -659,7 +660,7 @@
|
||||
print $upgrade_results;
|
||||
?>
|
||||
|
||||
- <?php }elseif ($_REQUEST["step"] == "9") { ?>
|
||||
+ <?php }elseif ($step == "9") { ?>
|
||||
|
||||
<p style='font-size: 16px; font-weight: bold; color: red;'>Important Upgrade Notice</p>
|
||||
|
||||
@@ -673,7 +674,7 @@
|
||||
|
||||
<?php }?>
|
||||
|
||||
- <p align="right"><input type="image" src="install_<?php if ($_REQUEST["step"] == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($_REQUEST["step"] == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
|
||||
+ <p align="right"><input type="image" src="install_<?php if ($step == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($step == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -681,7 +682,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
-<input type="hidden" name="step" value="<?php print $_REQUEST["step"];?>">
|
||||
+<input type="hidden" name="step" value="<?php print $step;?>">
|
||||
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
------------------------------------------------------------------------
|
||||
r7439 | rony | 2014-03-30 17:52:10 -0500 (Sun, 30 Mar 2014) | 5 lines
|
||||
|
||||
bug#0002405: SQL injection in graph_xport.php
|
||||
|
||||
- Fixed form input validation problems
|
||||
- Fixed rrd export and graph shell escape issues
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: branches/0.8.8/graph_xport.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/graph_xport.php (revision 7438)
|
||||
+++ branches/0.8.8/graph_xport.php (revision 7439)
|
||||
@@ -47,43 +47,48 @@
|
||||
|
||||
$graph_data_array = array();
|
||||
|
||||
+/* ================= input validation ================= */
|
||||
+input_validate_input_number(get_request_var("local_graph_id"));
|
||||
+input_validate_input_number(get_request_var("rra_id"));
|
||||
+/* ==================================================== */
|
||||
+
|
||||
/* override: graph start time (unix time) */
|
||||
-if (!empty($_GET["graph_start"]) && $_GET["graph_start"] < 1600000000) {
|
||||
- $graph_data_array["graph_start"] = $_GET["graph_start"];
|
||||
+if (!empty($_GET["graph_start"]) && is_numeric($_GET["graph_start"] && $_GET["graph_start"] < 1600000000)) {
|
||||
+ $graph_data_array["graph_start"] = get_request_var("graph_start");
|
||||
}
|
||||
|
||||
/* override: graph end time (unix time) */
|
||||
-if (!empty($_GET["graph_end"]) && $_GET["graph_end"] < 1600000000) {
|
||||
- $graph_data_array["graph_end"] = $_GET["graph_end"];
|
||||
+if (!empty($_GET["graph_end"]) && is_numeric($_GET["graph_end"]) && $_GET["graph_end"] < 1600000000) {
|
||||
+ $graph_data_array["graph_end"] = get_request_var("graph_end");
|
||||
}
|
||||
|
||||
/* override: graph height (in pixels) */
|
||||
-if (!empty($_GET["graph_height"]) && $_GET["graph_height"] < 3000) {
|
||||
- $graph_data_array["graph_height"] = $_GET["graph_height"];
|
||||
+if (!empty($_GET["graph_height"]) && is_numeric($_GET["graph_height"]) && $_GET["graph_height"] < 3000) {
|
||||
+ $graph_data_array["graph_height"] = get_request_var("graph_height");
|
||||
}
|
||||
|
||||
/* override: graph width (in pixels) */
|
||||
-if (!empty($_GET["graph_width"]) && $_GET["graph_width"] < 3000) {
|
||||
- $graph_data_array["graph_width"] = $_GET["graph_width"];
|
||||
+if (!empty($_GET["graph_width"]) && is_numeric($_GET["graph_width"]) && $_GET["graph_width"] < 3000) {
|
||||
+ $graph_data_array["graph_width"] = get_request_var("graph_width");
|
||||
}
|
||||
|
||||
/* override: skip drawing the legend? */
|
||||
if (!empty($_GET["graph_nolegend"])) {
|
||||
- $graph_data_array["graph_nolegend"] = $_GET["graph_nolegend"];
|
||||
+ $graph_data_array["graph_nolegend"] = get_request_var("graph_nolegend");
|
||||
}
|
||||
|
||||
/* print RRDTool graph source? */
|
||||
if (!empty($_GET["show_source"])) {
|
||||
- $graph_data_array["print_source"] = $_GET["show_source"];
|
||||
+ $graph_data_array["print_source"] = get_request_var("show_source");
|
||||
}
|
||||
|
||||
-$graph_info = db_fetch_row("SELECT * FROM graph_templates_graph WHERE local_graph_id='" . $_REQUEST["local_graph_id"] . "'");
|
||||
+$graph_info = db_fetch_row("SELECT * FROM graph_templates_graph WHERE local_graph_id='" . get_request_var("local_graph_id") . "'");
|
||||
|
||||
/* for bandwidth, NThPercentile */
|
||||
$xport_meta = array();
|
||||
|
||||
/* Get graph export */
|
||||
-$xport_array = @rrdtool_function_xport($_GET["local_graph_id"], $_GET["rra_id"], $graph_data_array, $xport_meta);
|
||||
+$xport_array = @rrdtool_function_xport($_GET["local_graph_id"], get_request_var("rra_id"), $graph_data_array, $xport_meta);
|
||||
|
||||
/* Make graph title the suggested file name */
|
||||
if (is_array($xport_array["meta"])) {
|
||||
Index: branches/0.8.8/lib/rrd.php
|
||||
===================================================================
|
||||
--- branches/0.8.8/lib/rrd.php (revision 7438)
|
||||
+++ branches/0.8.8/lib/rrd.php (revision 7439)
|
||||
@@ -865,13 +865,13 @@
|
||||
/* basic graph options */
|
||||
$graph_opts .=
|
||||
"--imgformat=" . $image_types{$graph["image_format_id"]} . RRD_NL .
|
||||
- "--start=$graph_start" . RRD_NL .
|
||||
- "--end=$graph_end" . RRD_NL .
|
||||
+ "--start=" . cacti_escapeshellarg($graph_start) . RRD_NL .
|
||||
+ "--end=" . cacti_escapeshellarg($graph_end) . RRD_NL .
|
||||
"--title=" . cacti_escapeshellarg($graph["title_cache"]) . RRD_NL .
|
||||
"$rigid" .
|
||||
- "--base=" . $graph["base_value"] . RRD_NL .
|
||||
- "--height=$graph_height" . RRD_NL .
|
||||
- "--width=$graph_width" . RRD_NL .
|
||||
+ "--base=" . cacti_escapeshellarg($graph["base_value"]) . RRD_NL .
|
||||
+ "--height=" . cacti_escapeshellarg($graph_height) . RRD_NL .
|
||||
+ "--width=" . cacti_escapeshellarg($graph_width) . RRD_NL .
|
||||
"$scale" .
|
||||
"$unit_value" .
|
||||
"$unit_exponent_value" .
|
||||
@@ -1606,8 +1606,8 @@
|
||||
|
||||
/* basic export options */
|
||||
$xport_opts =
|
||||
- "--start=$xport_start" . RRD_NL .
|
||||
- "--end=$xport_end" . RRD_NL .
|
||||
+ "--start=" . cacti_escapeshellarg($xport_start) . RRD_NL .
|
||||
+ "--end=" . cacti_escapeshellarg($xport_end) . RRD_NL .
|
||||
"--maxrows=10000" . RRD_NL;
|
||||
|
||||
$xport_defs = "";
|
||||
@@ -1997,7 +1997,7 @@
|
||||
$stacked_columns["col" . $j] = ($graph_item_types{$xport_item["graph_type_id"]} == "STACK") ? 1 : 0;
|
||||
$j++;
|
||||
|
||||
- $txt_xport_items .= "XPORT:" . $data_source_name . ":" . str_replace(":", "", cacti_escapeshellarg($legend_name)) ;
|
||||
+ $txt_xport_items .= "XPORT:" . cacti_escapeshellarg($data_source_name) . ":" . str_replace(":", "", cacti_escapeshellarg($legend_name)) ;
|
||||
}else{
|
||||
$need_rrd_nl = FALSE;
|
||||
}
|
||||
69
src/patches/hostname-rh.patch
Normal file
69
src/patches/hostname-rh.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
diff -up hostname/Makefile.rh hostname/Makefile
|
||||
--- hostname/Makefile.rh 2013-11-04 10:12:59.670379153 +0100
|
||||
+++ hostname/Makefile 2013-11-04 10:15:04.957314495 +0100
|
||||
@@ -10,21 +10,17 @@ OBJS=hostname.o
|
||||
|
||||
hostname: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lnsl
|
||||
- ln -fs hostname dnsdomainname
|
||||
- ln -fs hostname domainname
|
||||
- ln -fs hostname ypdomainname
|
||||
- ln -fs hostname nisdomainname
|
||||
|
||||
install: hostname
|
||||
install -d ${BASEDIR}$(MANDIR)/man1
|
||||
- install -o root -g root -m 0644 hostname.1 ${BASEDIR}$(MANDIR)/man1
|
||||
+ install -m 0644 hostname.1 ${BASEDIR}$(MANDIR)/man1
|
||||
ln -fs hostname.1 ${BASEDIR}$(MANDIR)/man1/dnsdomainname.1
|
||||
ln -fs hostname.1 ${BASEDIR}$(MANDIR)/man1/domainname.1
|
||||
ln -fs hostname.1 ${BASEDIR}$(MANDIR)/man1/ypdomainname.1
|
||||
ln -fs hostname.1 ${BASEDIR}$(MANDIR)/man1/nisdomainname.1
|
||||
|
||||
install -d ${BASEDIR}$(BINDIR)
|
||||
- install -o root -g root -m 0755 hostname ${BASEDIR}$(BINDIR)
|
||||
+ install -m 0755 hostname ${BASEDIR}$(BINDIR)
|
||||
ln -fs hostname ${BASEDIR}$(BINDIR)/dnsdomainname
|
||||
ln -fs hostname ${BASEDIR}$(BINDIR)/domainname
|
||||
ln -fs hostname ${BASEDIR}$(BINDIR)/nisdomainname
|
||||
diff -up hostname/hostname.1.rh hostname/hostname.1
|
||||
--- hostname/hostname.1.rh 2013-11-03 15:24:23.000000000 +0100
|
||||
+++ hostname/hostname.1 2013-11-04 10:12:59.670379153 +0100
|
||||
@@ -80,6 +80,28 @@ complete FQDN of the system is returned
|
||||
.B "THE FQDN"
|
||||
below).
|
||||
|
||||
+.LP
|
||||
+The function
|
||||
+.BR gethostname(2)
|
||||
+is used to get the hostname. When the
|
||||
+.BR "hostname \-a, \-d, \-f or \-i"
|
||||
+is called will
|
||||
+.BR gethostbyname(3)
|
||||
+be called. The difference in
|
||||
+.BR gethostname(2)
|
||||
+and
|
||||
+.BR gethostbyname(3)
|
||||
+is that
|
||||
+.BR gethostbyname(3)
|
||||
+is network aware, so it consults
|
||||
+.IR /etc/nsswitch.conf
|
||||
+and
|
||||
+.IR /etc/host.conf
|
||||
+to decide whether to read information in
|
||||
+.IR /etc/hostname
|
||||
+or
|
||||
+.IR /etc/hosts
|
||||
+
|
||||
.SS "SET NAME"
|
||||
When called with one argument or with the
|
||||
.B \-\-file
|
||||
@@ -105,8 +127,7 @@ command (see
|
||||
.B "THE FQDN"
|
||||
below).
|
||||
.LP
|
||||
-The host name is usually set once at system startup in
|
||||
-.I /etc/init.d/hostname.sh
|
||||
+The host name is usually set once at system startup
|
||||
(normally by reading the contents of a file which contains
|
||||
the host name, e.g.
|
||||
.IR /etc/hostname ).
|
||||
@@ -1,22 +0,0 @@
|
||||
Index: services/scheduler.cpp
|
||||
===================================================================
|
||||
--- services/scheduler.cpp (revision 1310078)
|
||||
+++ services/scheduler.cpp (working copy)
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "config.h"
|
||||
#include "bench.h"
|
||||
|
||||
-#define DEBUG_SCHEDULER 0
|
||||
+#define DEBUG_SCHEDULER 1
|
||||
|
||||
/* TODO:
|
||||
* leak check
|
||||
@@ -613,6 +613,8 @@
|
||||
|
||||
platform_map.insert( make_pair( string( "ppc" ), string( "ppc64" ) ) );
|
||||
platform_map.insert( make_pair( string( "s390" ), string( "s390x" ) ) );
|
||||
+
|
||||
+ platform_map.insert( make_pair( string( "armv5tel"), string( "armv7l" ) ) );
|
||||
}
|
||||
|
||||
multimap<string, string>::const_iterator end = platform_map.upper_bound( target );
|
||||
@@ -1,107 +0,0 @@
|
||||
Index: icecc-0.9.6/doc/man-scheduler.1.docbook
|
||||
===================================================================
|
||||
--- icecc-0.9.6.orig/doc/man-scheduler.1.docbook
|
||||
+++ icecc-0.9.6/doc/man-scheduler.1.docbook
|
||||
@@ -23,13 +23,13 @@
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
- <refname>scheduler</refname>
|
||||
+ <refname>icecc-scheduler</refname>
|
||||
<refpurpose>Icecream scheduler</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
-<command>scheduler</command>
|
||||
+<command>icecc-scheduler</command>
|
||||
<group>
|
||||
<arg choice="opt">
|
||||
<option>-n</option>
|
||||
@@ -151,7 +151,7 @@ need to run the scheduler with root righ
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
-<para>icecream, scheduler, iceccd, icemon</para>
|
||||
+<para>icecream, icecc-scheduler, iceccd, icemon</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
Index: icecc-0.9.6/services/Makefile.am
|
||||
===================================================================
|
||||
--- icecc-0.9.6.orig/services/Makefile.am
|
||||
+++ icecc-0.9.6/services/Makefile.am
|
||||
@@ -11,9 +11,9 @@ ice_HEADERS = job.h comm.h
|
||||
noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h platform.h
|
||||
icedir = $(includedir)/icecc
|
||||
|
||||
-sbin_PROGRAMS = scheduler
|
||||
-scheduler_SOURCES = scheduler.cpp
|
||||
-scheduler_LDADD = libicecc.la
|
||||
+sbin_PROGRAMS = icecc-scheduler
|
||||
+icecc_scheduler_SOURCES = scheduler.cpp
|
||||
+icecc_scheduler_LDADD = libicecc.la
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = icecc.pc
|
||||
Index: icecc-0.9.6/services/Makefile.in
|
||||
===================================================================
|
||||
--- icecc-0.9.6.orig/services/Makefile.in
|
||||
+++ icecc-0.9.6/services/Makefile.in
|
||||
@@ -37,7 +37,7 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
-sbin_PROGRAMS = scheduler$(EXEEXT)
|
||||
+sbin_PROGRAMS = icecc-scheduler$(EXEEXT)
|
||||
subdir = services
|
||||
DIST_COMMON = $(ice_HEADERS) $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/icecc.pc.in
|
||||
@@ -82,9 +82,9 @@ libicecc_la_LINK = $(LIBTOOL) --tag=CXX
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libicecc_la_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
PROGRAMS = $(sbin_PROGRAMS)
|
||||
-am_scheduler_OBJECTS = scheduler.$(OBJEXT)
|
||||
-scheduler_OBJECTS = $(am_scheduler_OBJECTS)
|
||||
-scheduler_DEPENDENCIES = libicecc.la
|
||||
+am_icecc_scheduler_OBJECTS = scheduler.$(OBJEXT)
|
||||
+icecc_scheduler_OBJECTS = $(am_icecc_scheduler_OBJECTS)
|
||||
+icecc_scheduler_DEPENDENCIES = libicecc.la
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@@ -107,8 +107,8 @@ CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
-SOURCES = $(libicecc_la_SOURCES) $(scheduler_SOURCES)
|
||||
-DIST_SOURCES = $(libicecc_la_SOURCES) $(scheduler_SOURCES)
|
||||
+SOURCES = $(libicecc_la_SOURCES) $(icecc_scheduler_SOURCES)
|
||||
+DIST_SOURCES = $(libicecc_la_SOURCES) $(icecc_scheduler_SOURCES)
|
||||
DATA = $(pkgconfig_DATA)
|
||||
HEADERS = $(ice_HEADERS) $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
@@ -242,8 +242,8 @@ libicecc_la_CXXFLAGS = -fPIC -DPIC
|
||||
ice_HEADERS = job.h comm.h
|
||||
noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h platform.h
|
||||
icedir = $(includedir)/icecc
|
||||
-scheduler_SOURCES = scheduler.cpp
|
||||
-scheduler_LDADD = libicecc.la
|
||||
+icecc_scheduler_SOURCES = scheduler.cpp
|
||||
+icecc_scheduler_LDADD = libicecc.la
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = icecc.pc
|
||||
all: all-am
|
||||
@@ -358,9 +358,9 @@ clean-sbinPROGRAMS:
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
-scheduler$(EXEEXT): $(scheduler_OBJECTS) $(scheduler_DEPENDENCIES)
|
||||
- @rm -f scheduler$(EXEEXT)
|
||||
- $(CXXLINK) $(scheduler_OBJECTS) $(scheduler_LDADD) $(LIBS)
|
||||
+icecc-scheduler$(EXEEXT): $(icecc_scheduler_OBJECTS) $(icecc_scheduler_DEPENDENCIES)
|
||||
+ @rm -f icecc-scheduler$(EXEEXT)
|
||||
+ $(CXXLINK) $(icecc_scheduler_OBJECTS) $(icecc_scheduler_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
@@ -1,166 +0,0 @@
|
||||
Submitted By: Randy McMurchy <randy_at_linuxfromscratch_dot_org>
|
||||
Date: 2005-03-23
|
||||
Initial Package Version: 1.4.2
|
||||
Upstream Status: Not sure
|
||||
Origin: Internet (URL's are now lost)
|
||||
Description: Fix the rexecd daemon so that it understands shadow
|
||||
passwords. Fix the rshd daemon so that it properly
|
||||
resolves hostnames.
|
||||
|
||||
diff -Naur inetutils-1.4.2-orig/rexecd/rexecd.c inetutils-1.4.2/rexecd/rexecd.c
|
||||
--- inetutils-1.4.2-orig/rexecd/rexecd.c 2002-12-11 12:38:00.000000000 +0000
|
||||
+++ inetutils-1.4.2/rexecd/rexecd.c 2005-02-22 19:53:44.146962264 +0000
|
||||
@@ -79,6 +79,10 @@
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_SHADOW_H
|
||||
+#include <shadow.h>
|
||||
+#endif
|
||||
+
|
||||
void error __P ((const char *fmt, ...));
|
||||
/*
|
||||
* remote execute server:
|
||||
@@ -127,6 +131,10 @@
|
||||
char *cmdbuf, *cp, *namep;
|
||||
char *user, *pass;
|
||||
struct passwd *pwd;
|
||||
+#ifdef HAVE_SHADOW_H
|
||||
+ struct spwd *spwd;
|
||||
+ char *pw_field;
|
||||
+#endif
|
||||
int s;
|
||||
u_short port;
|
||||
int pv[2], pid, cc;
|
||||
@@ -186,6 +194,24 @@
|
||||
exit(1);
|
||||
}
|
||||
endpwent();
|
||||
+
|
||||
+#ifdef HAVE_SHADOW_H
|
||||
+ // Get encrypted password from /etc/shadow if possible,
|
||||
+ // else from /etc/passwd.
|
||||
+ spwd = getspnam(user);
|
||||
+ if (spwd) {
|
||||
+ pw_field = spwd->sp_pwdp;
|
||||
+ } else {
|
||||
+ pw_field = pwd->pw_passwd;
|
||||
+ }
|
||||
+ if (*pw_field != '\0') {
|
||||
+ namep = CRYPT (pass, pw_field);
|
||||
+ if (strcmp(namep, pw_field)) {
|
||||
+ error("Password incorrect.\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ }
|
||||
+#else
|
||||
if (*pwd->pw_passwd != '\0') {
|
||||
namep = CRYPT (pass, pwd->pw_passwd);
|
||||
if (strcmp(namep, pwd->pw_passwd)) {
|
||||
@@ -193,6 +219,7 @@
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
write(STDERR_FILENO, "\0", 1);
|
||||
if (port) {
|
||||
pipe(pv);
|
||||
diff -Naur inetutils-1.4.2-orig/rshd/rshd.c inetutils-1.4.2/rshd/rshd.c
|
||||
--- inetutils-1.4.2-orig/rshd/rshd.c 2002-12-11 12:38:00.000000000 +0000
|
||||
+++ inetutils-1.4.2/rshd/rshd.c 2005-02-22 19:54:33.162510768 +0000
|
||||
@@ -443,7 +443,7 @@
|
||||
dup2 (sockfd, STDERR_FILENO);
|
||||
}
|
||||
|
||||
- /* Get the "name" of the clent form its Internet address.
|
||||
+ /* Get the "name" of the client form its Internet address.
|
||||
* This is used for the autentication below
|
||||
*/
|
||||
errorstr = NULL;
|
||||
@@ -457,52 +457,49 @@
|
||||
* in a remote net; look up the name and check that this
|
||||
* address corresponds to the name.
|
||||
*/
|
||||
- hostname = strdup (hp->h_name);
|
||||
+ const char *remotehost = strdup(hp->h_name);
|
||||
#ifdef KERBEROS
|
||||
if (!use_kerberos)
|
||||
#endif
|
||||
- if (check_all || local_domain (hp->h_name))
|
||||
+ if (! remotehost)
|
||||
+ errorstr = "Out of memory\n";
|
||||
+ else if (check_all || local_domain (remotehost))
|
||||
{
|
||||
- char *remotehost = (char *) alloca (strlen (hp->h_name) + 1);
|
||||
- if (! remotehost)
|
||||
- errorstr = "Out of memory\n";
|
||||
- else
|
||||
+ errorhost = remotehost;
|
||||
+ hp = gethostbyname (remotehost);
|
||||
+ if (hp == NULL)
|
||||
{
|
||||
- strcpy (remotehost, hp->h_name);
|
||||
- errorhost = remotehost;
|
||||
- hp = gethostbyname (remotehost);
|
||||
- if (hp == NULL)
|
||||
+ syslog (LOG_INFO,
|
||||
+ "Couldn't look up address for %s", remotehost);
|
||||
+ errorstr = "Couldn't look up address for your host (%s)\n";
|
||||
+ hostname = strdup(inet_ntoa(fromp->sin_addr));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ for (; ; hp->h_addr_list++)
|
||||
{
|
||||
- syslog (LOG_INFO,
|
||||
- "Couldn't look up address for %s", remotehost);
|
||||
- errorstr = "Couldn't look up address for your host (%s)\n";
|
||||
- hostname = inet_ntoa (fromp->sin_addr);
|
||||
+ if (hp->h_addr_list[0] == NULL)
|
||||
+ {
|
||||
+ syslog (LOG_NOTICE,
|
||||
+ "Host addr %s not listed for host %s",
|
||||
+ inet_ntoa (fromp->sin_addr), hp->h_name);
|
||||
+ errorstr = "Host address mismatch for %s\n";
|
||||
+ hostname = strdup(inet_ntoa(fromp->sin_addr));
|
||||
+ break;
|
||||
+ }
|
||||
+ if (!memcmp (hp->h_addr_list[0],
|
||||
+ (caddr_t)&fromp->sin_addr,
|
||||
+ sizeof fromp->sin_addr))
|
||||
+ {
|
||||
+ hostname = strdup(hp->h_name);
|
||||
+ break; /* equal, OK */
|
||||
+ }
|
||||
}
|
||||
- else
|
||||
- for (; ; hp->h_addr_list++)
|
||||
- {
|
||||
- if (hp->h_addr_list[0] == NULL)
|
||||
- {
|
||||
- syslog (LOG_NOTICE,
|
||||
- "Host addr %s not listed for host %s",
|
||||
- inet_ntoa (fromp->sin_addr), hp->h_name);
|
||||
- errorstr = "Host address mismatch for %s\n";
|
||||
- hostname = inet_ntoa (fromp->sin_addr);
|
||||
- break;
|
||||
- }
|
||||
- if (!memcmp (hp->h_addr_list[0],
|
||||
- (caddr_t)&fromp->sin_addr,
|
||||
- sizeof fromp->sin_addr))
|
||||
- {
|
||||
- hostname = hp->h_name;
|
||||
- break; /* equal, OK */
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
else
|
||||
- errorhost = hostname = inet_ntoa (fromp->sin_addr);
|
||||
+ errorhost = hostname = strdup(inet_ntoa(fromp->sin_addr));
|
||||
|
||||
#ifdef KERBEROS
|
||||
if (use_kerberos)
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
|
||||
Date: 2005-08-30
|
||||
Initial Package Version: 1.4.2
|
||||
Upstream Status: From upstream
|
||||
Origin: Greg Schafer <gschafer@zip.com.au> (http://www.diy-linux.org/downloads/patches/GCC4/inetutils-1.4.2-gcc4-fixes-1.patch)
|
||||
Description: Fix compilation issues with gcc4
|
||||
|
||||
diff -Naur inetutils-1.4.2.orig/ftp/ftp_var.h inetutils-1.4.2/ftp/ftp_var.h
|
||||
--- inetutils-1.4.2.orig/ftp/ftp_var.h 2000-07-08 01:00:53.000000000 +0000
|
||||
+++ inetutils-1.4.2/ftp/ftp_var.h 2005-08-30 20:25:27.205932304 +0000
|
||||
@@ -36,8 +36,6 @@
|
||||
#include <sys/param.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
-#include "extern.h"
|
||||
-
|
||||
#ifndef FTP_EXTERN
|
||||
#define FTP_EXTERN extern
|
||||
#endif
|
||||
@@ -129,3 +127,5 @@
|
||||
FTP_EXTERN int macnum; /* number of defined macros */
|
||||
FTP_EXTERN struct macel macros[16];
|
||||
FTP_EXTERN char macbuf[4096];
|
||||
+
|
||||
+#include "extern.h"
|
||||
diff -Naur inetutils-1.4.2.orig/libinetutils/ttymsg.c inetutils-1.4.2/libinetutils/ttymsg.c
|
||||
--- inetutils-1.4.2.orig/libinetutils/ttymsg.c 2001-11-01 15:52:19.000000000 +0000
|
||||
+++ inetutils-1.4.2/libinetutils/ttymsg.c 2005-08-30 20:24:27.168059448 +0000
|
||||
@@ -132,7 +132,7 @@
|
||||
}
|
||||
if (wret)
|
||||
{
|
||||
- (char *)iov->iov_base += wret;
|
||||
+ iov->iov_base = (char *)iov->iov_base + wret;
|
||||
iov->iov_len -= wret;
|
||||
}
|
||||
continue;
|
||||
674
src/patches/linux-3.10.39-pie_packet_sch.patch
Normal file
674
src/patches/linux-3.10.39-pie_packet_sch.patch
Normal file
@@ -0,0 +1,674 @@
|
||||
From d4b36210c2e6ecef0ce52fb6c18c51144f5c2d88 Mon Sep 17 00:00:00 2001
|
||||
From: Vijay Subramanian <vijaynsu@cisco.com>
|
||||
Date: Sat, 4 Jan 2014 17:33:55 -0800
|
||||
Subject: net: pkt_sched: PIE AQM scheme
|
||||
|
||||
Proportional Integral controller Enhanced (PIE) is a scheduler to address the
|
||||
bufferbloat problem.
|
||||
|
||||
>From the IETF draft below:
|
||||
" Bufferbloat is a phenomenon where excess buffers in the network cause high
|
||||
latency and jitter. As more and more interactive applications (e.g. voice over
|
||||
IP, real time video streaming and financial transactions) run in the Internet,
|
||||
high latency and jitter degrade application performance. There is a pressing
|
||||
need to design intelligent queue management schemes that can control latency and
|
||||
jitter; and hence provide desirable quality of service to users.
|
||||
|
||||
We present here a lightweight design, PIE(Proportional Integral controller
|
||||
Enhanced) that can effectively control the average queueing latency to a target
|
||||
value. Simulation results, theoretical analysis and Linux testbed results have
|
||||
shown that PIE can ensure low latency and achieve high link utilization under
|
||||
various congestion situations. The design does not require per-packet
|
||||
timestamp, so it incurs very small overhead and is simple enough to implement
|
||||
in both hardware and software. "
|
||||
|
||||
Many thanks to Dave Taht for extensive feedback, reviews, testing and
|
||||
suggestions. Thanks also to Stephen Hemminger and Eric Dumazet for reviews and
|
||||
suggestions. Naeem Khademi and Dave Taht independently contributed to ECN
|
||||
support.
|
||||
|
||||
For more information, please see technical paper about PIE in the IEEE
|
||||
Conference on High Performance Switching and Routing 2013. A copy of the paper
|
||||
can be found at ftp://ftpeng.cisco.com/pie/.
|
||||
|
||||
Please also refer to the IETF draft submission at
|
||||
http://tools.ietf.org/html/draft-pan-tsvwg-pie-00
|
||||
|
||||
All relevant code, documents and test scripts and results can be found at
|
||||
ftp://ftpeng.cisco.com/pie/.
|
||||
|
||||
For problems with the iproute2/tc or Linux kernel code, please contact Vijay
|
||||
Subramanian (vijaynsu@cisco.com or subramanian.vijay@gmail.com) Mythili Prabhu
|
||||
(mysuryan@cisco.com)
|
||||
|
||||
Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
|
||||
Signed-off-by: Mythili Prabhu <mysuryan@cisco.com>
|
||||
CC: Dave Taht <dave.taht@bufferbloat.net>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
diff -Naur linux-3.10.39.org/include/uapi/linux/pkt_sched.h linux-3.10.39/include/uapi/linux/pkt_sched.h
|
||||
--- linux-3.10.39.org/include/uapi/linux/pkt_sched.h 2014-05-06 16:56:24.000000000 +0200
|
||||
+++ linux-3.10.39/include/uapi/linux/pkt_sched.h 2014-05-15 10:33:08.296828477 +0200
|
||||
@@ -744,4 +744,29 @@
|
||||
};
|
||||
};
|
||||
|
||||
+/* PIE */
|
||||
+enum {
|
||||
+ TCA_PIE_UNSPEC,
|
||||
+ TCA_PIE_TARGET,
|
||||
+ TCA_PIE_LIMIT,
|
||||
+ TCA_PIE_TUPDATE,
|
||||
+ TCA_PIE_ALPHA,
|
||||
+ TCA_PIE_BETA,
|
||||
+ TCA_PIE_ECN,
|
||||
+ TCA_PIE_BYTEMODE,
|
||||
+ __TCA_PIE_MAX
|
||||
+};
|
||||
+#define TCA_PIE_MAX (__TCA_PIE_MAX - 1)
|
||||
+
|
||||
+struct tc_pie_xstats {
|
||||
+ __u32 prob; /* current probability */
|
||||
+ __u32 delay; /* current delay in ms */
|
||||
+ __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */
|
||||
+ __u32 packets_in; /* total number of packets enqueued */
|
||||
+ __u32 dropped; /* packets dropped due to pie_action */
|
||||
+ __u32 overlimit; /* dropped due to lack of space in queue */
|
||||
+ __u32 maxq; /* maximum queue size */
|
||||
+ __u32 ecn_mark; /* packets marked with ecn*/
|
||||
+};
|
||||
+
|
||||
#endif
|
||||
diff -Naur linux-3.10.39.org/net/sched/Kconfig linux-3.10.39/net/sched/Kconfig
|
||||
--- linux-3.10.39.org/net/sched/Kconfig 2014-05-06 16:56:24.000000000 +0200
|
||||
+++ linux-3.10.39/net/sched/Kconfig 2014-05-15 09:30:29.866632326 +0200
|
||||
@@ -272,6 +272,19 @@
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
+config NET_SCH_PIE
|
||||
+ tristate "Proportional Integral controller Enhanced (PIE) scheduler"
|
||||
+ help
|
||||
+ Say Y here if you want to use the Proportional Integral controller
|
||||
+ Enhanced scheduler packet scheduling algorithm.
|
||||
+ For more information, please see
|
||||
+ http://tools.ietf.org/html/draft-pan-tsvwg-pie-00
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the module
|
||||
+ will be called sch_pie.
|
||||
+
|
||||
+ If unsure, say N.
|
||||
+
|
||||
config NET_SCH_INGRESS
|
||||
tristate "Ingress Qdisc"
|
||||
depends on NET_CLS_ACT
|
||||
diff -Naur linux-3.10.39.org/net/sched/Makefile linux-3.10.39/net/sched/Makefile
|
||||
--- linux-3.10.39.org/net/sched/Makefile 2014-05-06 16:56:24.000000000 +0200
|
||||
+++ linux-3.10.39/net/sched/Makefile 2014-05-15 10:34:55.533502406 +0200
|
||||
@@ -39,6 +39,7 @@
|
||||
obj-$(CONFIG_NET_SCH_QFQ) += sch_qfq.o
|
||||
obj-$(CONFIG_NET_SCH_CODEL) += sch_codel.o
|
||||
obj-$(CONFIG_NET_SCH_FQ_CODEL) += sch_fq_codel.o
|
||||
+obj-$(CONFIG_NET_SCH_PIE) += sch_pie.o
|
||||
|
||||
obj-$(CONFIG_NET_CLS_U32) += cls_u32.o
|
||||
obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o
|
||||
diff -Naur linux-3.10.39.org/net/sched/sch_pie.c linux-3.10.39/net/sched/sch_pie.c
|
||||
--- linux-3.10.39.org/net/sched/sch_pie.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-3.10.39/net/sched/sch_pie.c 2014-05-15 09:30:29.869966724 +0200
|
||||
@@ -0,0 +1,555 @@
|
||||
+/* Copyright (C) 2013 Cisco Systems, Inc, 2013.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2
|
||||
+ * of the License.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Author: Vijay Subramanian <vijaynsu@cisco.com>
|
||||
+ * Author: Mythili Prabhu <mysuryan@cisco.com>
|
||||
+ *
|
||||
+ * ECN support is added by Naeem Khademi <naeemk@ifi.uio.no>
|
||||
+ * University of Oslo, Norway.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <net/pkt_sched.h>
|
||||
+#include <net/inet_ecn.h>
|
||||
+
|
||||
+#define QUEUE_THRESHOLD 10000
|
||||
+#define DQCOUNT_INVALID -1
|
||||
+#define MAX_PROB 0xffffffff
|
||||
+#define PIE_SCALE 8
|
||||
+
|
||||
+/* parameters used */
|
||||
+struct pie_params {
|
||||
+ psched_time_t target; /* user specified target delay in pschedtime */
|
||||
+ u32 tupdate; /* timer frequency (in jiffies) */
|
||||
+ u32 limit; /* number of packets that can be enqueued */
|
||||
+ u32 alpha; /* alpha and beta are between -4 and 4 */
|
||||
+ u32 beta; /* and are used for shift relative to 1 */
|
||||
+ bool ecn; /* true if ecn is enabled */
|
||||
+ bool bytemode; /* to scale drop early prob based on pkt size */
|
||||
+};
|
||||
+
|
||||
+/* variables used */
|
||||
+struct pie_vars {
|
||||
+ u32 prob; /* probability but scaled by u32 limit. */
|
||||
+ psched_time_t burst_time;
|
||||
+ psched_time_t qdelay;
|
||||
+ psched_time_t qdelay_old;
|
||||
+ u64 dq_count; /* measured in bytes */
|
||||
+ psched_time_t dq_tstamp; /* drain rate */
|
||||
+ u32 avg_dq_rate; /* bytes per pschedtime tick,scaled */
|
||||
+ u32 qlen_old; /* in bytes */
|
||||
+};
|
||||
+
|
||||
+/* statistics gathering */
|
||||
+struct pie_stats {
|
||||
+ u32 packets_in; /* total number of packets enqueued */
|
||||
+ u32 dropped; /* packets dropped due to pie_action */
|
||||
+ u32 overlimit; /* dropped due to lack of space in queue */
|
||||
+ u32 maxq; /* maximum queue size */
|
||||
+ u32 ecn_mark; /* packets marked with ECN */
|
||||
+};
|
||||
+
|
||||
+/* private data for the Qdisc */
|
||||
+struct pie_sched_data {
|
||||
+ struct pie_params params;
|
||||
+ struct pie_vars vars;
|
||||
+ struct pie_stats stats;
|
||||
+ struct timer_list adapt_timer;
|
||||
+};
|
||||
+
|
||||
+static void pie_params_init(struct pie_params *params)
|
||||
+{
|
||||
+ params->alpha = 2;
|
||||
+ params->beta = 20;
|
||||
+ params->tupdate = usecs_to_jiffies(30 * USEC_PER_MSEC); /* 30 ms */
|
||||
+ params->limit = 1000; /* default of 1000 packets */
|
||||
+ params->target = PSCHED_NS2TICKS(20 * NSEC_PER_MSEC); /* 20 ms */
|
||||
+ params->ecn = false;
|
||||
+ params->bytemode = false;
|
||||
+}
|
||||
+
|
||||
+static void pie_vars_init(struct pie_vars *vars)
|
||||
+{
|
||||
+ vars->dq_count = DQCOUNT_INVALID;
|
||||
+ vars->avg_dq_rate = 0;
|
||||
+ /* default of 100 ms in pschedtime */
|
||||
+ vars->burst_time = PSCHED_NS2TICKS(100 * NSEC_PER_MSEC);
|
||||
+}
|
||||
+
|
||||
+static bool drop_early(struct Qdisc *sch, u32 packet_size)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ u32 rnd;
|
||||
+ u32 local_prob = q->vars.prob;
|
||||
+ u32 mtu = psched_mtu(qdisc_dev(sch));
|
||||
+
|
||||
+ /* If there is still burst allowance left skip random early drop */
|
||||
+ if (q->vars.burst_time > 0)
|
||||
+ return false;
|
||||
+
|
||||
+ /* If current delay is less than half of target, and
|
||||
+ * if drop prob is low already, disable early_drop
|
||||
+ */
|
||||
+ if ((q->vars.qdelay < q->params.target / 2)
|
||||
+ && (q->vars.prob < MAX_PROB / 5))
|
||||
+ return false;
|
||||
+
|
||||
+ /* If we have fewer than 2 mtu-sized packets, disable drop_early,
|
||||
+ * similar to min_th in RED
|
||||
+ */
|
||||
+ if (sch->qstats.backlog < 2 * mtu)
|
||||
+ return false;
|
||||
+
|
||||
+ /* If bytemode is turned on, use packet size to compute new
|
||||
+ * probablity. Smaller packets will have lower drop prob in this case
|
||||
+ */
|
||||
+ if (q->params.bytemode && packet_size <= mtu)
|
||||
+ local_prob = (local_prob / mtu) * packet_size;
|
||||
+ else
|
||||
+ local_prob = q->vars.prob;
|
||||
+
|
||||
+ rnd = net_random();
|
||||
+ if (rnd < local_prob)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ bool enqueue = false;
|
||||
+
|
||||
+ if (unlikely(qdisc_qlen(sch) >= sch->limit)) {
|
||||
+ q->stats.overlimit++;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (!drop_early(sch, skb->len)) {
|
||||
+ enqueue = true;
|
||||
+ } else if (q->params.ecn && (q->vars.prob <= MAX_PROB / 10) &&
|
||||
+ INET_ECN_set_ce(skb)) {
|
||||
+ /* If packet is ecn capable, mark it if drop probability
|
||||
+ * is lower than 10%, else drop it.
|
||||
+ */
|
||||
+ q->stats.ecn_mark++;
|
||||
+ enqueue = true;
|
||||
+ }
|
||||
+
|
||||
+ /* we can enqueue the packet */
|
||||
+ if (enqueue) {
|
||||
+ q->stats.packets_in++;
|
||||
+ if (qdisc_qlen(sch) > q->stats.maxq)
|
||||
+ q->stats.maxq = qdisc_qlen(sch);
|
||||
+
|
||||
+ return qdisc_enqueue_tail(skb, sch);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ q->stats.dropped++;
|
||||
+ return qdisc_drop(skb, sch);
|
||||
+}
|
||||
+
|
||||
+static const struct nla_policy pie_policy[TCA_PIE_MAX + 1] = {
|
||||
+ [TCA_PIE_TARGET] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_LIMIT] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_TUPDATE] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_ALPHA] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_BETA] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_ECN] = {.type = NLA_U32},
|
||||
+ [TCA_PIE_BYTEMODE] = {.type = NLA_U32},
|
||||
+};
|
||||
+
|
||||
+static int pie_change(struct Qdisc *sch, struct nlattr *opt)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ struct nlattr *tb[TCA_PIE_MAX + 1];
|
||||
+ unsigned int qlen;
|
||||
+ int err;
|
||||
+
|
||||
+ if (!opt)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ err = nla_parse_nested(tb, TCA_PIE_MAX, opt, pie_policy);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ sch_tree_lock(sch);
|
||||
+
|
||||
+ /* convert from microseconds to pschedtime */
|
||||
+ if (tb[TCA_PIE_TARGET]) {
|
||||
+ /* target is in us */
|
||||
+ u32 target = nla_get_u32(tb[TCA_PIE_TARGET]);
|
||||
+
|
||||
+ /* convert to pschedtime */
|
||||
+ q->params.target = PSCHED_NS2TICKS((u64)target * NSEC_PER_USEC);
|
||||
+ }
|
||||
+
|
||||
+ /* tupdate is in jiffies */
|
||||
+ if (tb[TCA_PIE_TUPDATE])
|
||||
+ q->params.tupdate = usecs_to_jiffies(nla_get_u32(tb[TCA_PIE_TUPDATE]));
|
||||
+
|
||||
+ if (tb[TCA_PIE_LIMIT]) {
|
||||
+ u32 limit = nla_get_u32(tb[TCA_PIE_LIMIT]);
|
||||
+
|
||||
+ q->params.limit = limit;
|
||||
+ sch->limit = limit;
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_PIE_ALPHA])
|
||||
+ q->params.alpha = nla_get_u32(tb[TCA_PIE_ALPHA]);
|
||||
+
|
||||
+ if (tb[TCA_PIE_BETA])
|
||||
+ q->params.beta = nla_get_u32(tb[TCA_PIE_BETA]);
|
||||
+
|
||||
+ if (tb[TCA_PIE_ECN])
|
||||
+ q->params.ecn = nla_get_u32(tb[TCA_PIE_ECN]);
|
||||
+
|
||||
+ if (tb[TCA_PIE_BYTEMODE])
|
||||
+ q->params.bytemode = nla_get_u32(tb[TCA_PIE_BYTEMODE]);
|
||||
+
|
||||
+ /* Drop excess packets if new limit is lower */
|
||||
+ qlen = sch->q.qlen;
|
||||
+ while (sch->q.qlen > sch->limit) {
|
||||
+ struct sk_buff *skb = __skb_dequeue(&sch->q);
|
||||
+
|
||||
+ sch->qstats.backlog -= qdisc_pkt_len(skb);
|
||||
+ qdisc_drop(skb, sch);
|
||||
+ }
|
||||
+ qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
|
||||
+
|
||||
+ sch_tree_unlock(sch);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void pie_process_dequeue(struct Qdisc *sch, struct sk_buff *skb)
|
||||
+{
|
||||
+
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ int qlen = sch->qstats.backlog; /* current queue size in bytes */
|
||||
+
|
||||
+ /* If current queue is about 10 packets or more and dq_count is unset
|
||||
+ * we have enough packets to calculate the drain rate. Save
|
||||
+ * current time as dq_tstamp and start measurement cycle.
|
||||
+ */
|
||||
+ if (qlen >= QUEUE_THRESHOLD && q->vars.dq_count == DQCOUNT_INVALID) {
|
||||
+ q->vars.dq_tstamp = psched_get_time();
|
||||
+ q->vars.dq_count = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Calculate the average drain rate from this value. If queue length
|
||||
+ * has receded to a small value viz., <= QUEUE_THRESHOLD bytes,reset
|
||||
+ * the dq_count to -1 as we don't have enough packets to calculate the
|
||||
+ * drain rate anymore The following if block is entered only when we
|
||||
+ * have a substantial queue built up (QUEUE_THRESHOLD bytes or more)
|
||||
+ * and we calculate the drain rate for the threshold here. dq_count is
|
||||
+ * in bytes, time difference in psched_time, hence rate is in
|
||||
+ * bytes/psched_time.
|
||||
+ */
|
||||
+ if (q->vars.dq_count != DQCOUNT_INVALID) {
|
||||
+ q->vars.dq_count += skb->len;
|
||||
+
|
||||
+ if (q->vars.dq_count >= QUEUE_THRESHOLD) {
|
||||
+ psched_time_t now = psched_get_time();
|
||||
+ u32 dtime = now - q->vars.dq_tstamp;
|
||||
+ u32 count = q->vars.dq_count << PIE_SCALE;
|
||||
+
|
||||
+ if (dtime == 0)
|
||||
+ return;
|
||||
+
|
||||
+ count = count / dtime;
|
||||
+
|
||||
+ if (q->vars.avg_dq_rate == 0)
|
||||
+ q->vars.avg_dq_rate = count;
|
||||
+ else
|
||||
+ q->vars.avg_dq_rate =
|
||||
+ (q->vars.avg_dq_rate -
|
||||
+ (q->vars.avg_dq_rate >> 3)) + (count >> 3);
|
||||
+
|
||||
+ /* If the queue has receded below the threshold, we hold
|
||||
+ * on to the last drain rate calculated, else we reset
|
||||
+ * dq_count to 0 to re-enter the if block when the next
|
||||
+ * packet is dequeued
|
||||
+ */
|
||||
+ if (qlen < QUEUE_THRESHOLD)
|
||||
+ q->vars.dq_count = DQCOUNT_INVALID;
|
||||
+ else {
|
||||
+ q->vars.dq_count = 0;
|
||||
+ q->vars.dq_tstamp = psched_get_time();
|
||||
+ }
|
||||
+
|
||||
+ if (q->vars.burst_time > 0) {
|
||||
+ if (q->vars.burst_time > dtime)
|
||||
+ q->vars.burst_time -= dtime;
|
||||
+ else
|
||||
+ q->vars.burst_time = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void calculate_probability(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ u32 qlen = sch->qstats.backlog; /* queue size in bytes */
|
||||
+ psched_time_t qdelay = 0; /* in pschedtime */
|
||||
+ psched_time_t qdelay_old = q->vars.qdelay; /* in pschedtime */
|
||||
+ s32 delta = 0; /* determines the change in probability */
|
||||
+ u32 oldprob;
|
||||
+ u32 alpha, beta;
|
||||
+ bool update_prob = true;
|
||||
+
|
||||
+ q->vars.qdelay_old = q->vars.qdelay;
|
||||
+
|
||||
+ if (q->vars.avg_dq_rate > 0)
|
||||
+ qdelay = (qlen << PIE_SCALE) / q->vars.avg_dq_rate;
|
||||
+ else
|
||||
+ qdelay = 0;
|
||||
+
|
||||
+ /* If qdelay is zero and qlen is not, it means qlen is very small, less
|
||||
+ * than dequeue_rate, so we do not update probabilty in this round
|
||||
+ */
|
||||
+ if (qdelay == 0 && qlen != 0)
|
||||
+ update_prob = false;
|
||||
+
|
||||
+ /* Add ranges for alpha and beta, more aggressive for high dropping
|
||||
+ * mode and gentle steps for light dropping mode
|
||||
+ * In light dropping mode, take gentle steps; in medium dropping mode,
|
||||
+ * take medium steps; in high dropping mode, take big steps.
|
||||
+ */
|
||||
+ if (q->vars.prob < MAX_PROB / 100) {
|
||||
+ alpha =
|
||||
+ (q->params.alpha * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 7;
|
||||
+ beta =
|
||||
+ (q->params.beta * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 7;
|
||||
+ } else if (q->vars.prob < MAX_PROB / 10) {
|
||||
+ alpha =
|
||||
+ (q->params.alpha * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 5;
|
||||
+ beta =
|
||||
+ (q->params.beta * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 5;
|
||||
+ } else {
|
||||
+ alpha =
|
||||
+ (q->params.alpha * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 4;
|
||||
+ beta =
|
||||
+ (q->params.beta * (MAX_PROB / PSCHED_TICKS_PER_SEC)) >> 4;
|
||||
+ }
|
||||
+
|
||||
+ /* alpha and beta should be between 0 and 32, in multiples of 1/16 */
|
||||
+ delta += alpha * ((qdelay - q->params.target));
|
||||
+ delta += beta * ((qdelay - qdelay_old));
|
||||
+
|
||||
+ oldprob = q->vars.prob;
|
||||
+
|
||||
+ /* to ensure we increase probability in steps of no more than 2% */
|
||||
+ if (delta > (s32) (MAX_PROB / (100 / 2)) &&
|
||||
+ q->vars.prob >= MAX_PROB / 10)
|
||||
+ delta = (MAX_PROB / 100) * 2;
|
||||
+
|
||||
+ /* Non-linear drop:
|
||||
+ * Tune drop probability to increase quickly for high delays(>= 250ms)
|
||||
+ * 250ms is derived through experiments and provides error protection
|
||||
+ */
|
||||
+
|
||||
+ if (qdelay > (PSCHED_NS2TICKS(250 * NSEC_PER_MSEC)))
|
||||
+ delta += MAX_PROB / (100 / 2);
|
||||
+
|
||||
+ q->vars.prob += delta;
|
||||
+
|
||||
+ if (delta > 0) {
|
||||
+ /* prevent overflow */
|
||||
+ if (q->vars.prob < oldprob) {
|
||||
+ q->vars.prob = MAX_PROB;
|
||||
+ /* Prevent normalization error. If probability is at
|
||||
+ * maximum value already, we normalize it here, and
|
||||
+ * skip the check to do a non-linear drop in the next
|
||||
+ * section.
|
||||
+ */
|
||||
+ update_prob = false;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* prevent underflow */
|
||||
+ if (q->vars.prob > oldprob)
|
||||
+ q->vars.prob = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Non-linear drop in probability: Reduce drop probability quickly if
|
||||
+ * delay is 0 for 2 consecutive Tupdate periods.
|
||||
+ */
|
||||
+
|
||||
+ if ((qdelay == 0) && (qdelay_old == 0) && update_prob)
|
||||
+ q->vars.prob = (q->vars.prob * 98) / 100;
|
||||
+
|
||||
+ q->vars.qdelay = qdelay;
|
||||
+ q->vars.qlen_old = qlen;
|
||||
+
|
||||
+ /* We restart the measurement cycle if the following conditions are met
|
||||
+ * 1. If the delay has been low for 2 consecutive Tupdate periods
|
||||
+ * 2. Calculated drop probability is zero
|
||||
+ * 3. We have atleast one estimate for the avg_dq_rate ie.,
|
||||
+ * is a non-zero value
|
||||
+ */
|
||||
+ if ((q->vars.qdelay < q->params.target / 2) &&
|
||||
+ (q->vars.qdelay_old < q->params.target / 2) &&
|
||||
+ (q->vars.prob == 0) &&
|
||||
+ (q->vars.avg_dq_rate > 0))
|
||||
+ pie_vars_init(&q->vars);
|
||||
+}
|
||||
+
|
||||
+static void pie_timer(unsigned long arg)
|
||||
+{
|
||||
+ struct Qdisc *sch = (struct Qdisc *)arg;
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
|
||||
+
|
||||
+ spin_lock(root_lock);
|
||||
+ calculate_probability(sch);
|
||||
+
|
||||
+ /* reset the timer to fire after 'tupdate'. tupdate is in jiffies. */
|
||||
+ if (q->params.tupdate)
|
||||
+ mod_timer(&q->adapt_timer, jiffies + q->params.tupdate);
|
||||
+ spin_unlock(root_lock);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int pie_init(struct Qdisc *sch, struct nlattr *opt)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+
|
||||
+ pie_params_init(&q->params);
|
||||
+ pie_vars_init(&q->vars);
|
||||
+ sch->limit = q->params.limit;
|
||||
+
|
||||
+ setup_timer(&q->adapt_timer, pie_timer, (unsigned long)sch);
|
||||
+ mod_timer(&q->adapt_timer, jiffies + HZ / 2);
|
||||
+
|
||||
+ if (opt) {
|
||||
+ int err = pie_change(sch, opt);
|
||||
+
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int pie_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ struct nlattr *opts;
|
||||
+
|
||||
+ opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||
+ if (opts == NULL)
|
||||
+ goto nla_put_failure;
|
||||
+
|
||||
+ /* convert target from pschedtime to us */
|
||||
+ if (nla_put_u32(skb, TCA_PIE_TARGET,
|
||||
+ ((u32) PSCHED_TICKS2NS(q->params.target)) /
|
||||
+ NSEC_PER_USEC) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_LIMIT, sch->limit) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_TUPDATE, jiffies_to_usecs(q->params.tupdate)) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_ALPHA, q->params.alpha) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_BETA, q->params.beta) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_ECN, q->params.ecn) ||
|
||||
+ nla_put_u32(skb, TCA_PIE_BYTEMODE, q->params.bytemode))
|
||||
+ goto nla_put_failure;
|
||||
+
|
||||
+ return nla_nest_end(skb, opts);
|
||||
+
|
||||
+nla_put_failure:
|
||||
+ nla_nest_cancel(skb, opts);
|
||||
+ return -1;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static int pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ struct tc_pie_xstats st = {
|
||||
+ .prob = q->vars.prob,
|
||||
+ .delay = ((u32) PSCHED_TICKS2NS(q->vars.qdelay)) /
|
||||
+ NSEC_PER_USEC,
|
||||
+ /* unscale and return dq_rate in bytes per sec */
|
||||
+ .avg_dq_rate = q->vars.avg_dq_rate *
|
||||
+ (PSCHED_TICKS_PER_SEC) >> PIE_SCALE,
|
||||
+ .packets_in = q->stats.packets_in,
|
||||
+ .overlimit = q->stats.overlimit,
|
||||
+ .maxq = q->stats.maxq,
|
||||
+ .dropped = q->stats.dropped,
|
||||
+ .ecn_mark = q->stats.ecn_mark,
|
||||
+ };
|
||||
+
|
||||
+ return gnet_stats_copy_app(d, &st, sizeof(st));
|
||||
+}
|
||||
+
|
||||
+static struct sk_buff *pie_qdisc_dequeue(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ skb = __qdisc_dequeue_head(sch, &sch->q);
|
||||
+
|
||||
+ if (!skb)
|
||||
+ return NULL;
|
||||
+
|
||||
+ pie_process_dequeue(sch, skb);
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+static void pie_reset(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ qdisc_reset_queue(sch);
|
||||
+ pie_vars_init(&q->vars);
|
||||
+}
|
||||
+
|
||||
+static void pie_destroy(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct pie_sched_data *q = qdisc_priv(sch);
|
||||
+ q->params.tupdate = 0;
|
||||
+ del_timer_sync(&q->adapt_timer);
|
||||
+}
|
||||
+
|
||||
+static struct Qdisc_ops pie_qdisc_ops __read_mostly = {
|
||||
+ .id = "pie",
|
||||
+ .priv_size = sizeof(struct pie_sched_data),
|
||||
+ .enqueue = pie_qdisc_enqueue,
|
||||
+ .dequeue = pie_qdisc_dequeue,
|
||||
+ .peek = qdisc_peek_dequeued,
|
||||
+ .init = pie_init,
|
||||
+ .destroy = pie_destroy,
|
||||
+ .reset = pie_reset,
|
||||
+ .change = pie_change,
|
||||
+ .dump = pie_dump,
|
||||
+ .dump_stats = pie_dump_stats,
|
||||
+ .owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static int __init pie_module_init(void)
|
||||
+{
|
||||
+ return register_qdisc(&pie_qdisc_ops);
|
||||
+}
|
||||
+
|
||||
+static void __exit pie_module_exit(void)
|
||||
+{
|
||||
+ unregister_qdisc(&pie_qdisc_ops);
|
||||
+}
|
||||
+
|
||||
+module_init(pie_module_init);
|
||||
+module_exit(pie_module_exit);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Proportional Integral controller Enhanced (PIE) scheduler");
|
||||
+MODULE_AUTHOR("Vijay Subramanian");
|
||||
+MODULE_AUTHOR("Mythili Prabhu");
|
||||
+MODULE_LICENSE("GPL");
|
||||
52
src/patches/net-tools-1.60-no-hostname.patch
Normal file
52
src/patches/net-tools-1.60-no-hostname.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
--- a/Makefile.bak 2014-06-03 19:01:39.758845492 +0000
|
||||
+++ b/Makefile 2014-06-03 19:02:34.119171419 +0000
|
||||
@@ -76,7 +76,7 @@
|
||||
NET_LIB_PATH = lib
|
||||
NET_LIB_NAME = net-tools
|
||||
|
||||
-PROGS := ifconfig hostname arp netstat route rarp slattach plipconfig nameif
|
||||
+PROGS := ifconfig arp netstat route rarp slattach plipconfig nameif
|
||||
|
||||
-include config.make
|
||||
ifeq ($(HAVE_IP_TOOLS),1)
|
||||
@@ -190,9 +190,6 @@
|
||||
nameif: nameif.o
|
||||
$(CC) $(LDFLAGS) -o nameif nameif.o
|
||||
|
||||
-hostname: hostname.o
|
||||
- $(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
|
||||
-
|
||||
route: $(NET_LIB) route.o
|
||||
$(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)
|
||||
|
||||
@@ -224,7 +221,6 @@
|
||||
install -m 0755 -d ${BASEDIR}/sbin
|
||||
install -m 0755 -d ${BASEDIR}/bin
|
||||
install -m 0755 arp ${BASEDIR}/sbin
|
||||
- install -m 0755 hostname ${BASEDIR}/bin
|
||||
install -m 0755 ifconfig ${BASEDIR}/sbin
|
||||
install -m 0755 nameif ${BASEDIR}/sbin
|
||||
install -m 0755 netstat ${BASEDIR}/bin
|
||||
@@ -239,21 +235,11 @@
|
||||
ifeq ($(HAVE_MII),1)
|
||||
install -m 0755 mii-tool $(BASEDIR)/sbin
|
||||
endif
|
||||
- ln -fs hostname $(BASEDIR)/bin/dnsdomainname
|
||||
- ln -fs hostname $(BASEDIR)/bin/ypdomainname
|
||||
- ln -fs hostname $(BASEDIR)/bin/nisdomainname
|
||||
- ln -fs hostname $(BASEDIR)/bin/domainname
|
||||
-ifeq ($(HAVE_AFDECnet),1)
|
||||
- ln -fs hostname $(BASEDIR)/bin/nodename
|
||||
-endif
|
||||
|
||||
savebin:
|
||||
@for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
|
||||
${BASEDIR}/bin/netstat \
|
||||
- ${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route \
|
||||
- ${BASEDIR}/bin/hostname ${BASEDIR}/bin/ypdomainname \
|
||||
- ${BASEDIR}/bin/dnsdomainname ${BASEDIR}/bin/nisdomainname \
|
||||
- ${BASEDIR}/bin/domainname ; do \
|
||||
+ ${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route; do \
|
||||
[ -f $$i ] && cp -f $$i $$i.old ; done ; echo Saved.
|
||||
|
||||
installdata:
|
||||
185
src/patches/squidclamav-5.11-squid-helper-protocol.patch
Normal file
185
src/patches/squidclamav-5.11-squid-helper-protocol.patch
Normal file
@@ -0,0 +1,185 @@
|
||||
diff -Naur squidclamav-5.11.org/src/squidclamav.c squidclamav-5.11/src/squidclamav.c
|
||||
--- squidclamav-5.11.org/src/squidclamav.c 2012-10-29 09:46:06.000000000 +0100
|
||||
+++ squidclamav-5.11/src/squidclamav.c 2014-06-03 12:26:36.215696508 +0200
|
||||
@@ -483,7 +483,7 @@
|
||||
aren't appropriate, then just echo back the line from stdin */
|
||||
if (buff_status == 1) {
|
||||
logit(log_file, "DEBUG Invalid input buffer, aborting: %s\n", sbuff);
|
||||
- puts("");
|
||||
+ puts("BH message=\"Invalid input buffer\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -496,7 +496,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (TRUSTUSER match) for user: %s\n", in_buff.ident);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"TRUSTUSER match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -508,7 +508,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (TRUSTCLIENT match) for address: %s/%s\n",in_buff.ipaddress, in_buff.fqdn);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"TRUSTCLIENT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -520,7 +520,7 @@
|
||||
logit(log_file, "DEBUG No squidguard and no antivir check (WHITELIST match) for url: %s\n", in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"WHITLIST match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -536,7 +536,7 @@
|
||||
if ((sockd = dconnect ()) < 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't connect to Clamd daemon, fallback to Squid.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"Cannot connect to clamd\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -546,7 +546,7 @@
|
||||
if (write (sockd, "zINSTREAM", 10) <= 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't write to Clamd socket.\n");
|
||||
- puts("");
|
||||
+ puts("BG message=\"Cannot write to clamd socket\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -614,8 +614,7 @@
|
||||
logit(log_file, "Squid Cache purged of url %s.\n", in_buff.url);
|
||||
}
|
||||
}
|
||||
- fprintf (stdout, "%s %s %s %s\n", urlredir,
|
||||
- in_buff.src_address, in_buff.ident, in_buff.method);
|
||||
+ fprintf (stdout, "OK rewrite-url=\"%s\"\n", urlredir);
|
||||
fflush(stdout);
|
||||
xfree(urlredir);
|
||||
if (debug != 0)
|
||||
@@ -675,7 +674,7 @@
|
||||
continue operation (so that Squid still works!),
|
||||
we simply echo stdin to stdout - i.e. "bridge mode" :-) */
|
||||
if (bridge_mode == 1) {
|
||||
- puts("");
|
||||
+ puts("ERR message=\"brigde mode\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -685,7 +684,7 @@
|
||||
if (buff_status == -1) {
|
||||
if (debug > 2)
|
||||
logit(log_file, "DEBUG method is not GET skipping virus scan.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"method is not GET skipping virus scan\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -699,7 +698,7 @@
|
||||
timeit(g_start, "Total");
|
||||
|
||||
/* no replacement for the URL was found */
|
||||
- puts("");
|
||||
+ puts("ERR message=\"ABORT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
|
||||
@@ -750,7 +749,7 @@
|
||||
logit(log_file, "DEBUG HIT Cache found, trust cache enabled, skipping...\n");
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"cache hit found\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -762,7 +761,7 @@
|
||||
logit(log_file, "ERROR No content length from url %s\n", in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no content length from URL\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -775,7 +774,7 @@
|
||||
logit(log_file, "DEBUG No antivir check (Content length is upper than maxsize): %'.2f > %'.2f\n", usize, maxsize);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"content length is upper than maxsize\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -787,7 +786,7 @@
|
||||
in_buff.url);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no content type from URL\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -799,7 +798,7 @@
|
||||
logit(log_file, "DEBUG No antivir check (ABORTCONTENT match) for content-type: %s\n", content_type);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"ABORTCONTENT match\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -814,7 +813,7 @@
|
||||
if ((sockd = dconnect ()) < 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't connect to Clamd daemon, fallback to Squid.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"cannot connect clamd daemon\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -824,7 +823,7 @@
|
||||
if (write (sockd, "zINSTREAM", 10) <= 0)
|
||||
{
|
||||
logit(log_file, "ERROR Can't write to Clamd socket.\n");
|
||||
- puts("");
|
||||
+ puts("BH message=\"cannot write to clamd socket\"");
|
||||
fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -844,7 +843,7 @@
|
||||
close (sockd);
|
||||
if (debug > 1)
|
||||
logit(log_file, "DEBUG Connection to clamd closed.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"connection to clamd closed\"");
|
||||
fflush(stdout);
|
||||
if (statit == 1)
|
||||
timeit(g_start, "Total");
|
||||
@@ -892,8 +891,7 @@
|
||||
logit(log_file, "Squid Cache purged of url %s.\n", in_buff.url);
|
||||
}
|
||||
}
|
||||
- fprintf (stdout, "%s %s %s %s\n", urlredir,
|
||||
- in_buff.src_address, in_buff.ident, in_buff.method);
|
||||
+ fprintf (stdout, "OK rewrite-url=\"%s\"\n", urlredir);
|
||||
fflush(stdout);
|
||||
xfree(urlredir);
|
||||
if (debug != 0)
|
||||
@@ -911,7 +909,7 @@
|
||||
if (virusfound == 0) {
|
||||
if (debug != 0)
|
||||
logit(log_file, "DEBUG No virus detected.\n");
|
||||
- puts("");
|
||||
+ puts("ERR message=\"no virus detected\"");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
75
src/patches/squidguard-1.4-squid-helper-protocol.patch
Normal file
75
src/patches/squidguard-1.4-squid-helper-protocol.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
http://bugs.squid-cache.org/show_bug.cgi?id=3978
|
||||
|
||||
--- squidGuard-1.4.orig/src/main.c 2013-12-11 17:42:15.000000000 +1300
|
||||
+++ squidGuard-1.4.orig/src/main.c 2013-12-11 19:04:09.000000000 +1300
|
||||
@@ -175,7 +175,7 @@
|
||||
sgReloadConfig();
|
||||
}
|
||||
if(failsafe_mode) {
|
||||
- puts("");
|
||||
+ puts("ERR message=\"squidGuard failsafe mode\"");
|
||||
fflush(stdout);
|
||||
if(sig_hup){
|
||||
sgReloadConfig();
|
||||
@@ -184,7 +184,7 @@
|
||||
}
|
||||
if(parseLine(buf,&squidInfo) != 1){
|
||||
sgLogError("Error parsing squid line: %s",buf);
|
||||
- puts("");
|
||||
+ puts("BH message=\"squidGuard error parsing squid line\"");
|
||||
}
|
||||
else {
|
||||
src = Source;
|
||||
@@ -196,14 +196,14 @@
|
||||
acl = sgAclCheckSource(src);
|
||||
if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){
|
||||
if(src == NULL || src->cont_search == 0){
|
||||
- puts("");
|
||||
+ puts("ERR");
|
||||
break;
|
||||
} else
|
||||
if(src->next != NULL){
|
||||
src = src->next;
|
||||
continue;
|
||||
} else {
|
||||
- puts("");
|
||||
+ puts("ERR");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -215,9 +215,10 @@
|
||||
squidInfo.ident[0] = '-';
|
||||
squidInfo.ident[1] = '\0';
|
||||
}
|
||||
- fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src,
|
||||
- squidInfo.srcDomain,squidInfo.ident,
|
||||
- squidInfo.method);
|
||||
+ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') {
|
||||
+ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]);
|
||||
+ } else
|
||||
+ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect);
|
||||
/* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */
|
||||
break;
|
||||
}
|
||||
--- squidGuard-1.4.orig/src/sgDiv.c 2013-12-11 17:42:15.000000000 +1300
|
||||
+++ squidGuard-1.4.orig/src/sgDiv.c 2013-12-11 18:58:33.000000000 +1300
|
||||
@@ -771,7 +771,7 @@
|
||||
}
|
||||
sgLogError("Going into emergency mode");
|
||||
while(fgets(buf, MAX_BUF, stdin) != NULL){
|
||||
- puts("");
|
||||
+ puts("ERR");
|
||||
fflush(stdout);
|
||||
}
|
||||
sgLogError("ending emergency mode, stdin empty");
|
||||
--- squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 17:42:15.000000000 +1300
|
||||
+++ squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 18:58:40.000000000 +1300
|
||||
@@ -782,7 +782,7 @@
|
||||
}
|
||||
sgLogError("Going into emergency mode");
|
||||
while(fgets(buf, MAX_BUF, stdin) != NULL){
|
||||
- puts("");
|
||||
+ puts("ERR");
|
||||
fflush(stdout);
|
||||
}
|
||||
sgLogError("ending emergency mode, stdin empty");
|
||||
@@ -651,7 +651,7 @@ if ($ip ne $ipcache) {
|
||||
&General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server)");
|
||||
}
|
||||
}
|
||||
elsif ($settings{'SERVICE'} eq 'udmedia.de') {
|
||||
elsif ($settings{'SERVICE'} eq 'udmedia') {
|
||||
# use proxy ?
|
||||
my %proxysettings;
|
||||
&General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
|
||||
@@ -685,7 +685,7 @@ if ($ip ne $ipcache) {
|
||||
&General::log("Dynamic DNS ip-update for $settings{'HOSTDOMAIN'} : failure (could not connect to server, check your credentials---$out-$response--)");
|
||||
}
|
||||
}
|
||||
elsif ($settings{'SERVICE'} eq 'twodns.de') {
|
||||
elsif ($settings{'SERVICE'} eq 'twodns') {
|
||||
# use proxy ?
|
||||
my %proxysettings;
|
||||
&General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
|
||||
|
||||
Reference in New Issue
Block a user