diff options
author | jim-p <jimp@pfsense.org> | 2011-05-19 08:50:48 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-05-19 08:50:48 -0400 |
commit | 27d0722d13f41c3a569d05588e08dd2b1c18fd43 (patch) | |
tree | 3362f1f378d5d64de1446774fcb0b1b06b81c0b4 | |
parent | 62a29fe39e7d579788e97ca05c6266f46fe1f957 (diff) | |
parent | 2f6532d55221f86cbc717350eafb8e4404181cbd (diff) | |
download | pfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.zip pfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.tar.gz |
Merge remote branch 'upstream/master'
-rw-r--r-- | etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 2 | ||||
-rw-r--r-- | etc/inc/pkg-utils.inc | 12 | ||||
-rw-r--r-- | etc/inc/rrd.inc | 35 | ||||
-rw-r--r-- | etc/inc/service-utils.inc | 14 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 40 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 3 | ||||
-rw-r--r-- | etc/phpshellsessions/gitsync | 2 | ||||
-rwxr-xr-x | etc/rc.filter_synchronize | 7 | ||||
-rwxr-xr-x | etc/rc.start_packages | 80 | ||||
-rwxr-xr-x | etc/rc.stop_packages | 79 | ||||
-rw-r--r-- | usr/local/bin/captiveportal_gather_stats.php | 14 | ||||
-rw-r--r-- | usr/local/pkg/carp_settings.xml | 18 | ||||
-rwxr-xr-x | usr/local/www/diag_arp.php | 4 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 2 | ||||
-rwxr-xr-x | usr/local/www/services_captiveportal.php | 2 | ||||
-rwxr-xr-x | usr/local/www/status_dhcp_leases.php | 4 | ||||
-rw-r--r-- | usr/local/www/status_rrd_graph_img.php | 42 | ||||
-rw-r--r-- | usr/local/www/system_crlmanager.php | 2 | ||||
-rwxr-xr-x | usr/local/www/xmlrpc.php | 102 |
20 files changed, 317 insertions, 149 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index 6993148..3bd0de2 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -91,7 +91,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "http://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "7.9", + "latest_config" => "8.0", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index ce5a328..bb7e66b 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -372,6 +372,7 @@ function return_gateway_groups_array() { $gateways_arr = return_gateways_array(); $gateway_groups_array = array(); + if (0) { /* * NOTE: The code below is meant to replace the default gateway when it goes down. * This facilitates services running on pfSense itself and are not handled by a PBR to continue working. @@ -405,6 +406,7 @@ function return_gateway_groups_array() { } } unset($upgw, $dfltgwfound, $dfltgwdown, $gwname, $gwsttng); + } if (is_array($config['gateways']['gateway_group'])) { foreach($config['gateways']['gateway_group'] as $group) { diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 5c21428..070dade 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -42,6 +42,7 @@ require_once("globals.inc"); require_once("xmlrpc.inc"); +require_once("service-utils.inc"); if(file_exists("/cf/conf/use_xmlreader")) require_once("xmlreader.inc"); else @@ -324,6 +325,8 @@ function uninstall_package($pkg_name) { } } + stop_service($pkg_name); + $id = get_pkg_id($pkg_name); if ($id >= 0) { $pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package']; @@ -892,7 +895,7 @@ function delete_package($pkg) { } function delete_package_xml($pkg) { - global $g, $config, $static_output, $pkg_interface; + global $g, $config, $static_output, $pkg_interface, $rcfileprefix; conf_mount_rw(); @@ -964,6 +967,13 @@ function delete_package_xml($pkg) { if($instservice['name'] == $service['name']) { if($g['booting'] != true) stop_service($service['name']); + if($service['rcfile']) { + $prefix = $rcfileprefix; + if (!empty($service['prefix'])) + $prefix = $service['prefix']; + if (file_exists("{$prefix}{$service['rcfile']}")) + @unlink("{$prefix}{$service['rcfile']}"); + } unset($services[$key]); } } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 529080c..d3de377 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -744,42 +744,7 @@ function enable_rrd_graphing() { $rrdupdatesh .= "# polling Captive Portal for number of logged in users\n"; $rrdupdatesh .= "CP=`$php -q $captiveportal_gather loggedin`\n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \${CP}\n"; - - $ifname= "captiveportal"; - if (!file_exists("$rrddbpath$ifname$captiveportaltotalusers")) { - $rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportaltotalusers --step $rrdcaptiveportalinterval "; - $rrdcreate .= "DS:totalusers:GAUGE:$captiveportalvalid:0:10000 "; - $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; - $rrdcreate .= "RRA:AVERAGE:0.5:5:1100 "; - $rrdcreate .= "RRA:AVERAGE:0.5:60:1175 "; - $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 "; - $rrdcreate .= "RRA:MIN:0.5:1:1000 "; - $rrdcreate .= "RRA:MIN:0.5:5:1100 "; - $rrdcreate .= "RRA:MIN:0.5:60:1175 "; - $rrdcreate .= "RRA:MIN:0.5:720:3000 "; - $rrdcreate .= "RRA:MAX:0.5:1:1000 "; - $rrdcreate .= "RRA:MAX:0.5:5:1100 "; - $rrdcreate .= "RRA:MAX:0.5:60:1175 "; - $rrdcreate .= "RRA:MAX:0.5:720:3000 "; - $rrdcreate .= "RRA:LAST:0.5:1:1000 "; - $rrdcreate .= "RRA:LAST:0.5:5:1100 "; - $rrdcreate .= "RRA:LAST:0.5:60:1175 "; - $rrdcreate .= "RRA:LAST:0.5:720:3000 "; - create_new_rrd($rrdcreate); - } - - /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { - mwexec("$rrdtool update $rrddbpath$ifname$captiveportaltotalusers N:U"); - } - - /* the Captive Portal stats gathering function. */ - $rrdupdatesh .= "\n"; - $rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n"; - $rrdupdatesh .= "CP=`$php -q $captiveportal_gather total`\n"; - $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportaltotalusers \${CP}\n"; - } $rrdupdatesh .= "sleep 60\n"; diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 895eb57..57b1719 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -82,6 +82,9 @@ function start_service($name) { global $config; global $rcfileprefix; + if (empty($name)) + return; + /* make sure service is stopped before starting */ stop_service($name); sleep(2); @@ -114,6 +117,9 @@ function stop_service($name) { global $config; global $rcfileprefix; + if (empty($name)) + return; + if ($config['installedpackages']['service']) { foreach($config['installedpackages']['service'] as $service) { if(strtolower($service['name']) == strtolower($name)) { @@ -122,7 +128,10 @@ function stop_service($name) { if(!empty($service['prefix'])) { $prefix =& $service['prefix']; } - mwexec_bg("{$prefix}{$service['rcfile']} stop"); + if(file_exists("{$prefix}{$service['rcfile']}")) { + mwexec_bg("{$prefix}{$service['rcfile']} stop"); + } + return; } if (!empty($service['stopcmd'])) eval($service['stopcmd']); @@ -144,6 +153,9 @@ function stop_service($name) { function restart_service($name) { global $config; + if (empty($name)) + return; + stop_service($name); start_service($name); diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 77a8682..1646292 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -1804,13 +1804,26 @@ function upgrade_053_to_054() { $lbpool_srv_arr = array(); $gateway_group_arr = array(); $gateways = return_gateways_array(); + $group_name_changes = array(); if (! is_array($config['gateways']['gateway_item'])) $config['gateways']['gateway_item'] = array(); $a_gateways =& $config['gateways']['gateway_item']; foreach($lbpool_arr as $lbpool) { if($lbpool['type'] == "gateway") { - $gateway_group['name'] = $lbpool['name']; + // Gateway Groups have to have valid names in pf, old lb pools did not. Clean them up. + $group_name = ereg_replace("[^A-Za-z0-9]", "", $lbpool['name'] ); + // If we made and changes, check for collisions and note the change. + if ($group_name != $lbpool['name']) { + // Make sure the name isn't already in use. + foreach ($gateway_group_arr as $gwg) { + // If the name is in use, add some random bits to avoid collision. + if ($gwg['name'] == $group_name) + $group_name .= uniqid(); + } + $group_name_changes[$lbpool['name']] = $group_name; + } + $gateway_group['name'] = $group_name; $gateway_group['descr'] = $lbpool['descr']; $gateway_group['trigger'] = "down"; $gateway_group['item'] = array(); @@ -1855,6 +1868,11 @@ function upgrade_053_to_054() { // Only set the gateway group array if we converted any if (count($gateway_group_arr) != 0) { $config['gateways']['gateway_group'] = $gateway_group_arr; + // Update any rules that had a gateway change, if any. + if (count($group_name_changes) > 0) + foreach ($config['filter']['rule'] as & $rule) + if (!empty($rule["gateway"]) && array_key_exists($rule["gateway"], $group_name_changes)) + $rule["gateway"] = $group_name_changes[$rule["gateway"]]; } } @@ -2456,6 +2474,24 @@ function upgrade_076_to_077() { } function upgrade_077_to_078() { + if (is_array($config['pptpd']) && is_array($config['pptpd']['radius']) + && !is_array($config['pptpd']['radius']['server'])) { + $radarr = array(); + $radsvr = array(); + $radsvr['ip'] = $config['pptpd']['radius']['server']; + $radsvr['secret'] = $config['pptpd']['radius']['secret']; + $radsvr['port'] = 1812; + $radsvr['acctport'] = 1813; + $radsvr['enable'] = isset($config['pptpd']['radius']['enable']); + $radarr['accounting'] = isset($config['pptpd']['radius']['accounting']); + if ($radarr['accounting']) + $radarr['acct_update'] = $radsvr['ip']; + $radarr['server'] = $radsvr; + $config['pptpd']['radius'] = $radarr; + } +} + +function upgrade_078_to_079() { global $config; global $g; @@ -2541,7 +2577,7 @@ function upgrade_077_to_078() { } } -function upgrade_078_to_079() { +function upgrade_079_to_080() { global $config; /* enable the allow IPv6 toggle */ $config['system']['ipv6allow'] = true; diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 24e5956..80e3a85 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -282,7 +282,8 @@ function vpn_ipsec_configure($ipchg = false) break; } - $pskconf .= "{$peerid_data}\t{$ph1ent['pre-shared-key']}\n"; + if (!empty($peerid_data) && !empty($ph1ent['pre-shared-key'])) + $pskconf .= trim($peerid_data) . "\t" . trim($ph1ent['pre-shared-key']) . "\n"; } } diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync index 0ff40e1..81ea653 100644 --- a/etc/phpshellsessions/gitsync +++ b/etc/phpshellsessions/gitsync @@ -13,7 +13,7 @@ require_once("pfsense-utils.inc"); conf_mount_rw(); -$GIT_REPO="http://gitweb.pfsense.org/pfsense/mainline.git"; +$GIT_REPO="git://github.com/bsdperimeter/pfsense.git"; $CODIR = "/root/pfsense/"; global $g; diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize index d588e8a..0fe4c15 100755 --- a/etc/rc.filter_synchronize +++ b/etc/rc.filter_synchronize @@ -323,9 +323,10 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) { if ($carp['synchronizetrafficshaper'] != "" and is_array($config['shaper'])) { $sections[] = 'shaper'; } - if ($carp['synchronizetrafficshaper'] != "") { - if (!is_array($config['l7shaper'])) - $config['l7shaper'] = array(); + if ($carp['synchronizetrafficshaperlimiter'] != "" and is_array($config['dnshaper'])) { + $sections[] = 'dnshaper'; + } + if ($carp['synchronizetrafficshaperlayer7'] != "" and is_array($config['l7shaper'])) { $sections[] = 'l7shaper'; } if ($carp['synchronizestaticroutes'] != "") { diff --git a/etc/rc.start_packages b/etc/rc.start_packages index 4025e58..ddd288d 100755 --- a/etc/rc.start_packages +++ b/etc/rc.start_packages @@ -1,17 +1,73 @@ -#!/bin/sh +#!/usr/local/bin/php -f +<?php +/* $Id$ */ +/* + rc.start_packages + part of pfSense (http://www.pfSense.com) + Copyright (C) 2004 Scott Ullrich + All rights reserved. -# Set our operating platform -PLATFORM=`cat /etc/platform` + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -if [ ! "$PLATFORM" = "cdrom" ]; then + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - /etc/rc.packages 2>/dev/null + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - echo "Executing rc.d items... " - for FILE in /usr/local/etc/rc.d/*.sh; do - echo -n " Starting ${FILE}..." - sh $FILE start >>/tmp/bootup_messages 2>&1 & - echo "done." - done -fi + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +require_once("config.inc"); +require_once("functions.inc"); +require_once("filter.inc"); +require_once("shaper.inc"); +require_once("captiveportal.inc"); +require_once("pkg-utils.inc"); +require_once("pfsense-utils.inc"); +require_once("service-utils.inc"); + +log_error("Restarting/Starting all packages."); + +$rcfiles = glob("{$rcfileprefix}*.sh"); +if (!$rcfiles) + $rcfiles = array(); +else { + $rcfiles = array_flip($rcfiles); + if (!$rcfiles) + $rcfiles = array(); +} + +if (is_array($config['installedpackages']['package'])) { + foreach($config['installedpackages']['package'] as $package) { + echo " Starting package {$package['name']}..."; + sync_package($package['name']); + start_service($package['name']); + unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]); + echo "done.\n"; + } +} + +$shell = @popen("/bin/sh", "w"); +if ($shell) { + foreach ($rcfiles as $rcfile) { + echo " Starting {$rcfile}..."; + fwrite($shell, "{$rcfile} start >>/tmp/bootup_messages 2>&1 &"); + echo "done.\n"; + } + + pclose($shell); +} + +?> diff --git a/etc/rc.stop_packages b/etc/rc.stop_packages index 4ff9ed9..181d2ea 100755 --- a/etc/rc.stop_packages +++ b/etc/rc.stop_packages @@ -1,18 +1,71 @@ -#!/bin/sh +#!/usr/local/bin/php -f +<?php +/* $Id$ */ +/* + rc.stop_packages + part of pfSense (http://www.pfSense.com) + Copyright (C) 2004 Scott Ullrich + All rights reserved. -# Set our operating platform -PLATFORM=`cat /etc/platform` + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: -if [ ! "$PLATFORM" = "cdrom" ]; then + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - echo "Syncing packages..." - /etc/rc.packages 2>/dev/null + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - echo "Executing rc.d items... " - for FILE in /usr/local/etc/rc.d/*.sh; do - echo -n " Stopping ${FILE}..." - sh $FILE stop >>/tmp/bootup_messages 2>&1 - echo "done." - done -fi + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +require_once("config.inc"); +require_once("functions.inc"); +require_once("filter.inc"); +require_once("shaper.inc"); +require_once("captiveportal.inc"); +require_once("pkg-utils.inc"); +require_once("pfsense-utils.inc"); +require_once("service-utils.inc"); + +log_error("Stopping all packages."); + +$rcfiles = glob("{$rcfileprefix}*.sh"); +if (!$rcfiles) + $rcfiles = array(); +else { + $rcfiles = array_flip($rcfiles); + if (!$rcfiles) + $rcfiles = array(); +} + +if (is_array($config['installedpackages']['package'])) { + foreach($config['installedpackages']['package'] as $package) { + echo " Stoping package {$package['name']}..."; + stop_service($package['name']); + unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]); + echo "done.\n"; + } +} + +$shell = @popen("/bin/sh", "w"); +if ($shell) { + foreach ($rcfiles as $rcfile) { + echo " Stoping {$rcfile}..."; + fwrite($shell, "{$rcfile} stop >>/tmp/bootup_messages 2>&1"); + echo "done.\n"; + } + + pclose($shell); +} +?> diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php index 5fe1c6b..823b28f 100644 --- a/usr/local/bin/captiveportal_gather_stats.php +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -43,7 +43,7 @@ $concurrent_users = $no_users; $current_user_count = 0; /* tmp file to use to store old data (per interface)*/ -$tmpfile = "{$g['tmp_path']}/captiveportal_online_users"; +$tmpfile = "{$g['vardb_path']}/captiveportal_online_users"; $type = $argv[1]; @@ -82,12 +82,14 @@ if ($type == "loggedin") { $current_user_count = $current_user_count + 1; } - // Write out the latest timestamp - $fd = @fopen($tmpfile, "w"); - if ($fd) { - fwrite($fd, $timestamp); + // Write out the latest timestamp but not if it is empty + if (!empty($timestamp)) { + $fd = @fopen($tmpfile, "w"); + if ($fd) { + fwrite($fd, $timestamp); + } + @fclose($fd); } - @fclose($fd); /* If $timestamp is less than or equal to previous_user_timestamp return 0, * as we only want the 'X' number of users logged in since last RRD poll. diff --git a/usr/local/pkg/carp_settings.xml b/usr/local/pkg/carp_settings.xml index 3365bba..f335236 100644 --- a/usr/local/pkg/carp_settings.xml +++ b/usr/local/pkg/carp_settings.xml @@ -171,9 +171,21 @@ <type>checkbox</type> </field> <field> - <fielddescr>Synchronize traffic shaper</fielddescr> + <fielddescr>Synchronize traffic shaper(queues)</fielddescr> <fieldname>synchronizetrafficshaper</fieldname> - <description>When this option is enabled, this system will automatically sync the traffic shaper configuration to the other CARP host when changes are made.</description> + <description>When this option is enabled, this system will automatically sync the traffic shaper configuration for queues to the other CARP host when changes are made.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Synchronize traffic shaper(limiter)</fielddescr> + <fieldname>synchronizetrafficshaperlimiter</fieldname> + <description>When this option is enabled, this system will automatically sync the traffic shaper configuration for limiters to the other CARP host when changes are made.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Synchronize traffic shaper(layer7)</fielddescr> + <fieldname>synchronizetrafficshaperlayer7</fieldname> + <description>When this option is enabled, this system will automatically sync the traffic shaper configuration for layer7 to the other CARP host when changes are made.</description> <type>checkbox</type> </field> <field> @@ -211,4 +223,4 @@ /* force a filter configure for syncing */ filter_configure(); </custom_add_php_command_late> -</packagegui>
\ No newline at end of file +</packagegui> diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php index 3adc2a8..4665a44 100755 --- a/usr/local/www/diag_arp.php +++ b/usr/local/www/diag_arp.php @@ -309,8 +309,8 @@ $mac_man = load_mac_manufacturer_table(); <?php $mac=$entry['mac']; $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); - if(isset($mac_man[$mac_hi])){ print "<span title=\"$mac\">{$mac_man[$mac_hi]}</span>"; } - else{ print $mac; } + print $mac; + if(isset($mac_man[$mac_hi])){ print "<br/><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; } ?> <td class="listr"> <?php diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 119334e..e001903 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -346,7 +346,7 @@ if ($_POST['apply']) { log_error("removing old v6 address {$values['ipaddrv6']} on {$realif}"); mwexec("/sbin/ifconfig {$realif} inet6 {$values['ipaddrv6']} -alias"); } - interface_configure($ifapply, true); + interface_reconfigure($ifapply); } else { interface_bring_down($ifapply); } diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index 24595da..23e6cd9 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -263,6 +263,7 @@ function enable_change(enable_change) { document.iform.freelogins_resettimeout.disabled = endis; document.iform.freelogins_updatetimeouts.disabled = endis; document.iform.timeout.disabled = endis; + document.iform.preauthurl.disabled = endis; document.iform.redirurl.disabled = endis; document.iform.radiusip.disabled = radius_endis; document.iform.radiusip2.disabled = radius_endis; @@ -283,6 +284,7 @@ function enable_change(enable_change) { document.iform.radmac_format.disabled = radius_endis; document.iform.httpsname.disabled = endis; document.iform.cert.disabled = endis; + document.iform.cacert.disabled = endis; document.iform.key.disabled = endis; document.iform.logoutwin_enable.disabled = endis; document.iform.nomacfilter.disabled = endis; diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 007c1a8..ba18b72 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -363,13 +363,13 @@ foreach ($leases as $data) { $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); if ($data['online'] != "online") { if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined - echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac=$mac\" title=\"" . gettext("$mac - send Wake on LAN packet to this MAC address") ."\">{$mac_man[$mac_hi]}</a>{$fspane} </td>\n"; + echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac=$mac\" title=\"" . gettext("$mac - send Wake on LAN packet to this MAC address") ."\">{$mac}</a><br/><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>{$fspane} </td>\n"; }else{ echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" title=\"" . gettext("send Wake on LAN packet to this MAC address") ."\">{$data['mac']}</a>{$fspane} </td>\n"; } }else{ if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined - echo "<td class=\"listr\">{$fspans}<span title=\"$mac\">{$mac_man[$mac_hi]}</span>{$fspane} </td>\n"; + echo "<td class=\"listr\">{$fspans}{$mac}<br/><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>{$fspane} </td>\n"; }else{ echo "<td class=\"listr\">{$fspans}{$data['mac']}{$fspane} </td>\n"; } diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index d7e828e..2e2d81d 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -1054,16 +1054,15 @@ elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curda $graphcmd .= "--start $start --end $end "; $graphcmd .= "--vertical-label \"Captive Portal Users\" "; $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--base=1000 "; + $graphcmd .= "--lower-limit=0 "; + $graphcmd .= "--slope-mode "; $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; $graphcmd .= "--height 200 --width 620 "; $graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE\" "; - $graphcmd .= "LINE2:\"$curif-loggedinusers#{$colorcaptiveportalusers[0]}:$curif-loggedinusers\" "; - $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; - $graphcmd .= "COMMENT:\"Users Online\t\" "; - $graphcmd .= "GPRINT:\"$curif-loggedinusers:LAST:%7.2lf \" "; - $graphcmd .= "GPRINT:\"$curif-loggedinusers:AVERAGE:%7.2lf \" "; - $graphcmd .= "GPRINT:\"$curif-loggedinusers:MAX:%7.2lf \" "; + $graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" "; + $graphcmd .= "AREA:\"$curif-totalusers_t#{$colorcaptiveportalusers[0]}:Total logged in users\" "; + $graphcmd .= "GPRINT:\"$curif-totalusers_t:MAX:%8.0lf \\n\" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; } @@ -1074,37 +1073,18 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur $graphcmd .= "--vertical-label \"Captive Portal Users\" "; $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; - $graphcmd .= "--height 200 --width 620 "; - $graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE\" "; - $graphcmd .= "LINE2:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:$curif-concurrentusers\" "; - $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; - $graphcmd .= "COMMENT:\"Users Online\t\" "; - $graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%7.2lf \" "; - $graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%7.2lf \" "; - $graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%7.2lf \" "; - $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; -} -elseif((strstr($curdatabase, "-totalusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { - /* define graphcmd for online Captive Portal users stats */ - $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; - $graphcmd .= "--start $start --end $end "; - $graphcmd .= "--vertical-label \"Total Captive Portal Users\" "; - $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; $graphcmd .= "--base=1000 "; $graphcmd .= "--lower-limit=0 "; $graphcmd .= "--slope-mode "; - $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; $graphcmd .= "--height 200 --width 620 "; - $graphcmd .= "DEF:\"$curif-totalusers=$rrddbpath$curdatabase:totalusers:AVERAGE\" "; - $graphcmd .= "AREA:\"$curif-totalusers#{$colorcaptiveportalusers[0]}:$curif-totalusers\" "; + $graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE\" "; + $graphcmd .= "AREA:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:Concurrent Users\" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; $graphcmd .= "COMMENT:\"Users Online\t\" "; - $graphcmd .= "GPRINT:\"$curif-totalusers:LAST:%8.0lf \" "; - $graphcmd .= "GPRINT:\"$curif-totalusers:AVERAGE:%8.0lf \" "; - $graphcmd .= "GPRINT:\"$curif-totalusers:MAX:%8.0lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%8.0lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; } diff --git a/usr/local/www/system_crlmanager.php b/usr/local/www/system_crlmanager.php index 72e795b..1beb75b 100644 --- a/usr/local/www/system_crlmanager.php +++ b/usr/local/www/system_crlmanager.php @@ -494,6 +494,7 @@ function method_change() { </thead> <tbody> <?php + $caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png"; // Map CRLs to CAs in one pass $ca_crl_map = array(); foreach($a_crl as $crl) @@ -504,7 +505,6 @@ function method_change() { $name = htmlspecialchars($ca['descr']); if($ca['prv']) { - $caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png"; $cainternal = "YES"; } else $cainternal = "NO"; diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index ebb3a24..a732b95 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -158,26 +158,80 @@ function restore_config_section_xmlrpc($raw_params) { $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail']; + $vipbackup = array(); + $oldvips = array(); if (isset($params[0]['virtualip'])) { if(is_array($config['virtualip']['vip'])) { - foreach ($config['virtualip']['vip'] as $vip) - interface_vip_bring_down($vip); + foreach ($config['virtualip']['vip'] as $vipindex => $vip) { + if ($vip['mode'] == "carp") + $oldvips[$vip['vhid']] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}"; + else if ((($vip['mode'] == 'ipalias') || ($vip['mode'] == 'proxyarp')) && substr($vip['interface'], 0, 3) != "vip") + $vipbackup[] = $vip; + } } - $vipbackup = $config['virtualip']['vip']; } + // For vip section, first keep items sent from the master $config = array_merge($config, $params[0]); - // Then add ipalias and proxyarp types already defined on the backup - if (is_array($vipbackup)) { - foreach ($vipbackup as $vip) { - if ((($vip['mode'] == 'ipalias') || ($vip['mode'] == 'proxyarp')) && substr($vip['interface'], 0, 3) != "vip") - array_unshift($config['virtualip']['vip'], $vip); - } + + /* Then add ipalias and proxyarp types already defined on the backup */ + if (is_array($vipbackup) && !empty($vipbackup)) { + if (!is_array($config['virtualip'])) + $config['virtualip'] = array(); + if (!is_array($config['virtualip']['vip'])) + $config['virtualip']['vip'] = array(); + foreach ($vipbackup as $vip) + array_unshift($config['virtualip']['vip'], $vip); } + + /* Log what happened */ $mergedkeys = implode(",", array_keys($params[0])); write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); - interfaces_vips_configure(); + + /* + * The real work on handling the vips specially + * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps + */ + if (is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) { + $carp_setuped = false; + $anyproxyarp = false; + foreach ($config['virtualip']['vip'] as $vip) { + if (isset($oldvips[$vip['vhid']])) { + if ($oldvips[$vip['vhid']] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") { + if (does_interface_exist("vip{$vip['vhid']}")) + continue; // Skip reconfiguring this vips since nothing has changed. + } else + unset($oldvips['vhid']); + } + + switch ($vip['mode']) { + case "proxyarp": + $anyproxyarp = true; + break; + case "ipalias": + interface_ipalias_configure(&$vip); + break; + case "carp": + if ($carp_setuped == false) + $carp_setuped = true; + interface_carp_configure($vip); + break; + case "carpdev-dhcp": + interface_carpdev_configure($vip); + break; + } + } + /* Cleanup remaining old carps */ + foreach ($oldvips as $oldvipif => $oldvippar) { + if (does_interface_exist("vip{$oldvipif}")) + pfSense_interface_destroy("vip{$oldvipif}"); + } + if ($carp_setuped == true) + interfaces_carp_setup(); + if ($anyproxyarp == true) + interface_proxyarp_configure(); + } return $xmlrpc_g['return']['true']; } @@ -218,29 +272,7 @@ $merge_config_section_sig = array( function merge_config_section_xmlrpc($raw_params) { global $config, $xmlrpc_g; - $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) - return $xmlrpc_g['return']['authfail']; - if (isset($params[0]['virtualip'])) { - if(is_array($config['virtualip']['vip'])) { - foreach ($config['virtualip']['vip'] as $vip) - interface_vip_bring_down($vip); - } - $vipbackup = $config['virtualip']['vip']; - } - $config = array_merge_recursive_unique($config, $params[0]); - // Then add ipalias and proxyarp types already defined on the backup - if (is_array($vipbackup)) { - foreach ($vipbackup as $vip) { - if ((($vip['mode'] == 'ipalias') || ($vip['mode'] == 'proxyarp')) && substr($vip['interface'], 0, 3) != "vip") - array_unshift($config['virtualip']['vip'], $vip); - } - } - $mergedkeys = implode(",", array_keys($params[0])); - write_config("Merged in config ({$mergedkeys} sections) from XMLRPC client."); - interfaces_vips_configure(); - - return $xmlrpc_g['return']['true']; + return restore_config_section_xmlrpc($raw_params); } /*****************************/ @@ -372,6 +404,8 @@ function get_notices_xmlrpc($raw_params) { return $response; } +$xmlrpclockkey = lock('xmlrpc', LOCK_EX); + /*****************************/ $server = new XML_RPC_Server( array( @@ -412,4 +446,6 @@ $server = new XML_RPC_Server( ) ); +unlock($xmlrpclockkey); + ?> |