diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 6535f54893..0962cd8255 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -684,7 +684,7 @@ EOD; if ($reinit == false) unlock($captiveportallck); - /* filter on layer2 as well so we can check MAC addresses */ + /* activate ipfw(4) so CP can work */ mwexec("/sbin/sysctl net.link.ether.ipfw=1"); return $cprules; @@ -881,6 +881,17 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t /* Release the ruleno so it can be reallocated to new clients. */ captiveportal_free_ipfw_ruleno($dbent[1]); + + // XMLRPC Call over to the master Voucher node + $a_voucher = &$config['voucher']; + if(!empty($a_voucher['vouchersyncdbip'])) { + $syncip = $a_voucher['vouchersyncdbip']; + $syncport = $a_voucher['vouchersyncport']; + $syncpass = $a_voucher['vouchersyncpass']; + $vouchersyncusername = $a_voucher['vouchersyncusername']; + $remote_status = xmlrpc_sync_voucher_disconnect($dben, $syncip, $syncport, $syncpass, $vouchersyncusername, $term_cause, $stop_time); + } + } /* remove a single client by sessionid */ @@ -1378,7 +1389,7 @@ function captiveportal_get_next_ipfw_ruleno($rulenos_start = 2000, $rulenos_rang * and the out pipe ruleno + 1. This removes limitation that where present in * previous version of the peruserbw. */ - if (isset($config['captiveportal']['peruserbw'])) + if (isset($config['captiveportal']['peruserbw']) || $usebw == true) $ridx++; continue; } diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 75eb0139bc..9512b9549d 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -190,10 +190,10 @@ EOD; echo << 1) return; @@ -321,7 +324,7 @@ function conf_mount_rw() { /* if the platform is soekris or wrap or pfSense, lets mount the * compact flash cards root. - */ + */ $status = mwexec("/sbin/mount -u -w -o sync,noatime /"); /* we could not mount this correctly. kick off fsck */ if($status <> 0) { @@ -339,14 +342,14 @@ function conf_mount_rw() { * RESULT * null ******/ -function conf_mount_ro() { +function conf_mount_ro($nobootcheck = false) { global $g; /* do not umount on cdrom or pfSense platforms */ if($g['platform'] == "cdrom" or $g['platform'] == "pfSense") return; - if($g['booting']) + if($g['booting'] && !$nobootcheck) return; if (refcount_unreference(1000) > 0) @@ -397,12 +400,17 @@ function convert_config() { include_once('auth.inc'); include_once('upgrade_config.inc'); + if (file_exists("/etc/inc/upgrade_config_custom.inc")) + include_once("upgrade_config_custom.inc"); /* Loop and run upgrade_VER_to_VER() until we're at current version */ while ($config['version'] < $g['latest_config']) { $cur = $config['version'] * 10; $next = $cur + 1; $migration_function = sprintf('upgrade_%03d_to_%03d', $cur, $next); $migration_function(); + $migration_function = "{$migration_function}_custom"; + if (function_exists($migration_function)) + $migration_function(); $config['version'] = sprintf('%.1f', $next / 10); if($g['booting']) echo "."; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 64528e7590..7d558ebeab 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1882,7 +1882,7 @@ function filter_generate_user_rule($rule) { } else $aline['flags'] .= "keep state "; - if($noadvoptions == false || $l7_present) + if($noadvoptions == false) if( (isset($rule['source-track']) and $rule['source-track'] <> "") or (isset($rule['max']) and $rule['max'] <> "") or (isset($rule['max-src-nodes']) and $rule['max-src-nodes'] <> "") or @@ -1891,7 +1891,7 @@ function filter_generate_user_rule($rule) { (isset($rule['max-src-conn-rates']) and $rule['max-src-conn-rates'] <> "") or (isset($rule['max-src-states']) and $rule['max-src-states'] <> "") or (isset($rule['statetimeout']) and $rule['statetimeout'] <> "") or - isset($rule['sloppy']) or $l7_present) { + isset($rule['sloppy'])) { $aline['flags'] .= "( "; if (isset($rule['sloppy'])) $aline['flags'] .= "sloppy "; @@ -1914,8 +1914,6 @@ function filter_generate_user_rule($rule) { $aline['flags'] .= "max-src-conn-rate " . $rule['max-src-conn-rate'] . " "; $aline['flags'] .= "/" . $rule['max-src-conn-rates'] . ", overload flush global "; } - if(!empty($aline['divert'])) - $aline['flags'] .= "max-packets 5 "; $aline['flags'] .= " ) "; } diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index e678b3bb42..02eadf4ee2 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1215,8 +1215,8 @@ function interface_ppps_configure($interface) { $localips[$pid] = get_interface_ip($port); // try to get the interface IP from the port if(!is_ipaddr($localips[$pid])){ - log_error(sprintf(gettext("Could not get a Local IP address for PPTP/L2TP link on %s in interfaces_ppps_configure."), $port)); - return 0; + log_error("Could not get a Local IP address for PPTP/L2TP link on {$port} in interfaces_ppps_configure. Using 0.0.0.0 ip!"); + $localips[$pid] = "0.0.0.0"; } /* XXX: This needs to go away soon! [It's commented out!] */ /* Configure the gateway (remote IP ) */ @@ -1492,7 +1492,6 @@ EOD; $mpdconf .= << 0) mwexec('killall miniupnpd 2>/dev/null', true); mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null'); diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index c410495ea3..a77669d0e9 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -961,7 +961,9 @@ class priq_queue { $input_errors[] = gettext("Queue limit must be an integer"); if ($data['qlimit'] < 0) $input_errors[] = gettext("Queue limit must be positive"); - if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name'])) + if (!empty($data['newname']) && !preg_match("/^[a-zA-Z0-9_-]*$/", $data['newname'])) + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); + if (!empty($data['name']) && !preg_match("/^[a-zA-Z0-9_-]*$/", $data['name'])) $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } @@ -2770,7 +2772,7 @@ class dummynet_class { $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; $reqdfieldsn[] = gettext("Bandwidthtype"); - $reqdfields[] = "name"; + $reqdfields[] = "newname"; $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); @@ -2782,8 +2784,10 @@ class dummynet_class { ($data['buckets'] < 1 && $data['buckets'] > 100)) $input_errors[] = gettext("Buckets must be an integer between 16 and 65535."); if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = gettext("Queue limit must be an integer"); - if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) + $input_errors[] = gettext("Queue limit must be an integer"); + if (!empty($data['newname']) && !preg_match("/^[a-zA-Z0-9_-]+$/", $data['newname'])) + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); + if (!empty($data['name']) && !preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } } @@ -3252,7 +3256,7 @@ class dnqueue_class extends dummynet_class { $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > " . gettext("Enable/Disable queue and its children") . ""; + $form .= " > " . gettext("Enable/Disable queue") . ""; $form .= ""; $form .= "
" . gettext("Name") . ""; $form .= ""; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 107a777990..0ccce7e805 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1147,22 +1147,13 @@ function system_timezone_configure() { function system_ntp_configure() { global $config, $g; - $syscfg =& $config['system']; - - /* open configuration for wrting or bail */ - $fd = fopen("{$g['varetc_path']}/ntpd.conf","w"); - if(!$fd) { - log_error(sprintf(gettext("Could not open %s/ntpd.conf for writing"), $g['varetc_path'])); - return; - } - - fwrite($fd, "# \n"); - fwrite($fd, "# " . gettext("pfSense OpenNTPD configuration file") . " \n"); - fwrite($fd, "# \n\n"); + $ntpcfg = "# \n"; + $ntpcfg .= "# pfSense OpenNTPD configuration file \n"; + $ntpcfg .= "# \n\n"; /* foreach through servers and write out to ntpd.conf */ - foreach (explode(' ', $syscfg['timeservers']) as $ts) - fwrite($fd, sprintf(gettext("servers %s\n"), $ts)); + foreach (explode(' ', $config['system']['timeservers']) as $ts) + $ntpcfg .= "servers {$ts}\n"; /* Setup listener(s) if the user has configured one */ if ($config['installedpackages']['openntpd']) { @@ -1175,12 +1166,19 @@ function system_ntp_configure() { $ips = array_map('find_interface_ip', $ifaces); foreach ($ips as $ip) { if (is_ipaddr($ip)) - fwrite($fd, "listen on $ip\n"); + $ntpdcfg .= "listen on $ip\n"; } } } + $ntpdcfg .= "\n"; - fwrite($fd, "\n"); + /* open configuration for wrting or bail */ + $fd = fopen("{$g['varetc_path']}/ntpd.conf","w"); + if(!$fd) { + log_error("Could not open {$g['varetc_path']}/ntpd.conf for writing"); + return; + } + fwrite($fd, $ntpcfg); /* slurp! */ fclose($fd); @@ -1208,13 +1206,11 @@ function system_ntp_configure() { function sync_system_time() { global $config, $g; - $syscfg = $config['system']; - if ($g['booting']) echo gettext("Syncing system time before startup..."); /* foreach through servers and write out to ntpd.conf */ - foreach (explode(' ', $syscfg['timeservers']) as $ts) { + foreach (explode(' ', $config['system']['timeservers']) as $ts) { mwexec("/usr/sbin/ntpdate -s $ts"); } diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 7536f8cfc4..f530165304 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -790,6 +790,7 @@ function upgrade_043_to_044() { $gateways = return_gateways_array(true); $i = 0; if (is_array($config['staticroutes']['route'])) { + $gwmap = array(); foreach ($config['staticroutes']['route'] as $idx => $sroute) { $found = false; foreach ($gateways as $gwname => $gw) { @@ -799,9 +800,15 @@ function upgrade_043_to_044() { break; } } + if($gwmap[$sroute['gateway']]) { + /* We already added a gateway name for this IP */ + $config['staticroutes']['route'][$idx]['gateway'] = "{$gwmap[$sroute['gateway']]}"; + $found = true; + } if ($found == false) { $gateway = array(); - $gateway['name'] = "SROUTE{$i}"; + $gateway['name'] = "SROUTE{$i}"; + $gwmap[$sroute['gateway']] = $gateway['name']; $gateway['gateway'] = $sroute['gateway']; $gateway['interface'] = $sroute['interface']; $gateway['descr'] = sprintf(gettext("Upgraded static route for %s"), $sroute['network']); diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index cb137709c1..7d618ee85e 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -37,6 +37,54 @@ if(!function_exists('captiveportal_syslog')) require_once("captiveportal.inc"); +function xmlrpc_sync_voucher_disconnect($dbent, $syncip, $port, $password, $username, $term_cause = "1", $stop_time = null) { + global $g, $config; + require_once("xmlrpc.inc"); + if($port == "443") + $url = "https://{$syncip}:{$port}"; + else + $url = "http://{$syncip}:{$port}"; + + /* Construct code that is run on remote machine */ + $method = 'pfsense.exec_php'; + $execcmd = <<setCredentials($username, $password); + $resp = $cli->send($msg, "250"); + if(!is_object($resp)) { + $error = "A communications error occurred while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} (pfsense.exec_php)."; + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Communications error occurred", ""); + return false; + } elseif($resp->faultCode()) { + $error = "An error code was received while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Error code received", ""); + return false; + } else { + log_error("CaptivePortalVoucherSync XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php)."); + } + + $toreturn = XML_RPC_Decode($resp->value()); + + return $toreturn; +} + function xmlrpc_sync_used_voucher($voucher_received, $syncip, $port, $password, $username) { global $g, $config; require_once("xmlrpc.inc"); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 1c0a1c9612..702ad99836 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -136,6 +136,7 @@ function vpn_ipsec_configure($ipchg = false) $filterdns_list = array(); if (is_array($a_phase1) && count($a_phase1)) { + $ipsecpinghosts = ""; /* step through each phase1 entry */ foreach ($a_phase1 as $ph1ent) { if (isset($ph1ent['disabled'])) @@ -171,7 +172,6 @@ function vpn_ipsec_configure($ipchg = false) $rgmap[$ph1ent['remote-gateway']] = $rg; /* step through each phase2 entry */ - $ipsecpinghosts = ""; foreach ($a_phase2 as $ph2ent) { $ikeid = $ph2ent['ikeid']; diff --git a/etc/rc.bootup b/etc/rc.bootup index 6cff6accd6..b7a632ea3c 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -129,7 +129,7 @@ $memory = get_memory(); $avail = $memory[0]; echo " done.\n"; -conf_mount_rw(); +conf_mount_rw(true); /* save dmesg output to file */ system_dmesg_save(); @@ -400,6 +400,6 @@ unset($g['booting']); led_normalize(); -conf_mount_ro(); +conf_mount_ro(true); ?> diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize index ed803066c3..1dd08183dc 100755 --- a/etc/rc.filter_synchronize +++ b/etc/rc.filter_synchronize @@ -99,19 +99,19 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host $numberofruns = 0; while ($numberofruns < 2) { - $msg = new XML_RPC_Message($method, $params); - $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port); - $username = $config['system']['user'][0]['name']; - $cli->setCredentials($username, $password); - if($numberofruns > 1) - $cli->setDebug(1); - /* send our XMLRPC message and timeout after 240 seconds */ - $resp = $cli->send($msg, "240"); - if(!is_object($resp)) { - $error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}."; - } elseif($resp->faultCode()) { - $error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); - } else { + $msg = new XML_RPC_Message($method, $params); + $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port); + $username = $config['system']['user'][0]['name']; + $cli->setCredentials($username, $password); + if($numberofruns > 1) + $cli->setDebug(1); + /* send our XMLRPC message and timeout after 240 seconds */ + $resp = $cli->send($msg, "240"); + if(!is_object($resp)) { + $error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}."; + } elseif($resp->faultCode()) { + $error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + } else { $parsed_response = XML_RPC_decode($resp->value()); if(!is_array($parsed_response)) { if (trim($parsed_response) == "Authentication failed") { @@ -122,9 +122,11 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host } } else { if (!isset($parsed_response['config_version']) || - $parsed_response['config_version'] < $config['version']) + $parsed_response['config_version'] < $config['version']) { + update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!"); + log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!"); return false; - else + } else return true; } } @@ -379,11 +381,8 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) { if ($carp['synchronizecaptiveportal'] != "" and is_array($config['vouchers'])) $sections[] = 'vouchers'; if (count($sections) > 0) { - if (!carp_check_version($synchronizetoip, $carp['password'], $port)) { - update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!"); - log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!"); + if (!carp_check_version($synchronizetoip, $carp['password'], $port)) break; - } update_filter_reload_status("Signaling CARP reload signal..."); carp_sync_xml($synchronizetoip, $carp['password'], $sections, $port); diff --git a/etc/rc.newipsecdns b/etc/rc.newipsecdns index 141f04a892..2e53f99886 100755 --- a/etc/rc.newipsecdns +++ b/etc/rc.newipsecdns @@ -43,10 +43,7 @@ while (file_exists("{$g['varrun_path']}/booting")) { sleep(1); } - while(stristr(shell_exec("/bin/ps auxww"), "rc.newipsecdns")) { - // log_error("There is an existing rc.newipsecdns running, sleeping 1 second"); - sleep(1); - } + $ipseclck = lock('ipsecdns', LOCK_EX); log_error("IPSEC: One or more IPsec tunnel endpoints has changed its IP. Refreshing."); /* We will walk the list of hostnames found in the ipsec tunnel @@ -59,4 +56,6 @@ vpn_ipsec_configure(); filter_configure(); + + unlock($ipseclck); ?> diff --git a/etc/rc.shutdown b/etc/rc.shutdown index f8dd4a29f6..14faf805c0 100755 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -28,7 +28,7 @@ export PATH # temporary files on shutdown from /tmp/ PLATFORM=`cat /etc/platform` if [ "$PLATFORM" = "pfSense" ]; then - find -x /tmp/ -type f -exec rm -f {} \; + find -x /tmp/* -type f -exec rm -f {} \; else /etc/rc.backup_rrd.sh /etc/rc.backup_dhcpleases.sh diff --git a/etc/sshd b/etc/sshd index 28c8e55932..67fbe00258 100755 --- a/etc/sshd +++ b/etc/sshd @@ -42,7 +42,7 @@ exit; } - conf_mount_rw(); + conf_mount_rw(true); function file_size($file) { $size = filesize($file); @@ -138,7 +138,7 @@ /* are we already running? if so exit */ if(is_subsystem_dirty('sshdkeys')) { - conf_mount_ro(); + conf_mount_ro(true); exit; } @@ -185,6 +185,6 @@ exec("mkdir /conf/sshd"); exec("/bin/cp -p /etc/ssh/ssh_host* /conf/sshd"); } - conf_mount_ro(); + conf_mount_ro(true); ?> diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php index 187736b880..12b8be9912 100755 --- a/usr/local/www/carp_status.php +++ b/usr/local/www/carp_status.php @@ -68,7 +68,7 @@ if($_POST['disablecarp'] <> "") { } } } - $savemsg = sprintf(gettext("%s IPs have been disabled."), $carp_counter); + $savemsg = sprintf(gettext("%s IPs have been disabled. Please note that disabling does not survive a reboot."), $carp_counter); } else { $savemsg = gettext("CARP has been enabled."); mwexec("/sbin/sysctl net.inet.carp.allow=1"); diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php index 560cd1aa43..87e1e50e88 100755 --- a/usr/local/www/diag_logs_ipsec.php +++ b/usr/local/www/diag_logs_ipsec.php @@ -56,16 +56,30 @@ if(is_array($config['ipsec']['phase1'])) $gateway = ipsec_get_phase1_dst($ph1ent); if(!is_ipaddr($gateway)) continue; - $search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i"; + $search[] = "/(racoon: )(INFO[:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i"; + $search[] = "/(racoon: )(\[{$gateway}\]|{$gateway})(.*)/i"; + $replace[] = "$1[{$ph1ent['descr']}]: $2$3$4"; $replace[] = "$1[{$ph1ent['descr']}]: $2$3$4"; } /* collect all our own ip addresses */ exec("/sbin/ifconfig | /usr/bin/awk '/inet / {print $2}'", $ip_address_list); foreach($ip_address_list as $address) { - $search[] = "/(racoon: )([A-Z:].*?)({$address}\[[0-9].+\])(.*isakmp.*)/i"; + $search[] = "/(racoon: )(INFO[:].*?)({$address}\[[0-9].+\])/i"; + $search[] = "/(racoon: )(\[{$address}\]|{$address})(.*)/i"; + $replace[] = "$1[Self]: $2$3$4"; $replace[] = "$1[Self]: $2$3$4"; } +$search[] = "/(time up waiting for phase1)/i"; +$search[] = "/(failed to pre-process ph1 packet)/i"; +$search[] = "/(failed to pre-process ph2 packet)/i"; +$search[] = "/(no proposal chosen)/i"; +$replace[] = "$1 [Remote Side not responding]"; +$replace[] = "$1 [Check Phase 1 settings, lifetime, algorithm]"; +$replace[] = "$1 [Check Phase 2 settings, networks]"; +$replace[] = "$1 [Check Phase 2 settings, algorithm]"; + + $nentries = $config['syslog']['nentries']; if (!$nentries) $nentries = 50; diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index 33d124ebde..ce730e13d1 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -46,7 +46,7 @@ // Keywords not allowed in names -$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec"); +$reserved_keywords = array("all", "pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec"); require("guiconfig.inc"); require_once("functions.inc"); diff --git a/usr/local/www/firewall_shaper_vinterface.php b/usr/local/www/firewall_shaper_vinterface.php index 5222771bca..fae5429964 100644 --- a/usr/local/www/firewall_shaper_vinterface.php +++ b/usr/local/www/firewall_shaper_vinterface.php @@ -72,7 +72,7 @@ if ($_POST) { if ($_POST['name']) $qname = htmlspecialchars(trim($_POST['name'])); else if ($_POST['newname']) - $qname = htmlspecialchars(trim($_POST['name'])); + $qname = htmlspecialchars(trim($_POST['newname'])); if ($_POST['pipe']) $pipe = htmlspecialchars(trim($_POST['pipe'])); else diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index d1fa6f7ebd..2469631d91 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -159,7 +159,7 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) { } }// End force pppoe reset at specific time }// End if type == pppoe - else if ($a_ppps[$pppid]['type'] == "pptp"){ + else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp"){ $pconfig['pptp_username'] = $a_ppps[$pppid]['username']; $pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']); $pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']); @@ -175,6 +175,7 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) { $pconfig['dhcphostname'] = $wancfg['dhcphostname']; $pconfig['alias-address'] = $wancfg['alias-address']; $pconfig['alias-subnet'] = $wancfg['alias-subnet']; +$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']); $pconfig['descr'] = remove_bad_chars($wancfg['descr']); $pconfig['enable'] = isset($wancfg['enable']); @@ -196,6 +197,7 @@ switch($wancfg['ipaddr']) { break; case "pppoe": case "pptp": + case "l2tp": case "ppp": $pconfig['type'] = $wancfg['ipaddr']; break; @@ -415,6 +417,16 @@ if ($_POST['apply']) { } do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); break; + case "l2tp": + if ($_POST['pptp_dialondemand']) { + $reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout"); + $reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value")); + } else { + $reqdfields = explode(" ", "pptp_username pptp_password pptp_remote"); + $reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address")); + } + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; } /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ @@ -454,7 +466,7 @@ if ($_POST['apply']) { $input_errors[] = gettext("A valid PPTP local IP address must be specified."); if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) $input_errors[] = gettext("A valid PPTP subnet bit count must be specified."); - if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) + if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface]))) $input_errors[] = gettext("A valid PPTP remote IP address must be specified."); if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) $input_errors[] = gettext("The idle timeout value must be an integer."); @@ -588,6 +600,7 @@ if ($_POST['apply']) { $wancfg['dhcphostname'] = $_POST['dhcphostname']; $wancfg['alias-address'] = $_POST['alias-address']; $wancfg['alias-subnet'] = $_POST['alias-subnet']; + $wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false; if($gateway_item) { $a_gateways[] = $gateway_item; } @@ -648,6 +661,7 @@ if ($_POST['apply']) { break; case "pptp": + case "l2tp": $a_ppps[$pppid]['ptpid'] = $_POST['ptpid']; $a_ppps[$pppid]['type'] = $_POST['type']; $a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid']; @@ -888,7 +902,7 @@ $statusurl = "status_interfaces.php"; $closehead = false; include("head.inc"); -$types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP") /* , "carpdev-dhcp" => "CarpDev"*/); +$types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP") /* , "carpdev-dhcp" => "CarpDev"*/); ?> @@ -921,12 +935,15 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" $('none','static','dhcp','pptp', 'ppp').invoke('hide'); break; } + case "l2tp": case "pptp": { $('none','static','dhcp','pppoe', 'ppp').invoke('hide'); + $('pptp').show(); break; } } - $(t).show(); + if (t != "l2tp" && t != "pptp") + $(t).show(); } function show_allcfg(obj) { @@ -1250,6 +1267,17 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" + @@ -1279,6 +1307,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" "DHCP client."); ?> + @@ -1489,7 +1518,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" - + diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index faaeb37212..24595da7c1 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -614,7 +614,7 @@ value=""> } ?>
- + diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php index d6fdcede2f..266d36ba78 100755 --- a/usr/local/www/status_interfaces.php +++ b/usr/local/www/status_interfaces.php @@ -132,6 +132,21 @@ include("head.inc"); + + + + + diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 8af6e7d7b0..2094a87b04 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -545,7 +545,7 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat $graphcmd .= "GPRINT:\"$curif-in_pps_block:LAST:%7.2lf %S pps\" "; $graphcmd .= "GPRINT:\"$curif-pps_in_t_block:AVERAGE:%7.2lf %s pkts\" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"out-pass\t\" "; + $graphcmd .= "COMMENT:\"out-block\t\" "; $graphcmd .= "GPRINT:\"$curif-out_pps_block:MAX:%7.2lf %s pps\" "; $graphcmd .= "GPRINT:\"$curif-out_pps_block:AVERAGE:%7.2lf %S pps\" "; $graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" "; @@ -960,6 +960,28 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur $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 .= "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 .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; +} else { $data = false; log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index 0f751e70b4..ef82716a8b 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -91,6 +91,7 @@ if($_GET['act']=="new"){ $pconfig['tlsauth_enable'] = "yes"; $pconfig['autotls_enable'] = "yes"; $pconfig['dh_length'] = 1024; + $pconfig['device_mode'] = "tun"; $pconfig['interface'] = "wan"; $pconfig['local_port'] = openvpn_port_next('UDP'); $pconfig['pool_enable'] = "yes"; @@ -104,6 +105,7 @@ if($_GET['act']=="edit"){ $pconfig['mode'] = $a_server[$id]['mode']; $pconfig['protocol'] = $a_server[$id]['protocol']; $pconfig['authmode'] = $a_server[$id]['authmode']; + $pconfig['device_mode'] = $a_server[$id]['device_mode']; $pconfig['interface'] = $a_server[$id]['interface']; if (!empty($a_server[$id]['ipaddr'])) { $pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr']; @@ -304,6 +306,7 @@ if ($_POST) { if (!empty($pconfig['authmode'])) $server['authmode'] = implode(",", $pconfig['authmode']); $server['protocol'] = $pconfig['protocol']; + $server['device_mode'] = $pconfig['device_mode']; list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']); $server['local_port'] = $pconfig['local_port']; $server['description'] = $pconfig['description']; @@ -662,6 +665,26 @@ if ($savemsg) + + + +
+    + + + " class="formbtns"> + + + " class="formbtns"> + + +
+ +
diff --git a/usr/local/www/vpn_pptp.php b/usr/local/www/vpn_pptp.php index 84f402037d..5be5e6e3d3 100755 --- a/usr/local/www/vpn_pptp.php +++ b/usr/local/www/vpn_pptp.php @@ -342,7 +342,7 @@ function enable_change(enable_over) { } ?> -
+