diff options
-rw-r--r-- | etc/inc/upgrade_config.inc | 148 | ||||
-rw-r--r-- | usr/local/www/interfaces_gre.php | 12 | ||||
-rw-r--r-- | usr/local/www/interfaces_gre_edit.php | 40 | ||||
-rwxr-xr-x | usr/local/www/interfaces_groups_edit.php | 6 |
4 files changed, 135 insertions, 71 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index f918bd9..b607ab4 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2664,9 +2664,7 @@ function upgrade_080_to_081() { $databases = return_dir_as_array($rrddbpath, '/-(traffic|packets)\.rrd$/'); rsort($databases); foreach($databases as $database) { - $databasetmp = "{$database}.tmp"; $xmldump = "{$database}.old.xml"; - $xmldumptmp = "{$database}.tmp.xml"; $xmldumpnew = "{$database}.new.xml"; if ($g['booting']) @@ -2675,47 +2673,113 @@ function upgrade_080_to_081() { /* dump contents to xml and move database out of the way */ dump_rrd_to_xml("{$rrddbpath}/{$database}", "{$g['tmp_path']}/{$xmldump}"); - /* create new rrd database file */ - $rrdcreate = "$rrdtool create {$g['tmp_path']}/{$databasetmp} --step $rrdinterval "; - $rrdcreate .= "DS:inpass:COUNTER:$valid:0:$downstream "; - $rrdcreate .= "DS:outpass:COUNTER:$valid:0:$upstream "; - $rrdcreate .= "DS:inblock:COUNTER:$valid:0:$downstream "; - $rrdcreate .= "DS:outblock:COUNTER:$valid:0:$upstream "; - $rrdcreate .= "DS:inpass6:COUNTER:$valid:0:$downstream "; - $rrdcreate .= "DS:outpass6:COUNTER:$valid:0:$upstream "; - $rrdcreate .= "DS:inblock6:COUNTER:$valid:0:$downstream "; - $rrdcreate .= "DS:outblock6:COUNTER:$valid:0:$upstream "; - $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; - $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 "; - $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 "; - $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 "; - - create_new_rrd("$rrdcreate"); - /* create temporary xml from new RRD */ - dump_rrd_to_xml("{$g['tmp_path']}/{$databasetmp}", "{$g['tmp_path']}/{$xmldumptmp}"); - - $rrdold = xml2array(file_get_contents("{$g['tmp_path']}/{$xmldump}"), 1, "tag"); - $rrdolder = $rrdold['rrd']; - unset($rrdold); - - $rrdnew = xml2array(file_get_contents("{$g['tmp_path']}/{$xmldumptmp}"), 1, "tag"); - $rrdnewer = $rrdnew['rrd']; - unset($rrdnew); - - /* remove any MAX RRA's. Not needed for traffic. */ - if (is_array($rrdolder)) { - $i = 0; - foreach ($rrdolder['rra'] as $rra) { - if(trim($rra['cf']) == "MAX") { - unset($rrdolder['rra'][$i]); - } - $i++; - } + /* search and replace tags to add data sources */ + $ds_search = "<!-- Round Robin Archives -->"; + $ds_arr = array(); + $ds_arr[] = " <ds> + <name> inpass6 </name> + <type> COUNTER </type> + <minimal_heartbeat> {$valid} </minimal_heartbeat> + <min> 0.0000000000e+00 </min> + <max> 1.2500000000e+08 </max> + + <!-- PDP Status --> + <last_ds> 0 </last_ds> + <value> NaN </value> + <unknown_sec> 3 </unknown_sec> + </ds> + "; + $ds_arr[] = " <ds> + <name> outpass6 </name> + <type> COUNTER </type> + <minimal_heartbeat> {$valid} </minimal_heartbeat> + <min> 0.0000000000e+00 </min> + <max> 1.2500000000e+08 </max> + + <!-- PDP Status --> + <last_ds> 0 </last_ds> + <value> NaN </value> + <unknown_sec> 3 </unknown_sec> + </ds> + "; + $ds_arr[] = " <ds> + <name> inblock6 </name> + <type> COUNTER </type> + <minimal_heartbeat> {$valid} </minimal_heartbeat> + <min> 0.0000000000e+00 </min> + <max> 1.2500000000e+08 </max> + + <!-- PDP Status --> + <last_ds> 0 </last_ds> + <value> NaN </value> + <unknown_sec> 3 </unknown_sec> + </ds> + "; + $ds_arr[] = " <ds> + <name> outblock6 </name> + <type> COUNTER </type> + <minimal_heartbeat> {$valid} </minimal_heartbeat> + <min> 0.0000000000e+00 </min> + <max> 1.2500000000e+08 </max> + + <!-- PDP Status --> + <last_ds> 0 </last_ds> + <value> NaN </value> + <unknown_sec> 3 </unknown_sec> + </ds> + "; + + $cdp_search = "<\/cdp_prep>"; + $cdp_replace = "</cdp_prep>"; + $cdp_arr = array(); + $cdp_arr[] = " <ds> + <primary_value> NaN </primary_value> + <secondary_value> 0.0000000000e+00 </secondary_value> + <value> NaN </value> + <unknown_datapoints> 0 </unknown_datapoints> + </ds> + "; + $cdp_arr[] = " <ds> + <primary_value> NaN </primary_value> + <secondary_value> 0.0000000000e+00 </secondary_value> + <value> NaN </value> + <unknown_datapoints> 0 </unknown_datapoints> + </ds> + "; + $cdp_arr[] = " <ds> + <primary_value> NaN </primary_value> + <secondary_value> 0.0000000000e+00 </secondary_value> + <value> NaN </value> + <unknown_datapoints> 0 </unknown_datapoints> + </ds> + "; + $cdp_arr[] = " <ds> + <primary_value> NaN </primary_value> + <secondary_value> 0.0000000000e+00 </secondary_value> + <value> NaN </value> + <unknown_datapoints> 0 </unknown_datapoints> + </ds> + "; + + $value_search = "<\/row>"; + $value_replace = "</row>"; + $value = "<v> NaN </v>"; + + $xml = file_get_contents("{$g['tmp_path']}/{$xmldump}"); + foreach($ds_arr as $ds) { + $xml = preg_replace("/$ds_search/s", "$ds{$ds_search}", $xml); + } + foreach($cdp_arr as $cdp) { + $xml = preg_replace("/$cdp_search/s", "$cdp{$cdp_replace}", $xml); + } + foreach($ds_arr as $ds) { + $xml = preg_replace("/$value_search/s", "$value{$value_replace}", $xml); + } + + file_put_contents("{$g['tmp_path']}/{$xmldumpnew}", $xml); + mwexec("$rrdtool restore -f {$g['tmp_path']}/{$xmldumpnew} {$rrddbpath}/{$database} 2>&1"); + unset($xml); - file_put_contents("{$g['tmp_path']}/{$xmldumpnew}", dump_xml_config_raw(migrate_rrd_format($rrdolder, $rrdnewer), "rrd")); - mwexec("$rrdtool restore -f {$g['tmp_path']}/{$xmldumpnew} {$rrddbpath}/{$database} 2>&1"); - unset($rrdolder, $rrdnewer); - } } enable_rrd_graphing(); if ($g['booting']) diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php index e4e3954..eeedb2d 100644 --- a/usr/local/www/interfaces_gre.php +++ b/usr/local/www/interfaces_gre.php @@ -87,7 +87,7 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> <?php if ($input_errors) print_input_errors($input_errors); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces gre"> <tr><td> <?php $tab_array = array(); @@ -107,7 +107,7 @@ include("head.inc"); <tr> <td> <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area"> <tr> <td width="20%" class="listhdrr"><?=gettext("Interface");?></td> <td width="20%" class="listhdrr"><?=gettext("Tunnel to...");?></td> @@ -125,17 +125,17 @@ include("head.inc"); <td class="listbg"> <?=htmlspecialchars($gre['descr']);?> </td> - <td valign="middle" nowrap class="list"> <a href="interfaces_gre_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a> - <a href="interfaces_gre.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this GRE tunnel?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <td valign="middle" class="list nowrap"> <a href="interfaces_gre_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a> + <a href="interfaces_gre.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this GRE tunnel?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td> </tr> <?php $i++; endforeach; ?> <tr> <td class="list" colspan="3"> </td> - <td class="list"> <a href="interfaces_gre_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + <td class="list"> <a href="interfaces_gre_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td> </tr> <tr> <td class="tabcont" colspan="3"> - <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br></strong></span><?=gettext("Here you can configure Generic Routing Encapsulation (GRE - RFC 2784) tunnels.");?></span></p> + <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br/></strong></span><?=gettext("Here you can configure Generic Routing Encapsulation (GRE - RFC 2784) tunnels.");?></span></p> </td> </tr> </table> diff --git a/usr/local/www/interfaces_gre_edit.php b/usr/local/www/interfaces_gre_edit.php index 839a606..9715552 100644 --- a/usr/local/www/interfaces_gre_edit.php +++ b/usr/local/www/interfaces_gre_edit.php @@ -134,7 +134,7 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <?php if ($input_errors) print_input_errors($input_errors); ?> <form action="interfaces_gre_edit.php" method="post" name="iform" id="iform"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces gre edit"> <tr> <td colspan="2" valign="top" class="listtopic"><?=gettext("GRE configuration");?></td> </tr> @@ -150,7 +150,7 @@ include("head.inc"); foreach ($portlist as $ifn => $ifinfo) { echo "<option value=\"{$ifn}\""; if ($ifn == $pconfig['if']) - echo "selected"; + echo " selected=\"selected\""; echo ">{$ifinfo}</option>"; } ?> @@ -161,27 +161,27 @@ include("head.inc"); <tr> <td valign="top" class="vncellreq"><?=gettext("GRE remote address");?></td> <td class="vtable"> - <input name="remote-addr" type="text" class="formfld unknown" id="remote-addr" size="16" value="<?=htmlspecialchars($pconfig['remote-addr']);?>"> - <br> + <input name="remote-addr" type="text" class="formfld unknown" id="remote-addr" size="16" value="<?=htmlspecialchars($pconfig['remote-addr']);?>" /> + <br/> <span class="vexpl"><?=gettext("Peer address where encapsulated GRE packets will be sent ");?></span></td> </tr> <tr> <td valign="top" class="vncellreq"><?=gettext("GRE tunnel local address ");?></td> <td class="vtable"> - <input name="tunnel-local-addr" type="text" class="formfld unknown" id="tunnel-local-addr" size="16" value="<?=htmlspecialchars($pconfig['tunnel-local-addr']);?>"> - <br> + <input name="tunnel-local-addr" type="text" class="formfld unknown" id="tunnel-local-addr" size="16" value="<?=htmlspecialchars($pconfig['tunnel-local-addr']);?>" /> + <br/> <span class="vexpl"><?=gettext("Local GRE tunnel endpoint");?></span></td> </tr> <tr> <td valign="top" class="vncellreq"><?=gettext("GRE tunnel remote address ");?></td> <td class="vtable"> - <input name="tunnel-remote-addr" type="text" class="formfld unknown" id="tunnel-remote-addr" size="16" value="<?=htmlspecialchars($pconfig['tunnel-remote-addr']);?>"> + <input name="tunnel-remote-addr" type="text" class="formfld unknown" id="tunnel-remote-addr" size="16" value="<?=htmlspecialchars($pconfig['tunnel-remote-addr']);?>" /> <select name="tunnel-remote-net" class="formselect" id="tunnel-remote-net"> <?php for ($i = 128; $i > 0; $i--) { - echo "<option value=\"{$i}\" "; + echo "<option value=\"{$i}\""; if ($i == $pconfig['tunnel-remote-net']) - echo "selected"; + echo " selected=\"selected\""; echo ">" . $i . "</option>"; } ?> @@ -192,15 +192,15 @@ include("head.inc"); <tr> <td valign="top" class="vncell"><?=gettext("Mobile tunnel");?></td> <td class="vtable"> - <input name="link0" type="checkbox" id="link0" <?if ($pconfig['link0']) echo "checked";?>> - <br> + <input name="link0" type="checkbox" id="link0" <?if ($pconfig['link0']) echo "checked=\"checked\"";?> /> + <br/> <span class="vexpl"><?=gettext("Specify which encapsulation method the tunnel should use. ");?></span></td> </tr> <tr> <td valign="top" class="vncell"><?=gettext("Route search type");?></td> <td class="vtable"> - <input name="link1" type="checkbox" id="link1" <?if ($pconfig['link1']) echo "checked";?>> - <br> + <input name="link1" type="checkbox" id="link1" <?if ($pconfig['link1']) echo "checked=\"checked\"";?> /> + <br/> <span class="vexpl"> <?=gettext("For correct operation, the GRE device needs a route to the destination". " that is less specific than the one over the tunnel. (Basically, there". @@ -211,24 +211,24 @@ include("head.inc"); <tr> <td valign="top" class="vncell"><?=gettext("WCCP version");?></td> <td class="vtable"> - <input name="link2" type="checkbox" id="link2" <?if ($pconfig['link2']) echo "checked";?>> - <br> + <input name="link2" type="checkbox" id="link2" <?if ($pconfig['link2']) echo "checked=\"checked\"";?> /> + <br/> <span class="vexpl"><?=gettext("Specify which WCCP encapsulation(version 1 or 2) method the tunnel should use");?></span></td> </tr> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> <td width="78%" class="vtable"> - <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> - <br> <span class="vexpl"><?=gettext("You may enter a description here". + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" /> + <br/> <span class="vexpl"><?=gettext("You may enter a description here". " for your reference (not parsed).");?></span></td> </tr> <tr> <td width="22%" valign="top"> </td> <td width="78%"> - <input type="hidden" name="greif" value="<?=htmlspecialchars($pconfig['greif']); ?>"> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <input type="hidden" name="greif" value="<?=htmlspecialchars($pconfig['greif']); ?>" /> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" value="<?=gettext("Cancel");?>" onclick="history.back()" /> <?php if (isset($id) && $a_gres[$id]): ?> - <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>"> + <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> </td> </tr> diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php index 48093f4..1356760 100755 --- a/usr/local/www/interfaces_groups_edit.php +++ b/usr/local/www/interfaces_groups_edit.php @@ -202,8 +202,8 @@ var addRowTo = (function() { $iflist = get_configured_interface_with_descr(); foreach ($iflist as $ifnam => $ifdescr) - $innerHTML .= "<option value='{$ifnam}'>{$ifdescr}</option>"; - $innerHTML .= "</select>\";"; + $innerHTML .= "<option value='{$ifnam}'>{$ifdescr}<\/option>"; + $innerHTML .= "<\/select>\";"; ?> td.innerHTML=<?=$innerHTML;?> tr.appendChild(td); @@ -211,7 +211,7 @@ var addRowTo = (function() { td = d.createElement("td"); td.rowSpan = "1"; - td.innerHTML = '<a onclick="removeRow(this);return false;" href="#"><img border="0" src="/themes/' + theme + '/images/icons/icon_x.gif" alt="remove" /></a>'; + td.innerHTML = '<a onclick="removeRow(this);return false;" href="#"><img border="0" src="/themes/' + theme + '/images/icons/icon_x.gif" alt="remove" /><\/a>'; tr.appendChild(td); tbody.appendChild(tr); totalrows++; |