diff options
Diffstat (limited to 'usr')
-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 |
9 files changed, 111 insertions, 79 deletions
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); + ?> |