From da0031765e65735ceb404fc1bb28f564d727cc66 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 13 Aug 2010 13:32:53 -0300 Subject: [PATCH 001/329] Implement gettext() calls on array_intersect_key.inc --- etc/inc/array_intersect_key.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/array_intersect_key.inc b/etc/inc/array_intersect_key.inc index 0cd50993b8..c1416ad1ca 100644 --- a/etc/inc/array_intersect_key.inc +++ b/etc/inc/array_intersect_key.inc @@ -34,7 +34,7 @@ if (!function_exists('array_intersect_key')) { { $args = func_get_args(); if (count($args) < 2) { - user_error('Wrong parameter count for array_intersect_key()', E_USER_WARNING); + user_error(gettext('Wrong parameter count for array_intersect_key()'), E_USER_WARNING); return; } @@ -42,8 +42,8 @@ if (!function_exists('array_intersect_key')) { $array_count = count($args); for ($i = 0; $i !== $array_count; $i++) { if (!is_array($args[$i])) { - user_error('array_intersect_key() Argument #' . - ($i + 1) . ' is not an array', E_USER_WARNING); + user_error(gettext('array_intersect_key() Argument #') . + ($i + 1) . gettext(' is not an array'), E_USER_WARNING); return; } } @@ -64,4 +64,4 @@ if (!function_exists('array_intersect_key')) { } } -?> \ No newline at end of file +?> From 0b70d9f421d23841eaf9c976b904f3bb611912f9 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 13 Aug 2010 13:52:39 -0300 Subject: [PATCH 002/329] Implement gettext() calls on authgui.inc --- etc/inc/authgui.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 27e4c88b5c..97b2899b6e 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -64,7 +64,7 @@ if (!isAllowedPage($_SERVER['SCRIPT_NAME'])) { pfSenseHeader("/{$page}"); exit; } else { - display_error_form("201", "No page assigned to this user! Click here to logout."); + display_error_form("201", gettext("No page assigned to this user! Click here to logout.")); exit; } } else @@ -88,7 +88,7 @@ function display_error_form($http_code, $desc) { global $config, $g; $g['theme'] = $config['theme']; if(isAjax()) { - echo "Error: {$http_code} Description: {$desc}"; + printf(gettext("Error: %s Description: %s"), $http_code, $desc); return; } @@ -151,13 +151,13 @@ function display_login_form() { if(isAjax()) { if (isset($_POST['login'])) { if($_SESSION['Logged_In'] <> "True") { - isset($_SESSION['Login_Error']) ? $login_error = $_SESSION['Login_Error'] : $login_error = "unknown reason"; - echo "showajaxmessage('Invalid login ({$login_error}).');"; + isset($_SESSION['Login_Error']) ? $login_error = $_SESSION['Login_Error'] : $login_error = gettext("unknown reason"); + printf(gettext("showajaxmessage('Invalid login (%s).')"), $login_error); } if (file_exists("{$g['tmp_path']}/webconfigurator.lock")) { // TODO: add the IP from the user who did lock the device $whom = file_get_contents("{$g['tmp_path']}/webconfigurator.lock"); - echo "showajaxmessage('This device is currently beeing maintained by: {$whom}.');"; + printf(gettext("showajaxmessage('This device is currently beeing maintained by: %s.');"), $whom); } } exit; @@ -232,14 +232,14 @@ if($config['virtualip'])

- :
+


- :
+

@@ -261,4 +261,4 @@ if($config['virtualip']) \ No newline at end of file +?> From 940214048fa9582a560caefe44973a183beee009 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 13 Aug 2010 16:23:37 -0300 Subject: [PATCH 003/329] Implement gettext() calls on auth.inc --- etc/inc/auth.inc | 72 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index f85f8973dc..77e4aa5b03 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -81,7 +81,7 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][ $found_host = true; if($found_host == false) { - display_error_form("501", "Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding"); + display_error_form("501", gettext("Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding")); exit; } } @@ -225,7 +225,7 @@ function local_sync_accounts() { continue; $cmd = "/usr/sbin/pw userdel {$line[2]}"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); mwexec($cmd); } pclose($fd); @@ -245,7 +245,7 @@ function local_sync_accounts() { continue; $cmd = "/usr/sbin/pw groupdel {$line[2]}"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); mwexec($cmd); } pclose($fd); @@ -309,7 +309,7 @@ function local_user_set(& $user) { if ($user_uid == 0) { $cmd = "/usr/sbin/pw usermod -q -n root -s /bin/sh -H 0"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); $fd = popen($cmd, "w"); fwrite($fd, $user['password']); pclose($fd); @@ -336,7 +336,7 @@ function local_user_set(& $user) { " -c ".escapeshellarg($user['fullname'])." -H 0 2>&1"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); $fd = popen($cmd, "w"); fwrite($fd, $user['password']); pclose($fd); @@ -380,7 +380,7 @@ function local_user_del($user) { $cmd = "/usr/sbin/pw userdel {$user['name']} {$rmhome}"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); mwexec($cmd); /* Delete user from groups needs a call to write_config() */ @@ -507,7 +507,7 @@ function local_group_set($group, $reset = false) { $cmd = "/usr/sbin/pw {$group_op} {$group_name} -g {$group_gid} -M {$group_members} 2>&1"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); mwexec($cmd); } @@ -519,7 +519,7 @@ function local_group_del($group) { $cmd = "/usr/sbin/pw groupdel {$group['name']}"; if($debug) - log_error("Running: {$cmd}"); + log_error(sprintf(gettext("Running: %s"), $cmd)); mwexec($cmd); } @@ -553,7 +553,7 @@ function ldap_test_connection($authcfg) { $error = true; if ($error == true) { - log_error("ERROR! Could not connect to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname)); return false; } @@ -595,7 +595,7 @@ function ldap_test_bind($authcfg) { $error = true; if ($error == true) { - log_error("ERROR! Could not connect to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname)); return false; } @@ -648,7 +648,7 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { /* first check if there is even an LDAP server populated */ if(!$ldapserver) { - log_error("ERROR! ldap_get_user_ous() backed selected with no LDAP authentication server defined."); + log_error(gettext("ERROR! ldap_get_user_ous() backed selected with no LDAP authentication server defined.")); return $ous; } @@ -662,7 +662,7 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { $error = true; if ($error == true) { - log_error("ERROR! Could not connect to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname)); return $ous; } @@ -673,12 +673,12 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { if ($ldapanon == true) { if (!($res = @ldap_bind($ldap))) { - log_error("ERROR! ldap_get_user_ous() could not bind anonymously to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! ldap_get_user_ous() could not bind anonymously to server %s."), $ldapname)); @ldap_close($ldap); return $ous; } } else if (!($res = @ldap_bind($ldap, $ldapbindun, $ldapbindpw))) { - log_error("ERROR! ldap_get_user_ous() could not bind to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! ldap_get_user_ous() could not bind to server %s."), $ldapname)); @ldap_close($ldap); return $ous; } @@ -773,7 +773,7 @@ function ldap_get_groups($username, $authcfg) { $error = true; if ($error == true) { - log_error("ERROR! ldap_get_groups() Could not connect to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! ldap_get_groups() Could not connect to server %s."), $ldapname)); return memberof; } @@ -783,12 +783,12 @@ function ldap_get_groups($username, $authcfg) { /* bind as user that has rights to read group attributes */ if ($ldapanon == true) { if (!($res = @ldap_bind($ldap))) { - log_error("ERROR! ldap_get_groups() could not bind anonymously to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! ldap_get_groups() could not bind anonymously to server %s."), $ldapname)); @ldap_close($ldap); return false; } } else if (!($res = @ldap_bind($ldap, $ldapbindun, $ldapbindpw))) { - log_error("ERROR! ldap_get_groups() could not bind to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! ldap_get_groups() could not bind to server %s."), $ldapname)); @ldap_close($ldap); return memberof; } @@ -872,10 +872,10 @@ function ldap_backed($username, $passwd, $authcfg) { /* first check if there is even an LDAP server populated */ if(!$ldapserver) { if ($ldapfallback) { - log_error("ERROR! ldap_backed() called with no LDAP authentication server defined. Defaulting to local user database. Visit System -> User Manager."); + log_error(gettext("ERROR! ldap_backed() called with no LDAP authentication server defined. Defaulting to local user database. Visit System -> User Manager.")); return local_backed($username, $passwd); } else - log_error("ERROR! ldap_backed() called with no LDAP authentication server defined."); + log_error(gettext("ERROR! ldap_backed() called with no LDAP authentication server defined.")); return false; } @@ -893,7 +893,7 @@ function ldap_backed($username, $passwd, $authcfg) { $error = true; if ($error == true) { - log_error("ERROR! Could not connect to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname)); return false; } @@ -907,7 +907,7 @@ function ldap_backed($username, $passwd, $authcfg) { if ($error == true) { @ldap_close($ldap); - log_error("ERROR! Could not bind to server {$ldapname}."); + log_error(sprintf(gettext("ERROR! Could not bind to server %s."), $ldapname)); return false; } @@ -924,11 +924,11 @@ function ldap_backed($username, $passwd, $authcfg) { /* Person. To later be used by ldap_get_groups. */ /* that way we don't have to search twice. */ /*****************************************************************/ - log_error("Now Searching for {$username} in directory."); + log_error(sprintf(gettext("Now Searching for %s in directory."), $username)); /* Iterate through the user containers for search */ foreach ($ldac_splits as $i => $ldac_split) { /* Make sure we just use the first user we find */ - log_error("Now Searching in server {$ldapname}, container {$ldac_split} with filter {$ldapfilter}."); + log_error(sprintf(gettext("Now Searching in server %s, container %s with filter %s."), $ldapname, $ldac_split, $ldapfilter)); if ($ldapscope == "one") $ldapfunc = "ldap_list"; else @@ -939,7 +939,7 @@ function ldap_backed($username, $passwd, $authcfg) { else $search = @$ldapfunc($ldap,"{$ldac_split},{$ldapbasedn}",$ldapfilter); if (!$search) { - log_error("Search resulted in error: " . ldap_error($ldap)); + log_error(sprintf(gettext("Search resulted in error: %s"), ldap_error($ldap))); continue; } $info = ldap_get_entries($ldap,$search); @@ -955,18 +955,18 @@ function ldap_backed($username, $passwd, $authcfg) { if ($usercount != 1){ @ldap_unbind($ldap); - log_error("ERROR! Either LDAP search failed, or multiple users were found."); + log_error(gettext("ERROR! Either LDAP search failed, or multiple users were found.")); return false; } /* Now lets bind as the user we found */ if (!($res = @ldap_bind($ldap, $userdn, $passwd))) { - log_error("ERROR! Could not login to server {$ldapname} as user {$username}."); + log_error(sprintf(gettext("ERROR! Could not login to server %s as user %s."), $ldapname, $username)); @ldap_unbind($ldap); return false; } - log_error("Logged in successfully as {$username} via LDAP server {$ldapname} with DN = {$userdn}."); + log_error(sprintf(gettext("Logged in successfully as %s via LDAP server %s with DN = %s."), $username, $ldapname, $userdn)); /* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */ @ldap_unbind($ldap); @@ -997,7 +997,7 @@ function radius_backed($username, $passwd, $authcfg){ $retvalue['auth_val'] = 1; $retvalue['error'] = $rauth->getError(); if ($debug) - printf("Radius start: %s
\n", $retvalue['error']); + printf(gettext("Radius start: %s%s"), $retvalue['error'], "
\n"); } // XXX - billm - somewhere in here we need to handle securid challenge/response @@ -1008,7 +1008,7 @@ function radius_backed($username, $passwd, $authcfg){ $retvalue['auth_val'] = 1; $retvalue['error'] = $result->getMessage(); if ($debug) - printf("Radius send failed: %s
\n", $retvalue['error']); + printf(gettext("Radius send failed: %s%s"), $retvalue['error'], "
\n"); } else if ($result === true) { $retvalue['auth_val'] = 2; if ($debug) @@ -1060,7 +1060,7 @@ function auth_get_authserver($name) { } } if ($name == "Local Database") - return array("name" => "Local Database", "type" => "Local Auth", "host" => $config['system']['hostname']); + return array("name" => gettext("Local Database"), "type" => gettext("Local Auth"), "host" => $config['system']['hostname']); } function auth_get_authserver_list() { @@ -1075,7 +1075,7 @@ function auth_get_authserver_list() { } } - $list["Local Database"] = array( "name" => "Local Database", "type" => "Local Auth", "host" => $config['system']['hostname']); + $list["Local Database"] = array( "name" => gettext("Local Database"), "type" => gettext("Local Auth"), "host" => $config['system']['hostname']); return $list; } @@ -1145,7 +1145,7 @@ function session_auth() { $_SESSION['Logged_In'] = "True"; $_SESSION['Username'] = $_POST['usernamefld']; $_SESSION['last_access'] = time(); - log_error("Successful login for user '{$_POST['usernamefld']}' from: {$_SERVER['REMOTE_ADDR']}"); + log_error(sprintf(gettext("Successful login for user '%s' from: %s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); $HTTP_SERVER_VARS['AUTH_USER'] = $_SESSION['Username']; if (isset($_POST['postafterlogin'])) return true; @@ -1157,8 +1157,8 @@ function session_auth() { exit; } else { /* give the user an error message */ - $_SESSION['Login_Error'] = "Username or Password incorrect"; - log_error("Login attempt with user: '{$_POST['usernamefld']}' from: '{$_SERVER['REMOTE_ADDR']}' failed."); + $_SESSION['Login_Error'] = gettext("Username or Password incorrect"); + log_error(sprintf(gettext("Login attempt with user: '%s' from: '%s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); if(isAjax()) { echo "showajaxmessage('{$_SESSION['Login_Error']}');"; return; @@ -1198,9 +1198,9 @@ function session_auth() { if (isset($_GET['logout'])) { if ($_SESSION['Logout']) - log_error("Session timed out for user '{$_SESSION['Username']}' from: {$_SERVER['REMOTE_ADDR']}"); + log_error(sprintf(gettext("Session timed out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); else - log_error("User logged out for user '{$_SESSION['Username']}' from: {$_SERVER['REMOTE_ADDR']}"); + log_error(sprintf(gettext("User logged out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); /* wipe out $_SESSION */ $_SESSION = array(); From fdc55311b47180f0fd584eb40e6a260037e86aab Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 13 Aug 2010 17:05:36 -0300 Subject: [PATCH 004/329] Implement gettext() calls on captiveportal.inc --- etc/inc/captiveportal.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 9918f1f1ce..9c78017421 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -55,7 +55,7 @@ function captiveportal_configure() { if (isset($config['captiveportal']['enable'])) { if ($g['booting']) - echo "Starting captive portal... "; + echo gettext("Starting captive portal... "); /* kill any running mini_httpd */ killbypid("{$g['varrun_path']}/lighty-CaptivePortal.pid"); @@ -253,7 +253,7 @@ EOD; $fd = @fopen("{$g['vardb_path']}/captiveportal_radius.db", "w"); if (!$fd) { - printf("Error: cannot open radius DB file in captiveportal_configure().\n"); + printf(gettext("Error: cannot open radius DB file in captiveportal_configure().%s"), "\n"); return 1; } else if (isset($radiusip2, $radiuskey2)) { fwrite($fd,$radiusip . "," . $radiusport . "," . $radiusacctport . "," . $radiuskey . "\n" @@ -265,7 +265,7 @@ EOD; } if ($g['booting']) - echo "done\n"; + printf(gettext("done%s"), "\n"); } else { killbypid("{$g['varrun_path']}/lighty-CaptivePortal.pid"); @@ -996,7 +996,7 @@ function radius($username,$password,$clientip,$clientmac,$type) { if (is_null($ruleno)) { $auth_list = array(); $auth_list['auth_val'] = 1; - $auth_list['error'] = "System reached maximum login capacity"; + $auth_list['error'] = gettext("System reached maximum login capacity"); unlock($captiveportallck); return $auth_list; } @@ -1086,7 +1086,7 @@ function captiveportal_write_elements() { foreach ($config['captiveportal']['element'] as $data) { $fd = @fopen($g['captiveportal_element_path'] . '/' . $data['name'], "wb"); if (!$fd) { - printf("Error: cannot open '{$data['name']}' in captiveportal_write_elements().\n"); + printf(gettext("Error: cannot open '%s' in captiveportal_write_elements()%s"), $data['name'], "\n"); return 1; } $decoded = base64_decode($data['content']); From e96d2182cddab944ecc6de439d81ad95ca09ac62 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 08:40:25 -0300 Subject: [PATCH 005/329] Implement gettext() calls on cmd_chain.inc --- etc/inc/cmd_chain.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/cmd_chain.inc b/etc/inc/cmd_chain.inc index eb819547c8..ea295cda85 100644 --- a/etc/inc/cmd_chain.inc +++ b/etc/inc/cmd_chain.inc @@ -98,7 +98,7 @@ Class CmdCHAIN { $ignore_return_text = $cmd['ignore_return_text']; // Should we perform verbose debugging? if($this->is_debugging == true) { - log_error("CmdCHAIN is executing -> {$cmd_title} - {$command}"); + log_error(sprintf(gettext("CmdCHAIN is executing -> %s - %s"), $cmd_title, $command)); usleep(100); // give network stack time to deliver network syslog message } // Execute command @@ -106,9 +106,9 @@ Class CmdCHAIN { if($this->ignore_return_text == true) continue; if(intval($status) <> 0) { - log_error("{$cmd_title} failed with return code -> {$status}. The command was {$command}"); + log_error(sprintf(gettext("%s failed with return code -> %s. The command was %s"), $cmd_title, $status, $command)); if($this->halt_on_errors == true) - return("{$cmd_title} failed with return code -> {$status}. The command was {$command}"); + return(sprintf(gettext("%s failed with return code -> %s. The command was %s"), $cmd_title, $status, $command)); } } return; @@ -129,4 +129,4 @@ $cmdchain->clear(); // clears the previous added entries */ -?> \ No newline at end of file +?> From 814f9e6495dad2476926738cd7b670622738b812 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 09:36:21 -0300 Subject: [PATCH 006/329] Implement gettext() calls on config.console.inc --- etc/inc/config.console.inc | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 5c5590c890..3c783b2551 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -55,10 +55,10 @@ function set_networking_interfaces_ports() { if($avail < $g['minimum_ram_warning']) { echo "\n\n\n"; - echo "DANGER! WARNING! ACHTUNG!\n\n"; - echo "{$g['product_name']} requires *AT LEAST* {$g['minimum_ram_warning_text']} RAM to function correctly.\n"; - echo "Only ({$avail}) MB RAM has been detected.\n"; - echo "\nPress ENTER to continue. "; + echo gettext("DANGER! WARNING! ACHTUNG!") . "\n\n"; + printf(gettext("%s requires *AT LEAST* %s RAM to function correctly.%s"), $g['product_name'], $g['minimum_ram_warning_text'], "\n"); + printf(gettext("Only (%s) MB RAM has been detected.%s"), $avail, "\n"); + echo "\n" . gettext("Press ENTER to continue.") . " "; fgets($fp); echo "\n"; } @@ -80,7 +80,7 @@ Valid interfaces are: EOD; if(!is_array($iflist)) { - echo "No interfaces found!\n"; + echo gettext("No interfaces found!") . "\n"; $iflist = array(); } else { foreach ($iflist as $iface => $ifa) { @@ -178,7 +178,7 @@ EOD; if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { - echo "\n\nVLAN interfaces:\n\n"; + echo "\n\n" . gettext("VLAN interfaces:") . "\n\n"; foreach ($config['vlans']['vlan'] as $vlan) { echo sprintf("% -16s%s\n", "{$vlan['if']}_vlan{$vlan['tag']}", @@ -204,7 +204,7 @@ hitting 'a' to initiate auto detection. EOD; do { - echo "\nEnter the WAN interface name or 'a' for auto-detection: "; + echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection:") . " "; $wanif = chop(fgets($fp)); if ($wanif === "") { return; @@ -212,16 +212,16 @@ EOD; if ($wanif === "a") $wanif = autodetect_interface("WAN", $fp); else if (!array_key_exists($wanif, $iflist)) { - echo "\nInvalid interface name '{$wanif}'\n"; + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $wanif, "\n"); unset($wanif); continue; } } while (!$wanif); do { - echo "\nEnter the LAN interface name or 'a' for auto-detection \n" . - "NOTE: this enables full Firewalling/NAT mode.\n" . - "(or nothing if finished): "; + printf(gettext("%sEnter the LAN interface name or 'a' for auto-detection %s" . + "NOTE: this enables full Firewalling/NAT mode.%s" . + "(or nothing if finished):%s"), "\n", "\n", "\n", " "); $lanif = chop(fgets($fp)); @@ -241,7 +241,7 @@ EOD; if ($lanif === "a") $lanif = autodetect_interface("LAN", $fp); else if (!array_key_exists($lanif, $iflist)) { - echo "\nInvalid interface name '{$lanif}'\n"; + printf(gettext("%sInvalid interface name '%s'%s)", "\n", $lanif), "\n"); unset($lanif); continue; } @@ -258,22 +258,22 @@ EOD; $i1 = $i + 1; if($config['interfaces']['opt' . $i1]['descr']) - echo "\nOptional interface {$i1} description found: {$config['interfaces']['opt' . $i1]['descr']}"; + printf(gettext("%sOptional interface %s description found: %s"), "\n", $config['interfaces']['opt' . $i1]['descr']); - echo "\nEnter the Optional {$i1} interface name or 'a' for auto-detection\n" . - "(or nothing if finished): "; + printf(gettext("%sEnter the Optional %s{$i1} interface name or 'a' for auto-detection%s" . + "(or nothing if finished):%s"), "\n", $i1, "\n", " "); $optif[$i] = chop(fgets($fp)); if ($optif[$i]) { if ($optif[$i] === "a") { - $ad = autodetect_interface("Optional " . $i1, $fp); + $ad = autodetect_interface(gettext("Optional") . " " . $i1, $fp); if ($ad) $optif[$i] = $ad; else unset($optif[$i]); } else if (!array_key_exists($optif[$i], $iflist)) { - echo "\nInvalid interface name '{$optif[$i]}'\n"; + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $optif[$i], "\n"); unset($optif[$i]); continue; } @@ -301,7 +301,7 @@ EOD; } } - echo "\nThe interfaces will be assigned as follows: \n\n"; + printf(gettext("%sThe interfaces will be assigned as follows: %s%s"), "\n", "\n", "\n"); if ($lanif != "") echo "LAN -> " . $lanif . "\n"; @@ -407,16 +407,16 @@ EODD; for (; isset($config['interfaces']['opt' . ($i+1)]); $i++) unset($config['interfaces']['opt' . ($i+1)]); - echo "\nWriting configuration..."; + printf(gettext("%sWriting configuration..."), "\n"); write_config(); - echo "done.\n"; + printf(gettext("done.%s"), "\n"); fclose($fp); if($g['booting']) return; - echo "One moment while we reload the settings..."; + echo gettext("One moment while we reload the settings..."); $g['booting'] = false; @@ -426,7 +426,7 @@ EODD; reload_all_sync(); */ - echo " done!\n"; + echo " " . gettext("done!") . "\n"; touch("{$g['tmp_path']}/assign_complete"); @@ -446,12 +446,12 @@ EOD; foreach ($iflist_prev as $ifn => $ifa) { if (!$ifa['up'] && $iflist[$ifn]['up']) { - echo "Detected link-up on interface {$ifn}.\n"; + printf(gettext("Detected link-up on interface %s.%s"), $ifn, "\n"); return $ifn; } } - echo "No link-up detected.\n"; + printf(gettext("No link-up detected.%s"), "\n"); return null; } @@ -490,9 +490,9 @@ EOD; while (1) { $vlan = array(); - echo "\n\nVLAN Capable interfaces:\n\n"; + echo "\n\n" . gettext("VLAN Capable interfaces:") . "\n\n"; if(!is_array($iflist)) { - echo "No interfaces found!\n"; + echo gettext("No interfaces found!") . "\n"; } else { $vlan_capable=0; foreach ($iflist as $iface => $ifa) { @@ -505,28 +505,28 @@ EOD; } if($vlan_capable == 0) { - echo "No VLAN capable interfaces detected.\n"; + echo gettext("No VLAN capable interfaces detected.") . "\n"; return; } - echo "\nEnter the parent interface name for the new VLAN (or nothing if finished): "; + echo "\n" . gettext("Enter the parent interface name for the new VLAN (or nothing if finished):") . " "; $vlan['if'] = chop(fgets($fp)); if ($vlan['if']) { if (!array_key_exists($vlan['if'], $iflist) or !is_jumbo_capable($vlan['if'])) { - echo "\nInvalid interface name '{$vlan['if']}'\n"; + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $vlan['if'], "\n"); continue; } } else { break; } - echo "Enter the VLAN tag (1-4094): "; + echo gettext("Enter the VLAN tag (1-4094):") . " "; $vlan['tag'] = chop(fgets($fp)); $vlan['vlanif'] = "{$vlan['if']}_vlan{$vlan['tag']}"; if (!is_numericint($vlan['tag']) || ($vlan['tag'] < 1) || ($vlan['tag'] > 4094)) { - echo "\nInvalid VLAN tag '{$vlan['tag']}'\n"; + printf(gettext("%sInvalid VLAN tag '%s'%s"), "\n", $vlan['tag'], "\n"); continue; } @@ -535,4 +535,4 @@ EOD; } } -?> \ No newline at end of file +?> From 10e91486fa5c2d467135bcaa887aee83458442a0 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 09:54:11 -0300 Subject: [PATCH 007/329] Implement gettext() calls on config.inc --- etc/inc/config.inc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 724615a53a..98592c9e14 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -88,10 +88,10 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) { if(stristr($config_contents, "") == true) { if($g['booting']) echo "."; /* user has just upgraded to m0n0wall, replace root xml tags */ - log_error("Upgrading m0n0wall configuration to pfSense... "); + log_error(gettext("Upgrading m0n0wall configuration to pfSense... ")); $config_contents = str_replace("m0n0wall","pfsense", $config_contents); if (!config_validate("{$g['conf_path']}/config.xml")) - log_error("ERROR! Could not convert m0n0wall -> pfsense in config.xml"); + log_error(gettext("ERROR! Could not convert m0n0wall -> pfsense in config.xml")); conf_mount_rw(); $fd = fopen("/cf/conf/config.xml", "w"); fwrite($fd, $config_contents); @@ -121,9 +121,10 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { } } $cfgfstype = "msdosfs"; - echo "CDROM build\n"; - echo " CFG: {$cfgpartition}\n"; - echo " TYPE: {$cfgfstype}\n"; + echo gettext("CDROM build") . "\n"; + echo " " . gettext("CFG:") . " {$cfgpartition}\n"; + echo " " . gettext("CFG:") . " {$cfgpartition}\n"; + echo " " . gettext("TYPE:") . " {$cfgfstype}\n"; } else { if($g['booting']) echo "."; /* probe kernel known disks until we find one with config.xml */ @@ -138,7 +139,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { $cfgdevice = $mountdisk; $cfgpartition = $cfgdevice . "a"; $cfgfstype = "ufs"; - echo "Found configuration on $cfgdevice.\n"; + printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); } mwexec("/sbin/umount -f {$g['cf_path']}"); @@ -153,7 +154,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { $cfgdevice = $mountdisk; $cfgpartition = $cfgdevice . "d"; $cfgfstype = "ufs"; - echo "Found configuration on $cfgdevice.\n"; + printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); } mwexec("/sbin/umount -f {$g['cf_path']}"); @@ -167,11 +168,11 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { if (!$cfgdevice) { $last_backup = discover_last_backup(); if($last_backup) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); restore_backup("/cf/conf/backup/{$last_backup}"); } else { - log_error("No config.xml or config backups found, resetting to factory defaults."); + log_error(gettext("No config.xml or config backups found, resetting to factory defaults.")); restore_backup('/conf.default/config.xml'); } } @@ -211,4 +212,4 @@ if($config_parsed == true) { } } -?> \ No newline at end of file +?> From 5bd033a03083c496bc33f2cbef41034b847f9d83 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 16 Aug 2010 10:21:27 -0300 Subject: [PATCH 008/329] Implement gettext() calls on easyrule.inc --- etc/inc/easyrule.inc | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/etc/inc/easyrule.inc b/etc/inc/easyrule.inc index c23cf6c731..2e3af4bba1 100644 --- a/etc/inc/easyrule.inc +++ b/etc/inc/easyrule.inc @@ -110,7 +110,7 @@ function easyrule_block_rule_create($int = 'wan') { $filterent['interface'] = $int; $filterent['source']['address'] = $blockaliasname . strtoupper($int); $filterent['destination']['any'] = ''; - $filterent['descr'] = "Easy Rule: Blocked from Firewall Log View"; + $filterent['descr'] = gettext("Easy Rule: Blocked from Firewall Log View"); $a_filter[] = $filterent; @@ -159,15 +159,15 @@ function easyrule_block_alias_add($host, $int = 'wan') { $alias['descr'] = $a_aliases[$id]['descr']; $alias['address'] = $a_aliases[$id]['address'] . ' ' . $host . '/32'; - $alias['detail'] = $a_aliases[$id]['detail'] . 'Entry added ' . date('r') . '||'; + $alias['detail'] = $a_aliases[$id]['detail'] . gettext('Entry added') . ' ' . date('r') . '||'; } else { /* Create a new alias with all the proper information */ - $alias['name'] = $blockaliasname . strtoupper($int); - $alias['type'] = 'network'; - $alias['descr'] = mb_convert_encoding("Hosts blocked from Firewall Log view","HTML-ENTITIES","auto"); + $alias['name'] = $blockaliasname . strtoupper($int); + $alias['type'] = 'network'; + $alias['descr'] = mb_convert_encoding(gettext("Hosts blocked from Firewall Log view"),"HTML-ENTITIES","auto"); $alias['address'] = $host . '/32'; - $alias['detail'] = 'Entry added ' . date('r') . '||'; + $alias['detail'] = gettext('Entry added') . ' ' . date('r') . '||'; } /* Replace the old alias if needed, otherwise tack it on the end */ @@ -242,7 +242,7 @@ function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport) { $filterent = array(); $filterent['type'] = 'pass'; $filterent['interface'] = $int; - $filterent['descr'] = "Easy Rule: Passed from Firewall Log View"; + $filterent['descr'] = gettext("Easy Rule: Passed from Firewall Log View"); if ($proto != "any") $filterent['protocol'] = $proto; @@ -272,21 +272,21 @@ function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport) { function easyrule_parse_block($int, $src) { if (!empty($src) && !empty($int)) { if (!is_ipaddr($src)) { - return "Tried to block invalid IP: " . htmlspecialchars($src); + return gettext("Tried to block invalid IP:") . ' ' . htmlspecialchars($src); } $int = easyrule_find_rule_interface($int); if ($int === false) { - return "Invalid interface for block rule: " . htmlspecialchars($int); + return gettext("Invalid interface for block rule:") . ' ' . htmlspecialchars($int); } if (easyrule_block_host_add($src, $int)) { - return "Host added successfully"; + return gettext("Host added successfully"); } else { - return "Failed to create block rule, alias, or add host."; + return gettext("Failed to create block rule, alias, or add host."); } } else { - return "Tried to block but had no host IP or interface"; + return gettext("Tried to block but had no host IP or interface"); } - return "Unknown block error."; + return gettext("Unknown block error."); } function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0) { /* Check for valid int, srchost, dsthost, dstport, and proto */ @@ -295,36 +295,36 @@ function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0) { if (!empty($int) && !empty($proto) && !empty($src) && !empty($dst)) { $int = easyrule_find_rule_interface($int); if ($int === false) { - return "Invalid interface for pass rule: " . htmlspecialchars($int); + return gettext("Invalid interface for pass rule:") . ' ' . htmlspecialchars($int); } if (getprotobyname($proto) == -1) { - return "Invalid protocol for pass rule: " . htmlspecialchars($proto); + return gettext("Invalid protocol for pass rule:") . ' ' . htmlspecialchars($proto); } if (!is_ipaddr($src)) { - return "Tried to pass invalid source IP: " . htmlspecialchars($src); + return gettext("Tried to pass invalid source IP:") . ' ' . htmlspecialchars($src); } if (!is_ipaddr($dst)) { - return "Tried to pass invalid destination IP: " . htmlspecialchars($dst); + return gettext("Tried to pass invalid destination IP:") . ' ' . htmlspecialchars($dst); } if (in_array($proto, $protocols_with_ports)) { if (empty($dstport)) { - return "Missing destination port: " . htmlspecialchars($dstport); + return gettext("Missing destination port:") . ' ' . htmlspecialchars($dstport); } if (!is_port($dstport)) { - return "Tried to pass invalid destination port: " . htmlspecialchars($dstport); + return gettext("Tried to pass invalid destination port:") . ' ' . htmlspecialchars($dstport); } } else { $dstport = 0; } /* Should have valid input... */ if (easyrule_pass_rule_add($int, $proto, $src, $dst, $dstport)) { - return "Successfully added pass rule!"; + return gettext("Successfully added pass rule!"); } else { - return "Failed to add pass rule."; + return gettext("Failed to add pass rule."); } } else { - return "Missing parameters for pass rule."; + return gettext("Missing parameters for pass rule."); } - return "Unknown pass error."; + return gettext("Unknown pass error."); } ?> From 4e038d31d9ec1c60b18e0cf10a0718a2e62cc97e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 10:36:09 -0300 Subject: [PATCH 009/329] Implement gettext() calls on config.lib.inc --- etc/inc/config.lib.inc | 98 +++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 120f8b1d85..dd2a9b27ce 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -59,9 +59,9 @@ function encrypted_configxml() { if(tagfile_deformat($configtxt, $configtxt, "config.xml")) { $fp = fopen('php://stdin', 'r'); $data = ""; - echo "\n\n*** Encrypted config.xml detected ***\n"; + echo "\n\n" . gettext("*** Encrypted config.xml detected ***") . "\n"; while($data == "") { - echo "\nEnter the password to decrypt config.xml: "; + echo "\n" . gettext("Enter the password to decrypt config.xml:") . " "; $decrypt_password = chop(fgets($fp)); $data = decrypt_data($configtxt, $decrypt_password); if(!strstr($data, "")) @@ -71,10 +71,10 @@ function encrypted_configxml() { fwrite($fd, $data); fclose($fd); exec("/bin/mv {$g['conf_path']}/config.xml.tmp {$g['conf_path']}/config.xml"); - echo "\nConfig.xml unlocked.\n"; + echo "\n" . gettext("Config.xml unlocked.") . "\n"; fclose($fp); } else { - echo "\nInvalid password entered. Please try again.\n"; + echo "\n" . gettext("Invalid password entered. Please try again.") . "\n"; } } } @@ -98,12 +98,12 @@ function parse_config($parse = false) { if (!file_exists("{$g['conf_path']}/config.xml") || filesize("{$g['conf_path']}/config.xml") == 0) { $last_backup = discover_last_backup(); if($last_backup) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); restore_backup("{$g['conf_path']}/backup/{$last_backup}"); } else { unlock($lockkey); - die("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."); + die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.")); } } if($g['booting']) echo "."; @@ -119,13 +119,13 @@ function parse_config($parse = false) { } } else { if(!file_exists($g['conf_path'] . "/config.xml")) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); $last_backup = discover_last_backup(); if ($last_backup) restore_backup("/cf/conf/backup/{$last_backup}"); else - log_error("Could not restore config.xml."); + log_error(gettext("Could not restore config.xml.")); } unlock($lockkey); $config = parse_config(true); @@ -134,13 +134,13 @@ function parse_config($parse = false) { } else { if(!file_exists($g['conf_path'] . "/config.xml")) { if($g['booting']) echo "."; - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); $last_backup = discover_last_backup(); if ($last_backup) restore_backup("/cf/conf/backup/{$last_backup}"); else - log_error("Could not restore config.xml."); + log_error(gettext("Could not restore config.xml.")); } $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']); if($config == "-1") { @@ -201,8 +201,8 @@ function restore_backup($file) { conf_mount_rw(); unlink_if_exists("{$g['tmp_path']}/config.cache"); copy("$file","/cf/conf/config.xml"); - log_error("{$g['product_name']} is restoring the configuration $file"); - file_notice("config.xml", "{$g['product_name']} is restoring the configuration $file", "pfSenseConfigurator", ""); + log_error(sprintf(gettext("%s is restoring the configuration %s"), $g['product_name'], $file)); + file_notice("config.xml", sprintf(gettext("%s is restoring the configuration %s"), $g['product_name'], $file), "pfSenseConfigurator", ""); conf_mount_ro(); } } @@ -224,30 +224,30 @@ function parse_config_bootup() { if ($g['booting']) { if (strstr($g['platform'], "cdrom")) { /* try copying the default config. to the floppy */ - echo "Resetting factory defaults...\n"; + echo gettext("Resetting factory defaults...") . "\n"; reset_factory_defaults(true); if (file_exists("{$g['conf_path']}/config.xml")) { /* do nothing, we have a file. */ } else { - echo "No XML configuration file found - using factory defaults.\n"; - echo "Make sure that the configuration floppy disk with the conf/config.xml\n"; - echo "file is inserted. If it isn't, your configuration changes will be lost\n"; - echo "on reboot.\n"; + echo gettext("No XML configuration file found - using factory defaults.") . "\n"; + echo gettext("Make sure that the configuration floppy disk with the conf/config.xml") . "\n"; + echo gettext("file is inserted. If it isn't, your configuration changes will be lost") . "\n"; + echo gettext("on reboot.") . "\n"; } } else { $last_backup = discover_last_backup(); if($last_backup) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); restore_backup("/cf/conf/backup/{$last_backup}"); } if(!file_exists("{$g['conf_path']}/config.xml")) { - echo "XML configuration file not found. {$g['product_name']} cannot continue booting.\n"; + printf(gettext("XML configuration file not found. %s cannot continue booting.%s"), $g['product_name'], "\n"); mwexec("/sbin/halt"); exit; } - log_error("Last known config found and restored. Please double check your configuration file for accuracy."); - file_notice("config.xml", "Last known config found and restored. Please double check your configuration file for accuracy.", "pfSenseConfigurator", ""); + log_error(gettext("Last known config found and restored. Please double check your configuration file for accuracy.")); + file_notice("config.xml", gettext("Last known config found and restored. Please double check your configuration file for accuracy."), "pfSenseConfigurator", ""); } } else { unlock($lockkey); @@ -258,12 +258,12 @@ function parse_config_bootup() { if (filesize("{$g['conf_path']}/config.xml") == 0) { $last_backup = discover_last_backup(); if($last_backup) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); + log_error(gettext("No config.xml found, attempting last known config restore.")); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); restore_backup("{$g['conf_path']}/backup/{$last_backup}"); } else { unlock($lockkey); - die("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."); + die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.")); } } unlock($lockkey); @@ -309,7 +309,7 @@ function conf_mount_rw() { $status = mwexec("/sbin/mount -u -w {$g['cf_path']}"); if($status <> 0) { if($g['booting']) - echo "Disk is dirty. Running fsck -y\n"; + echo gettext("Disk is dirty. Running fsck -y") . "\n"; mwexec("/sbin/fsck -y {$g['cf_path']}"); $status = mwexec("/sbin/mount -u -w {$g['cf_path']}"); } @@ -320,7 +320,7 @@ function conf_mount_rw() { $status = mwexec("/sbin/mount -u -w /"); /* we could not mount this correctly. kick off fsck */ if($status <> 0) { - log_error("File system is dirty. Launching FSCK for /"); + log_error(gettext("File system is dirty. Launching FSCK for /")); mwexec("/sbin/fsck -y /"); $status = mwexec("/sbin/mount -u -w /"); } @@ -366,7 +366,7 @@ function conf_mount_ro() { function convert_config() { global $config, $g; $now = date("H:i:s"); - log_error("Start Configuration upgrade at $now, set execution timeout to 15 minutes"); + log_error(sprintf(gettext("Start Configuration upgrade at %s, set execution timeout to 15 minutes"), $now)); //ini_set("max_execution_time", "900"); /* special case upgrades */ @@ -376,8 +376,8 @@ function convert_config() { if(stristr($config['cron']['item'][$x]['command'], "rc.update_bogons.sh")) { if($config['cron']['item'][$x]['hour'] == "*" ) { $config['cron']['item'][$x]['hour'] = "3"; - write_config("Updated bogon update frequency to 3am"); - log_error("Updated bogon update frequency to 3am"); + write_config(gettext("Updated bogon update frequency to 3am")); + log_error(gettext("Updated bogon update frequency to 3am")); } } } @@ -401,13 +401,13 @@ function convert_config() { } $now = date("H:i:s"); - log_error("Ended Configuration upgrade at $now"); + log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now)); if ($prev_version != $config['version']) - write_config("Upgraded config version level from {$prev_version} to {$config['version']}"); + write_config(sprintf(gettext("Upgraded config version level from %s to %s"), $prev_version, $config['version'])); if($g['booting']) - echo "Loading new configuration..."; + echo gettext("Loading new configuration..."); } /****f* config/safe_write_file @@ -470,7 +470,7 @@ function write_config($desc="Unknown", $backup = true) { // $config = parse_config(true, false, false); if($g['bootup']) - log_error("WARNING! Configuration written on bootup. This can cause stray openvpn and load balancing items in config.xml"); + log_error(gettext("WARNING! Configuration written on bootup. This can cause stray openvpn and load balancing items in config.xml")); if($backup) backup_config(); @@ -480,7 +480,7 @@ function write_config($desc="Unknown", $backup = true) { /* Log the running script so it's not entirely unlogged what changed */ if ($desc == "Unknown") - $desc = "{$_SERVER['SCRIPT_NAME']} made unknown change"; + $desc = sprintf(gettext("%s made unknown change"), $_SERVER['SCRIPT_NAME']); $config['revision']['description'] = "{$_SESSION['Username']}: " . $desc; $config['revision']['username'] = $_SESSION["Username"]; @@ -493,9 +493,9 @@ function write_config($desc="Unknown", $backup = true) { /* write new configuration */ if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) { - log_error("WARNING: Config contents could not be save. Could not open file!"); + log_error(gettext("WARNING: Config contents could not be save. Could not open file!")); unlock($lockkey); - file_notice("config.xml", "Unable to open {$g['cf_conf_path']}/config.xml for writing in write_config()\n"); + file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n")); return -1; } @@ -593,7 +593,7 @@ function config_restore($conffile) { conf_mount_ro(); - write_config("Reverted to " . array_pop(explode("/", $conffile)) . ".", false); + write_config(gettext("Reverted to") . " " . array_pop(explode("/", $conffile)) . ".", false); return 0; } @@ -608,9 +608,9 @@ function config_install($conffile) { return 1; if($g['booting'] == true) - echo "Installing configuration...\n"; + echo gettext("Installing configuration...") . "\n"; else - log_error("Installing configuration ...."); + log_error(gettext("Installing configuration ....")); conf_mount_rw(); $lockkey = lock('config', LOCK_EX); @@ -634,13 +634,13 @@ function config_validate($conffile) { $xml_parser = xml_parser_create(); if (!($fp = fopen($conffile, "r"))) { - $xmlerr = "XML error: unable to open file"; + $xmlerr = gettext("XML error: unable to open file"); return false; } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - $xmlerr = sprintf("%s at line %d", + $xmlerr = sprintf(gettext("%s at line %d"), xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)); return false; @@ -686,9 +686,9 @@ function cleanup_backupcache($revisions = 30, $lock = false) { echo "."; $newxml = parse_xml_config($backup, $g['xml_rootobj']); if($newxml == "-1") { - log_error("The backup cache file $backup is corrupted. Unlinking."); + log_error(sprintf(gettext("The backup cache file %s is corrupted. Unlinking."), $backup)); unlink($backup); - log_error("The backup cache file $backup is corrupted. Unlinking."); + log_error(sprintf(gettext("The backup cache file %s is corrupted. Unlinking."), $backup)); continue; } if($newxml['revision']['description'] == "") @@ -723,7 +723,7 @@ function cleanup_backupcache($revisions = 30, $lock = false) { conf_mount_ro(); if($g['booting'] && $i) - print "done.\n"; + print gettext("done.") . "\n"; if (!$lock) unlock($lockkey); } @@ -799,4 +799,4 @@ function set_device_perms() { } } -?> \ No newline at end of file +?> From 8abd095a53ee096606eac2fbf19e87d4c868d20b Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 10:56:04 -0300 Subject: [PATCH 010/329] Implement gettext() calls on filter_log.inc --- etc/inc/filter_log.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index ed4b311790..e78bc0cd36 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -159,7 +159,7 @@ function parse_filter_line($line) { return $flent; } else { if($g['debug']) { - log_error("There was a error parsing rule: $errline. Please report to mailing list or forum."); + log_error(sprintf(gettext("There was a error parsing rule: %s. Please report to mailing list or forum."), $errline)); } return ""; } @@ -203,7 +203,7 @@ function get_port_with_service($port, $proto) { $service = getservbyport($port, $proto); $portstr = ""; if ($service) { - $portstr = "" . htmlspecialchars($port) . ""; + $portstr = sprintf(gettext("%s"), $port, $proto, $service, htmlspecialchars($port)); } else { $portstr = htmlspecialchars($port); } @@ -279,4 +279,4 @@ function handle_ajax($nentries, $tail = 50) { } } -?> \ No newline at end of file +?> From 5c7296d27f1c4fbc2eff629b17bccb80136fc5b8 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 12:53:12 -0300 Subject: [PATCH 011/329] Implement gettext() calls on gwlb.inc --- etc/inc/gwlb.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 4a9decb48d..bea0bed09e 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -230,7 +230,7 @@ EOD; mwexec("/sbin/route delete -host " . escapeshellarg($gateway['monitor'])); mwexec("/sbin/route add -host " . escapeshellarg($gateway['monitor']) . " " . escapeshellarg($gateway['gateway'])); - log_error("Removing static route for monitor {$gateway['monitor']} and adding a new route through {$gateway['gateway']}"); + log_error(sprintf(gettext("Removing static route for monitor %s and adding a new route through %s"), $gateway['monitor'], $gateway['gateway'])); } } } @@ -383,13 +383,13 @@ function return_gateway_groups_array() { continue; } if (stristr($status['status'], "down")) { - $msg = "MONITOR: $gwname has high latency, removing from routing group"; + $msg = sprintf(gettext("MONITOR: %s has high latency, removing from routing group"), $gwname); log_error($msg); notify_via_growl($msg); } elseif (stristr($status['status'], "loss")) { if (strstr($group['trigger'], "loss")) { /* packet loss */ - $msg = "MONITOR: $gwname has packet loss, removing from routing group"; + $msg = sprintf(gettext("MONITOR: %s has packet loss, removing from routing group"), $gwname); log_error($msg); notify_via_growl($msg); } else { @@ -398,6 +398,7 @@ function return_gateway_groups_array() { } elseif (stristr($status['status'], "delay")) { if (strstr($group['trigger'] , "latency")) { /* high latency */ + $msg = sprintf(gettext("MONITOR: %s has high latency, removing from routing group"), $gwname); $msg = "MONITOR: $gwname has high latency, removing from routing group"; log_error($msg); notify_via_growl($msg); @@ -413,7 +414,7 @@ function return_gateway_groups_array() { $tiers_count = count($tiers); if($tiers_count == 0) { /* Oh dear, we have no members! Engage Plan B */ - $msg = "All gateways are unavailable, proceeding with configured XML settings!"; + $msg = gettext("All gateways are unavailable, proceeding with configured XML settings!"); log_error($msg); notify_via_growl($msg); foreach($group['item'] as $item) { @@ -468,7 +469,7 @@ function dhclient_update_gateway_groups_defaultroute($interface = "wan") { } } if($changed && $current_gw) - write_config("Updating gateway group gateway for $interface - new gateway is $current_gw"); + write_config(sprintf(gettext("Updating gateway group gateway for %s - new gateway is %s"), $interfac, $current_gw)); } function lookup_gateway_ip_by_name($name) { From 07e40c1faea86d969327722eb101ad0d202bd84e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 15:41:30 -0300 Subject: [PATCH 012/329] Implement gettext() calls on interfaces.inc --- etc/inc/interfaces.inc | 134 ++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 021d76d50d..91568157c3 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -47,7 +47,7 @@ require_once("cmd_chain.inc"); function interfaces_bring_up($interface) { if(!$interface) { - log_error("interfaces_bring_up() was called but no variable defined."); + log_error(gettext("interfaces_bring_up() was called but no variable defined.")); log_error( "Backtrace: " . debug_backtrace() ); return; } @@ -86,19 +86,19 @@ function does_interface_exist($interface) { function interfaces_loopback_configure() { if($g['booting']) - echo "Configuring loopback interface..."; + echo gettext("Configuring loopback interface..."); pfSense_interface_setaddress("lo0", "127.0.0.1"); interfaces_bring_up("lo0"); exec("/sbin/route add 127.0.0.2 127.0.0.1"); if($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; return 0; } function interfaces_vlan_configure() { global $config, $g; if($g['booting']) - echo "Configuring VLAN interfaces..."; + echo gettext("Configuring VLAN interfaces..."); if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { if(empty($vlan['vlanif'])) @@ -108,14 +108,14 @@ function interfaces_vlan_configure() { } } if($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } function interface_vlan_configure(&$vlan) { global $config, $g; if (!is_array($vlan)) { - log_error("VLAN: called with wrong options. Problems with config!"); + log_error(gettext("VLAN: called with wrong options. Problems with config!")); return; } $if = $vlan['if']; @@ -123,7 +123,7 @@ function interface_vlan_configure(&$vlan) { $tag = $vlan['tag']; if (empty($if)) { - log_error("interface_vlan_confgure called with if undefined."); + log_error(gettext("interface_vlan_confgure called with if undefined.")); return; } @@ -157,14 +157,14 @@ function interface_qinq_configure(&$vlan, $fd = NULL) { global $config, $g; if (!is_array($vlan)) { - log_error("QinQ compat VLAN: called with wrong options. Problems with config!\n"); + log_error(sprintf(gettext("QinQ compat VLAN: called with wrong options. Problems with config!%s"), "\n")); return; } $qinqif = $vlan['if']; $tag = $vlan['tag']; if(empty($qinqif)) { - log_error("interface_qinq_confgure called with if undefined.\n"); + log_error(sprintf(gettext("interface_qinq_confgure called with if undefined.%s"), "\n")); return; } $vlanif = interface_vlan_configure($vlan); @@ -225,7 +225,7 @@ function interface_qinq_configure(&$vlan, $fd = NULL) { function interfaces_qinq_configure() { global $config, $g; if($g['booting']) - echo "Configuring QinQ interfaces..."; + echo gettext("Configuring QinQ interfaces..."); if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) { foreach ($config['qinqs']['qinqentry'] as $qinq) { /* XXX: Maybe we should report any errors?! */ @@ -233,14 +233,14 @@ function interfaces_qinq_configure() { } } if($g['booting']) - echo "done.\n"; + echo gettext( "done.") . "\n"; } function interface_qinq2_configure(&$qinq, $fd, $macaddr) { global $config, $g; if (!is_array($qinq)) { - log_error("QinQ compat VLAN: called with wrong options. Problems with config!\n"); + log_error(sprintf(gettext("QinQ compat VLAN: called with wrong options. Problems with config!%s"), "\n")); return; } @@ -248,7 +248,7 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr) { $tag = $qinq['tag']; $vlanif = "{$if}_{$tag}"; if(empty($if)) { - log_error("interface_qinq_confgure called with if undefined.\n"); + log_error(sprintf(gettext("interface_qinq_confgure called with if undefined.%s"), "\n")); return; } @@ -269,7 +269,7 @@ function interfaces_create_wireless_clones() { global $config; if($g['booting']) - echo "Creating other wireless clone interfaces..."; + echo gettext("Creating other wireless clone interfaces..."); if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) { foreach ($config['wireless']['clone'] as $clone) { if(empty($clone['cloneif'])) @@ -283,7 +283,7 @@ function interfaces_create_wireless_clones() { } } if($g['booting']) - echo " done.\n"; + echo " " . gettext("done.") . "\n"; } function interfaces_bridge_configure() { @@ -308,7 +308,7 @@ function interface_bridge_configure(&$bridge) { return -1; if (empty($bridge['members'])) { - log_error("No members found on {$bridge['bridgeif']}"); + log_error(sprintf(gettext("No members found on %s"), $bridge['bridgeif'])); return -1; } @@ -349,7 +349,7 @@ function interface_bridge_configure(&$bridge) { /* make sure the parent interface is up */ pfSense_interface_mtu($realif, $smallermtu); if(!$realif) - log_error("realif not defined in interfaces bridge - up"); + log_error(gettext("realif not defined in interfaces bridge - up")); interfaces_bring_up($realif1); mwexec("/sbin/ifconfig {$bridgeif} addm {$realif}"); } @@ -457,7 +457,7 @@ function interface_bridge_configure(&$bridge) { if($bridgeif) interfaces_bring_up($bridgeif); else - log_error("bridgeif not defined -- could not bring interface up"); + log_error(gettext("bridgeif not defined -- could not bring interface up")); return $bridgeif; } @@ -492,7 +492,7 @@ function interfaces_lagg_configure() { global $config, $g; if($g['booting']) - echo "Configuring LAGG interfaces..."; + echo gettext("Configuring LAGG interfaces..."); $i = 0; if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) { foreach ($config['laggs']['lagg'] as $lagg) { @@ -504,7 +504,7 @@ function interfaces_lagg_configure() } } if($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } function interface_lagg_configure(&$lagg) { @@ -603,7 +603,7 @@ function interface_gre_configure(&$gre) { if($greif) interfaces_bring_up($greif); else - log_error("Could not bring greif up -- variable not defined."); + log_error(gettext("Could not bring greif up -- variable not defined.")); if (isset($gre['link1']) && $gre['link1']) mwexec("/sbin/route add {$gre['tunnel-remote-addr']}/{$gre['tunnel-remote-net']} {$gre['tunnel-local-addr']}"); @@ -639,7 +639,7 @@ function interface_gif_configure(&$gif) { if($realif) interfaces_bring_up($realif); else - log_error("could not bring realif up -- variable not defined -- interface_gif_configure()"); + log_error(gettext("could not bring realif up -- variable not defined -- interface_gif_configure()")); if ($g['booting'] || !(empty($gif['gifif']))) { pfSense_interface_destroy($gif['gifif']); @@ -658,7 +658,7 @@ function interface_gif_configure(&$gif) { if($gifif) interfaces_bring_up($gifif); else - log_error("could not bring gifif up -- variable not defined"); + log_error(gettext("could not bring gifif up -- variable not defined")); /* XXX: Needed?! */ //mwexec("/sbin/route add {$gif['tunnel-remote-addr']}/{$gif['tunnel-remote-net']} -iface {$gifif}"); @@ -700,12 +700,12 @@ function interfaces_configure() { $delayed_list[$if] = $ifname; else { if ($g['booting']) - echo "Configuring {$ifname} interface..."; + printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) - log_error("Configuring {$ifname}"); + log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); if ($g['booting']) - echo "done.\n"; + echo gettext( "done.") . "\n"; } } @@ -720,14 +720,14 @@ function interfaces_configure() { foreach ($delayed_list as $if => $ifname) { if ($g['booting']) - echo "Configuring {$ifname} interface..."; + printf(gettext("Configuring %s interface..."), $ifname); if ($g['debug']) - log_error("Configuring {$ifname}"); + log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } /* set up BRIDGe virtual interfaces */ @@ -735,14 +735,14 @@ function interfaces_configure() { foreach ($bridge_list as $if => $ifname) { if ($g['booting']) - echo "Configuring {$ifname} interface..."; + printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) - log_error("Configuring {$ifname}"); + log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } /* bring up vip interfaces */ @@ -1030,7 +1030,7 @@ function interface_ppps_configure($interface) { } } if (!$ppp || $ifcfg['if'] != $ppp['if']){ - log_error("Can't find PPP config for {$ifcfg['if']} in interface_ppps_configure()."); + log_error(sprintf(gettext("Can't find PPP config for %s in interface_ppps_configure()."), $ifcfg['if'])); return 0; } $pppif = $ifcfg['if']; @@ -1077,7 +1077,7 @@ 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("Could not get a Local IP address for PPTP/L2TP link on {$port} in interfaces_ppps_configure."); + log_error(sprintf(gettext("Could not get a Local IP address for PPTP/L2TP link on %s in interfaces_ppps_configure."), $port)); return 0; } /* XXX: This needs to go away soon! [It's commented out!] */ @@ -1092,18 +1092,18 @@ function interface_ppps_configure($interface) { */ } if(!is_ipaddr($gateways[$pid])){ - log_error("Could not get a PPTP/L2TP Remote IP address from {$dhcp_gateway} for {$gway} in interfaces_ppps_configure."); + log_error(sprintf(gettext("Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure."), $dhcp_gateway, $gway)); return 0; } break; case "ppp": if (!file_exists("{$port}")) { - log_error("Device {$port} does not exist. PPP link cannot start without the modem device."); + log_error(sprintf(gettext("Device %s does not exist. PPP link cannot start without the modem device."), $port)); return 0; } break; default: - log_error("Unkown {$type} configured as ppp interface."); + log_error(sprintf(gettext("Unkown %s configured as ppp interface."), $type)); break; } } @@ -1368,7 +1368,7 @@ EOD; else { $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); if (!$fd) { - log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n"); + log_error(sprintf(gettext("Error: cannot open mpd_%s.conf in interface_ppps_configure().%s"), $interface, "\n")); return 0; } // Write out mpd_ppp.conf @@ -1420,7 +1420,7 @@ function interfaces_carp_setup() { $cmdchain = new CmdCHAIN(); if ($g['booting']) { - echo "Configuring CARP settings..."; + echo gettext("Configuring CARP settings..."); mute_kernel_msgs(); } @@ -1440,14 +1440,14 @@ function interfaces_carp_setup() { unset($pfsyncenabled); } - $cmdchain->add("Allow CARP", "/sbin/sysctl net.inet.carp.allow=1", true); + $cmdchain->add(gettext("Allow CARP"), "/sbin/sysctl net.inet.carp.allow=1", true); if($balanacing) { - $cmdchain->add("Enable CARP ARP-balancing", "/sbin/sysctl net.inet.carp.arpbalance=1", true); - $cmdchain->add("Disallow CARP preemption", "/sbin/sysctl net.inet.carp.preempt=0", true); + $cmdchain->add(gettext("Enable CARP ARP-balancing"), "/sbin/sysctl net.inet.carp.arpbalance=1", true); + $cmdchain->add(gettext("Disallow CARP preemption"), "/sbin/sysctl net.inet.carp.preempt=0", true); } else - $cmdchain->add("Enable CARP preemption", "/sbin/sysctl net.inet.carp.preempt=1", true); + $cmdchain->add(gettext("Enable CARP preemption"), "/sbin/sysctl net.inet.carp.preempt=1", true); - $cmdchain->add("Enable CARP logging", "/sbin/sysctl net.inet.carp.log=2", true); + $cmdchain->add(gettext("Enable CARP logging"), "/sbin/sysctl net.inet.carp.log=2", true); if (!empty($pfsyncinterface)) $carp_sync_int = get_real_interface($pfsyncinterface); @@ -1463,22 +1463,22 @@ function interfaces_carp_setup() { fclose($fd); mwexec("/sbin/pfctl -f {$g['tmp_path']}/rules.boot"); } else - log_error("Could not create rules.boot file!"); + log_error(gettext("Could not create rules.boot file!")); } /* setup pfsync interface */ if($carp_sync_int and $pfsyncenabled) { if (is_ipaddr($pfsyncpeerip)) - $cmdchain->add("Bring up pfsync0 syncpeer", "/sbin/ifconfig pfsync0 syncdev {$carp_sync_int} syncpeer {$pfsyncpeerip} up", false); + $cmdchain->add(gettext("Bring up pfsync0 syncpeer"), "/sbin/ifconfig pfsync0 syncdev {$carp_sync_int} syncpeer {$pfsyncpeerip} up", false); else - $cmdchain->add("Bring up pfsync0 syncdev", "/sbin/ifconfig pfsync0 syncdev {$carp_sync_int} up", false); + $cmdchain->add(gettext("Bring up pfsync0 syncdev"), "/sbin/ifconfig pfsync0 syncdev {$carp_sync_int} up", false); } else - $cmdchain->add("Bring up pfsync0", "/sbin/ifconfig pfsync0 syncdev lo0 up", false); + $cmdchain->add(gettext("Bring up pfsync0"), "/sbin/ifconfig pfsync0 syncdev lo0 up", false); if($config['virtualip']['vip']) - $cmdchain->add("Allow CARP.", "/sbin/sysctl net.inet.carp.allow=1", true); + $cmdchain->add(gettext("Allow CARP."), "/sbin/sysctl net.inet.carp.allow=1", true); else - $cmdchain->add("Disallow CARP.", "/sbin/sysctl net.inet.carp.allow=0", true); + $cmdchain->add(gettext("Disallow CARP."), "/sbin/sysctl net.inet.carp.allow=0", true); if($g['debug']) $cmdchain->setdebug(); // optional for verbose logging @@ -1488,7 +1488,7 @@ function interfaces_carp_setup() { if ($g['booting']) { unmute_kernel_msgs(); - echo "done.\n"; + echo gettext("done.") . "\n"; } } @@ -1665,7 +1665,7 @@ function interface_carp_configure(&$vip) { */ $realif = get_real_interface($vip['interface']); if (!does_interface_exist($realif)) { - file_notice("CARP", "Interface specified for the virtual IP address {$vip['subnet']} does not exist. Skipping this VIP.", "Firewall: Virtual IP", ""); + file_notice("CARP", sprintf(gettext("Interface specified for the virtual IP address %s does not exist. Skipping this VIP."), $vip['subnet']), "Firewall: Virtual IP", ""); return; } @@ -1673,7 +1673,7 @@ function interface_carp_configure(&$vip) { $ww_subnet_ip = find_interface_ip($realif); $ww_subnet_bits = find_interface_subnet($realif); if (!ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits)) { - file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IP address {$vip['subnet']}.", "Firewall: Virtual IP", ""); + file_notice("CARP", sprintf(gettext("Sorry but we could not find a matching real interface subnet for the virtual IP address %s."), $vip['subnet']), "Firewall: Virtual IP", ""); return; } @@ -1708,7 +1708,7 @@ function interface_carpdev_configure(&$vip) { if($vip['password'] != "") $password = " pass \"" . $vip_password . "\""; - log_error("Found carpdev interface {$vip['interface']} on top of interface {$interface}"); + log_error(sprintf(gettext("Found carpdev interface %s on top of interface %s"), $vip['interface'], $interface)); if (empty($vip['interface'])) return; @@ -1720,7 +1720,7 @@ function interface_carpdev_configure(&$vip) { * prevents a panic if the interface is missing or invalid */ if (!does_interface_exist($realif)) { - file_notice("CARP", "Interface specified for the virtual IP address {$vip['subnet']} does not exist. Skipping this VIP.", "Firewall: Virtual IP", ""); + file_notice("CARP", sprintf(gettext("Interface specified for the virtual IP address %s does not exist. Skipping this VIP."), $vip['subnet']), "Firewall: Virtual IP", ""); return; } @@ -1766,7 +1766,7 @@ EOD; /* fire up dhclient */ mwexec("/sbin/dhclient -c {$g['varetc_path']}/dhclient_{$vipif}.conf {$vipif} > {$g['tmp_path']}/{$vipif}_output > {$g['tmp_path']}/{$vipif}_error_output", false); } else { - log_error("Error: cannot open dhclient_{$vipif}.conf in interfaces_carpdev_configure() for writing.\n"); + log_error(sprintf(gettext("Error: cannot open dhclient_%s.conf in interfaces_carpdev_configure() for writing.%s"), $vipif, "\n")); mwexec("/sbin/dhclient -b {$vipif}"); } @@ -1799,15 +1799,15 @@ function interface_wireless_clone($realif, $wlcfg) { exec("/sbin/ifconfig {$realif}", $output, $ret); $ifconfig_str = implode($output); if(($wlcfg_mode == "hostap") && (! preg_match("/hostap/si", $ifconfig_str))) { - log_error("Interface {$realif} changed to hostap mode"); + log_error(sprintf(gettext("Interface %s changed to hostap mode"), $realif)); $needs_clone = true; } if(($wlcfg_mode == "adhoc") && (! preg_match("/adhoc/si", $ifconfig_str))) { - log_error("Interface {$realif} changed to adhoc mode"); + log_error(sprintf(gettext("Interface %s changed to adhoc mode"), $realif)); $needs_clone = true; } if(($wlcfg_mode == "bss") && (preg_match("/hostap|adhoc/si", $ifconfig_str))) { - log_error("Interface {$realif} changed to infrastructure mode"); + log_error(sprintf(gettext("Interface %s changed to infrastructure mode"), $realif)); $needs_clone = true; } } else { @@ -1819,12 +1819,12 @@ function interface_wireless_clone($realif, $wlcfg) { if(does_interface_exist($realif)) pfSense_interface_destroy($realif); - log_error("Cloning new wireless interface {$realif}"); + log_error(sprintf(gettext("Cloning new wireless interface %s"), $realif)); // Create the new wlan interface. FreeBSD returns the new interface name. // example: wlan2 exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} bssid 2>&1", $out, $ret); if($ret <> 0) { - log_error("Failed to clone interface {$baseif} with error code {$ret}, output {$out[0]}"); + log_error(sprintf(gettext("Failed to clone interface %s with error code %s, output %s"), $baseif, $ret, $out[0])); return false; } $newif = trim($out[0]); @@ -2335,13 +2335,13 @@ function interface_configure($interface = "wan", $reloadall = false) { /* this is not a valid mac address. generate a * temporary mac address so the machine can get online. */ - echo "Generating new MAC address."; + echo gettext("Generating new MAC address."); $random_mac = generate_random_mac_address(); mwexec("/sbin/ifconfig " . escapeshellarg(get_real_interface($wancfg['if'])) . " link " . escapeshellarg($random_mac)); $wancfg['spoofmac'] = $random_mac; write_config(); - file_notice("MAC Address altered", "The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface {$realif} has been automatically replaced with {$random_mac}", "Interfaces"); + file_notice("MAC Address altered", sprintf(gettext("The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %s has been automatically replaced with %s"), $realif, $random_mac), "Interfaces"); } } @@ -2464,7 +2464,7 @@ function interface_carpdev_dhcp_configure($interface = "wan") { if($wanif) interfaces_bring_up($wanif); else - log_error("Could not bring wanif up in terface_carpdev_dhcp_configure()"); + log_error(gettext("Could not bring wanif up in terface_carpdev_dhcp_configure()")); return 0; } @@ -2479,7 +2479,7 @@ function interface_dhcp_configure($interface = "wan") { /* generate dhclient_wan.conf */ $fd = fopen("{$g['varetc_path']}/dhclient_{$interface}.conf", "w"); if (!$fd) { - printf("Error: cannot open dhclient_{$interface}.conf in interfaces_wan_dhcp_configure() for writing.\n"); + printf(printf(gettext("Error: cannot open dhclient_%s.conf in interfaces_wan_dhcp_configure() for writing.%s"), $interface, "\n")); return 1; } @@ -2492,7 +2492,7 @@ function interface_dhcp_configure($interface = "wan") { $wanif = get_real_interface($interface); if (empty($wanif)) { - log_error("Invalid interface \"{$interface}\" in interface_dhcp_configure()"); + log_error(sprintf(gettext("Invalid interface \"%s\" in interface_dhcp_configure()"), $interface)); return 0; } $dhclientconf = ""; @@ -2527,7 +2527,7 @@ EOD; if($wanif) interfaces_bring_up($wanif); else - log_error("Could not bring up {$wanif} interface in interface_dhcp_configure()"); + log_error(printf(gettext("Could not bring up %s interface in interface_dhcp_configure()"), $wanif)); /* fire up dhclient */ mwexec("/sbin/dhclient -c {$g['varetc_path']}/dhclient_{$interface}.conf {$wanif} > {$g['tmp_path']}/{$wanif}_output > {$g['tmp_path']}/{$wanif}_error_output"); From c3d32df4651091760e2e195b459c92f9389eaed4 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 16 Aug 2010 16:06:05 -0300 Subject: [PATCH 013/329] Implement gettext() calls on filter.inc --- etc/inc/filter.inc | 108 +++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 5fe9cfbb76..695f6f0392 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -162,7 +162,7 @@ function filter_configure_sync() { filter_pflog_start(); - update_filter_reload_status("Initializing"); + update_filter_reload_status(gettext("Initializing")); /* invalidate interface cache */ get_interface_arr(true); @@ -174,43 +174,43 @@ function filter_configure_sync() { /* Get interface list to work with. */ filter_generate_optcfg_array(); if($g['booting'] == true) - echo "Configuring firewall"; + echo gettext("Configuring firewall"); /* generate aliases */ if($g['booting'] == true) echo "."; - update_filter_reload_status("Creating aliases"); + update_filter_reload_status(gettext("Creating aliases")); $aliases = filter_generate_aliases(); $gateways = filter_generate_gateways(); if($g['booting'] == true) echo "."; - update_filter_reload_status("Generating NAT rules"); + update_filter_reload_status(gettext("Generating NAT rules")); /* generate nat rules */ $natrules = filter_nat_rules_generate(); if($g['booting'] == true) echo "."; - update_filter_reload_status("Generating filter rules"); + update_filter_reload_status(gettext("Generating filter rules")); /* generate pfctl rules */ $pfrules = filter_rules_generate(); /* generate altq, limiter */ if($g['booting'] == true) echo "."; - update_filter_reload_status("Generating ALTQ queues"); + update_filter_reload_status(gettext("Generating ALTQ queues")); $altq_queues = filter_generate_altq_queues(); - update_filter_reload_status("Generating Limiter rules"); + update_filter_reload_status(gettext("Generating Limiter rules")); $dummynet_rules = filter_generate_dummynet_rules(); - update_filter_reload_status("Generating Layer7 rules"); + update_filter_reload_status(gettext("Generating Layer7 rules")); generate_layer7_files(); if($g['booting'] == true) echo "."; - update_filter_reload_status("Loading filter rules"); + update_filter_reload_status(gettext("Loading filter rules")); /* enable pf if we need to, otherwise disable */ if(!isset ($config['system']['disablefilter'])) { mwexec("/sbin/pfctl -e", true); } else { mwexec("/sbin/pfctl -d"); unlink_if_exists("{$g['tmp_path']}/filter_loading"); - update_filter_reload_status("Filter is disabled. Not loading rules."); + update_filter_reload_status(gettext("Filter is disabled. Not loading rules.")); if($g['booting'] == true) echo "done.\n"; unlock($filterlck); @@ -224,7 +224,7 @@ function filter_configure_sync() { $rules = ""; $rules .= "{$aliases} \n"; $rules .= "{$gateways} \n"; - update_filter_reload_status("Setting up logging information"); + update_filter_reload_status(gettext("Setting up logging information")); $rules .= filter_setup_logging_interfaces(); if($config['system']['optimization'] <> "") { $rules .= "set optimization {$config['system']['optimization']}\n"; @@ -255,7 +255,7 @@ function filter_configure_sync() { $rules .= "\n"; $rules .= "set skip on pfsync0\n"; $rules .= "\n"; - update_filter_reload_status("Setting up SCRUB information"); + update_filter_reload_status(gettext("Setting up SCRUB information")); $rules .= filter_generate_scrubing(); $rules .= "\n"; /* NOTE: Disabled until we catch up with dummynet changes. */ @@ -267,7 +267,7 @@ function filter_configure_sync() { $rules .= discover_pkg_rules("filter"); if(!file_put_contents("{$g['tmp_path']}/rules.debug", $rules, LOCK_EX)) { - log_error("WARNING: Could not write new rules!"); + log_error(gettext("WARNING: Could not write new rules!")); unlock($filterlck); return; } @@ -301,11 +301,12 @@ function filter_configure_sync() { $line_number = $line_error[1]; $line_split = file("{$g['tmp_path']}/rules.debug"); if(is_array($line_split)) - $line_error = "The line in question reads [{$line_number}]: {$line_split[$line_number-1]}"; + $line_error = sprintf(gettext("The line in question reads [%d]: %s"), $line_number, $line_split[$line_number-1]); if($line_error and $line_number) { - file_notice("filter_load", "There were error(s) loading the rules: {$rules_error} {$line_error}", "Filter Reload", ""); - log_error("There were error(s) loading the rules: {$rules_error} - {$line_error}"); - update_filter_reload_status("There were error(s) loading the rules: {$rules_error} - {$line_error}"); + $error_msg = gettext("There were error(s) loading the rules: %s - %s"), $rules_error, $line_error); + file_notice("filter_load", $error_msg, "Filter Reload", ""); + log_error($error_msg); + update_filter_reload_status($error_msg); unlock($filterlck); return; } @@ -314,12 +315,13 @@ function filter_configure_sync() { exec("/sbin/pfctl -d"); exec("/sbin/pfctl -e"); exec("/sbin/pfctl -f {$g['tmp_path']}/rules.debug"); - file_notice("pf_busy", "PF was wedged/busy and has been reset.", "pf_busy", ""); - log_error("PF was wedged/busy and has been reset."); + $error_msg = gettext("PF was wedged/busy and has been reset."); + file_notice("pf_busy", $error_msg, "pf_busy", ""); + log_error($error_msg); } } - update_filter_reload_status("Starting up layer7 daemon"); + update_filter_reload_status(gettext("Starting up layer7 daemon")); layer7_start_l7daemon(); if(!empty($filterdns)) { @@ -368,19 +370,19 @@ function filter_configure_sync() { if($g['booting'] == true) echo "."; - update_filter_reload_status("Processing down interface states"); + update_filter_reload_status(gettext("Processing down interface states")); filter_delete_states_for_down_gateways(); - update_filter_reload_status("Running plugins"); + update_filter_reload_status(gettext("Running plugins")); if(is_dir("/usr/local/pkg/pf/")) { /* process packager manager custom rules */ - update_filter_reload_status("Running plugins (pf)"); + update_filter_reload_status(gettext("Running plugins (pf)")); run_plugins("/usr/local/pkg/pf/"); - update_filter_reload_status("Plugins completed."); + update_filter_reload_status(gettext("Plugins completed.")); } - update_filter_reload_status("Done"); + update_filter_reload_status(gettext("Done")); if($g['booting'] == true) echo "done.\n"; @@ -558,7 +560,7 @@ function filter_generate_gateways() { $rules = "# Gateways\n"; - update_filter_reload_status("Creating gateway group item..."); + update_filter_reload_status(gettext("Creating gateway group item...")); /* Lookup Gateways to be used in filter rules once */ $GatewaysList = return_gateways_array(); @@ -588,14 +590,14 @@ function filter_generate_gateways() { $gatewayip = $member['gwip']; if (($int <> "") && is_ipaddr($gatewayip)) { if ($g['debug']) - log_error("Setting up route with {$gatewayip} om $int"); + log_error(sprintf(gettext("Setting up route with %s on %s"), $gatewayip, $int)); if ($member['weight'] > 1) { $routeto .= str_repeat("( {$int} {$gatewayip} ) ", $member['weight']); } else $routeto .= "( {$int} {$gatewayip} ) "; $foundlb++; } else - log_error("An error occurred while trying to find the interface got $gatewayip . The rule has not been added."); + log_error(sprintf(gettext("An error occurred while trying to find the interface got %s . The rule has not been added."), $gatewayip)); } $route = ""; if ($foundlb > 0) { @@ -821,7 +823,7 @@ function filter_generate_reflection_nat($rule, $nat_ifs, $protocol, $target, $ta // Initialize natrules holder string $natrules = ""; - update_filter_reload_status("Creating reflection NAT rule for {$rule['descr']}..."); + update_filter_reload_status(sprintf(gettext("Creating reflection NAT rule for %s..."), $rule['descr'])); /* TODO: Add this option to port forwards page. */ if(isset($rule['staticnatport'])) { @@ -870,7 +872,7 @@ function filter_generate_reflection($rule, $nordr, $rdr_ifs, $srcaddr, $dstaddr_ else $reflectiontimeout = "2000"; - update_filter_reload_status("Creating reflection rule for {$rule['descr']}..."); + update_filter_reload_status(sprintf(gettext("Creating reflection rule for %s..."), $rule['descr'])); $rdr_if_list = implode(" ", $rdr_ifs); if(count($rdr_ifs) > 1) @@ -941,7 +943,7 @@ function filter_generate_reflection($rule, $nordr, $rdr_ifs, $srcaddr, $dstaddr_ if($rule['local-port']) $lrange_start = $rule['local-port']; if(($range_end + 1) - $dstport[0] > 500) { - log_error("Not installing nat reflection rules for a port range > 500"); + log_error(gettext("Not installing nat reflection rules for a port range > 500")); /* only install reflection rules for < 19991 items */ } else if($starting_localhost_port < 19991) { $loc_pt = $lrange_start; @@ -949,7 +951,7 @@ function filter_generate_reflection($rule, $nordr, $rdr_ifs, $srcaddr, $dstaddr_ if(is_alias($loc_pt)) { $loc_pt_translated = filter_expand_alias($loc_pt); if(!$loc_pt_translated) { - log_error("Reflection processing: {$loc_pt} is not a vaild port alias."); + log_error(sprintf(gettext("Reflection processing: %s is not a vaild port alias."), $loc_pt)); continue; } $toadd_array = split(" ", $loc_pt_translated); @@ -961,7 +963,7 @@ function filter_generate_reflection($rule, $nordr, $rdr_ifs, $srcaddr, $dstaddr_ $rflctrange = "{$starting_localhost_port}"; $delta = $range_end - $dstport[0]; if(($starting_localhost_port + $delta) > 19990) { - log_error("Installing partial nat reflection rules. Maximum 1,000 reached."); + log_error(gettext("Installing partial nat reflection rules. Maximum 1,000 reached.")); $delta = 19990 - $starting_localhost_port; $range_end = $dstport[0] + $delta; $rflctintrange = ""; @@ -1073,7 +1075,7 @@ function filter_nat_rules_generate() { $natrules = "nat-anchor \"natearly/*\"\n"; $natrules .= "nat-anchor \"natrules/*\"\n\n"; - update_filter_reload_status("Creating 1:1 rules..."); + update_filter_reload_status(gettext("Creating 1:1 rules...")); $reflection_txt = ""; @@ -1121,7 +1123,7 @@ function filter_nat_rules_generate() { /* advanced outbound rules */ if(is_array($config['nat']['advancedoutbound']['rule'])) { foreach ($config['nat']['advancedoutbound']['rule'] as $obent) { - update_filter_reload_status("Creating advanced outbound rule {$obent['descr']}"); + update_filter_reload_status(sprintf(gettext("Creating advanced outbound rule %s"), $obent['descr'])); $src = $obent['source']['network']; if(isset($obent['destination']['not']) && !isset($obent['destination']['any'])) $dst = "!" . $obent['destination']['address']; @@ -1150,7 +1152,7 @@ function filter_nat_rules_generate() { } } else { /* standard outbound rules (one for each interface) */ - update_filter_reload_status("Creating outbound NAT rules"); + update_filter_reload_status(gettext("Creating outbound NAT rules")); $tonathosts = ""; $numberofnathosts = 0; @@ -1234,7 +1236,7 @@ function filter_nat_rules_generate() { } if($numberofnathosts > 0): foreach ($FilterIflist as $if => $ifcfg) { - update_filter_reload_status("Creating outbound rules {$if} - ({$ifcfg['descr']})"); + update_filter_reload_status(sprintf(gettext("Creating outbound rules %s - (%s)"), $if, $ifcfg['descr'])); if(interface_has_gateway($if)) { $target = $ifcfg['ip']; /* create outbound nat entries for all local networks */ @@ -1252,7 +1254,7 @@ function filter_nat_rules_generate() { $natrules .= "\n# Load balancing anchor\n"; $natrules .= "rdr-anchor \"relayd/*\"\n"; - update_filter_reload_status("Setting up TFTP helper"); + update_filter_reload_status(gettext("Setting up TFTP helper")); $natrules .= "# TFTP proxy\n"; $natrules .= "rdr-anchor \"tftp-proxy/*\"\n"; @@ -1292,7 +1294,7 @@ function filter_nat_rules_generate() { $starting_localhost_port = 19000; $natrules .= "# NAT Inbound Redirects\n"; foreach ($config['nat']['rule'] as $rule) { - update_filter_reload_status("Creating NAT rule {$rule['descr']}"); + update_filter_reload_status(sprintf(gettext("Creating NAT rule %s"), $rule['descr'])); if(isset($rule['disabled'])) continue; @@ -1431,7 +1433,7 @@ EOD; function filter_generate_user_rule_arr($rule) { global $config; - update_filter_reload_status("Creating filter rule {$rule['descr']} ..."); + update_filter_reload_status(sprintf(gettext("Creating filter rule %s ..."), $rule['descr'])); $ret = array(); $line = filter_generate_user_rule($rule); $ret['rule'] = $line; @@ -1513,7 +1515,7 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { $srcport = explode("-", $rule[$target]['port']); $srcporta = alias_expand($srcport[0]); if(!$srcporta) - log_error("filter_generate_address: {$srcport[0]} is not a valid source port."); + log_error(sprintf(gettext("filter_generate_address: %s is not a valid source port."), $srcport[0])); else if((!$srcport[1]) || ($srcport[0] == $srcport[1])) { $src .= " port {$srcporta} "; } else if(($srcport[0] == 1) && ($srcport[1] == 65535)) { @@ -1613,7 +1615,7 @@ function filter_generate_user_rule($rule) { $aline['quick'] = " quick "; /* set the gateway interface */ - update_filter_reload_status("Setting up pass/block rules {$rule['descr']}"); + update_filter_reload_status(sprintf(gettext("Setting up pass/block rules %s"), $rule['descr'])); /* do not process reply-to for gateway'd rules */ if($rule['gateway'] == "" && interface_has_gateway($rule['interface']) && !isset($rule['disablereplyto'])) { @@ -1622,7 +1624,7 @@ function filter_generate_user_rule($rule) { $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; } else { if($rule['interface'] <> "pptp") { - log_error("Could not find gateway for interface({$rule['interface']})."); + log_error(sprintf(gettext("Could not find gateway for interface (%s)."), $rule['interface'])); } } } @@ -1632,7 +1634,7 @@ function filter_generate_user_rule($rule) { /* Add the load balanced gateways */ $aline['route'] = " \$GW{$rule['gateway']} "; else - log_error("The gateway: {$rule['gateway']} is invalid/unkown not using it."); + log_error(sprintf(gettext("The gateway: %s is invalid/unkown not using it."), $rule['gateway'])); } if(isset($rule['protocol'])) { @@ -1646,7 +1648,7 @@ function filter_generate_user_rule($rule) { if($rule['source']['port'] <> "" || $rule['destination']['port'] <> "") $aline['prot'] = " proto tcp "; } - update_filter_reload_status("Creating rule {$rule['descr']}"); + update_filter_reload_status(sprintf(gettext("Creating rule %s"), $rule['descr'])); /* source address */ $src = filter_generate_address($rule, "source"); @@ -1852,7 +1854,7 @@ function filter_generate_user_rule($rule) { function filter_rules_generate() { global $config, $g, $FilterIflist, $time_based_rules, $GatewaysList; - update_filter_reload_status("Creating default rules"); + update_filter_reload_status(gettext("Creating default rules")); if(isset($config['system']['developerspew'])) { $mt = microtime(); echo "filter_rules_generate() being called $mt\n"; @@ -2120,7 +2122,7 @@ EOD; /* this shouldnt ever happen but instead of breaking the clients ruleset * log an error. */ - log_error("ERROR! PPTP enabled but could not resolve the \$pptpdtarget"); + log_error(sprintf(gettext("ERROR! PPTP enabled but could not resolve the %s"), \$pptpdtarget")); } } @@ -2198,7 +2200,7 @@ EOD; } } - update_filter_reload_status("Creating IPsec rules..."); + update_filter_reload_status(gettext("Creating IPsec rules...")); $ipfrules .= filter_generate_ipsec_rules(); $ipfrules .= << 0) { - $errorrules = "There was an error while parsing the package filter rules for {$pkg_inc}.\n"; + $errorrules = sprintf(gettext("There was an error while parsing the package filter rules for %s."), $pkg_inc) . "\n"; log_error($errorrules); file_put_contents("{$g['tmp_path']}/rules.packages.{$pkg}", "#{$errorrules}\n"); continue; From b1fd7536620baa7f5000216e114b025d990b0a0f Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 16:27:00 -0300 Subject: [PATCH 014/329] Implement gettext() calls on ipsec.inc --- etc/inc/ipsec.inc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index 0dd0fe0ad0..12f106a962 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -36,21 +36,21 @@ /* IPsec defines */ $my_identifier_list = array( - 'myaddress' => array( 'desc' => 'My IP address', 'mobile' => true ), - 'address' => array( 'desc' => 'IP address', 'mobile' => true ), - 'fqdn' => array( 'desc' => 'Distinguished name', 'mobile' => true ), - 'user_fqdn' => array( 'desc' => 'User distinguished name', 'mobile' => true ), - 'asn1dn' => array( 'desc' => 'ASN.1 distinguished Name', 'mobile' => true ), - 'keyid tag' => array( 'desc' => 'KeyID tag', 'mobile' => true ), - 'dyn_dns' => array( 'desc' => 'Dynamic DNS', 'mobile' => true )); + 'myaddress' => array( 'desc' => gettext('My IP address'), 'mobile' => true ), + 'address' => array( 'desc' => gettext('IP address'), 'mobile' => true ), + 'fqdn' => array( 'desc' => gettext('Distinguished name'), 'mobile' => true ), + 'user_fqdn' => array( 'desc' => gettext('User distinguished name'), 'mobile' => true ), + 'asn1dn' => array( 'desc' => gettext('ASN.1 distinguished Name'), 'mobile' => true ), + 'keyid tag' => array( 'desc' => gettext('KeyID tag'), 'mobile' => true ), + 'dyn_dns' => array( 'desc' => gettext('Dynamic DNS'), 'mobile' => true )); $peer_identifier_list = array( - 'peeraddress' => array( 'desc' => 'Peer IP address', 'mobile' => false ), - 'address' => array( 'desc' => 'IP address', 'mobile' => false ), - 'fqdn' => array( 'desc' => 'Distinguished name', 'mobile' => true ), - 'user_fqdn' => array( 'desc' => 'User distinguished name', 'mobile' => true ), - 'asn1dn' => array( 'desc' => 'ASN.1 distinguished Name', 'mobile' => true ), - 'keyid tag' => array( 'desc' =>'KeyID tag', 'mobile' => true )); + 'peeraddress' => array( 'desc' => gettext('Peer IP address'), 'mobile' => false ), + 'address' => array( 'desc' => gettext('IP address'), 'mobile' => false ), + 'fqdn' => array( 'desc' => gettext('Distinguished name'), 'mobile' => true ), + 'user_fqdn' => array( 'desc' => gettext('User distinguished name'), 'mobile' => true ), + 'asn1dn' => array( 'desc' => gettext('ASN.1 distinguished Name'), 'mobile' => true ), + 'keyid tag' => array( 'desc' =>gettext('KeyID tag'), 'mobile' => true )); $p1_ealgos = array( 'aes' => array( 'name' => 'AES', 'keysel' => array( 'lo' => 128, 'hi' => 256, 'step' => 64 ) ), @@ -213,9 +213,9 @@ function ipsec_idinfo_to_text(& $idinfo) { case "network": return $idinfo['address']."/".$idinfo['netbits']; case "mobile": - return "Mobile Client"; + return gettext("Mobile Client"); case "none": - return "None"; + return gettext("None"); default: return strtoupper($idinfo['type']); } From 930fc5add493e5bb3ff57c8581770fc9c2985e4a Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 16:51:26 -0300 Subject: [PATCH 015/329] Implement gettext() calls on meta.inc --- etc/inc/meta.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/inc/meta.inc b/etc/inc/meta.inc index 30903191ed..63c9391f33 100644 --- a/etc/inc/meta.inc +++ b/etc/inc/meta.inc @@ -65,7 +65,7 @@ function list_phpfiles($path, & $found) { $dir = opendir($path); if (!$dir) { - echo "list_phpfiles: unable to examine path {$path}\n"; + printf(gettext("list_phpfiles: unable to examine path %s%s"), $path, "\n"); return; } @@ -96,7 +96,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $fdata = @file_get_contents($fpath); if (!$fdata) { - echo "unable to read {$fpath}\n"; + printf(gettext("unable to read %s%s"), $fpath, "\n"); continue; } @@ -129,7 +129,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $tagend = substr($fdata, $tagend_off + 4, $tagend_len - 4); if ($tagbeg != $tagend) { - echo "error: tag mismatch ( {$tagbeg} != {$tagend} ) in '$fpath'\n"; + printf(gettext("error: tag mismatch ( %s != %s ) in '%s'%s"), $tagbeg, $tagend, $fpath, "\n"); break; } @@ -140,7 +140,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $mdata = substr($fdata, $mdata_off, $mdata_len); if (!strlen($mdata)) { - echo "warning: tag {$tagbeg} has no data in '$fpath'\n"; + printf(gettext("warning: tag %s has no data in '%s'%s"), $tagbeg, $fpath, "\n"); break; } @@ -160,7 +160,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $valtag = stripos($line, "##|*"); if ($valtag === false || $valtag) { - echo "warning: tag {$tagbeg} has malformed data in '$fpath'\n"; + printf(gettext("warning: tag %s has malformed data in '%s'%s"), $tagbeg, $fpath, "\n"); continue; } @@ -182,7 +182,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { } if (!isset($vname) || !isset($vdata)) { - echo "warning: tag {$tagbeg} has invalid data in '$fpath'\n"; + printf(gettext("warning: tag %s has invalid data in '%s'%s"), $tagbeg, $fpath, "\n"); continue; } From 5025dfe3476903d4aefe9e4a1d1a15df082852ee Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 17:14:27 -0300 Subject: [PATCH 016/329] Implement gettext() calls on notices.inc --- etc/inc/notices.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 44159877d8..6d4ed1e192 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -73,12 +73,12 @@ function file_notice($id, $notice, $category = "General", $url = "", $priority = $queue[$queuekey] = $toqueue; $queueout = fopen($notice_path, "w"); if(!$queueout) { - log_error("Could not open {$notice_path} for writing"); + log_error(printf(gettext("Could not open %s for writing"), $notice_path)); return; } fwrite($queueout, serialize($queue)); fclose($queueout); - log_error("New alert found: {$notice}"); + log_error(printf(gettext("New alert found: %s"), $notice)); /* soekris */ if(file_exists("/dev/led/error")) exec("/bin/echo 1 > /dev/led/error"); @@ -323,11 +323,11 @@ function notify_via_smtp($message) { fclose($fd); if($smtp->SendMessage($from, array($to), $headers, $message)) { - log_error("Message sent to {$to} OK"); + log_error(sprintf(gettext("Message sent to %s OK"), $to)); return; } else { - log_error("Could not send the message to {$to} -- Error: {$smtp->error}"); - return("Could not send the message to {$to} -- Error: {$smtp->error}"); + log_error(sprintf(gettext("Could not send the message to %s -- Error: %s"), $to, $smtp->error)); + return(sprintf(gettext("Could not send the message to %s -- Error: %s"), $to, $smtp->error)); } } From 4aa02281b02f74ed44b18e1ee98dd5b57f77ae0c Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 17:27:33 -0300 Subject: [PATCH 017/329] Implement gettext() calls on openvpn.inc --- etc/inc/openvpn.inc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index a529322aad..8116f969dd 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -72,15 +72,15 @@ $openvpn_dh_lengths = array( 1024, 2048, 4096 ); $openvpn_server_modes = array( - 'p2p_tls' => "Peer to Peer ( SSL/TLS )", - 'p2p_shared_key' => "Peer to Peer ( Shared Key )", - 'server_tls' => "Remote Access ( SSL/TLS )", - 'server_user' => "Remote Access ( User Auth )", - 'server_tls_user' => "Remote Access ( SSL/TLS + User Auth )"); + 'p2p_tls' => gettext("Peer to Peer ( SSL/TLS )"), + 'p2p_shared_key' => gettext("Peer to Peer ( Shared Key )"), + 'server_tls' => gettext("Remote Access ( SSL/TLS )"), + 'server_user' => gettext("Remote Access ( User Auth )"), + 'server_tls_user' => gettext("Remote Access ( SSL/TLS + User Auth )")); $openvpn_client_modes = array( - 'p2p_tls' => "Peer to Peer ( SSL/TLS )", - 'p2p_shared_key' => "Peer to Peer ( Shared Key )" ); + 'p2p_tls' => gettext("Peer to Peer ( SSL/TLS )"), + 'p2p_shared_key' => gettext("Peer to Peer ( Shared Key )") ); function openvpn_create_key() { @@ -168,21 +168,21 @@ function openvpn_get_cipherlist() { $words = explode(' ', $line); $ciphers[$words[0]] = "{$words[0]} {$words[1]}"; } - $ciphers["none"] = "None (No Encryption)"; + $ciphers["none"] = gettext("None (No Encryption)"); return $ciphers; } function openvpn_validate_host($value, $name) { $value = trim($value); if (empty($value) || (!is_domain($value) && !is_ipaddr($value))) - return "The field '$name' must contain a valid IP address or domain name."; + return sprintf(gettext("The field '%s' must contain a valid IP address or domain name."), $name); return false; } function openvpn_validate_port($value, $name) { $value = trim($value); if (empty($value) || !is_numeric($value) || $value < 0 || ($value > 65535)) - return "The field '$name' must contain a valid port, ranging from 0 to 65535."; + return sprintf(gettext("The field '%s' must contain a valid port, ranging from 0 to 65535."), $name); return false; } @@ -191,7 +191,7 @@ function openvpn_validate_cidr($value, $name) { if (!empty($value)) { list($ip, $mask) = explode('/', $value); if (!is_ipaddr($ip) or !is_numeric($mask) or ($mask > 32) or ($mask < 0)) - return "The field '$name' must contain a valid CIDR range."; + return sprintf(gettext("The field '%s' must contain a valid CIDR range."), $name); } return false; } From 487415e888a9c82484809a10de24f66447171c49 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 17:43:15 -0300 Subject: [PATCH 018/329] Implement gettext() calls on PEAR.inc --- etc/inc/PEAR.inc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/etc/inc/PEAR.inc b/etc/inc/PEAR.inc index 26d11596bf..ac5cc120c1 100644 --- a/etc/inc/PEAR.inc +++ b/etc/inc/PEAR.inc @@ -158,7 +158,7 @@ class PEAR { $classname = strtolower(get_class($this)); if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; + printf(gettext("PEAR constructor called, class=%s%s"), $classname, "\n"); } if ($error_class !== null) { $this->_error_class = $error_class; @@ -195,7 +195,7 @@ class PEAR */ function _PEAR() { if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); + printf(gettext("PEAR destructor called, class=%s%s"), strtolower(get_class($this)), "\n"); } } @@ -334,12 +334,12 @@ class PEAR if (is_callable($options)) { $setoptions = $options; } else { - trigger_error("invalid error callback", E_USER_WARNING); + trigger_error(gettext("invalid error callback"), E_USER_WARNING); } break; default: - trigger_error("invalid error mode", E_USER_WARNING); + trigger_error(gettext("invalid error mode"), E_USER_WARNING); break; } } @@ -442,17 +442,17 @@ class PEAR $deleted = false; } } - return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + return $deleted ? true : PEAR::raiseError(gettext("The expected error you submitted does not exist")); // IMPROVE ME } elseif (!empty($error_code)) { // $error_code comes alone, trying to unset it if ($this->_checkDelExpect($error_code)) { return true; } else { - return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME + return PEAR::raiseError(gettext("The expected error you submitted does not exist")); // IMPROVE ME } } else { // $error_code is empty - return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME + return PEAR::raiseError(gettext("The expected error you submitted is empty")); // IMPROVE ME } } @@ -592,12 +592,12 @@ class PEAR if (is_callable($options)) { $def_options = $options; } else { - trigger_error("invalid error callback", E_USER_WARNING); + trigger_error(gettext("invalid error callback"), E_USER_WARNING); } break; default: - trigger_error("invalid error mode", E_USER_WARNING); + trigger_error(gettext("invalid error mode"), E_USER_WARNING); break; } $stack[] = array($mode, $options); @@ -629,12 +629,12 @@ class PEAR if (is_callable($options)) { $setoptions = $options; } else { - trigger_error("invalid error callback", E_USER_WARNING); + trigger_error(gettext("invalid error callback"), E_USER_WARNING); } break; default: - trigger_error("invalid error mode", E_USER_WARNING); + trigger_error(gettext("invalid error mode"), E_USER_WARNING); break; } return true; @@ -863,7 +863,7 @@ class PEAR_Error } } if ($this->mode & PEAR_ERROR_EXCEPTION) { - trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING); + trigger_error(gettext("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions"), E_USER_WARNING); eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);'); } } @@ -1020,8 +1020,8 @@ class PEAR_Error } else { $callback = $this->callback; } - return sprintf('[%s: message="%s" code=%d mode=callback '. - 'callback=%s prefix="%s" info="%s"]', + return sprintf(gettext('[%s: message="%s" code=%d mode=callback '. + 'callback=%s prefix="%s" info="%s"]'), strtolower(get_class($this)), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo); @@ -1038,8 +1038,8 @@ class PEAR_Error if ($this->mode & PEAR_ERROR_RETURN) { $modes[] = 'return'; } - return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. - 'prefix="%s" info="%s"]', + return sprintf(gettext('[%s: message="%s" code=%d mode=%s level=%s '. + 'prefix="%s" info="%s"]'), strtolower(get_class($this)), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, @@ -1056,4 +1056,4 @@ class PEAR_Error * c-basic-offset: 4 * End: */ -?> \ No newline at end of file +?> From 62bf5cd09f322d3234674eaa51409abbefc617cb Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 16 Aug 2010 17:44:53 -0300 Subject: [PATCH 019/329] Fix some syntax errors --- etc/inc/filter.inc | 4 ++-- etc/inc/zeromq.inc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 695f6f0392..3182d9eac8 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -303,7 +303,7 @@ function filter_configure_sync() { if(is_array($line_split)) $line_error = sprintf(gettext("The line in question reads [%d]: %s"), $line_number, $line_split[$line_number-1]); if($line_error and $line_number) { - $error_msg = gettext("There were error(s) loading the rules: %s - %s"), $rules_error, $line_error); + $error_msg = sprintf(gettext("There were error(s) loading the rules: %s - %s"), $rules_error, $line_error); file_notice("filter_load", $error_msg, "Filter Reload", ""); log_error($error_msg); update_filter_reload_status($error_msg); @@ -2122,7 +2122,7 @@ EOD; /* this shouldnt ever happen but instead of breaking the clients ruleset * log an error. */ - log_error(sprintf(gettext("ERROR! PPTP enabled but could not resolve the %s"), \$pptpdtarget")); + log_error(gettext("ERROR! PPTP enabled but could not resolve the \$pptpdtarget")); } } diff --git a/etc/inc/zeromq.inc b/etc/inc/zeromq.inc index 27ffc4f35c..0e96aef05a 100644 --- a/etc/inc/zeromq.inc +++ b/etc/inc/zeromq.inc @@ -265,4 +265,4 @@ function get_notices_zeromq($raw_params) { return $response; } -?> \ No newline at end of file +?> From 7d1b238c1910966e144ff17e211f3fecbdfd3485 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Mon, 16 Aug 2010 18:25:08 -0300 Subject: [PATCH 020/329] Implement gettext() calls on pfsense-utils.inc --- etc/inc/pfsense-utils.inc | 62 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index fa7da13b2a..89eac5bb30 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -433,11 +433,11 @@ function get_carp_interface_status($carpinterface) { $carp_query = split("\n", `/sbin/ifconfig $carpinterface | grep carp`); foreach($carp_query as $int) { if(stristr($int, "MASTER")) - return "MASTER"; + return gettext("MASTER"); if(stristr($int, "BACKUP")) - return "BACKUP"; + return gettext("BACKUP"); if(stristr($int, "INIT")) - return "INIT"; + return gettext("INIT"); } return; } @@ -466,7 +466,7 @@ function add_rule_to_anchor($anchor, $rule, $label) { function remove_text_from_file($file, $text) { global $fd_log; if($fd_log) - fwrite($fd_log, "Adding needed text items:\n"); + fwrite($fd_log, sprintf(gettext("Adding needed text items:%s"), "\n")); $filecontents = file_get_contents($file); $textTMP = str_replace($text, "", $filecontents); $text = $textTMP; @@ -515,7 +515,7 @@ function after_sync_bump_adv_skew() { } } if($processed_skew == 1) - write_config("After synch increase advertising skew"); + write_config(gettext("After synch increase advertising skew")); } /* @@ -560,16 +560,16 @@ function WakeOnLan($addr, $mac) // send it to the broadcast address using UDP $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if ($s == false) { - log_error("Error creating socket!"); - log_error("Error code is '".socket_last_error($s)."' - " . socket_strerror(socket_last_error($s))); + log_error(gettext("Error creating socket!")); + log_error(sprintf(gettext("Error code is '%s' - %s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); } else { // setting a broadcast option to socket: $opt_ret = socket_set_option($s, 1, 6, TRUE); if($opt_ret < 0) - log_error("setsockopt() failed, error: " . strerror($opt_ret)); + log_error(sprintf(gettext("setsockopt() failed, error: %s"), strerror($opt_ret))); $e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050); socket_close($s); - log_error("Magic Packet sent ({$e}) to {$addr} MAC={$mac}"); + log_error(sprintf(gettext("Magic Packet sent (%s) to {%s} MAC=%s"), $e, $addr, $mac)); return true; } @@ -646,7 +646,7 @@ function restore_config_section($section, $new_contents) { @unlink($g['tmp_path'] . "/tmpxml"); if(file_exists("{$g['tmp_path']}/config.cache")) unlink("{$g['tmp_path']}/config.cache"); - write_config("Restored {$section} of config file (maybe from CARP partner)"); + write_config(sprintf(gettext("Restored %s of config file (maybe from CARP partner)"), $section)); conf_mount_ro(); return; } @@ -667,7 +667,7 @@ function merge_config_section($section, $new_contents) { $section_xml = parse_xml_config($fname, $section); $config[$section] = $section_xml; unlink($fname); - write_config("Restored {$section} of config file (maybe from CARP partner)"); + write_config(sprintf(gettext("Restored %s of config file (maybe from CARP partner)"), $section)); conf_mount_ro(); return; } @@ -812,10 +812,10 @@ function call_pfsense_method($method, $params, $timeout = 0) { } $resp = $cli->send($msg, $timeout); if(!$resp) { - log_error("XMLRPC communication error: " . $cli->errstr); + log_error(sprintf(gettext("XMLRPC communication error: %s"), $cli->errstr)); return false; } elseif($resp->faultCode()) { - log_error("XMLRPC request failed with error " . $resp->faultCode() . ": " . $resp->faultString()); + log_error(sprintf(gettext("XMLRPC request failed with error %s: %s"), $resp->faultCode(), $resp->faultString())); return false; } else { return XML_RPC_Decode($resp->value()); @@ -890,13 +890,13 @@ function reload_interfaces_sync() { /* XXX: Use locks?! */ if (file_exists("{$g['tmp_path']}/reloading_all")) { - log_error("WARNING: Recursive call to interfaces sync!"); + log_error(gettext("WARNING: Recursive call to interfaces sync!")); return; } touch("{$g['tmp_path']}/reloading_all"); if($g['debug']) - log_error("reload_interfaces_sync() is starting."); + log_error(gettext("reload_interfaces_sync() is starting.")); /* parse config.xml again */ $config = parse_config(true); @@ -904,17 +904,17 @@ function reload_interfaces_sync() { /* enable routing */ system_routing_enable(); if($g['debug']) - log_error("Enabling system routing"); + log_error(gettext("Enabling system routing")); if($g['debug']) - log_error("Cleaning up Interfaces"); + log_error(gettext("Cleaning up Interfaces")); /* set up interfaces */ interfaces_configure(); /* remove reloading_all trigger */ if($g['debug']) - log_error("Removing {$g['tmp_path']}/reloading_all"); + log_error(sprintf(gettext("Removing %s/reloading_all"), $g['tmp_path'])); /* start devd back up */ mwexec("/bin/rm {$g['tmp_path']}/reload*"); @@ -961,7 +961,7 @@ function reload_all_sync() { /* XXX: Use locks?! */ if (file_exists("{$g['tmp_path']}/reloading_all")) { - log_error("WARNING: Recursive call to reload all sync!"); + log_error(gettext("WARNING: Recursive call to reload all sync!")); return; } touch("{$g['tmp_path']}/reloading_all"); @@ -1031,7 +1031,7 @@ function auto_login() { } if (!$fd) { conf_mount_ro(); - log_error("Enabling auto login was not possible."); + log_error(gettext("Enabling auto login was not possible.")); return; } foreach($getty_split as $gs) { @@ -1179,7 +1179,7 @@ function get_ppp_uptime($port){ } return convert_seconds_to_hms($sec); } else { - $total_time = "No history data found!"; + $total_time = gettext("No history data found!"); return $total_time; } } @@ -1287,7 +1287,7 @@ function get_interface_info($ifdescr) { break; if (!file_exists($dev)) { $ifinfo['nodevice'] = 1; - $ifinfo['pppinfo'] = $dev . " device not present! Is the modem attached to the system?"; + $ifinfo['pppinfo'] = $dev . " " . gettext("device not present! Is the modem attached to the system?"); } // Calculate cumulative uptime for PPP link. Useful for connections that have per minute/hour contracts so you don't go over! if (isset($ppp['uptime'])) @@ -1327,8 +1327,8 @@ function get_interface_info($ifdescr) { if (preg_match("/status: (.*)$/", $ici, $matches)) { if ($matches[1] != "active") $ifinfo['status'] = $matches[1]; - if($ifinfo['status'] == "running") - $ifinfo['status'] = "up"; + if($ifinfo['status'] == gettext("running")) + $ifinfo['status'] = gettext("up"); } if (preg_match("/channel (\S*)/", $ici, $matches)) { $ifinfo['channel'] = $matches[1]; @@ -1363,13 +1363,13 @@ function get_interface_info($ifdescr) { if($bridge) { $bridge_text = `/sbin/ifconfig {$bridge}`; if(stristr($bridge_text, "blocking") <> false) { - $ifinfo['bridge'] = "blocking - check for ethernet loops"; + $ifinfo['bridge'] = "" . gettext("blocking") . " - " . gettext("check for ethernet loops"); $ifinfo['bridgeint'] = $bridge; } else if(stristr($bridge_text, "learning") <> false) { - $ifinfo['bridge'] = "learning"; + $ifinfo['bridge'] = gettext("learning"); $ifinfo['bridgeint'] = $bridge; } else if(stristr($bridge_text, "forwarding") <> false) { - $ifinfo['bridge'] = "forwarding"; + $ifinfo['bridge'] = gettext("forwarding"); $ifinfo['bridgeint'] = $bridge; } } @@ -1480,7 +1480,7 @@ function compare_hostname_to_dnscache($hostname) { if(trim($oldcontents) != trim($contents)) { if($g['debug']) { - log_error("DNSCACHE: Found old IP {$oldcontents} and new IP {$contents}"); + log_error(sprintf(gettext("DNSCACHE: Found old IP %s and new IP %s"), $oldcontents, $contents)); } return ($oldcontents); } else { @@ -1647,11 +1647,11 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, if($debug) fwrite($fd, print_r($pconfig, true)); if($fieldb) { - if($debug) fwrite($fd, "fieldb exists\n"); + if($debug) fwrite($fd, sprintf(gettext("fieldb exists%s"), "\n")); for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($debug) fwrite($fd, "$i\n"); if($config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] == $origname) { - if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n"); + if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %s to %s%s"), $origname, $new_alias_name, "\n")); $config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] = $new_alias_name; } } @@ -1660,7 +1660,7 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($config["$section"]["$subsection"][$i]["$fielda"] == $origname) { $config["$section"]["$subsection"][$i]["$fielda"] = $new_alias_name; - if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n"); + if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %s to %s%s"), $origname, $new_alias_name, "\n")); } } } From 6acdf659ce8ea7d4752fa8dd246e7d0921d2af39 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 08:38:40 -0300 Subject: [PATCH 021/329] Implement gettext() calls on pkg-utils.inc --- etc/inc/pkg-utils.inc | 178 +++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index c4402a4f39..d3d0e48efd 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -171,7 +171,7 @@ function get_pkg_sizes($pkgs = 'all') { function resync_all_package_configs($show_message = false) { global $config, $restart_sync, $pkg_interface; $i = 0; - log_error("Resyncing configuration for all packages."); + log_error(gettext("Resyncing configuration for all packages.")); if(!$config['installedpackages']['package']) return; if($show_message == true) @@ -186,7 +186,7 @@ function resync_all_package_configs($show_message = false) { if($restart_sync == true) { $restart_sync = false; if($pkg_interface == "console") - echo "\nSyncing packages:"; + echo "\n" . gettext("Syncing packages:"); } $i++; } @@ -224,7 +224,7 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu } $package = $config['installedpackages']['package'][$pkg_id]; if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - log_error("The {$package['name']} package is missing required dependencies and must be reinstalled." . $package['configurationfile']); + log_error(sprintf(gettext("The %s package is missing required dependencies and must be reinstalled. %s"), $package['name'], $package['configurationfile'])); install_package($package['name']); uninstall_package_from_name($package['name']); install_package($package['name']); @@ -246,7 +246,7 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu if(!is_dir($prefix)) exec("mkdir -p {$prefix}"); if(!file_exists($prefix . $depend_file)) - log_error("The {$package['name']} package is missing required dependencies and must be reinstalled."); + log_error(sprintf(gettext("The %s package is missing required dependencies and must be reinstalled."), $package['name'])); switch ($format) { case "files": $depends[] = $prefix . $depend_file; @@ -315,7 +315,7 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { else return; /* empty package tag */ if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - log_error("The {$package['name']} package is missing its configuration file and must be reinstalled."); + log_error(sprintf(gettext("The %s package is missing its configuration file and must be reinstalled."), $package['name'])); force_remove_package($package['name']); } else { $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui"); @@ -327,7 +327,7 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { require_once($include_file); else { /* XXX: What the heck is this?! */ - log_error("Could not locate {$include_file}."); + log_error(sprintf(gettext("Could not locate %s."), $include_file)); install_package($package['name']); uninstall_package_from_name($package['name']); install_package($package['name']); @@ -347,8 +347,8 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { if(is_array($depends)) { foreach($depends as $item) { if(!file_exists($item)) { - file_notice($package['name'], "The {$package['name']} package is missing required dependencies and must be reinstalled.", "Packages", "/pkg_mgr_install.php?mode=reinstallpkg&pkg={$package['name']}", 1); - log_error("Could not find {$item}. Reinstalling package."); + file_notice($package['name'], sprintf(gettext("The %s package is missing required dependencies and must be reinstalled."), $package['name']), "Packages", "/pkg_mgr_install.php?mode=reinstallpkg&pkg={$package['name']}", 1); + log_error(sprintf(gettext("Could not find %s. Reinstalling package."), $item)); install_package($pkg_name); uninstall_package_from_name($pkg_name); install_package($pkg_name); @@ -420,7 +420,7 @@ function install_package($package, $pkg_info = "") { /* open logfiles and begin installation */ if(!$fd_log) { if(!$fd_log = fopen("{$g['tmp_path']}/pkg_mgr_{$package}.log", "w")) { - update_output_window("Warning, could not open log for writing."); + update_output_window(gettext("Warning, could not open log for writing.")); } } /* fetch package information if needed */ @@ -428,45 +428,45 @@ function install_package($package, $pkg_info = "") { $pkg_info = get_pkg_info(array($package)); $pkg_info = $pkg_info[$package]; // We're only dealing with one package, so we can strip away the extra array. } - @fwrite($fd_log, "Beginning package installation.\n"); - log_error('Beginning package installation for ' . $pkg_info['name'] . '.'); - update_status("Beginning package installation for " . $pkg_info['name'] . "..."); + @fwrite($fd_log, gettext("Beginning package installation.\n")); + log_error(gettext('Beginning package installation for') . ' ' . $pkg_info['name'] . '.'); + update_status(gettext("Beginning package installation for") . " " . $pkg_info['name'] . "..."); /* fetch the package's configuration file */ if($pkg_info['config_file'] != "") { - $static_output .= "Downloading package configuration file... "; + $static_output .= gettext("Downloading package configuration file...") . " "; update_output_window($static_output); - @fwrite($fd_log, "Downloading package configuration file...\n"); + @fwrite($fd_log, gettext("Downloading package configuration file...\n")); $fetchto = substr(strrchr($pkg_info['config_file'], '/'), 1); download_file_with_progress_bar($pkg_info['config_file'], '/usr/local/pkg/' . $fetchto); if(!file_exists('/usr/local/pkg/' . $fetchto)) { - @fwrite($fd_log, "ERROR! Unable to fetch package configuration file. Aborting installation.\n"); + @fwrite($fd_log, gettext("ERROR! Unable to fetch package configuration file. Aborting installation.\n")); if($pkg_interface == "console") { conf_mount_ro(); - print "\nERROR! Unable to fetch package configuration file. Aborting package installation.\n"; + print gettext("\nERROR! Unable to fetch package configuration file. Aborting package installation.\n"); return; } else { - $static_output .= "failed!\n\nInstallation aborted."; + $static_output .= gettext("failed!") . "\n\n" . gettext("Installation aborted."); update_output_window($static_output); - echo "
Show install log"; + echo "
Show " . gettext("install log") . ""; conf_mount_ro(); return -1; } } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* add package information to config.xml */ $pkgid = get_pkg_id($pkg_info['name']); - $static_output .= "Saving updated package information... "; + $static_output .= gettext("Saving updated package information...") . " "; update_output_window($static_output); if($pkgid == -1) { $config['installedpackages']['package'][] = $pkg_info; - $changedesc = "Installed {$pkg_info['name']} package."; - $to_output = "done.\n"; + $changedesc = gettext("Installed") . $pkg_info['name'] . gettext("package."); + $to_output = gettext("done.") . "\n"; } else { $config['installedpackages']['package'][$pkgid] = $pkg_info; - $changedesc = "Overwrote previous installation of {$pkg_info['name']}."; - $to_output = "overwrite!\n"; + $changedesc = sprintf(gettext("Overwrote previous installation of %s."), $pkg_info['name']); + $to_output = gettext("overwrite!") . "\n"; } /* XXX: Fix inclusion of config.inc that causes data loss! */ conf_mount_ro(); @@ -475,12 +475,12 @@ function install_package($package, $pkg_info = "") { update_output_window($static_output); /* install other package components */ install_package_xml($package); - $static_output .= "Writing configuration... "; + $static_output .= gettext("Writing configuration...") . " "; update_output_window($static_output); write_config($changedesc); $static_output .= "done.\n"; update_output_window($static_output); - $static_output .= "Starting service.\n"; + $static_output .= gettext("Starting service.") . "\n"; update_output_window($static_output); if($pkg_info['after_install_info']) update_output_window($pkg_info['after_install_info']); @@ -513,7 +513,7 @@ function eval_once($toeval) { function install_package_xml($pkg) { global $g, $config, $fd_log, $static_output, $pkg_interface; if(($pkgid = get_pkg_id($pkg)) == -1) { - $static_output .= "The {$pkg} package is not installed.\n\nInstallation aborted."; + $static_output .= sprintf(gettext("The %s package is not installed.%sInstallation aborted."), $pkg, "\n\n"); update_output_window($static_output); if($pkg_interface <> "console") { echo "\n"; @@ -527,7 +527,7 @@ function install_package_xml($pkg) { /* set up logging if needed */ if(!$fd_log) { if(!$fd_log = fopen("{$g['tmp_path']}/pkg_mgr_{$pkg}.log", "w")) { - update_output_window("Warning, could not open log for writing."); + update_output_window(gettext("Warning, could not open log for writing.")); } } @@ -535,7 +535,7 @@ function install_package_xml($pkg) { if($pkg_info['logging']) { mwexec("/usr/sbin/fifolog_create -s 32768 {$g['varlog_path']}/{$pkg_info['logging']['logfilename']}"); @chmod($g['varlog_path'] . '/' . $pkg_info['logging']['logfilename'], 0600); - @fwrite($fd_log, "Adding text to file /etc/syslog.conf\n"); + @fwrite($fd_log, gettext("Adding text to file /etc/syslog.conf\n")); if(is_process_running("syslogd")) mwexec("killall syslogd"); system_syslogd_start(); @@ -552,8 +552,8 @@ function install_package_xml($pkg) { if($pkg_info['depends_on_package_base_url'] != "") { if($pkg_interface == "console") echo "\n"; - update_status("Installing " . $pkg_info['name'] . " and its dependencies."); - $static_output .= "Downloading " . $pkg_info['name'] . " and its dependencies... "; + update_status(gettext("Installing") . " " . $pkg_info['name'] . " " . gettext("and its dependencies.")); + $static_output .= gettext("Downloading") . " " . $pkg_info['name'] . " " . gettext("and its dependencies... "); $static_orig = $static_output; $static_output .= "\n"; update_output_window($static_output); @@ -566,19 +566,19 @@ function install_package_xml($pkg) { } if($pkg_installed == false) pkg_fetch_recursive($pkg_name, $pkgdep, 0, $pkg_info['depends_on_package_base_url']); - $static_output = $static_orig . "done.\nChecking for successful package installation... "; + $static_output = $static_orig . gettext("done.") . "\n" . gettext("Checking for successful package installation... "); update_output_window($static_output); /* make sure our package was successfully installed */ if($pkg_installed == false) $pkg_installed = is_freebsd_pkg_installed($pkg_name); if($pkg_installed == true) { - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); - fwrite($fd_log, "pkg_add successfully completed.\n"); + fwrite($fd_log, gettext("pkg_add successfully completed.\n")); } else { $static_output .= "of {$pkg_name} failed!\n\nInstallation aborted."; update_output_window($static_output); - fwrite($fd_log, "Package WAS NOT installed properly.\n"); + fwrite($fd_log, gettext("Package WAS NOT installed properly.\n")); fclose($fd_log); if($pkg_interface <> "console") { echo "\n"; @@ -591,30 +591,30 @@ function install_package_xml($pkg) { } $configfile = substr(strrchr($pkg_info['config_file'], '/'), 1); if(file_exists("/usr/local/pkg/" . $configfile)) { - $static_output .= "Loading package configuration... "; + $static_output .= gettext("Loading package configuration... "); update_output_window($static_output); $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $configfile, "packagegui"); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); - $static_output .= "Configuring package components...\n"; + $static_output .= gettext("Configuring package components...") . "\n"; if (!empty($pkg_config['filter_rules_needed'])) $config['installedpackages']['package'][$pkgid]['filter_rule_function'] = $pkg_config['filter_rules_needed']; update_output_window($static_output); /* modify system files */ if(is_array($pkg_config['modify_system']['item'])) { - $static_output .= "\tSystem files... "; + $static_output .= "\t" . gettext("System files... "); update_output_window($static_output); foreach($pkg_config['modify_system']['item'] as $ms) { if($ms['textneeded']) { add_text_to_file($ms['modifyfilename'], $ms['textneeded']); } } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* download additional files */ if(is_array($pkg_config['additional_files_needed'])) { - $static_output .= "\tAdditional files... "; + $static_output .= "\t" . gettext("Additional files... "); $static_orig = $static_output; update_output_window($static_output); foreach($pkg_config['additional_files_needed'] as $afn) { @@ -635,20 +635,20 @@ function install_package_xml($pkg) { update_output_window($static_output); download_file_with_progress_bar($afn['item'][0], $prefix . $filename); if(stristr($filename, ".tgz") <> "") { - fwrite($fd_log, "Extracting tarball to -C for " . $filename . "...\n"); + fwrite($fd_log, gettext("Extracting tarball to -C for") . " " . $filename . "...\n"); $tarout = ""; exec("/usr/bin/tar xvzf " . $prefix . $filename . " -C / 2>&1", $tarout); fwrite($fd_log, print_r($tarout, true) . "\n"); } if($pkg_chmod <> "") { - fwrite($fd_log, "Changing file mode to {$pkg_chmod} for {$prefix}{$filename}\n"); + fwrite($fd_log, sprintf(gettext("Changing file mode to %s for %s%s%s"), $pkg_chmod, $prefix, $filename, "\n")); @chmod($prefix . $filename, $pkg_chmod); system("/bin/chmod {$pkg_chmod} {$prefix}{$filename}"); } $static_output = $static_orig; update_output_window($static_output); } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* if a require exists, include it. this will @@ -656,7 +656,7 @@ function install_package_xml($pkg) { * instead of making us blindly guess */ if($pkg_config['include_file'] <> "") { - $static_output = "Loading package instructions..."; + $static_output = gettext("Loading package instructions..."); update_output_window($static_output); fwrite($fd_log, "require_once('{$pkg_config['include_file']}')\n"); if (file_exists($pkg_config['include_file'])) @@ -664,7 +664,7 @@ function install_package_xml($pkg) { } /* sidebar items */ if(is_array($pkg_config['menu'])) { - $static_output .= "\tMenu items... "; + $static_output .= "\t" . gettext("Menu items... "); update_output_window($static_output); foreach($pkg_config['menu'] as $menu) { if(is_array($config['installedpackages']['menu'])) @@ -673,12 +673,12 @@ function install_package_xml($pkg) { continue 2; $config['installedpackages']['menu'][] = $menu; } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* integrated tab items */ if(is_array($pkg_config['tabs']['tab'])) { - $static_output .= "\tIntegrated Tab items... "; + $static_output .= "\t" . gettext("Integrated Tab items... "); update_output_window($static_output); foreach($pkg_config['tabs']['tab'] as $tab) { if(is_array($config['installedpackages']['tab'])) @@ -687,12 +687,12 @@ function install_package_xml($pkg) { continue 2; $config['installedpackages']['tab'][] = $tab; } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* services */ if(is_array($pkg_config['service'])) { - $static_output .= "\tServices... "; + $static_output .= "\t" . gettext("Services... "); update_output_window($static_output); foreach($pkg_config['service'] as $service) { if(is_array($config['installedpackages']['service'])) @@ -701,33 +701,33 @@ function install_package_xml($pkg) { continue 2; $config['installedpackages']['service'][] = $service; } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* custom commands */ - $static_output .= "\tCustom commands... "; + $static_output .= "\t" . gettext("Custom commands... "); update_output_window($static_output); if($pkg_config['custom_php_global_functions'] <> "") { - $static_output = "Executing custom_php_global_functions()..."; + $static_output = gettext("Executing custom_php_global_functions()..."); update_output_window($static_output); eval_once($pkg_config['custom_php_global_functions']); } if($pkg_config['custom_php_install_command']) { - $static_output = "Executing custom_php_install_command()..."; + $static_output = gettext("Executing custom_php_install_command()..."); update_output_window($static_output); eval_once($pkg_config['custom_php_install_command']); } if($pkg_config['custom_php_resync_config_command'] <> "") { - $static_output = "Executing custom_php_resync_config_command()..."; + $static_output = gettext("Executing custom_php_resync_config_command()..."); update_output_window($static_output); eval_once($pkg_config['custom_php_resync_config_command']); } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } else { - $static_output .= "Loading package configuration... failed!\n\nInstallation aborted."; + $static_output .= gettext("Loading package configuration... failed!") . "\n\n" . gettext("Installation aborted."); update_output_window($static_output); - fwrite($fd_log, "Unable to load package configuration. Installation aborted.\n"); + fwrite($fd_log, gettext("Unable to load package configuration. Installation aborted.\n")); fclose($fd_log); if($pkg_interface <> "console") { echo "\n"; @@ -740,8 +740,8 @@ function install_package_xml($pkg) { function delete_package($pkg, $pkgid) { global $g, $config, $fd_log, $static_output; - update_status("Removing package..."); - $static_output .= "Removing package... "; + update_status(gettext("Removing package...")); + $static_output .= gettext("Removing package... "); update_output_window($static_output); $pkgid = get_pkg_id($pkgid); $pkg_info = $config['installedpackages']['package'][$pkgid]; @@ -750,11 +750,11 @@ function delete_package($pkg, $pkgid) { if(empty($configfile)) return; - $static_output .= "\nStarting package deletion for {$pkg_info['name']}...\n"; + $static_output .= sprintf(gettext("%sStarting package deletion for %s...%s"), "\n", $pkg_info['name'], "\n"); update_output_window($static_output); if (!empty($pkg)) delete_package_recursive($pkg); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); return; } @@ -785,7 +785,7 @@ function delete_package_xml($pkg) { conf_mount_rw(); if(($pkgid = get_pkg_id($pkg)) == -1) { - $static_output .= "The {$pkg} package is not installed.\n\nDeletion aborted."; + $static_output .= sprintf(gettext("The %s package is not installed.%sDeletion aborted."), $pkg, "\n\n"); update_output_window($static_output); if($pkg_interface <> "console") { echo "\n"; @@ -799,12 +799,12 @@ function delete_package_xml($pkg) { /* set up logging if needed */ if(!$fd_log) { if(!$fd_log = fopen("{$g['tmp_path']}/pkg_mgr_{$pkg}.log", "w")) { - update_output_window("Warning, could not open log for writing."); + update_output_window(gettext("Warning, could not open log for writing.")); } } - update_status("Removing {$pkg} components..."); - fwrite($fd_log, "Removing {$pkg} package... "); - $static_output .= "Removing {$pkg} components...\n"; + update_status(sprintf(gettext("Removing %s components..."), $pkg)); + fwrite($fd_log, sprintf(gettext("Removing %s package... "), $pkg)); + $static_output .= sprintf(gettext("Removing %s components...%s"), $pkg, "\n"); update_output_window($static_output); /* parse package configuration */ $packages = &$config['installedpackages']['package']; @@ -815,7 +815,7 @@ function delete_package_xml($pkg) { $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $packages[$pkgid]['configurationfile'], "packagegui"); /* remove tab items */ if(is_array($pkg_config['tabs'])) { - $static_output .= "\tMenu items... "; + $static_output .= "\t" . gettext("Menu items... "); update_output_window($static_output); if(is_array($pkg_config['tabs']['tab']) && is_array($tabs)) { foreach($pkg_config['tabs']['tab'] as $tab) { @@ -824,12 +824,12 @@ function delete_package_xml($pkg) { unset($tabs[$key]); } } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* remove menu items */ if(is_array($pkg_config['menu'])) { - $static_output .= "\tMenu items... "; + $static_output .= "\t" . gettext("Menu items... "); update_output_window($static_output); if (is_array($pkg_config['menu']) && is_array($menus)) { foreach($pkg_config['menu'] as $menu) { @@ -838,12 +838,12 @@ function delete_package_xml($pkg) { unset($menus[$key]); } } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* remove services */ if(is_array($pkg_config['service'])) { - $static_output .= "\tServices... "; + $static_output .= "\t" . gettext("Services... "); update_output_window($static_output); if (is_array($pkg_config['service']) && is_array($services)) { foreach($pkg_config['service'] as $service) { @@ -855,7 +855,7 @@ function delete_package_xml($pkg) { } } } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* if a require exists, include it. this will @@ -863,7 +863,7 @@ function delete_package_xml($pkg) { * instead of making us blindly guess */ if($pkg_config['include_file'] <> "") { - $static_output = "Loading package instructions..."; + $static_output = gettext("Loading package instructions..."); update_output_window($static_output); fwrite($fd_log, "require_once(\"{$pkg_config['include_file']}\")\n"); if(file_exists($pkg_config['include_file'])) @@ -877,34 +877,34 @@ function delete_package_xml($pkg) { eval_once($pkg_config['custom_php_pre_deinstall_command']); /* system files */ if(is_array($pkg_config['modify_system']['item'])) { - $static_output .= "\tSystem files... "; + $static_output .= "\t" . gettext("System files... "); update_output_window($static_output); foreach($pkg_config['modify_system']['item'] as $ms) { if($ms['textneeded']) remove_text_from_file($ms['modifyfilename'], $ms['textneeded']); } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* syslog */ if($pkg_config['logging']['logfile_name'] <> "") { - $static_output .= "\tSyslog entries... "; + $static_output .= "\t" . gettext("Syslog entries... "); update_output_window($static_output); remove_text_from_file("/etc/syslog.conf", $pkg_config['logging']['facilityname'] . "\t\t\t\t" . $pkg_config['logging']['logfilename']); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* deinstall commands */ if($pkg_config['custom_php_deinstall_command'] <> "") { - $static_output .= "\tDeinstall commands... "; + $static_output .= "\t" . gettext("Deinstall commands... "); update_output_window($static_output); eval_once($pkg_config['custom_php_deinstall_command']); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } if($pkg_config['include_file'] <> "") { - $static_output = "\tRemoving pacakge instructions..."; + $static_output = "\t" . gettext("Removing pacakge instructions..."); update_output_window($static_output); - fwrite($fd_log, "Remove '{$pkg_config['include_file']}'\n"); + fwrite($fd_log, sprintf(gettext("Remove '%s'%s"), $pkg_config['include_file'], "\n")); unlink_if_exists("/usr/local/pkg/" . $pkg_config['include_file']); $static_output .= "done.\n"; update_output_window($static_output); @@ -912,7 +912,7 @@ function delete_package_xml($pkg) { } /* remove all additional files */ if(is_array($pkg_config['additional_files_needed'])) { - $static_output .= "\tAuxiliary files... "; + $static_output .= "\t" . gettext("Auxiliary files... "); update_output_window($static_output); foreach($pkg_config['additional_files_needed'] as $afn) { $filename = get_filename_from_url($afn['item'][0]); @@ -925,24 +925,24 @@ function delete_package_xml($pkg) { if(file_exists($prefix . $filename)) mwexec("rm -rf {$prefix}{$filename}"); } - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* package XML file */ - $static_output .= "\tPackage XML... "; + $static_output .= "\t" . gettext("Package XML... "); update_output_window($static_output); unlink_if_exists("/usr/local/pkg/" . $packages[$pkgid]['configurationfile']); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); } /* remove config.xml entries */ conf_mount_ro(); - $static_output .= "\tConfiguration... "; + $static_output .= "\t" . gettext("Configuration... "); update_output_window($static_output); unset($config['installedpackages']['package'][$pkgid]); - $static_output .= "done.\n"; + $static_output .= gettext("done.") . "\n"; update_output_window($static_output); - write_config("Removed {$pkg} package."); + write_config(sprintf(gettext("Removed %s package."), $pkg)); /* file cleanup */ $ctag = file("/etc/crontab"); foreach($ctag as $line) { From f55943aa30f4bf5f0b916454bbbdc7bd7de0e63f Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 09:27:14 -0300 Subject: [PATCH 022/329] Implement gettext() calls on xmlparse_attr.inc --- etc/inc/xmlparse_attr.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/xmlparse_attr.inc b/etc/inc/xmlparse_attr.inc index 06d02c48a3..04428ccad5 100644 --- a/etc/inc/xmlparse_attr.inc +++ b/etc/inc/xmlparse_attr.inc @@ -75,7 +75,7 @@ function startElement_attr($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf("XML error: %s at line %d cannot occur more than once\n", + die(sprintf(gettext("XML error: %s at line %d cannot occur more than once") . "\n", $name, xml_get_current_line_number($parser))); } else if (isset($writeattrs)) { @@ -184,7 +184,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1); if (!($fp = fopen($cffile, "r"))) { - log_error("Error: could not open XML input\n"); + log_error(gettext("Error: could not open XML input") . "\n"); if (isset($parsed_attributes)) { $parsed_attributes = array(); unset($parsedattrs); @@ -194,7 +194,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf("XML error: %s at line %d\n", + log_error(sprintf(gettext("XML error: %s at line %d") . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); if (isset($parsed_attributes)) { @@ -207,7 +207,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst xml_parser_free($xml_parser); if (!$parsedcfg[$rootobj]) { - log_error("XML error: no $rootobj object found!\n"); + log_error(sprintf(gettext("XML error: no %s object found!") . "\n", $rootobj)); if (isset($parsed_attributes)) { $parsed_attributes = array(); unset($parsedattrs); From ada992bd115db157ef8f21090e79135b1c26c152 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 09:34:12 -0300 Subject: [PATCH 023/329] Implement gettext() calls on xmlparse.inc --- etc/inc/xmlparse.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index 3d20ebba2d..cb012534c1 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -82,7 +82,7 @@ function startElement($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf("XML error: %s at line %d cannot occur more than once\n", + die(sprintf(gettext("XML error: %s at line %d cannot occur more than once") . "\n", $name, xml_get_current_line_number($parser))); } @@ -173,13 +173,13 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1); if (!($fp = fopen($cffile, "r"))) { - log_error("Error: could not open XML input\n"); + log_error(gettext("Error: could not open XML input") . "\n"); return -1; } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf("XML error: %s at line %d\n", + log_error(sprintf(gettext("XML error: %s at line %d") . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); return -1; @@ -188,7 +188,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { xml_parser_free($xml_parser); if (!$parsedcfg[$rootobj]) { - log_error("XML error: no $rootobj object found!\n"); + log_error(sprintf(gettext("XML error: no %s object found!") . "\n", $rootobj)); return -1; } From 61349b3fa848091e84ff0cd9e7e8d2386d51eee8 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 09:36:17 -0300 Subject: [PATCH 024/329] Implement gettext() on xmlreader.inc --- etc/inc/xmlreader.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/xmlreader.inc b/etc/inc/xmlreader.inc index 41f2938640..9c6eb99128 100644 --- a/etc/inc/xmlreader.inc +++ b/etc/inc/xmlreader.inc @@ -126,7 +126,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { add_elements($parsedcfg, $par); $par->close(); } else - log_error("Error returned while trying to parse {$cffile}"); + log_error(sprintf(gettext("Error returned while trying to parse %s"), $cffile")); return $parsedcfg[$rootobj]; } From 4d814149a95852c258f97d95ef1c4c2a2aab19a1 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 10:54:42 -0300 Subject: [PATCH 025/329] Implement gettext() calls on priv.defs.inc --- etc/inc/priv.defs.inc | 768 +++++++++++++++++++++--------------------- 1 file changed, 384 insertions(+), 384 deletions(-) diff --git a/etc/inc/priv.defs.inc b/etc/inc/priv.defs.inc index d9913163fa..079dfa5094 100644 --- a/etc/inc/priv.defs.inc +++ b/etc/inc/priv.defs.inc @@ -7,1107 +7,1107 @@ $priv_list = array(); $priv_list['page-all'] = array(); -$priv_list['page-all']['name'] = "WebCfg - All pages"; -$priv_list['page-all']['descr'] = "Allow access to all pages"; +$priv_list['page-all']['name'] = gettext("WebCfg - All pages"); +$priv_list['page-all']['descr'] = gettext("Allow access to all pages"); $priv_list['page-all']['match'] = array(); $priv_list['page-all']['match'][] = "*"; $priv_list['page-status-carp'] = array(); -$priv_list['page-status-carp']['name'] = "WebCfg - Status: CARP page"; -$priv_list['page-status-carp']['descr'] = "Allow access to the 'Status: CARP' page."; +$priv_list['page-status-carp']['name'] = gettext("WebCfg - Status: CARP page"); +$priv_list['page-status-carp']['descr'] = gettext("Allow access to the 'Status: CARP' page."); $priv_list['page-status-carp']['match'] = array(); $priv_list['page-status-carp']['match'][] = "carp_status.php*"; $priv_list['page-diagnostics-configurationhistory'] = array(); -$priv_list['page-diagnostics-configurationhistory']['name'] = "WebCfg - Diagnostics: Configuration History page"; -$priv_list['page-diagnostics-configurationhistory']['descr'] = "Allow access to the 'Diagnostics: Configuration History' page."; +$priv_list['page-diagnostics-configurationhistory']['name'] = gettext("WebCfg - Diagnostics: Configuration History page"); +$priv_list['page-diagnostics-configurationhistory']['descr'] = gettext("Allow access to the 'Diagnostics: Configuration History' page."); $priv_list['page-diagnostics-configurationhistory']['match'] = array(); $priv_list['page-diagnostics-configurationhistory']['match'][] = "diag_confbak.php*"; $priv_list['page-diagnostics-arptable'] = array(); -$priv_list['page-diagnostics-arptable']['name'] = "WebCfg - Diagnostics: ARP Table page"; -$priv_list['page-diagnostics-arptable']['descr'] = "Allow access to the 'Diagnostics: ARP Table' page."; +$priv_list['page-diagnostics-arptable']['name'] = gettext("WebCfg - Diagnostics: ARP Table page"); +$priv_list['page-diagnostics-arptable']['descr'] = gettext("Allow access to the 'Diagnostics: ARP Table' page."); $priv_list['page-diagnostics-arptable']['match'] = array(); $priv_list['page-diagnostics-arptable']['match'][] = "diag_arp.php*"; $priv_list['page-diagnostics-backup/restore'] = array(); -$priv_list['page-diagnostics-backup/restore']['name'] = "WebCfg - Diagnostics: Backup/restore page"; -$priv_list['page-diagnostics-backup/restore']['descr'] = "Allow access to the 'Diagnostics: Backup/restore' page."; +$priv_list['page-diagnostics-backup/restore']['name'] = gettext("WebCfg - Diagnostics: Backup/restore page"); +$priv_list['page-diagnostics-backup/restore']['descr'] = gettext("Allow access to the 'Diagnostics: Backup/restore' page."); $priv_list['page-diagnostics-backup/restore']['match'] = array(); $priv_list['page-diagnostics-backup/restore']['match'][] = "diag_backup.php*"; $priv_list['page-status-dhcpleases'] = array(); -$priv_list['page-status-dhcpleases']['name'] = "WebCfg - Status: DHCP leases page"; -$priv_list['page-status-dhcpleases']['descr'] = "Allow access to the 'Status: DHCP leases' page."; +$priv_list['page-status-dhcpleases']['name'] = gettext("WebCfg - Status: DHCP leases page"); +$priv_list['page-status-dhcpleases']['descr'] = gettext("Allow access to the 'Status: DHCP leases' page."); $priv_list['page-status-dhcpleases']['match'] = array(); $priv_list['page-status-dhcpleases']['match'][] = "status_dhcp_leases.php*"; $priv_list['page-diagnostics-factorydefaults'] = array(); -$priv_list['page-diagnostics-factorydefaults']['name'] = "WebCfg - Diagnostics: Factory defaults page"; -$priv_list['page-diagnostics-factorydefaults']['descr'] = "Allow access to the 'Diagnostics: Factory defaults' page."; +$priv_list['page-diagnostics-factorydefaults']['name'] = gettext("WebCfg - Diagnostics: Factory defaults page"); +$priv_list['page-diagnostics-factorydefaults']['descr'] = gettext("Allow access to the 'Diagnostics: Factory defaults' page."); $priv_list['page-diagnostics-factorydefaults']['match'] = array(); $priv_list['page-diagnostics-factorydefaults']['match'][] = "diag_defaults.php*"; $priv_list['page-diagnostics-showstates'] = array(); -$priv_list['page-diagnostics-showstates']['name'] = "WebCfg - Diagnostics: Show States page"; -$priv_list['page-diagnostics-showstates']['descr'] = "Allow access to the 'Diagnostics: Show States' page."; +$priv_list['page-diagnostics-showstates']['name'] = gettext("WebCfg - Diagnostics: Show States page"); +$priv_list['page-diagnostics-showstates']['descr'] = gettext("Allow access to the 'Diagnostics: Show States' page."); $priv_list['page-diagnostics-showstates']['match'] = array(); $priv_list['page-diagnostics-showstates']['match'][] = "diag_dump_states.php*"; $priv_list['page-status-ipsec'] = array(); -$priv_list['page-status-ipsec']['name'] = "WebCfg - Status: IPsec page"; -$priv_list['page-status-ipsec']['descr'] = "Allow access to the 'Status: IPsec' page."; +$priv_list['page-status-ipsec']['name'] = gettext("WebCfg - Status: IPsec page"); +$priv_list['page-status-ipsec']['descr'] = gettext("Allow access to the 'Status: IPsec' page."); $priv_list['page-status-ipsec']['match'] = array(); $priv_list['page-status-ipsec']['match'][] = "diag_ipsec.php*"; $priv_list['page-status-ipsec-sad'] = array(); -$priv_list['page-status-ipsec-sad']['name'] = "WebCfg - Status: IPsec: SAD page"; -$priv_list['page-status-ipsec-sad']['descr'] = "Allow access to the 'Status: IPsec: SAD' page."; +$priv_list['page-status-ipsec-sad']['name'] = gettext("WebCfg - Status: IPsec: SAD page"); +$priv_list['page-status-ipsec-sad']['descr'] = gettext("Allow access to the 'Status: IPsec: SAD' page."); $priv_list['page-status-ipsec-sad']['match'] = array(); $priv_list['page-status-ipsec-sad']['match'][] = "diag_ipsec_sad.php*"; $priv_list['page-status-ipsec-spd'] = array(); -$priv_list['page-status-ipsec-spd']['name'] = "WebCfg - Status: IPsec: SPD page"; -$priv_list['page-status-ipsec-spd']['descr'] = "Allow access to the 'Status: IPsec: SPD' page."; +$priv_list['page-status-ipsec-spd']['name'] = gettext("WebCfg - Status: IPsec: SPD page"); +$priv_list['page-status-ipsec-spd']['descr'] = gettext("Allow access to the 'Status: IPsec: SPD' page."); $priv_list['page-status-ipsec-spd']['match'] = array(); $priv_list['page-status-ipsec-spd']['match'][] = "diag_ipsec_spd.php*"; $priv_list['page-diagnostics-logs-system'] = array(); -$priv_list['page-diagnostics-logs-system']['name'] = "WebCfg - Diagnostics: Logs: System page"; -$priv_list['page-diagnostics-logs-system']['descr'] = "Allow access to the 'Diagnostics: Logs: System' page."; +$priv_list['page-diagnostics-logs-system']['name'] = gettext("WebCfg - Diagnostics: Logs: System page"); +$priv_list['page-diagnostics-logs-system']['descr'] = gettext("Allow access to the 'Diagnostics: Logs: System' page."); $priv_list['page-diagnostics-logs-system']['match'] = array(); $priv_list['page-diagnostics-logs-system']['match'][] = "diag_logs.php*"; $priv_list['page-status-systemlogs-portalauth'] = array(); -$priv_list['page-status-systemlogs-portalauth']['name'] = "WebCfg - Status: System logs: Portal Auth page"; -$priv_list['page-status-systemlogs-portalauth']['descr'] = "Allow access to the 'Status: System logs: Portal Auth' page."; +$priv_list['page-status-systemlogs-portalauth']['name'] = gettext("WebCfg - Status: System logs: Portal Auth page"); +$priv_list['page-status-systemlogs-portalauth']['descr'] = gettext("Allow access to the 'Status: System logs: Portal Auth' page."); $priv_list['page-status-systemlogs-portalauth']['match'] = array(); $priv_list['page-status-systemlogs-portalauth']['match'][] = "diag_logs_auth.php*"; $priv_list['page-diagnostics-logs-dhcp'] = array(); -$priv_list['page-diagnostics-logs-dhcp']['name'] = "WebCfg - Diagnostics: Logs: DHCP page"; -$priv_list['page-diagnostics-logs-dhcp']['descr'] = "Allow access to the 'Diagnostics: Logs: DHCP' page."; +$priv_list['page-diagnostics-logs-dhcp']['name'] = gettext("WebCfg - Diagnostics: Logs: DHCP page"); +$priv_list['page-diagnostics-logs-dhcp']['descr'] = gettext("Allow access to the 'Diagnostics: Logs: DHCP' page."); $priv_list['page-diagnostics-logs-dhcp']['match'] = array(); $priv_list['page-diagnostics-logs-dhcp']['match'][] = "diag_logs_dhcp.php*"; $priv_list['page-diagnostics-logs-firewall'] = array(); -$priv_list['page-diagnostics-logs-firewall']['name'] = "WebCfg - Diagnostics: Logs: Firewall page"; -$priv_list['page-diagnostics-logs-firewall']['descr'] = "Allow access to the 'Diagnostics: Logs: Firewall' page."; +$priv_list['page-diagnostics-logs-firewall']['name'] = gettext("WebCfg - Diagnostics: Logs: Firewall page"); +$priv_list['page-diagnostics-logs-firewall']['descr'] = gettext("Allow access to the 'Diagnostics: Logs: Firewall' page."); $priv_list['page-diagnostics-logs-firewall']['match'] = array(); $priv_list['page-diagnostics-logs-firewall']['match'][] = "diag_logs_filter.php*"; $priv_list['page-hidden-nolongerincluded'] = array(); -$priv_list['page-hidden-nolongerincluded']['name'] = "WebCfg - Hidden: No longer included page"; -$priv_list['page-hidden-nolongerincluded']['descr'] = "Allow access to the 'Hidden: No longer included' page."; +$priv_list['page-hidden-nolongerincluded']['name'] = gettext("WebCfg - Hidden: No longer included page"); +$priv_list['page-hidden-nolongerincluded']['descr'] = gettext("Allow access to the 'Hidden: No longer included' page."); $priv_list['page-hidden-nolongerincluded']['match'] = array(); $priv_list['page-hidden-nolongerincluded']['match'][] = "diag_logs_filter_dynamic.php*"; $priv_list['page-status-systemlogs-ipsecvpn'] = array(); -$priv_list['page-status-systemlogs-ipsecvpn']['name'] = "WebCfg - Status: System logs: IPsec VPN page"; -$priv_list['page-status-systemlogs-ipsecvpn']['descr'] = "Allow access to the 'Status: System logs: IPsec VPN' page."; +$priv_list['page-status-systemlogs-ipsecvpn']['name'] = gettext("WebCfg - Status: System logs: IPsec VPN page"); +$priv_list['page-status-systemlogs-ipsecvpn']['descr'] = gettext("Allow access to the 'Status: System logs: IPsec VPN' page."); $priv_list['page-status-systemlogs-ipsecvpn']['match'] = array(); $priv_list['page-status-systemlogs-ipsecvpn']['match'][] = "diag_logs_ipsec.php*"; $priv_list['page-status-systemlogs-openntpd'] = array(); -$priv_list['page-status-systemlogs-openntpd']['name'] = "WebCfg - Status: System logs: OpenNTPD page"; -$priv_list['page-status-systemlogs-openntpd']['descr'] = "Allow access to the 'Status: System logs: OpenNTPD' page."; +$priv_list['page-status-systemlogs-openntpd']['name'] = gettext("WebCfg - Status: System logs: OpenNTPD page"); +$priv_list['page-status-systemlogs-openntpd']['descr'] = gettext("Allow access to the 'Status: System logs: OpenNTPD' page."); $priv_list['page-status-systemlogs-openntpd']['match'] = array(); $priv_list['page-status-systemlogs-openntpd']['match'][] = "diag_logs_ntpd.php*"; $priv_list['page-status-systemlogs-openvpn'] = array(); -$priv_list['page-status-systemlogs-openvpn']['name'] = "WebCfg - Status: System logs: OpenVPN page"; -$priv_list['page-status-systemlogs-openvpn']['descr'] = "Allow access to the 'Status: System logs: OpenVPN' page."; +$priv_list['page-status-systemlogs-openvpn']['name'] = gettext("WebCfg - Status: System logs: OpenVPN page"); +$priv_list['page-status-systemlogs-openvpn']['descr'] = gettext("Allow access to the 'Status: System logs: OpenVPN' page."); $priv_list['page-status-systemlogs-openvpn']['match'] = array(); $priv_list['page-status-systemlogs-openvpn']['match'][] = "diag_logs_openvpn.php*"; $priv_list['page-status-systemlogs-loadbalancer'] = array(); -$priv_list['page-status-systemlogs-loadbalancer']['name'] = "WebCfg - Status: System logs: Load Balancer page"; -$priv_list['page-status-systemlogs-loadbalancer']['descr'] = "Allow access to the 'Status: System logs: Load Balancer' page."; +$priv_list['page-status-systemlogs-loadbalancer']['name'] = gettext("WebCfg - Status: System logs: Load Balancer page"); +$priv_list['page-status-systemlogs-loadbalancer']['descr'] = gettext("Allow access to the 'Status: System logs: Load Balancer' page."); $priv_list['page-status-systemlogs-loadbalancer']['match'] = array(); $priv_list['page-status-systemlogs-loadbalancer']['match'][] = "diag_logs_relayd.php*"; $priv_list['page-diagnostics-logs-settings'] = array(); -$priv_list['page-diagnostics-logs-settings']['name'] = "WebCfg - Diagnostics: Logs: Settings page"; -$priv_list['page-diagnostics-logs-settings']['descr'] = "Allow access to the 'Diagnostics: Logs: Settings' page."; +$priv_list['page-diagnostics-logs-settings']['name'] = gettext("WebCfg - Diagnostics: Logs: Settings page"); +$priv_list['page-diagnostics-logs-settings']['descr'] = gettext("Allow access to the 'Diagnostics: Logs: Settings' page."); $priv_list['page-diagnostics-logs-settings']['match'] = array(); $priv_list['page-diagnostics-logs-settings']['match'][] = "diag_logs_settings.php*"; $priv_list['page-diagnostics-logs-pptpvpn'] = array(); -$priv_list['page-diagnostics-logs-pptpvpn']['name'] = "WebCfg - Diagnostics: Logs: VPN page"; -$priv_list['page-diagnostics-logs-pptpvpn']['descr'] = "Allow access to the 'Diagnostics: Logs: VPN' page."; +$priv_list['page-diagnostics-logs-pptpvpn']['name'] = gettext("WebCfg - Diagnostics: Logs: VPN page"); +$priv_list['page-diagnostics-logs-pptpvpn']['descr'] = gettext("Allow access to the 'Diagnostics: Logs: VPN' page."); $priv_list['page-diagnostics-logs-pptpvpn']['match'] = array(); $priv_list['page-diagnostics-logs-pptpvpn']['match'][] = "diag_logs_vpn.php*"; $priv_list['page-diagnostics-packetcapture'] = array(); -$priv_list['page-diagnostics-packetcapture']['name'] = "WebCfg - Diagnostics: Packet Capture page"; -$priv_list['page-diagnostics-packetcapture']['descr'] = "Allow access to the 'Diagnostics: Packet Capture' page."; +$priv_list['page-diagnostics-packetcapture']['name'] = gettext("WebCfg - Diagnostics: Packet Capture page"); +$priv_list['page-diagnostics-packetcapture']['descr'] = gettext("Allow access to the 'Diagnostics: Packet Capture' page."); $priv_list['page-diagnostics-packetcapture']['match'] = array(); $priv_list['page-diagnostics-packetcapture']['match'][] = "diag_packet_capture.php*"; $priv_list['page-diagnostics-patters'] = array(); -$priv_list['page-diagnostics-patters']['name'] = "WebCfg - Diagnostics: Patterns page"; -$priv_list['page-diagnostics-patters']['descr'] = "Allow access to the 'Diagnostics: Patterns' page."; +$priv_list['page-diagnostics-patters']['name'] = gettext("WebCfg - Diagnostics: Patterns page"); +$priv_list['page-diagnostics-patters']['descr'] = gettext("Allow access to the 'Diagnostics: Patterns' page."); $priv_list['page-diagnostics-patters']['match'] = array(); $priv_list['page-diagnostics-patters']['match'][] = "patterns.php*"; $priv_list['page-diagnostics-ping'] = array(); -$priv_list['page-diagnostics-ping']['name'] = "WebCfg - Diagnostics: Ping page"; -$priv_list['page-diagnostics-ping']['descr'] = "Allow access to the 'Diagnostics: Ping' page."; +$priv_list['page-diagnostics-ping']['name'] = gettext("WebCfg - Diagnostics: Ping page"); +$priv_list['page-diagnostics-ping']['descr'] = gettext("Allow access to the 'Diagnostics: Ping' page."); $priv_list['page-diagnostics-ping']['match'] = array(); $priv_list['page-diagnostics-ping']['match'][] = "diag_ping.php*"; $priv_list['page-status-packagelogs'] = array(); -$priv_list['page-status-packagelogs']['name'] = "WebCfg - Status: Package logs page"; -$priv_list['page-status-packagelogs']['descr'] = "Allow access to the 'Status: Package logs' page."; +$priv_list['page-status-packagelogs']['name'] = gettext("WebCfg - Status: Package logs page"); +$priv_list['page-status-packagelogs']['descr'] = gettext("Allow access to the 'Status: Package logs' page."); $priv_list['page-status-packagelogs']['match'] = array(); $priv_list['page-status-packagelogs']['match'][] = "diag_pkglogs.php*"; $priv_list['page-diagnostics-resetstate'] = array(); -$priv_list['page-diagnostics-resetstate']['name'] = "WebCfg - Diagnostics: Reset state page"; -$priv_list['page-diagnostics-resetstate']['descr'] = "Allow access to the 'Diagnostics: Reset state' page."; +$priv_list['page-diagnostics-resetstate']['name'] = gettext("WebCfg - Diagnostics: Reset state page"); +$priv_list['page-diagnostics-resetstate']['descr'] = gettext("Allow access to the 'Diagnostics: Reset state' page."); $priv_list['page-diagnostics-resetstate']['match'] = array(); $priv_list['page-diagnostics-resetstate']['match'][] = "diag_resetstate.php*"; $priv_list['page-diagnostics-routingtables'] = array(); -$priv_list['page-diagnostics-routingtables']['name'] = "WebCfg - Diagnostics: Routing tables page"; -$priv_list['page-diagnostics-routingtables']['descr'] = "Allow access to the 'Diagnostics: Routing tables' page."; +$priv_list['page-diagnostics-routingtables']['name'] = gettext("WebCfg - Diagnostics: Routing tables page"); +$priv_list['page-diagnostics-routingtables']['descr'] = gettext("Allow access to the 'Diagnostics: Routing tables' page."); $priv_list['page-diagnostics-routingtables']['match'] = array(); $priv_list['page-diagnostics-routingtables']['match'][] = "diag_routes.php*"; $priv_list['page-diagnostics-interfacetraffic'] = array(); -$priv_list['page-diagnostics-interfacetraffic']['name'] = "WebCfg - Diagnostics: Interface Traffic page"; -$priv_list['page-diagnostics-interfacetraffic']['descr'] = "Allow access to the 'Diagnostics: Interface Traffic' page."; +$priv_list['page-diagnostics-interfacetraffic']['name'] = gettext("WebCfg - Diagnostics: Interface Traffic page"); +$priv_list['page-diagnostics-interfacetraffic']['descr'] = gettext("Allow access to the 'Diagnostics: Interface Traffic' page."); $priv_list['page-diagnostics-interfacetraffic']['match'] = array(); $priv_list['page-diagnostics-interfacetraffic']['match'][] = "graph.php*"; $priv_list['page-diag-system-activity'] = array(); -$priv_list['page-diag-system-activity']['name'] = "WebCfg - Diagnostics: System Activity"; -$priv_list['page-diag-system-activity']['descr'] = "Allows access to the 'Diagnostics: System Activity' page"; +$priv_list['page-diag-system-activity']['name'] = gettext("WebCfg - Diagnostics: System Activity"); +$priv_list['page-diag-system-activity']['descr'] = gettext("Allows access to the 'Diagnostics: System Activity' page"); $priv_list['page-diag-system-activity']['match'] = array(); $priv_list['page-diag-system-activity']['match'][] = "diag_system_activity*"; $priv_list['page-diag-system-activity'] = array(); -$priv_list['page-diag-system-activity']['name'] = "WebCfg - Diagnostics: System Activity"; -$priv_list['page-diag-system-activity']['descr'] = "Allows access to the 'Diagnostics: System Activity' page"; +$priv_list['page-diag-system-activity']['name'] = gettext("WebCfg - Diagnostics: System Activity"); +$priv_list['page-diag-system-activity']['descr'] = gettext("Allows access to the 'Diagnostics: System Activity' page"); $priv_list['page-diag-system-activity']['match'] = array(); $priv_list['page-diag-system-activity']['match'][] = "diag_system_pftop*"; $priv_list['page-diagnostics-traceroute'] = array(); -$priv_list['page-diagnostics-traceroute']['name'] = "WebCfg - Diagnostics: Traceroute page"; -$priv_list['page-diagnostics-traceroute']['descr'] = "Allow access to the 'Diagnostics: Traceroute' page."; +$priv_list['page-diagnostics-traceroute']['name'] = gettext("WebCfg - Diagnostics: Traceroute page"); +$priv_list['page-diagnostics-traceroute']['descr'] = gettext("Allow access to the 'Diagnostics: Traceroute' page."); $priv_list['page-diagnostics-traceroute']['match'] = array(); $priv_list['page-diagnostics-traceroute']['match'][] = "diag_traceroute.php*"; $priv_list['page-diagnostics-command'] = array(); -$priv_list['page-diagnostics-command']['name'] = "WebCfg - Diagnostics: Command page"; -$priv_list['page-diagnostics-command']['descr'] = "Allow access to the 'Diagnostics: Command' page."; +$priv_list['page-diagnostics-command']['name'] = gettext("WebCfg - Diagnostics: Command page"); +$priv_list['page-diagnostics-command']['descr'] = gettext("Allow access to the 'Diagnostics: Command' page."); $priv_list['page-diagnostics-command']['match'] = array(); $priv_list['page-diagnostics-command']['match'][] = "exec.php*"; $priv_list['page-hidden-execraw'] = array(); -$priv_list['page-hidden-execraw']['name'] = "WebCfg - Hidden: Exec Raw page"; -$priv_list['page-hidden-execraw']['descr'] = "Allow access to the 'Hidden: Exec Raw' page."; +$priv_list['page-hidden-execraw']['name'] = gettext("WebCfg - Hidden: Exec Raw page"); +$priv_list['page-hidden-execraw']['descr'] = gettext("Allow access to the 'Hidden: Exec Raw' page."); $priv_list['page-hidden-execraw']['match'] = array(); $priv_list['page-hidden-execraw']['match'][] = "exec_raw.php*"; $priv_list['page-firewall-alias-edit'] = array(); -$priv_list['page-firewall-alias-edit']['name'] = "WebCfg - Firewall: Alias: Edit page"; -$priv_list['page-firewall-alias-edit']['descr'] = "Allow access to the 'Firewall: Alias: Edit' page."; +$priv_list['page-firewall-alias-edit']['name'] = gettext("WebCfg - Firewall: Alias: Edit page"); +$priv_list['page-firewall-alias-edit']['descr'] = gettext("Allow access to the 'Firewall: Alias: Edit' page."); $priv_list['page-firewall-alias-edit']['match'] = array(); $priv_list['page-firewall-alias-edit']['match'][] = "firewall_aliases_edit.php*"; $priv_list['page-firewall-aliases'] = array(); -$priv_list['page-firewall-aliases']['name'] = "WebCfg - Firewall: Aliases page"; -$priv_list['page-firewall-aliases']['descr'] = "Allow access to the 'Firewall: Aliases' page."; +$priv_list['page-firewall-aliases']['name'] = gettext("WebCfg - Firewall: Aliases page"); +$priv_list['page-firewall-aliases']['descr'] = gettext("Allow access to the 'Firewall: Aliases' page."); $priv_list['page-firewall-aliases']['match'] = array(); $priv_list['page-firewall-aliases']['match'][] = "firewall_aliases.php*"; $priv_list['page-firewall-alias-import'] = array(); -$priv_list['page-firewall-alias-import']['name'] = "WebCfg - Firewall: Alias: Import page"; -$priv_list['page-firewall-alias-import']['descr'] = "Allow access to the 'Firewall: Alias: Import' page."; +$priv_list['page-firewall-alias-import']['name'] = gettext("WebCfg - Firewall: Alias: Import page"); +$priv_list['page-firewall-alias-import']['descr'] = gettext("Allow access to the 'Firewall: Alias: Import' page."); $priv_list['page-firewall-alias-import']['match'] = array(); $priv_list['page-firewall-alias-import']['match'][] = "firewall_aliases_import.php*"; $priv_list['page-firewall-nat-portforward'] = array(); -$priv_list['page-firewall-nat-portforward']['name'] = "WebCfg - Firewall: NAT: Port Forward page"; -$priv_list['page-firewall-nat-portforward']['descr'] = "Allow access to the 'Firewall: NAT: Port Forward' page."; +$priv_list['page-firewall-nat-portforward']['name'] = gettext("WebCfg - Firewall: NAT: Port Forward page"); +$priv_list['page-firewall-nat-portforward']['descr'] = gettext("Allow access to the 'Firewall: NAT: Port Forward' page."); $priv_list['page-firewall-nat-portforward']['match'] = array(); $priv_list['page-firewall-nat-portforward']['match'][] = "firewall_nat.php*"; $priv_list['page-firewall-nat-1-1'] = array(); -$priv_list['page-firewall-nat-1-1']['name'] = "WebCfg - Firewall: NAT: 1:1 page"; -$priv_list['page-firewall-nat-1-1']['descr'] = "Allow access to the 'Firewall: NAT: 1:1' page."; +$priv_list['page-firewall-nat-1-1']['name'] = gettext("WebCfg - Firewall: NAT: 1:1 page"); +$priv_list['page-firewall-nat-1-1']['descr'] = gettext("Allow access to the 'Firewall: NAT: 1:1' page."); $priv_list['page-firewall-nat-1-1']['match'] = array(); $priv_list['page-firewall-nat-1-1']['match'][] = "firewall_nat_1to1.php*"; $priv_list['page-firewall-nat-1-1-edit'] = array(); -$priv_list['page-firewall-nat-1-1-edit']['name'] = "WebCfg - Firewall: NAT: 1:1: Edit page"; -$priv_list['page-firewall-nat-1-1-edit']['descr'] = "Allow access to the 'Firewall: NAT: 1:1: Edit' page."; +$priv_list['page-firewall-nat-1-1-edit']['name'] = gettext("WebCfg - Firewall: NAT: 1:1: Edit page"); +$priv_list['page-firewall-nat-1-1-edit']['descr'] = gettext("Allow access to the 'Firewall: NAT: 1:1: Edit' page."); $priv_list['page-firewall-nat-1-1-edit']['match'] = array(); $priv_list['page-firewall-nat-1-1-edit']['match'][] = "firewall_nat_1to1_edit.php*"; $priv_list['page-firewall-nat-portforward-edit'] = array(); -$priv_list['page-firewall-nat-portforward-edit']['name'] = "WebCfg - Firewall: NAT: Port Forward: Edit page"; -$priv_list['page-firewall-nat-portforward-edit']['descr'] = "Allow access to the 'Firewall: NAT: Port Forward: Edit' page."; +$priv_list['page-firewall-nat-portforward-edit']['name'] = gettext("WebCfg - Firewall: NAT: Port Forward: Edit page"); +$priv_list['page-firewall-nat-portforward-edit']['descr'] = gettext("Allow access to the 'Firewall: NAT: Port Forward: Edit' page."); $priv_list['page-firewall-nat-portforward-edit']['match'] = array(); $priv_list['page-firewall-nat-portforward-edit']['match'][] = "firewall_nat_edit.php*"; $priv_list['page-firewall-nat-outbound'] = array(); -$priv_list['page-firewall-nat-outbound']['name'] = "WebCfg - Firewall: NAT: Outbound page"; -$priv_list['page-firewall-nat-outbound']['descr'] = "Allow access to the 'Firewall: NAT: Outbound' page."; +$priv_list['page-firewall-nat-outbound']['name'] = gettext("WebCfg - Firewall: NAT: Outbound page"); +$priv_list['page-firewall-nat-outbound']['descr'] = gettext("Allow access to the 'Firewall: NAT: Outbound' page."); $priv_list['page-firewall-nat-outbound']['match'] = array(); $priv_list['page-firewall-nat-outbound']['match'][] = "firewall_nat_out.php*"; $priv_list['page-services-loadbalancer-relay-protocol-edit'] = array(); -$priv_list['page-services-loadbalancer-relay-protocol-edit']['name'] = "WebCfg - Services: Load Balancer: Relay Protocol: Edit page"; -$priv_list['page-services-loadbalancer-relay-protocol-edit']['descr'] = "Allow access to the 'Services: Load Balancer: Relay Protocol: Edit' page."; +$priv_list['page-services-loadbalancer-relay-protocol-edit']['name'] = gettext("WebCfg - Services: Load Balancer: Relay Protocol: Edit page"); +$priv_list['page-services-loadbalancer-relay-protocol-edit']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Relay Protocol: Edit' page."); $priv_list['page-services-loadbalancer-relay-protocol-edit']['match'] = array(); $priv_list['page-services-loadbalancer-relay-protocol-edit']['match'][] = "load_balancer_relay_protocol_edit.php*"; $priv_list['page-firewall-schedules'] = array(); -$priv_list['page-firewall-schedules']['name'] = "WebCfg - Firewall: Schedules page"; -$priv_list['page-firewall-schedules']['descr'] = "Allow access to the 'Firewall: Schedules' page."; +$priv_list['page-firewall-schedules']['name'] = gettext("WebCfg - Firewall: Schedules page"); +$priv_list['page-firewall-schedules']['descr'] = gettext("Allow access to the 'Firewall: Schedules' page."); $priv_list['page-firewall-schedules']['match'] = array(); $priv_list['page-firewall-schedules']['match'][] = "firewall_schedule.php*"; $priv_list['page-firewall-trafficshaper'] = array(); -$priv_list['page-firewall-trafficshaper']['name'] = "WebCfg - Firewall: Traffic Shaper page"; -$priv_list['page-firewall-trafficshaper']['descr'] = "Allow access to the 'Firewall: Traffic Shaper' page."; +$priv_list['page-firewall-trafficshaper']['name'] = gettext("WebCfg - Firewall: Traffic Shaper page"); +$priv_list['page-firewall-trafficshaper']['descr'] = gettext("Allow access to the 'Firewall: Traffic Shaper' page."); $priv_list['page-firewall-trafficshaper']['match'] = array(); $priv_list['page-firewall-trafficshaper']['match'][] = "firewall_shaper.php*"; $priv_list['page-firewall-trafficshaper-layer7'] = array(); -$priv_list['page-firewall-trafficshaper-layer7']['name'] = "WebCfg - Firewall: Traffic Shaper: Layer7 page"; -$priv_list['page-firewall-trafficshaper-layer7']['descr'] = "Allow access to the 'Firewall: Traffic Shaper: Layer7' page."; +$priv_list['page-firewall-trafficshaper-layer7']['name'] = gettext("WebCfg - Firewall: Traffic Shaper: Layer7 page"); +$priv_list['page-firewall-trafficshaper-layer7']['descr'] = gettext("Allow access to the 'Firewall: Traffic Shaper: Layer7' page."); $priv_list['page-firewall-trafficshaper-layer7']['match'] = array(); $priv_list['page-firewall-trafficshaper-layer7']['match'][] = "firewall_shaper_layer7.php*"; $priv_list['page-firewall-trafficshaper-queues'] = array(); -$priv_list['page-firewall-trafficshaper-queues']['name'] = "WebCfg - Firewall: Traffic Shaper: Queues page"; -$priv_list['page-firewall-trafficshaper-queues']['descr'] = "Allow access to the 'Firewall: Traffic Shaper: Queues' page."; +$priv_list['page-firewall-trafficshaper-queues']['name'] = gettext("WebCfg - Firewall: Traffic Shaper: Queues page"); +$priv_list['page-firewall-trafficshaper-queues']['descr'] = gettext("Allow access to the 'Firewall: Traffic Shaper: Queues' page."); $priv_list['page-firewall-trafficshaper-queues']['match'] = array(); $priv_list['page-firewall-trafficshaper-queues']['match'][] = "firewall_shaper_queues.php*"; $priv_list['page-firewall-trafficshaper-limiter'] = array(); -$priv_list['page-firewall-trafficshaper-limiter']['name'] = "WebCfg - Firewall: Traffic Shaper: Limiter page"; -$priv_list['page-firewall-trafficshaper-limiter']['descr'] = "Allow access to the 'Firewall: Traffic Shaper: Limiter' page."; +$priv_list['page-firewall-trafficshaper-limiter']['name'] = gettext("WebCfg - Firewall: Traffic Shaper: Limiter page"); +$priv_list['page-firewall-trafficshaper-limiter']['descr'] = gettext("Allow access to the 'Firewall: Traffic Shaper: Limiter' page."); $priv_list['page-firewall-trafficshaper-limiter']['match'] = array(); $priv_list['page-firewall-trafficshaper-limiter']['match'][] = "firewall_shaper_vinterface.php*"; $priv_list['page-firewall-trafficshaper-wizard'] = array(); -$priv_list['page-firewall-trafficshaper-wizard']['name'] = "WebCfg - Firewall: Traffic Shaper: Wizard page"; -$priv_list['page-firewall-trafficshaper-wizard']['descr'] = "Allow access to the 'Firewall: Traffic Shaper: Wizard' page."; +$priv_list['page-firewall-trafficshaper-wizard']['name'] = gettext("WebCfg - Firewall: Traffic Shaper: Wizard page"); +$priv_list['page-firewall-trafficshaper-wizard']['descr'] = gettext("Allow access to the 'Firewall: Traffic Shaper: Wizard' page."); $priv_list['page-firewall-trafficshaper-wizard']['match'] = array(); $priv_list['page-firewall-trafficshaper-wizard']['match'][] = "firewall_shaper_wizards.php*"; $priv_list['page-firewall-virtualipaddresses'] = array(); -$priv_list['page-firewall-virtualipaddresses']['name'] = "WebCfg - Firewall: Virtual IP Addresses page"; -$priv_list['page-firewall-virtualipaddresses']['descr'] = "Allow access to the 'Firewall: Virtual IP Addresses' page."; +$priv_list['page-firewall-virtualipaddresses']['name'] = gettext("WebCfg - Firewall: Virtual IP Addresses page"); +$priv_list['page-firewall-virtualipaddresses']['descr'] = gettext("Allow access to the 'Firewall: Virtual IP Addresses' page."); $priv_list['page-firewall-virtualipaddresses']['match'] = array(); $priv_list['page-firewall-virtualipaddresses']['match'][] = "firewall_virtual_ip.php*"; $priv_list['page-firewall-virtualipaddress-edit'] = array(); -$priv_list['page-firewall-virtualipaddress-edit']['name'] = "WebCfg - Firewall: Virtual IP Address: Edit page"; -$priv_list['page-firewall-virtualipaddress-edit']['descr'] = "Allow access to the 'Firewall: Virtual IP Address: Edit' page."; +$priv_list['page-firewall-virtualipaddress-edit']['name'] = gettext("WebCfg - Firewall: Virtual IP Address: Edit page"); +$priv_list['page-firewall-virtualipaddress-edit']['descr'] = gettext("Allow access to the 'Firewall: Virtual IP Address: Edit' page."); $priv_list['page-firewall-virtualipaddress-edit']['match'] = array(); $priv_list['page-firewall-virtualipaddress-edit']['match'][] = "firewall_virtual_ip_edit.php*"; $priv_list['page-getstats'] = array(); -$priv_list['page-getstats']['name'] = "WebCfg - AJAX: Get Stats"; -$priv_list['page-getstats']['descr'] = "Allow access to the 'AJAX: Get Stats' page."; +$priv_list['page-getstats']['name'] = gettext("WebCfg - AJAX: Get Stats"); +$priv_list['page-getstats']['descr'] = gettext("Allow access to the 'AJAX: Get Stats' page."); $priv_list['page-getstats']['match'] = array(); $priv_list['page-getstats']['match'][] = "getstats.php*"; $priv_list['page-status-systemlogs-ppp'] = array(); -$priv_list['page-status-systemlogs-ppp']['name'] = "WebCfg - Status: System logs: IPsec VPN page"; -$priv_list['page-status-systemlogs-ppp']['descr'] = "Allow access to the 'Status: System logs: IPsec VPN' page."; +$priv_list['page-status-systemlogs-ppp']['name'] = gettext("WebCfg - Status: System logs: IPsec VPN page"); +$priv_list['page-status-systemlogs-ppp']['descr'] = gettext("Allow access to the 'Status: System logs: IPsec VPN' page."); $priv_list['page-status-systemlogs-ppp']['match'] = array(); $priv_list['page-status-systemlogs-ppp']['match'][] = "diag_logs_ppp.php*"; $priv_list['page-diagnostics-nanobsd'] = array(); -$priv_list['page-diagnostics-nanobsd']['name'] = "WebCfg - Diagnostics: NanoBSD"; -$priv_list['page-diagnostics-nanobsd']['descr'] = "Allow access to the 'Diagnostics: NanoBSD' page."; +$priv_list['page-diagnostics-nanobsd']['name'] = gettext("WebCfg - Diagnostics: NanoBSD"); +$priv_list['page-diagnostics-nanobsd']['descr'] = gettext("Allow access to the 'Diagnostics: NanoBSD' page."); $priv_list['page-diagnostics-nanobsd']['match'] = array(); $priv_list['page-diagnostics-nanobsd']['match'][] = "diag_nanobsd.php*"; $priv_list['page-interfaces-gif'] = array(); -$priv_list['page-interfaces-gif']['name'] = "WebCfg - Interfaces: GIF page"; -$priv_list['page-interfaces-gif']['descr'] = "Allow access to the 'Interfaces: GIF' page."; +$priv_list['page-interfaces-gif']['name'] = gettext("WebCfg - Interfaces: GIF page"); +$priv_list['page-interfaces-gif']['descr'] = gettext("Allow access to the 'Interfaces: GIF' page."); $priv_list['page-interfaces-gif']['match'] = array(); $priv_list['page-interfaces-gif']['match'][] = "interfaces_gif.php*"; $priv_list['page-diagnostics-cpuutilization'] = array(); -$priv_list['page-diagnostics-cpuutilization']['name'] = "WebCfg - Diagnostics: CPU Utilization page"; -$priv_list['page-diagnostics-cpuutilization']['descr'] = "Allow access to the 'Diagnostics: CPU Utilization' page."; +$priv_list['page-diagnostics-cpuutilization']['name'] = gettext("WebCfg - Diagnostics: CPU Utilization page"); +$priv_list['page-diagnostics-cpuutilization']['descr'] = gettext("Allow access to the 'Diagnostics: CPU Utilization' page."); $priv_list['page-diagnostics-cpuutilization']['match'] = array(); $priv_list['page-diagnostics-cpuutilization']['match'][] = "graph_cpu.php*"; $priv_list['page-diagnostics-haltsystem'] = array(); -$priv_list['page-diagnostics-haltsystem']['name'] = "WebCfg - Diagnostics: Halt system page"; -$priv_list['page-diagnostics-haltsystem']['descr'] = "Allow access to the 'Diagnostics: Halt system' page."; +$priv_list['page-diagnostics-haltsystem']['name'] = gettext("WebCfg - Diagnostics: Halt system page"); +$priv_list['page-diagnostics-haltsystem']['descr'] = gettext("Allow access to the 'Diagnostics: Halt system' page."); $priv_list['page-diagnostics-haltsystem']['match'] = array(); $priv_list['page-diagnostics-haltsystem']['match'][] = "halt.php*"; $priv_list['page-requiredforjavascript'] = array(); -$priv_list['page-requiredforjavascript']['name'] = "WebCfg - Required for javascript page"; -$priv_list['page-requiredforjavascript']['descr'] = "Allow access to the 'Required for javascript' page."; +$priv_list['page-requiredforjavascript']['name'] = gettext("WebCfg - Required for javascript page"); +$priv_list['page-requiredforjavascript']['descr'] = gettext("Allow access to the 'Required for javascript' page."); $priv_list['page-requiredforjavascript']['match'] = array(); $priv_list['page-requiredforjavascript']['match'][] = "headjs.php*"; $priv_list['page-xmlrpcinterfacestats'] = array(); -$priv_list['page-xmlrpcinterfacestats']['name'] = "WebCfg - XMLRPC Interface Stats page"; -$priv_list['page-xmlrpcinterfacestats']['descr'] = "Allow access to the 'XMLRPC Interface Stats' page."; +$priv_list['page-xmlrpcinterfacestats']['name'] = gettext("WebCfg - XMLRPC Interface Stats page"); +$priv_list['page-xmlrpcinterfacestats']['descr'] = gettext("Allow access to the 'XMLRPC Interface Stats' page."); $priv_list['page-xmlrpcinterfacestats']['match'] = array(); $priv_list['page-xmlrpcinterfacestats']['match'][] = "ifstats.php*"; $priv_list['page-system-login/logout'] = array(); -$priv_list['page-system-login/logout']['name'] = "WebCfg - System: Login / Logout page"; -$priv_list['page-system-login/logout']['descr'] = "Allow access to the 'System: Login / Logout' page."; +$priv_list['page-system-login/logout']['name'] = gettext("WebCfg - System: Login / Logout page"); +$priv_list['page-system-login/logout']['descr'] = gettext("Allow access to the 'System: Login / Logout' page."); $priv_list['page-system-login/logout']['match'] = array(); $priv_list['page-system-login/logout']['match'][] = "index.php*"; $priv_list['page-interfaces'] = array(); -$priv_list['page-interfaces']['name'] = "WebCfg - Interfaces: WAN page"; -$priv_list['page-interfaces']['descr'] = "Allow access to the 'Interfaces' page."; +$priv_list['page-interfaces']['name'] = gettext("WebCfg - Interfaces: WAN page"); +$priv_list['page-interfaces']['descr'] = gettext("Allow access to the 'Interfaces' page."); $priv_list['page-interfaces']['match'] = array(); $priv_list['page-interfaces']['match'][] = "interfaces.php*"; $priv_list['page-interfaces-assignnetworkports'] = array(); -$priv_list['page-interfaces-assignnetworkports']['name'] = "WebCfg - Interfaces: Assign network ports page"; -$priv_list['page-interfaces-assignnetworkports']['descr'] = "Allow access to the 'Interfaces: Assign network ports' page."; +$priv_list['page-interfaces-assignnetworkports']['name'] = gettext("WebCfg - Interfaces: Assign network ports page"); +$priv_list['page-interfaces-assignnetworkports']['descr'] = gettext("Allow access to the 'Interfaces: Assign network ports' page."); $priv_list['page-interfaces-assignnetworkports']['match'] = array(); $priv_list['page-interfaces-assignnetworkports']['match'][] = "interfaces_assign.php*"; $priv_list['page-interfaces-bridge'] = array(); -$priv_list['page-interfaces-bridge']['name'] = "WebCfg - Interfaces: Bridge page"; -$priv_list['page-interfaces-bridge']['descr'] = "Allow access to the 'Interfaces: Bridge' page."; +$priv_list['page-interfaces-bridge']['name'] = gettext("WebCfg - Interfaces: Bridge page"); +$priv_list['page-interfaces-bridge']['descr'] = gettext("Allow access to the 'Interfaces: Bridge' page."); $priv_list['page-interfaces-bridge']['match'] = array(); $priv_list['page-interfaces-bridge']['match'][] = "interfaces_bridge.php*"; $priv_list['page-interfaces-bridge-edit'] = array(); -$priv_list['page-interfaces-bridge-edit']['name'] = "WebCfg - Interfaces: Bridge edit page"; -$priv_list['page-interfaces-bridge-edit']['descr'] = "Allow access to the 'Interfaces: Bridge : Edit' page."; +$priv_list['page-interfaces-bridge-edit']['name'] = gettext("WebCfg - Interfaces: Bridge edit page"); +$priv_list['page-interfaces-bridge-edit']['descr'] = gettext("Allow access to the 'Interfaces: Bridge : Edit' page."); $priv_list['page-interfaces-bridge-edit']['match'] = array(); $priv_list['page-interfaces-bridge-edit']['match'][] = "interfaces_bridge_edit.php*"; $priv_list['page-interfaces-gif-edit'] = array(); -$priv_list['page-interfaces-gif-edit']['name'] = "WebCfg - Interfaces: GIF: Edit page"; -$priv_list['page-interfaces-gif-edit']['descr'] = "Allow access to the 'Interfaces: GIF: Edit' page."; +$priv_list['page-interfaces-gif-edit']['name'] = gettext("WebCfg - Interfaces: GIF: Edit page"); +$priv_list['page-interfaces-gif-edit']['descr'] = gettext("Allow access to the 'Interfaces: GIF: Edit' page."); $priv_list['page-interfaces-gif-edit']['match'] = array(); $priv_list['page-interfaces-gif-edit']['match'][] = "interfaces_gif_edit.php*"; $priv_list['page-interfaces-gre'] = array(); -$priv_list['page-interfaces-gre']['name'] = "WebCfg - Interfaces: GRE page"; -$priv_list['page-interfaces-gre']['descr'] = "Allow access to the 'Interfaces: GRE' page."; +$priv_list['page-interfaces-gre']['name'] = gettext("WebCfg - Interfaces: GRE page"); +$priv_list['page-interfaces-gre']['descr'] = gettext("Allow access to the 'Interfaces: GRE' page."); $priv_list['page-interfaces-gre']['match'] = array(); $priv_list['page-interfaces-gre']['match'][] = "interfaces_gre.php*"; $priv_list['page-package-settings'] = array(); -$priv_list['page-package-settings']['name'] = "WebCfg - Package: Settings page"; -$priv_list['page-package-settings']['descr'] = "Allow access to the 'Package: Settings' page."; +$priv_list['page-package-settings']['name'] = gettext("WebCfg - Package: Settings page"); +$priv_list['page-package-settings']['descr'] = gettext("Allow access to the 'Package: Settings' page."); $priv_list['page-package-settings']['match'] = array(); $priv_list['page-package-settings']['match'][] = "pkg.php*"; $priv_list['page-interfaces-gre-edit'] = array(); -$priv_list['page-interfaces-gre-edit']['name'] = "WebCfg - Interfaces: GRE: Edit page"; -$priv_list['page-interfaces-gre-edit']['descr'] = "Allow access to the 'Interfaces: GRE: Edit' page."; +$priv_list['page-interfaces-gre-edit']['name'] = gettext("WebCfg - Interfaces: GRE: Edit page"); +$priv_list['page-interfaces-gre-edit']['descr'] = gettext("Allow access to the 'Interfaces: GRE: Edit' page."); $priv_list['page-interfaces-gre-edit']['match'] = array(); $priv_list['page-interfaces-gre-edit']['match'][] = "interfaces_gre_edit.php*"; $priv_list['page-interfacess-lagg'] = array(); -$priv_list['page-interfacess-lagg']['name'] = "WebCfg - Interfaces: LAGG: page"; -$priv_list['page-interfacess-lagg']['descr'] = "Edit Interface LAGG"; +$priv_list['page-interfacess-lagg']['name'] = gettext("WebCfg - Interfaces: LAGG: page"); +$priv_list['page-interfacess-lagg']['descr'] = gettext("Edit Interface LAGG"); $priv_list['page-interfacess-lagg']['match'] = array(); $priv_list['page-interfacess-lagg']['match'][] = "interfaces_lagg.php*"; $priv_list['page-interfaces-ppps-edit'] = array(); -$priv_list['page-interfaces-ppps-edit']['name'] = "WebCfg - Interfaces: PPP: Edit page"; -$priv_list['page-interfaces-ppps-edit']['descr'] = "Allow access to the 'Interfaces: PPP: Edit' page."; +$priv_list['page-interfaces-ppps-edit']['name'] = gettext("WebCfg - Interfaces: PPP: Edit page"); +$priv_list['page-interfaces-ppps-edit']['descr'] = gettext("Allow access to the 'Interfaces: PPP: Edit' page."); $priv_list['page-interfaces-ppps-edit']['match'] = array(); $priv_list['page-interfaces-ppps-edit']['match'][] = "interfaces_ppps_edit.php*"; $priv_list['page-interfaces-ppps'] = array(); -$priv_list['page-interfaces-ppps']['name'] = "WebCfg - Interfaces: PPP page"; -$priv_list['page-interfaces-ppps']['descr'] = "Allow access to the 'Interfaces: PPP' page."; +$priv_list['page-interfaces-ppps']['name'] = gettext("WebCfg - Interfaces: PPP page"); +$priv_list['page-interfaces-ppps']['descr'] = gettext("Allow access to the 'Interfaces: PPP' page."); $priv_list['page-interfaces-ppps']['match'] = array(); $priv_list['page-interfaces-ppps']['match'][] = "interfaces_ppps.php*"; $priv_list['page-interfaces-groups'] = array(); -$priv_list['page-interfaces-groups']['name'] = "WebCfg - Interfaces: Groups page"; -$priv_list['page-interfaces-groups']['descr'] = "Create interface groups"; +$priv_list['page-interfaces-groups']['name'] = gettext("WebCfg - Interfaces: Groups page"); +$priv_list['page-interfaces-groups']['descr'] = gettext("Create interface groups"); $priv_list['page-interfaces-groups']['match'] = array(); $priv_list['page-interfaces-groups']['match'][] = "interfaces_groups.php*"; $priv_list['page-interfacess-groups'] = array(); -$priv_list['page-interfacess-groups']['name'] = "WebCfg - Interfaces: Groups: Edit page"; -$priv_list['page-interfacess-groups']['descr'] = "Edit Interface groups"; +$priv_list['page-interfacess-groups']['name'] = gettext("WebCfg - Interfaces: Groups: Edit page"); +$priv_list['page-interfacess-groups']['descr'] = gettext("Edit Interface groups"); $priv_list['page-interfacess-groups']['match'] = array(); $priv_list['page-interfacess-groups']['match'][] = "interfaces_groups_edit.php*"; $priv_list['page-interfacess-lagg'] = array(); -$priv_list['page-interfacess-lagg']['name'] = "WebCfg - Interfaces: LAGG: Edit page"; -$priv_list['page-interfacess-lagg']['descr'] = "Edit Interface LAGG"; +$priv_list['page-interfacess-lagg']['name'] = gettext("WebCfg - Interfaces: LAGG: Edit page"); +$priv_list['page-interfacess-lagg']['descr'] = gettext("Edit Interface LAGG"); $priv_list['page-interfacess-lagg']['match'] = array(); $priv_list['page-interfacess-lagg']['match'][] = "interfaces_lagg_edit.php*"; $priv_list['page-interfaces-vlan'] = array(); -$priv_list['page-interfaces-vlan']['name'] = "WebCfg - Interfaces: VLAN page"; -$priv_list['page-interfaces-vlan']['descr'] = "Allow access to the 'Interfaces: VLAN' page."; +$priv_list['page-interfaces-vlan']['name'] = gettext("WebCfg - Interfaces: VLAN page"); +$priv_list['page-interfaces-vlan']['descr'] = gettext("Allow access to the 'Interfaces: VLAN' page."); $priv_list['page-interfaces-vlan']['match'] = array(); $priv_list['page-interfaces-vlan']['match'][] = "interfaces_vlan.php*"; $priv_list['page-interfaces-vlan-edit'] = array(); -$priv_list['page-interfaces-vlan-edit']['name'] = "WebCfg - Interfaces: VLAN: Edit page"; -$priv_list['page-interfaces-vlan-edit']['descr'] = "Allow access to the 'Interfaces: VLAN: Edit' page."; +$priv_list['page-interfaces-vlan-edit']['name'] = gettext("WebCfg - Interfaces: VLAN: Edit page"); +$priv_list['page-interfaces-vlan-edit']['descr'] = gettext("Allow access to the 'Interfaces: VLAN: Edit' page."); $priv_list['page-interfaces-vlan-edit']['match'] = array(); $priv_list['page-interfaces-vlan-edit']['match'][] = "interfaces_vlan_edit.php*"; $priv_list['page-interfaces-wireless'] = array(); -$priv_list['page-interfaces-wireless']['name'] = "WebCfg - Interfaces: Wireless page"; -$priv_list['page-interfaces-wireless']['descr'] = "Allow access to the 'Interfaces: Wireless' page."; +$priv_list['page-interfaces-wireless']['name'] = gettext("WebCfg - Interfaces: Wireless page"); +$priv_list['page-interfaces-wireless']['descr'] = gettext("Allow access to the 'Interfaces: Wireless' page."); $priv_list['page-interfaces-wireless']['match'] = array(); $priv_list['page-interfaces-wireless']['match'][] = "interfaces_wireless.php*"; $priv_list['page-interfaces-wireless-edit'] = array(); -$priv_list['page-interfaces-wireless-edit']['name'] = "WebCfg - Interfaces: Wireless edit page"; -$priv_list['page-interfaces-wireless-edit']['descr'] = "Allow access to the 'Interfaces: Wireless : Edit' page."; +$priv_list['page-interfaces-wireless-edit']['name'] = gettext("WebCfg - Interfaces: Wireless edit page"); +$priv_list['page-interfaces-wireless-edit']['descr'] = gettext("Allow access to the 'Interfaces: Wireless : Edit' page."); $priv_list['page-interfaces-wireless-edit']['match'] = array(); $priv_list['page-interfaces-wireless-edit']['match'][] = "interfaces_wireless_edit.php*"; $priv_list['page-system-license'] = array(); -$priv_list['page-system-license']['name'] = "WebCfg - System: License page"; -$priv_list['page-system-license']['descr'] = "Allow access to the 'System: License' page."; +$priv_list['page-system-license']['name'] = gettext("WebCfg - System: License page"); +$priv_list['page-system-license']['descr'] = gettext("Allow access to the 'System: License' page."); $priv_list['page-system-license']['match'] = array(); $priv_list['page-system-license']['match'][] = "license.php*"; $priv_list['page-services-loadbalancer-monitor'] = array(); -$priv_list['page-services-loadbalancer-monitor']['name'] = "WebCfg - Services: Load Balancer: Monitors page"; -$priv_list['page-services-loadbalancer-monitor']['descr'] = "Allow access to the 'Services: Load Balancer: Monitors' page."; +$priv_list['page-services-loadbalancer-monitor']['name'] = gettext("WebCfg - Services: Load Balancer: Monitors page"); +$priv_list['page-services-loadbalancer-monitor']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Monitors' page."); $priv_list['page-services-loadbalancer-monitor']['match'] = array(); $priv_list['page-services-loadbalancer-monitor']['match'][] = "load_balancer_monitor.php*"; $priv_list['page-services-loadbalancer-monitor-edit'] = array(); -$priv_list['page-services-loadbalancer-monitor-edit']['name'] = "WebCfg - Services: Load Balancer: Monitor: Edit page"; -$priv_list['page-services-loadbalancer-monitor-edit']['descr'] = "Allow access to the 'Services: Load Balancer: Monitor: Edit' page."; +$priv_list['page-services-loadbalancer-monitor-edit']['name'] = gettext("WebCfg - Services: Load Balancer: Monitor: Edit page"); +$priv_list['page-services-loadbalancer-monitor-edit']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Monitor: Edit' page."); $priv_list['page-services-loadbalancer-monitor-edit']['match'] = array(); $priv_list['page-services-loadbalancer-monitor-edit']['match'][] = "load_balancer_monitor_edit.php*"; $priv_list['page-loadbalancer-pool'] = array(); -$priv_list['page-loadbalancer-pool']['name'] = "WebCfg - Load Balancer: Pool page"; -$priv_list['page-loadbalancer-pool']['descr'] = "Allow access to the 'Load Balancer: Pool' page."; +$priv_list['page-loadbalancer-pool']['name'] = gettext("WebCfg - Load Balancer: Pool page"); +$priv_list['page-loadbalancer-pool']['descr'] = gettext("Allow access to the 'Load Balancer: Pool' page."); $priv_list['page-loadbalancer-pool']['match'] = array(); $priv_list['page-loadbalancer-pool']['match'][] = "load_balancer_pool.php*"; $priv_list['page-loadbalancer-pool-edit'] = array(); -$priv_list['page-loadbalancer-pool-edit']['name'] = "WebCfg - Load Balancer: Pool: Edit page"; -$priv_list['page-loadbalancer-pool-edit']['descr'] = "Allow access to the 'Load Balancer: Pool: Edit' page."; +$priv_list['page-loadbalancer-pool-edit']['name'] = gettext("WebCfg - Load Balancer: Pool: Edit page"); +$priv_list['page-loadbalancer-pool-edit']['descr'] = gettext("Allow access to the 'Load Balancer: Pool: Edit' page."); $priv_list['page-loadbalancer-pool-edit']['match'] = array(); $priv_list['page-loadbalancer-pool-edit']['match'][] = "load_balancer_pool_edit.php*"; $priv_list['page-system-packagemanager'] = array(); -$priv_list['page-system-packagemanager']['name'] = "WebCfg - System: Package Manager page"; -$priv_list['page-system-packagemanager']['descr'] = "Allow access to the 'System: Package Manager' page."; +$priv_list['page-system-packagemanager']['name'] = gettext("WebCfg - System: Package Manager page"); +$priv_list['page-system-packagemanager']['descr'] = gettext("Allow access to the 'System: Package Manager' page."); $priv_list['page-system-packagemanager']['match'] = array(); $priv_list['page-system-packagemanager']['match'][] = "pkg_mgr.php*"; $priv_list['page-services-captiveportal-allowedips'] = array(); -$priv_list['page-services-captiveportal-allowedips']['name'] = "WebCfg - Services: Captive portal: Allowed IPs page"; -$priv_list['page-services-captiveportal-allowedips']['descr'] = "Allow access to the 'Services: Captive portal: Allowed IPs' page."; +$priv_list['page-services-captiveportal-allowedips']['name'] = gettext("WebCfg - Services: Captive portal: Allowed IPs page"); +$priv_list['page-services-captiveportal-allowedips']['descr'] = gettext("Allow access to the 'Services: Captive portal: Allowed IPs' page."); $priv_list['page-services-captiveportal-allowedips']['match'] = array(); $priv_list['page-services-captiveportal-allowedips']['match'][] = "services_captiveportal_ip.php*"; $priv_list['page-interfacess-qinq'] = array(); -$priv_list['page-interfacess-qinq']['name'] = "WebCfg - Interfaces: QinQ: Edit page"; -$priv_list['page-interfacess-qinq']['descr'] = "Edit Interface qinq"; +$priv_list['page-interfacess-qinq']['name'] = gettext("WebCfg - Interfaces: QinQ: Edit page"); +$priv_list['page-interfacess-qinq']['descr'] = gettext("Edit Interface qinq"); $priv_list['page-interfacess-qinq']['match'] = array(); $priv_list['page-interfacess-qinq']['match'][] = "interfaces_qinq_edit.php*"; $priv_list['page-services-loadbalancer-relay-action'] = array(); -$priv_list['page-services-loadbalancer-relay-action']['name'] = "WebCfg - Services: Load Balancer: Relay Actions page"; -$priv_list['page-services-loadbalancer-relay-action']['descr'] = "Allow access to the 'Services: Load Balancer: Relay Actions' page."; +$priv_list['page-services-loadbalancer-relay-action']['name'] = gettext("WebCfg - Services: Load Balancer: Relay Actions page"); +$priv_list['page-services-loadbalancer-relay-action']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Relay Actions' page."); $priv_list['page-services-loadbalancer-relay-action']['match'] = array(); $priv_list['page-services-loadbalancer-relay-action']['match'][] = "load_balancer_relay_action.php*"; $priv_list['page-services-loadbalancer-relay-action-edit'] = array(); -$priv_list['page-services-loadbalancer-relay-action-edit']['name'] = "WebCfg - Services: Load Balancer: Relay Action: Edit page"; -$priv_list['page-services-loadbalancer-relay-action-edit']['descr'] = "Allow access to the 'Services: Load Balancer: Relay Action: Edit' page."; +$priv_list['page-services-loadbalancer-relay-action-edit']['name'] = gettext("WebCfg - Services: Load Balancer: Relay Action: Edit page"); +$priv_list['page-services-loadbalancer-relay-action-edit']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Relay Action: Edit' page."); $priv_list['page-services-loadbalancer-relay-action-edit']['match'] = array(); $priv_list['page-services-loadbalancer-relay-action-edit']['match'][] = "load_balancer_relay_action_edit.php*"; $priv_list['page-services-loadbalancer-relay-protocol'] = array(); -$priv_list['page-services-loadbalancer-relay-protocol']['name'] = "WebCfg - Services: Load Balancer: Relay Protocols page"; -$priv_list['page-services-loadbalancer-relay-protocol']['descr'] = "Allow access to the 'Services: Load Balancer: Relay Protocols' page."; +$priv_list['page-services-loadbalancer-relay-protocol']['name'] = gettext("WebCfg - Services: Load Balancer: Relay Protocols page"); +$priv_list['page-services-loadbalancer-relay-protocol']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Relay Protocols' page."); $priv_list['page-services-loadbalancer-relay-protocol']['match'] = array(); $priv_list['page-services-loadbalancer-relay-protocol']['match'][] = "load_balancer_relay_protocol.php*"; $priv_list['page-services-loadbalancer-virtualservers'] = array(); -$priv_list['page-services-loadbalancer-virtualservers']['name'] = "WebCfg - Services: Load Balancer: Virtual Servers page"; -$priv_list['page-services-loadbalancer-virtualservers']['descr'] = "Allow access to the 'Services: Load Balancer: Virtual Servers' page."; +$priv_list['page-services-loadbalancer-virtualservers']['name'] = gettext("WebCfg - Services: Load Balancer: Virtual Servers page"); +$priv_list['page-services-loadbalancer-virtualservers']['descr'] = gettext("Allow access to the 'Services: Load Balancer: Virtual Servers' page."); $priv_list['page-services-loadbalancer-virtualservers']['match'] = array(); $priv_list['page-services-loadbalancer-virtualservers']['match'][] = "load_balancer_virtual_server.php*"; $priv_list['page-loadbalancer-virtualserver-edit'] = array(); -$priv_list['page-loadbalancer-virtualserver-edit']['name'] = "WebCfg - Load Balancer: Virtual Server: Edit page"; -$priv_list['page-loadbalancer-virtualserver-edit']['descr'] = "Allow access to the 'Load Balancer: Virtual Server: Edit' page."; +$priv_list['page-loadbalancer-virtualserver-edit']['name'] = gettext("WebCfg - Load Balancer: Virtual Server: Edit page"); +$priv_list['page-loadbalancer-virtualserver-edit']['descr'] = gettext("Allow access to the 'Load Balancer: Virtual Server: Edit' page."); $priv_list['page-loadbalancer-virtualserver-edit']['match'] = array(); $priv_list['page-loadbalancer-virtualserver-edit']['match'][] = "load_balancer_virtual_server_edit.php*"; $priv_list['page-package-edit'] = array(); -$priv_list['page-package-edit']['name'] = "WebCfg - Package: Edit page"; -$priv_list['page-package-edit']['descr'] = "Allow access to the 'Package: Edit' page."; +$priv_list['page-package-edit']['name'] = gettext("WebCfg - Package: Edit page"); +$priv_list['page-package-edit']['descr'] = gettext("Allow access to the 'Package: Edit' page."); $priv_list['page-package-edit']['match'] = array(); $priv_list['page-package-edit']['match'][] = "pkg_edit.php*"; $priv_list['page-system-packagemanager-installpackage'] = array(); -$priv_list['page-system-packagemanager-installpackage']['name'] = "WebCfg - System: Package Manager: Install Package page"; -$priv_list['page-system-packagemanager-installpackage']['descr'] = "Allow access to the 'System: Package Manager: Install Package' page."; +$priv_list['page-system-packagemanager-installpackage']['name'] = gettext("WebCfg - System: Package Manager: Install Package page"); +$priv_list['page-system-packagemanager-installpackage']['descr'] = gettext("Allow access to the 'System: Package Manager: Install Package' page."); $priv_list['page-system-packagemanager-installpackage']['match'] = array(); $priv_list['page-system-packagemanager-installpackage']['match'][] = "pkg_mgr_install.php*"; $priv_list['page-system-packagemanager-installed'] = array(); -$priv_list['page-system-packagemanager-installed']['name'] = "WebCfg - System: Package Manager: Installed page"; -$priv_list['page-system-packagemanager-installed']['descr'] = "Allow access to the 'System: Package Manager: Installed' page."; +$priv_list['page-system-packagemanager-installed']['name'] = gettext("WebCfg - System: Package Manager: Installed page"); +$priv_list['page-system-packagemanager-installed']['descr'] = gettext("Allow access to the 'System: Package Manager: Installed' page."); $priv_list['page-system-packagemanager-installed']['match'] = array(); $priv_list['page-system-packagemanager-installed']['match'][] = "pkg_mgr_installed.php*"; $priv_list['page-diagnostics-rebootsystem'] = array(); -$priv_list['page-diagnostics-rebootsystem']['name'] = "WebCfg - Diagnostics: Reboot System page"; -$priv_list['page-diagnostics-rebootsystem']['descr'] = "Allow access to the 'Diagnostics: Reboot System' page."; +$priv_list['page-diagnostics-rebootsystem']['name'] = gettext("WebCfg - Diagnostics: Reboot System page"); +$priv_list['page-diagnostics-rebootsystem']['descr'] = gettext("Allow access to the 'Diagnostics: Reboot System' page."); $priv_list['page-diagnostics-rebootsystem']['match'] = array(); $priv_list['page-diagnostics-rebootsystem']['match'][] = "reboot.php*"; $priv_list['page-services-captiveportal-filemanager'] = array(); -$priv_list['page-services-captiveportal-filemanager']['name'] = "WebCfg - Services: Captive portal: File Manager page"; -$priv_list['page-services-captiveportal-filemanager']['descr'] = "Allow access to the 'Services: Captive portal: File Manager' page."; +$priv_list['page-services-captiveportal-filemanager']['name'] = gettext("WebCfg - Services: Captive portal: File Manager page"); +$priv_list['page-services-captiveportal-filemanager']['descr'] = gettext("Allow access to the 'Services: Captive portal: File Manager' page."); $priv_list['page-services-captiveportal-filemanager']['match'] = array(); $priv_list['page-services-captiveportal-filemanager']['match'][] = "services_captiveportal_filemanager.php*"; $priv_list['page-diagnostics-restart-httpd'] = array(); -$priv_list['page-diagnostics-restart-httpd']['name'] = "WebCfg - Diagnostics: Restart HTTPD : System page"; -$priv_list['page-diagnostics-restart-httpd']['descr'] = "Allow access to the 'Diagnostics: Restart HTTPD: System' page."; +$priv_list['page-diagnostics-restart-httpd']['name'] = gettext("WebCfg - Diagnostics: Restart HTTPD : System page"); +$priv_list['page-diagnostics-restart-httpd']['descr'] = gettext("Allow access to the 'Diagnostics: Restart HTTPD: System' page."); $priv_list['page-diagnostics-restart-httpd']['match'] = array(); $priv_list['page-diagnostics-restart-httpd']['match'][] = "restart_httpd.php*"; $priv_list['page-services-captiveportal'] = array(); -$priv_list['page-services-captiveportal']['name'] = "WebCfg - Services: Captive portal page"; -$priv_list['page-services-captiveportal']['descr'] = "Allow access to the 'Services: Captive portal' page."; +$priv_list['page-services-captiveportal']['name'] = gettext("WebCfg - Services: Captive portal page"); +$priv_list['page-services-captiveportal']['descr'] = gettext("Allow access to the 'Services: Captive portal' page."); $priv_list['page-services-captiveportal']['match'] = array(); $priv_list['page-services-captiveportal']['match'][] = "services_captiveportal.php*"; $priv_list['page-services-captiveportal-macaddresses'] = array(); -$priv_list['page-services-captiveportal-macaddresses']['name'] = "WebCfg - Services: Captive portal: Mac Addresses page"; -$priv_list['page-services-captiveportal-macaddresses']['descr'] = "Allow access to the 'Services: Captive portal: Mac Addresses' page."; +$priv_list['page-services-captiveportal-macaddresses']['name'] = gettext("WebCfg - Services: Captive portal: Mac Addresses page"); +$priv_list['page-services-captiveportal-macaddresses']['descr'] = gettext("Allow access to the 'Services: Captive portal: Mac Addresses' page."); $priv_list['page-services-captiveportal-macaddresses']['match'] = array(); $priv_list['page-services-captiveportal-macaddresses']['match'][] = "services_captiveportal_mac.php*"; $priv_list['page-services-captiveportal-editmacaddresses'] = array(); -$priv_list['page-services-captiveportal-editmacaddresses']['name'] = "WebCfg - Services: Captive portal: Edit MAC Addresses page"; -$priv_list['page-services-captiveportal-editmacaddresses']['descr'] = "Allow access to the 'Services: Captive portal: Edit MAC Addresses' page."; +$priv_list['page-services-captiveportal-editmacaddresses']['name'] = gettext("WebCfg - Services: Captive portal: Edit MAC Addresses page"); +$priv_list['page-services-captiveportal-editmacaddresses']['descr'] = gettext("Allow access to the 'Services: Captive portal: Edit MAC Addresses' page."); $priv_list['page-services-captiveportal-editmacaddresses']['match'] = array(); $priv_list['page-services-captiveportal-editmacaddresses']['match'][] = "services_captiveportal_mac_edit.php*"; $priv_list['page-services-dhcpserver-editstaticmapping'] = array(); -$priv_list['page-services-dhcpserver-editstaticmapping']['name'] = "WebCfg - Services: DHCP Server : Edit static mapping page"; -$priv_list['page-services-dhcpserver-editstaticmapping']['descr'] = "Allow access to the 'Services: DHCP Server : Edit static mapping' page."; +$priv_list['page-services-dhcpserver-editstaticmapping']['name'] = gettext("WebCfg - Services: DHCP Server : Edit static mapping page"); +$priv_list['page-services-dhcpserver-editstaticmapping']['descr'] = gettext("Allow access to the 'Services: DHCP Server : Edit static mapping' page."); $priv_list['page-services-dhcpserver-editstaticmapping']['match'] = array(); $priv_list['page-services-dhcpserver-editstaticmapping']['match'][] = "services_dhcp_edit.php*"; $priv_list['page-services-dhcprelay'] = array(); -$priv_list['page-services-dhcprelay']['name'] = "WebCfg - Services: DHCP Relay page"; -$priv_list['page-services-dhcprelay']['descr'] = "Allow access to the 'Services: DHCP Relay' page."; +$priv_list['page-services-dhcprelay']['name'] = gettext("WebCfg - Services: DHCP Relay page"); +$priv_list['page-services-dhcprelay']['descr'] = gettext("Allow access to the 'Services: DHCP Relay' page."); $priv_list['page-services-dhcprelay']['match'] = array(); $priv_list['page-services-dhcprelay']['match'][] = "services_dhcp_relay.php*"; $priv_list['page-services-dhcpserver'] = array(); -$priv_list['page-services-dhcpserver']['name'] = "WebCfg - Services: DHCP server page"; -$priv_list['page-services-dhcpserver']['descr'] = "Allow access to the 'Services: DHCP server' page."; +$priv_list['page-services-dhcpserver']['name'] = gettext("WebCfg - Services: DHCP server page"); +$priv_list['page-services-dhcpserver']['descr'] = gettext("Allow access to the 'Services: DHCP server' page."); $priv_list['page-services-dhcpserver']['match'] = array(); $priv_list['page-services-dhcpserver']['match'][] = "services_dhcp.php*"; $priv_list['page-services-dnsforwarder'] = array(); -$priv_list['page-services-dnsforwarder']['name'] = "WebCfg - Services: DNS Forwarder page"; -$priv_list['page-services-dnsforwarder']['descr'] = "Allow access to the 'Services: DNS Forwarder' page."; +$priv_list['page-services-dnsforwarder']['name'] = gettext("WebCfg - Services: DNS Forwarder page"); +$priv_list['page-services-dnsforwarder']['descr'] = gettext("Allow access to the 'Services: DNS Forwarder' page."); $priv_list['page-services-dnsforwarder']['match'] = array(); $priv_list['page-services-dnsforwarder']['match'][] = "services_dnsmasq.php*"; $priv_list['page-services-igmpproxy'] = array(); -$priv_list['page-services-igmpproxy']['name'] = "WebCfg - Services: Igmpproxy page"; -$priv_list['page-services-igmpproxy']['descr'] = "Allow access to the 'Services: Igmpproxy' page."; +$priv_list['page-services-igmpproxy']['name'] = gettext("WebCfg - Services: Igmpproxy page"); +$priv_list['page-services-igmpproxy']['descr'] = gettext("Allow access to the 'Services: Igmpproxy' page."); $priv_list['page-services-igmpproxy']['match'] = array(); $priv_list['page-services-igmpproxy']['match'][] = "services_igmpproxy.php*"; $priv_list['page-services-dnsforwarder-edithost'] = array(); -$priv_list['page-services-dnsforwarder-edithost']['name'] = "WebCfg - Services: DNS Forwarder: Edit host page"; -$priv_list['page-services-dnsforwarder-edithost']['descr'] = "Allow access to the 'Services: DNS Forwarder: Edit host' page."; +$priv_list['page-services-dnsforwarder-edithost']['name'] = gettext("WebCfg - Services: DNS Forwarder: Edit host page"); +$priv_list['page-services-dnsforwarder-edithost']['descr'] = gettext("Allow access to the 'Services: DNS Forwarder: Edit host' page."); $priv_list['page-services-dnsforwarder-edithost']['match'] = array(); $priv_list['page-services-dnsforwarder-edithost']['match'][] = "services_dnsmasq_edit.php*"; $priv_list['page-services-dynamicdnsclients'] = array(); -$priv_list['page-services-dynamicdnsclients']['name'] = "WebCfg - Services: Dynamic DNS clients page"; -$priv_list['page-services-dynamicdnsclients']['descr'] = "Allow access to the 'Services: Dynamic DNS clients' page."; +$priv_list['page-services-dynamicdnsclients']['name'] = gettext("WebCfg - Services: Dynamic DNS clients page"); +$priv_list['page-services-dynamicdnsclients']['descr'] = gettext("Allow access to the 'Services: Dynamic DNS clients' page."); $priv_list['page-services-dynamicdnsclients']['match'] = array(); $priv_list['page-services-dynamicdnsclients']['match'][] = "services_dyndns.php*"; $priv_list['page-system-usermanager-settings-testldap'] = array(); -$priv_list['page-system-usermanager-settings-testldap']['name'] = "WebCfg - System: User Manager: Settings: Test LDAP page"; -$priv_list['page-system-usermanager-settings-testldap']['descr'] = "Allow access to the 'System: User Manager: Settings: Test LDAP' page."; +$priv_list['page-system-usermanager-settings-testldap']['name'] = gettext("WebCfg - System: User Manager: Settings: Test LDAP page"); +$priv_list['page-system-usermanager-settings-testldap']['descr'] = gettext("Allow access to the 'System: User Manager: Settings: Test LDAP' page."); $priv_list['page-system-usermanager-settings-testldap']['match'] = array(); $priv_list['page-system-usermanager-settings-testldap']['match'][] = "system_usermanager_settings_test.php*"; $priv_list['page-services-dynamicdnsclient'] = array(); -$priv_list['page-services-dynamicdnsclient']['name'] = "WebCfg - Services: Dynamic DNS client page"; -$priv_list['page-services-dynamicdnsclient']['descr'] = "Allow access to the 'Services: Dynamic DNS client' page."; +$priv_list['page-services-dynamicdnsclient']['name'] = gettext("WebCfg - Services: Dynamic DNS client page"); +$priv_list['page-services-dynamicdnsclient']['descr'] = gettext("Allow access to the 'Services: Dynamic DNS client' page."); $priv_list['page-services-dynamicdnsclient']['match'] = array(); $priv_list['page-services-dynamicdnsclient']['match'][] = "services_dyndns_edit.php*"; $priv_list['page-services-igmpproxy'] = array(); -$priv_list['page-services-igmpproxy']['name'] = "WebCfg - Firewall: Igmpproxy: Edit page"; -$priv_list['page-services-igmpproxy']['descr'] = "Allow access to the 'Firewall: Igmpproxy' page."; +$priv_list['page-services-igmpproxy']['name'] = gettext("WebCfg - Firewall: Igmpproxy: Edit page"); +$priv_list['page-services-igmpproxy']['descr'] = gettext("Allow access to the 'Firewall: Igmpproxy' page."); $priv_list['page-services-igmpproxy']['match'] = array(); $priv_list['page-services-igmpproxy']['match'][] = "services_igmpproxy_edit.php*"; $priv_list['page-services-proxyarp'] = array(); -$priv_list['page-services-proxyarp']['name'] = "WebCfg - Services: Proxy ARP page"; -$priv_list['page-services-proxyarp']['descr'] = "Allow access to the 'Services: Proxy ARP' page."; +$priv_list['page-services-proxyarp']['name'] = gettext("WebCfg - Services: Proxy ARP page"); +$priv_list['page-services-proxyarp']['descr'] = gettext("Allow access to the 'Services: Proxy ARP' page."); $priv_list['page-services-proxyarp']['match'] = array(); $priv_list['page-services-proxyarp']['match'][] = "services_proxyarp.php*"; $priv_list['page-services-proxyarp-edit'] = array(); -$priv_list['page-services-proxyarp-edit']['name'] = "WebCfg - Services: Proxy ARP: Edit page"; -$priv_list['page-services-proxyarp-edit']['descr'] = "Allow access to the 'Services: Proxy ARP: Edit' page."; +$priv_list['page-services-proxyarp-edit']['name'] = gettext("WebCfg - Services: Proxy ARP: Edit page"); +$priv_list['page-services-proxyarp-edit']['descr'] = gettext("Allow access to the 'Services: Proxy ARP: Edit' page."); $priv_list['page-services-proxyarp-edit']['match'] = array(); $priv_list['page-services-proxyarp-edit']['match'][] = "services_proxyarp_edit.php*"; $priv_list['page-services-rfc2136clients'] = array(); -$priv_list['page-services-rfc2136clients']['name'] = "WebCfg - Services: RFC 2136 clients page"; -$priv_list['page-services-rfc2136clients']['descr'] = "Allow access to the 'Services: RFC 2136 clients' page."; +$priv_list['page-services-rfc2136clients']['name'] = gettext("WebCfg - Services: RFC 2136 clients page"); +$priv_list['page-services-rfc2136clients']['descr'] = gettext("Allow access to the 'Services: RFC 2136 clients' page."); $priv_list['page-services-rfc2136clients']['match'] = array(); $priv_list['page-services-rfc2136clients']['match'][] = "services_rfc2136.php*"; $priv_list['page-services-snmp'] = array(); -$priv_list['page-services-snmp']['name'] = "WebCfg - Services: SNMP page"; -$priv_list['page-services-snmp']['descr'] = "Allow access to the 'Services: SNMP' page."; +$priv_list['page-services-snmp']['name'] = gettext("WebCfg - Services: SNMP page"); +$priv_list['page-services-snmp']['descr'] = gettext("Allow access to the 'Services: SNMP' page."); $priv_list['page-services-snmp']['match'] = array(); $priv_list['page-services-snmp']['match'][] = "services_snmp.php*"; $priv_list['page-firewall-rules'] = array(); -$priv_list['page-firewall-rules']['name'] = "WebCfg - Firewall: Rules page"; -$priv_list['page-firewall-rules']['descr'] = "Allow access to the 'Firewall: Rules' page."; +$priv_list['page-firewall-rules']['name'] = gettext("WebCfg - Firewall: Rules page"); +$priv_list['page-firewall-rules']['descr'] = gettext("Allow access to the 'Firewall: Rules' page."); $priv_list['page-firewall-rules']['match'] = array(); $priv_list['page-firewall-rules']['match'][] = "firewall_rules.php*"; $priv_list['page-services-wakeonlan'] = array(); -$priv_list['page-services-wakeonlan']['name'] = "WebCfg - Services: Wake on LAN page"; -$priv_list['page-services-wakeonlan']['descr'] = "Allow access to the 'Services: Wake on LAN' page."; +$priv_list['page-services-wakeonlan']['name'] = gettext("WebCfg - Services: Wake on LAN page"); +$priv_list['page-services-wakeonlan']['descr'] = gettext("Allow access to the 'Services: Wake on LAN' page."); $priv_list['page-services-wakeonlan']['match'] = array(); $priv_list['page-services-wakeonlan']['match'][] = "services_wol.php*"; $priv_list['page-services-wakeonlan-edit'] = array(); -$priv_list['page-services-wakeonlan-edit']['name'] = "WebCfg - Services: Wake on LAN: Edit page"; -$priv_list['page-services-wakeonlan-edit']['descr'] = "Allow access to the 'Services: Wake on LAN: Edit' page."; +$priv_list['page-services-wakeonlan-edit']['name'] = gettext("WebCfg - Services: Wake on LAN: Edit page"); +$priv_list['page-services-wakeonlan-edit']['descr'] = gettext("Allow access to the 'Services: Wake on LAN: Edit' page."); $priv_list['page-services-wakeonlan-edit']['match'] = array(); $priv_list['page-services-wakeonlan-edit']['match'][] = "services_wol_edit.php*"; $priv_list['page-hidden-detailedstatus'] = array(); -$priv_list['page-hidden-detailedstatus']['name'] = "WebCfg - Hidden: Detailed Status page"; -$priv_list['page-hidden-detailedstatus']['descr'] = "Allow access to the 'Hidden: Detailed Status' page."; +$priv_list['page-hidden-detailedstatus']['name'] = gettext("WebCfg - Hidden: Detailed Status page"); +$priv_list['page-hidden-detailedstatus']['descr'] = gettext("Allow access to the 'Hidden: Detailed Status' page."); $priv_list['page-hidden-detailedstatus']['match'] = array(); $priv_list['page-hidden-detailedstatus']['match'][] = "status.php*"; $priv_list['page-status-captiveportal'] = array(); -$priv_list['page-status-captiveportal']['name'] = "WebCfg - Status: Captive portal page"; -$priv_list['page-status-captiveportal']['descr'] = "Allow access to the 'Status: Captive portal' page."; +$priv_list['page-status-captiveportal']['name'] = gettext("WebCfg - Status: Captive portal page"); +$priv_list['page-status-captiveportal']['descr'] = gettext("Allow access to the 'Status: Captive portal' page."); $priv_list['page-status-captiveportal']['match'] = array(); $priv_list['page-status-captiveportal']['match'][] = "status_captiveportal.php*"; $priv_list['page-status-filterreloadstatus'] = array(); -$priv_list['page-status-filterreloadstatus']['name'] = "WebCfg - Status: Filter Reload Status page"; -$priv_list['page-status-filterreloadstatus']['descr'] = "Allow access to the 'Status: Filter Reload Status' page."; +$priv_list['page-status-filterreloadstatus']['name'] = gettext("WebCfg - Status: Filter Reload Status page"); +$priv_list['page-status-filterreloadstatus']['descr'] = gettext("Allow access to the 'Status: Filter Reload Status' page."); $priv_list['page-status-filterreloadstatus']['match'] = array(); $priv_list['page-status-filterreloadstatus']['match'][] = "status_filter_reload.php*"; $priv_list['page-status-gateways'] = array(); -$priv_list['page-status-gateways']['name'] = "WebCfg - Status: Gateways page"; -$priv_list['page-status-gateways']['descr'] = "Allow access to the 'Status: Gateways' page."; +$priv_list['page-status-gateways']['name'] = gettext("WebCfg - Status: Gateways page"); +$priv_list['page-status-gateways']['descr'] = gettext("Allow access to the 'Status: Gateways' page."); $priv_list['page-status-gateways']['match'] = array(); $priv_list['page-status-gateways']['match'][] = "status_gateways.php*"; $priv_list['page-status-cpuload'] = array(); -$priv_list['page-status-cpuload']['name'] = "WebCfg - Status: CPU load page"; -$priv_list['page-status-cpuload']['descr'] = "Allow access to the 'Status: CPU load' page."; +$priv_list['page-status-cpuload']['name'] = gettext("WebCfg - Status: CPU load page"); +$priv_list['page-status-cpuload']['descr'] = gettext("Allow access to the 'Status: CPU load' page."); $priv_list['page-status-cpuload']['match'] = array(); $priv_list['page-status-cpuload']['match'][] = "status_graph_cpu.php*"; $priv_list['page-status-gatewaygroups'] = array(); -$priv_list['page-status-gatewaygroups']['name'] = "WebCfg - Status: Gateway Groups page"; -$priv_list['page-status-gatewaygroups']['descr'] = "Allow access to the 'Status: Gateway Groups' page."; +$priv_list['page-status-gatewaygroups']['name'] = gettext("WebCfg - Status: Gateway Groups page"); +$priv_list['page-status-gatewaygroups']['descr'] = gettext("Allow access to the 'Status: Gateway Groups' page."); $priv_list['page-status-gatewaygroups']['match'] = array(); $priv_list['page-status-gatewaygroups']['match'][] = "status_gateway_groups.php*"; $priv_list['page-status-interfaces'] = array(); -$priv_list['page-status-interfaces']['name'] = "WebCfg - Status: Interfaces page"; -$priv_list['page-status-interfaces']['descr'] = "Allow access to the 'Status: Interfaces' page."; +$priv_list['page-status-interfaces']['name'] = gettext("WebCfg - Status: Interfaces page"); +$priv_list['page-status-interfaces']['descr'] = gettext("Allow access to the 'Status: Interfaces' page."); $priv_list['page-status-interfaces']['match'] = array(); $priv_list['page-status-interfaces']['match'][] = "status_interfaces.php*"; $priv_list['page-status-openvpn'] = array(); -$priv_list['page-status-openvpn']['name'] = "WebCfg - Status: OpenVPN page"; -$priv_list['page-status-openvpn']['descr'] = "Allow access to the 'Status: OpenVPN' page."; +$priv_list['page-status-openvpn']['name'] = gettext("WebCfg - Status: OpenVPN page"); +$priv_list['page-status-openvpn']['descr'] = gettext("Allow access to the 'Status: OpenVPN' page."); $priv_list['page-status-openvpn']['match'] = array(); $priv_list['page-status-openvpn']['match'][] = "status_openvpn.php*"; $priv_list['page-status-trafficshaper-queues'] = array(); -$priv_list['page-status-trafficshaper-queues']['name'] = "WebCfg - Status: Traffic shaper: Queues page"; -$priv_list['page-status-trafficshaper-queues']['descr'] = "Allow access to the 'Status: Traffic shaper: Queues' page."; +$priv_list['page-status-trafficshaper-queues']['name'] = gettext("WebCfg - Status: Traffic shaper: Queues page"); +$priv_list['page-status-trafficshaper-queues']['descr'] = gettext("Allow access to the 'Status: Traffic shaper: Queues' page."); $priv_list['page-status-trafficshaper-queues']['match'] = array(); $priv_list['page-status-trafficshaper-queues']['match'][] = "status_queues.php*"; $priv_list['page-status-rrdgraphs'] = array(); -$priv_list['page-status-rrdgraphs']['name'] = "WebCfg - Status: RRD Graphs page"; -$priv_list['page-status-rrdgraphs']['descr'] = "Allow access to the 'Status: RRD Graphs' page."; +$priv_list['page-status-rrdgraphs']['name'] = gettext("WebCfg - Status: RRD Graphs page"); +$priv_list['page-status-rrdgraphs']['descr'] = gettext("Allow access to the 'Status: RRD Graphs' page."); $priv_list['page-status-rrdgraphs']['match'] = array(); $priv_list['page-status-rrdgraphs']['match'][] = "status_rrd_graph.php*"; $priv_list['page-status-rrdgraphs']['match'][] = "status_rrd_graph_img.php*"; $priv_list['page-status-rrdgraph-settings'] = array(); -$priv_list['page-status-rrdgraph-settings']['name'] = "WebCfg - Status: RRD Graphs settings page"; -$priv_list['page-status-rrdgraph-settings']['descr'] = "Allow access to the 'Status: RRD Graphs: settings' page."; +$priv_list['page-status-rrdgraph-settings']['name'] = gettext("WebCfg - Status: RRD Graphs settings page"); +$priv_list['page-status-rrdgraph-settings']['descr'] = gettext("Allow access to the 'Status: RRD Graphs: settings' page."); $priv_list['page-status-rrdgraph-settings']['match'] = array(); $priv_list['page-status-rrdgraph-settings']['match'][] = "status_rrd_graph_settings.php*"; $priv_list['page-status-services'] = array(); -$priv_list['page-status-services']['name'] = "WebCfg - Status: Services page"; -$priv_list['page-status-services']['descr'] = "Allow access to the 'Status: Services' page."; +$priv_list['page-status-services']['name'] = gettext("WebCfg - Status: Services page"); +$priv_list['page-status-services']['descr'] = gettext("Allow access to the 'Status: Services' page."); $priv_list['page-status-services']['match'] = array(); $priv_list['page-status-services']['match'][] = "status_services.php*"; $priv_list['page-status-loadbalancer-pool'] = array(); -$priv_list['page-status-loadbalancer-pool']['name'] = "WebCfg - Status: Load Balancer: Pool page"; -$priv_list['page-status-loadbalancer-pool']['descr'] = "Allow access to the 'Status: Load Balancer: Pool' page."; +$priv_list['page-status-loadbalancer-pool']['name'] = gettext("WebCfg - Status: Load Balancer: Pool page"); +$priv_list['page-status-loadbalancer-pool']['descr'] = gettext("Allow access to the 'Status: Load Balancer: Pool' page."); $priv_list['page-status-loadbalancer-pool']['match'] = array(); $priv_list['page-status-loadbalancer-pool']['match'][] = "status_lb_pool.php*"; $priv_list['page-status-loadbalancer-virtualserver'] = array(); -$priv_list['page-status-loadbalancer-virtualserver']['name'] = "WebCfg - Status: Load Balancer: Virtual Server page"; -$priv_list['page-status-loadbalancer-virtualserver']['descr'] = "Allow access to the 'Status: Load Balancer: Virtual Server' page."; +$priv_list['page-status-loadbalancer-virtualserver']['name'] = gettext("WebCfg - Status: Load Balancer: Virtual Server page"); +$priv_list['page-status-loadbalancer-virtualserver']['descr'] = gettext("Allow access to the 'Status: Load Balancer: Virtual Server' page."); $priv_list['page-status-loadbalancer-virtualserver']['match'] = array(); $priv_list['page-status-loadbalancer-virtualserver']['match'][] = "status_lb_vs.php*"; $priv_list['page-status-upnpstatus'] = array(); -$priv_list['page-status-upnpstatus']['name'] = "WebCfg - Status: UPnP Status page"; -$priv_list['page-status-upnpstatus']['descr'] = "Allow access to the 'Status: UPnP Status' page."; +$priv_list['page-status-upnpstatus']['name'] = gettext("WebCfg - Status: UPnP Status page"); +$priv_list['page-status-upnpstatus']['descr'] = gettext("Allow access to the 'Status: UPnP Status' page."); $priv_list['page-status-upnpstatus']['match'] = array(); $priv_list['page-status-upnpstatus']['match'][] = "status_upnp.php*"; $priv_list['page-diagnostics-wirelessstatus'] = array(); -$priv_list['page-diagnostics-wirelessstatus']['name'] = "WebCfg - Status: Wireless page"; -$priv_list['page-diagnostics-wirelessstatus']['descr'] = "Allow access to the 'Status: Wireless' page."; +$priv_list['page-diagnostics-wirelessstatus']['name'] = gettext("WebCfg - Status: Wireless page"); +$priv_list['page-diagnostics-wirelessstatus']['descr'] = gettext("Allow access to the 'Status: Wireless' page."); $priv_list['page-diagnostics-wirelessstatus']['match'] = array(); $priv_list['page-diagnostics-wirelessstatus']['match'][] = "status_wireless.php*"; $priv_list['page-system-generalsetup'] = array(); -$priv_list['page-system-generalsetup']['name'] = "WebCfg - System: General Setup page"; -$priv_list['page-system-generalsetup']['descr'] = "Allow access to the 'System: General Setup' page."; +$priv_list['page-system-generalsetup']['name'] = gettext("WebCfg - System: General Setup page"); +$priv_list['page-system-generalsetup']['descr'] = gettext("Allow access to the 'System: General Setup' page."); $priv_list['page-system-generalsetup']['match'] = array(); $priv_list['page-system-generalsetup']['match'][] = "system.php*"; $priv_list['page-system-advanced-admin'] = array(); -$priv_list['page-system-advanced-admin']['name'] = "WebCfg - System: Advanced: Admin Access Page"; -$priv_list['page-system-advanced-admin']['descr'] = "Allow access to the 'System: Advanced: Admin Access' page."; +$priv_list['page-system-advanced-admin']['name'] = gettext("WebCfg - System: Advanced: Admin Access Page"); +$priv_list['page-system-advanced-admin']['descr'] = gettext("Allow access to the 'System: Advanced: Admin Access' page."); $priv_list['page-system-advanced-admin']['match'] = array(); $priv_list['page-system-advanced-admin']['match'][] = "system_advanced_admin.php*"; $priv_list['page-system-firmware-manualupdate'] = array(); -$priv_list['page-system-firmware-manualupdate']['name'] = "WebCfg - System: Firmware: Manual Update page"; -$priv_list['page-system-firmware-manualupdate']['descr'] = "Allow access to the 'System: Firmware: Manual Update' page."; +$priv_list['page-system-firmware-manualupdate']['name'] = gettext("WebCfg - System: Firmware: Manual Update page"); +$priv_list['page-system-firmware-manualupdate']['descr'] = gettext("Allow access to the 'System: Firmware: Manual Update' page."); $priv_list['page-system-firmware-manualupdate']['match'] = array(); $priv_list['page-system-firmware-manualupdate']['match'][] = "system_firmware.php*"; $priv_list['page-system-firmware-checkforupdate'] = array(); -$priv_list['page-system-firmware-checkforupdate']['name'] = "WebCfg - System: Firmware: Check For Update page"; -$priv_list['page-system-firmware-checkforupdate']['descr'] = "Allow access to the 'System: Firmware: Check For Update' page."; +$priv_list['page-system-firmware-checkforupdate']['name'] = gettext("WebCfg - System: Firmware: Check For Update page"); +$priv_list['page-system-firmware-checkforupdate']['descr'] = gettext("Allow access to the 'System: Firmware: Check For Update' page."); $priv_list['page-system-firmware-checkforupdate']['match'] = array(); $priv_list['page-system-firmware-checkforupdate']['match'][] = "system_firmware_auto.php*"; $priv_list['page-system-advanced-firewall'] = array(); -$priv_list['page-system-advanced-firewall']['name'] = "WebCfg - System: Advanced: Firewall and NAT page"; -$priv_list['page-system-advanced-firewall']['descr'] = "Allow access to the 'System: Advanced: Firewall and NAT' page."; +$priv_list['page-system-advanced-firewall']['name'] = gettext("WebCfg - System: Advanced: Firewall and NAT page"); +$priv_list['page-system-advanced-firewall']['descr'] = gettext("Allow access to the 'System: Advanced: Firewall and NAT' page."); $priv_list['page-system-advanced-firewall']['match'] = array(); $priv_list['page-system-advanced-firewall']['match'][] = "system_advanced.php*"; $priv_list['page-system-advanced-misc'] = array(); -$priv_list['page-system-advanced-misc']['name'] = "WebCfg - System: Advanced: Miscellaneous page"; -$priv_list['page-system-advanced-misc']['descr'] = "Allow access to the 'System: Advanced: Miscellaneous' page."; +$priv_list['page-system-advanced-misc']['name'] = gettext("WebCfg - System: Advanced: Miscellaneous page"); +$priv_list['page-system-advanced-misc']['descr'] = gettext("Allow access to the 'System: Advanced: Miscellaneous' page."); $priv_list['page-system-advanced-misc']['match'] = array(); $priv_list['page-system-advanced-misc']['match'][] = "system_advanced.php*"; $priv_list['page-system-advanced-network'] = array(); -$priv_list['page-system-advanced-network']['name'] = "WebCfg - System: Advanced: Network page"; -$priv_list['page-system-advanced-network']['descr'] = "Allow access to the 'System: Advanced: Networking' page."; +$priv_list['page-system-advanced-network']['name'] = gettext("WebCfg - System: Advanced: Network page"); +$priv_list['page-system-advanced-network']['descr'] = gettext("Allow access to the 'System: Advanced: Networking' page."); $priv_list['page-system-advanced-network']['match'] = array(); $priv_list['page-system-advanced-network']['match'][] = "system_advanced-network.php*"; $priv_list['page-system-advanced-sysctl'] = array(); -$priv_list['page-system-advanced-sysctl']['name'] = "WebCfg - System: Advanced: Tunables page"; -$priv_list['page-system-advanced-sysctl']['descr'] = "Allow access to the 'System: Advanced: Tunables' page."; +$priv_list['page-system-advanced-sysctl']['name'] = gettext("WebCfg - System: Advanced: Tunables page"); +$priv_list['page-system-advanced-sysctl']['descr'] = gettext("Allow access to the 'System: Advanced: Tunables' page."); $priv_list['page-system-advanced-sysctl']['match'] = array(); $priv_list['page-system-advanced-sysctl']['match'][] = "system_advanced-sysctrl.php*"; $priv_list['page-system-authservers'] = array(); -$priv_list['page-system-authservers']['name'] = "WebCfg - System: Authentication Servers"; -$priv_list['page-system-authservers']['descr'] = "Allow access to the 'System: Authentication Servers' page."; +$priv_list['page-system-authservers']['name'] = gettext("WebCfg - System: Authentication Servers"); +$priv_list['page-system-authservers']['descr'] = gettext("Allow access to the 'System: Authentication Servers' page."); $priv_list['page-system-authservers']['match'] = array(); $priv_list['page-system-authservers']['match'][] = "system_authservers.php*"; $priv_list['page-system-camanager'] = array(); -$priv_list['page-system-camanager']['name'] = "WebCfg - System: CA Manager"; -$priv_list['page-system-camanager']['descr'] = "Allow access to the 'System: CA Manager' page."; +$priv_list['page-system-camanager']['name'] = gettext("WebCfg - System: CA Manager"); +$priv_list['page-system-camanager']['descr'] = gettext("Allow access to the 'System: CA Manager' page."); $priv_list['page-system-camanager']['match'] = array(); $priv_list['page-system-camanager']['match'][] = "system_camanager.php*"; $priv_list['page-system-certmanager'] = array(); -$priv_list['page-system-certmanager']['name'] = "WebCfg - System: Certificate Manager"; -$priv_list['page-system-certmanager']['descr'] = "Allow access to the 'System: Certificate Manager' page."; +$priv_list['page-system-certmanager']['name'] = gettext("WebCfg - System: Certificate Manager"); +$priv_list['page-system-certmanager']['descr'] = gettext("Allow access to the 'System: Certificate Manager' page."); $priv_list['page-system-certmanager']['match'] = array(); $priv_list['page-system-certmanager']['match'][] = "system_certmanager.php*"; $priv_list['page-system-firmware-autoupdate'] = array(); -$priv_list['page-system-firmware-autoupdate']['name'] = "WebCfg - System: Firmware: Auto Update page"; -$priv_list['page-system-firmware-autoupdate']['descr'] = "Allow access to the 'System: Firmware: Auto Update' page."; +$priv_list['page-system-firmware-autoupdate']['name'] = gettext("WebCfg - System: Firmware: Auto Update page"); +$priv_list['page-system-firmware-autoupdate']['descr'] = gettext("Allow access to the 'System: Firmware: Auto Update' page."); $priv_list['page-system-firmware-autoupdate']['match'] = array(); $priv_list['page-system-firmware-autoupdate']['match'][] = "system_firmware_check.php*"; $priv_list['page-system-firmware-settings'] = array(); -$priv_list['page-system-firmware-settings']['name'] = "WebCfg - System: Firmware: Settings page"; -$priv_list['page-system-firmware-settings']['descr'] = "Allow access to the 'System: Firmware: Settings' page."; +$priv_list['page-system-firmware-settings']['name'] = gettext("WebCfg - System: Firmware: Settings page"); +$priv_list['page-system-firmware-settings']['descr'] = gettext("Allow access to the 'System: Firmware: Settings' page."); $priv_list['page-system-firmware-settings']['match'] = array(); $priv_list['page-system-firmware-settings']['match'][] = "system_firmware_settings.php*"; $priv_list['page-system-gatewaygroups'] = array(); -$priv_list['page-system-gatewaygroups']['name'] = "WebCfg - System: Gateway Groups page"; -$priv_list['page-system-gatewaygroups']['descr'] = "Allow access to the 'System: Gateway Groups' page."; +$priv_list['page-system-gatewaygroups']['name'] = gettext("WebCfg - System: Gateway Groups page"); +$priv_list['page-system-gatewaygroups']['descr'] = gettext("Allow access to the 'System: Gateway Groups' page."); $priv_list['page-system-gatewaygroups']['match'] = array(); $priv_list['page-system-gatewaygroups']['match'][] = "system_gateway_groups.php*"; $priv_list['page-system-gateways-editgatewaygroups'] = array(); -$priv_list['page-system-gateways-editgatewaygroups']['name'] = "WebCfg - System: Gateways: Edit Gateway Groups page"; -$priv_list['page-system-gateways-editgatewaygroups']['descr'] = "Allow access to the 'System: Gateways: Edit Gateway Groups' page."; +$priv_list['page-system-gateways-editgatewaygroups']['name'] = gettext("WebCfg - System: Gateways: Edit Gateway Groups page"); +$priv_list['page-system-gateways-editgatewaygroups']['descr'] = gettext("Allow access to the 'System: Gateways: Edit Gateway Groups' page."); $priv_list['page-system-gateways-editgatewaygroups']['match'] = array(); $priv_list['page-system-gateways-editgatewaygroups']['match'][] = "system_gateway_groups_edit.php*"; $priv_list['page-system-gateways'] = array(); -$priv_list['page-system-gateways']['name'] = "WebCfg - System: Gateways page"; -$priv_list['page-system-gateways']['descr'] = "Allow access to the 'System: Gateways' page."; +$priv_list['page-system-gateways']['name'] = gettext("WebCfg - System: Gateways page"); +$priv_list['page-system-gateways']['descr'] = gettext("Allow access to the 'System: Gateways' page."); $priv_list['page-system-gateways']['match'] = array(); $priv_list['page-system-gateways']['match'][] = "system_gateways.php*"; $priv_list['page-system-staticroutes'] = array(); -$priv_list['page-system-staticroutes']['name'] = "WebCfg - System: Static Routes page"; -$priv_list['page-system-staticroutes']['descr'] = "Allow access to the 'System: Static Routes' page."; +$priv_list['page-system-staticroutes']['name'] = gettext("WebCfg - System: Static Routes page"); +$priv_list['page-system-staticroutes']['descr'] = gettext("Allow access to the 'System: Static Routes' page."); $priv_list['page-system-staticroutes']['match'] = array(); $priv_list['page-system-staticroutes']['match'][] = "system_routes.php*"; $priv_list['page-pfsensewizardsubsystem'] = array(); -$priv_list['page-pfsensewizardsubsystem']['name'] = "WebCfg - pfSense wizard subsystem page"; -$priv_list['page-pfsensewizardsubsystem']['descr'] = "Allow access to the 'pfSense wizard subsystem' page."; +$priv_list['page-pfsensewizardsubsystem']['name'] = gettext("WebCfg - pfSense wizard subsystem page"); +$priv_list['page-pfsensewizardsubsystem']['descr'] = gettext("Allow access to the 'pfSense wizard subsystem' page."); $priv_list['page-pfsensewizardsubsystem']['match'] = array(); $priv_list['page-pfsensewizardsubsystem']['match'][] = "wizard.php*"; $priv_list['page-system-gateways-editgateway'] = array(); -$priv_list['page-system-gateways-editgateway']['name'] = "WebCfg - System: Gateways: Edit Gateway page"; -$priv_list['page-system-gateways-editgateway']['descr'] = "Allow access to the 'System: Gateways: Edit Gateway' page."; +$priv_list['page-system-gateways-editgateway']['name'] = gettext("WebCfg - System: Gateways: Edit Gateway page"); +$priv_list['page-system-gateways-editgateway']['descr'] = gettext("Allow access to the 'System: Gateways: Edit Gateway' page."); $priv_list['page-system-gateways-editgateway']['match'] = array(); $priv_list['page-system-gateways-editgateway']['match'][] = "system_gateways_edit.php*"; $priv_list['page-system-groupmanager-addprivs'] = array(); -$priv_list['page-system-groupmanager-addprivs']['name'] = "WebCfg - System: Group Manager: Add Privileges page"; -$priv_list['page-system-groupmanager-addprivs']['descr'] = "Allow access to the 'System: Group Manager: Add Privileges' page."; +$priv_list['page-system-groupmanager-addprivs']['name'] = gettext("WebCfg - System: Group Manager: Add Privileges page"); +$priv_list['page-system-groupmanager-addprivs']['descr'] = gettext("Allow access to the 'System: Group Manager: Add Privileges' page."); $priv_list['page-system-groupmanager-addprivs']['match'] = array(); $priv_list['page-system-groupmanager-addprivs']['match'][] = "system_groupmanager_addprivs.php*"; $priv_list['page-system-staticroutes-editroute'] = array(); -$priv_list['page-system-staticroutes-editroute']['name'] = "WebCfg - System: Static Routes: Edit route page"; -$priv_list['page-system-staticroutes-editroute']['descr'] = "Allow access to the 'System: Static Routes: Edit route' page."; +$priv_list['page-system-staticroutes-editroute']['name'] = gettext("WebCfg - System: Static Routes: Edit route page"); +$priv_list['page-system-staticroutes-editroute']['descr'] = gettext("Allow access to the 'System: Static Routes: Edit route' page."); $priv_list['page-system-staticroutes-editroute']['match'] = array(); $priv_list['page-system-staticroutes-editroute']['match'][] = "system_routes_edit.php*"; $priv_list['page-system-usermanager'] = array(); -$priv_list['page-system-usermanager']['name'] = "WebCfg - System: User Manager page"; -$priv_list['page-system-usermanager']['descr'] = "Allow access to the 'System: User Manager' page."; +$priv_list['page-system-usermanager']['name'] = gettext("WebCfg - System: User Manager page"); +$priv_list['page-system-usermanager']['descr'] = gettext("Allow access to the 'System: User Manager' page."); $priv_list['page-system-usermanager']['match'] = array(); $priv_list['page-system-usermanager']['match'][] = "system_usermanager.php*"; $priv_list['page-system-usermanager_addcert'] = array(); -$priv_list['page-system-usermanager_addcert']['name'] = "WebCfg - System: User Manager: Add Certificate"; -$priv_list['page-system-usermanager_addcert']['descr'] = "Allow access to the 'User Manager: Add Certificate' page."; +$priv_list['page-system-usermanager_addcert']['name'] = gettext("WebCfg - System: User Manager: Add Certificate"); +$priv_list['page-system-usermanager_addcert']['descr'] = gettext("Allow access to the 'User Manager: Add Certificate' page."); $priv_list['page-system-usermanager_addcert']['match'] = array(); $priv_list['page-system-usermanager_addcert']['match'][] = "system_usermanager_addcert.php*"; $priv_list['page-system-usermanager-addprivs'] = array(); -$priv_list['page-system-usermanager-addprivs']['name'] = "WebCfg - System: User Manager: Add Privileges page"; -$priv_list['page-system-usermanager-addprivs']['descr'] = "Allow access to the 'System: User Manager: Add Privileges' page."; +$priv_list['page-system-usermanager-addprivs']['name'] = gettext("WebCfg - System: User Manager: Add Privileges page"); +$priv_list['page-system-usermanager-addprivs']['descr'] = gettext("Allow access to the 'System: User Manager: Add Privileges' page."); $priv_list['page-system-usermanager-addprivs']['match'] = array(); $priv_list['page-system-usermanager-addprivs']['match'][] = "system_usermanager_addprivs.php*"; $priv_list['page-upload_progress'] = array(); -$priv_list['page-upload_progress']['name'] = "WebCfg - System: Firmware: Manual Update page (progress bar)"; -$priv_list['page-upload_progress']['descr'] = "Allow access to the 'System: Firmware: Manual Update: Progress bar' page."; +$priv_list['page-upload_progress']['name'] = gettext("WebCfg - System: Firmware: Manual Update page (progress bar)"); +$priv_list['page-upload_progress']['descr'] = gettext("Allow access to the 'System: Firmware: Manual Update: Progress bar' page."); $priv_list['page-upload_progress']['match'] = array(); $priv_list['page-upload_progress']['match'][] = "upload_progress*"; $priv_list['page-services-captiveportal-editallowedips'] = array(); -$priv_list['page-services-captiveportal-editallowedips']['name'] = "WebCfg - Services: Captive portal: Edit Allowed IPs page"; -$priv_list['page-services-captiveportal-editallowedips']['descr'] = "Allow access to the 'Services: Captive portal: Edit Allowed IPs' page."; +$priv_list['page-services-captiveportal-editallowedips']['name'] = gettext("WebCfg - Services: Captive portal: Edit Allowed IPs page"); +$priv_list['page-services-captiveportal-editallowedips']['descr'] = gettext("Allow access to the 'Services: Captive portal: Edit Allowed IPs' page."); $priv_list['page-services-captiveportal-editallowedips']['match'] = array(); $priv_list['page-services-captiveportal-editallowedips']['match'][] = "services_captiveportal_ip_edit.php*"; $priv_list['page-services-dnsforwarder-editdomainoverride'] = array(); -$priv_list['page-services-dnsforwarder-editdomainoverride']['name'] = "WebCfg - Services: DNS Forwarder: Edit Domain Override page"; -$priv_list['page-services-dnsforwarder-editdomainoverride']['descr'] = "Allow access to the 'Services: DNS Forwarder: Edit Domain Override' page."; +$priv_list['page-services-dnsforwarder-editdomainoverride']['name'] = gettext("WebCfg - Services: DNS Forwarder: Edit Domain Override page"); +$priv_list['page-services-dnsforwarder-editdomainoverride']['descr'] = gettext("Allow access to the 'Services: DNS Forwarder: Edit Domain Override' page."); $priv_list['page-services-dnsforwarder-editdomainoverride']['match'] = array(); $priv_list['page-services-dnsforwarder-editdomainoverride']['match'][] = "services_dnsmasq_domainoverride_edit.php*"; $priv_list['page-services-pppoeserver-user-edit'] = array(); -$priv_list['page-services-pppoeserver-user-edit']['name'] = "WebCfg - Services: PPPoE Server: User: Edit page"; -$priv_list['page-services-pppoeserver-user-edit']['descr'] = "Allow access to the 'Services: PPPoE Server: User: Edit' page."; +$priv_list['page-services-pppoeserver-user-edit']['name'] = gettext("WebCfg - Services: PPPoE Server: User: Edit page"); +$priv_list['page-services-pppoeserver-user-edit']['descr'] = gettext("Allow access to the 'Services: PPPoE Server: User: Edit' page."); $priv_list['page-services-pppoeserver-user-edit']['match'] = array(); $priv_list['page-services-pppoeserver-user-edit']['match'][] = "vpn_pppoe_users_edit.php*"; $priv_list['page-hidden-uploadconfiguration'] = array(); -$priv_list['page-hidden-uploadconfiguration']['name'] = "WebCfg - Hidden: Upload Configuration page"; -$priv_list['page-hidden-uploadconfiguration']['descr'] = "Allow access to the 'Hidden: Upload Configuration' page."; +$priv_list['page-hidden-uploadconfiguration']['name'] = gettext("WebCfg - Hidden: Upload Configuration page"); +$priv_list['page-hidden-uploadconfiguration']['descr'] = gettext("Allow access to the 'Hidden: Upload Configuration' page."); $priv_list['page-hidden-uploadconfiguration']['match'] = array(); $priv_list['page-hidden-uploadconfiguration']['match'][] = "uploadconfig.php*"; $priv_list['page-vpn-ipsec'] = array(); -$priv_list['page-vpn-ipsec']['name'] = "WebCfg - VPN: IPsec page"; -$priv_list['page-vpn-ipsec']['descr'] = "Allow access to the 'VPN: IPsec' page."; +$priv_list['page-vpn-ipsec']['name'] = gettext("WebCfg - VPN: IPsec page"); +$priv_list['page-vpn-ipsec']['descr'] = gettext("Allow access to the 'VPN: IPsec' page."); $priv_list['page-vpn-ipsec']['match'] = array(); $priv_list['page-vpn-ipsec']['match'][] = "vpn_ipsec.php*"; $priv_list['page-vpn-ipsec-mobile'] = array(); -$priv_list['page-vpn-ipsec-mobile']['name'] = "WebCfg - VPN: IPsec: Mobile page"; -$priv_list['page-vpn-ipsec-mobile']['descr'] = "Allow access to the 'VPN: IPsec: Mobile' page."; +$priv_list['page-vpn-ipsec-mobile']['name'] = gettext("WebCfg - VPN: IPsec: Mobile page"); +$priv_list['page-vpn-ipsec-mobile']['descr'] = gettext("Allow access to the 'VPN: IPsec: Mobile' page."); $priv_list['page-vpn-ipsec-mobile']['match'] = array(); $priv_list['page-vpn-ipsec-mobile']['match'][] = "vpn_ipsec_mobile.php*"; $priv_list['page-vpn-ipsec-editphase1'] = array(); -$priv_list['page-vpn-ipsec-editphase1']['name'] = "WebCfg - VPN: IPsec: Edit Phase 1 page"; -$priv_list['page-vpn-ipsec-editphase1']['descr'] = "Allow access to the 'VPN: IPsec: Edit Phase 1' page."; +$priv_list['page-vpn-ipsec-editphase1']['name'] = gettext("WebCfg - VPN: IPsec: Edit Phase 1 page"); +$priv_list['page-vpn-ipsec-editphase1']['descr'] = gettext("Allow access to the 'VPN: IPsec: Edit Phase 1' page."); $priv_list['page-vpn-ipsec-editphase1']['match'] = array(); $priv_list['page-vpn-ipsec-editphase1']['match'][] = "vpn_ipsec_phase1.php*"; $priv_list['page-vpn-ipsec-editphase2'] = array(); -$priv_list['page-vpn-ipsec-editphase2']['name'] = "WebCfg - VPN: IPsec: Edit Phase 2 page"; -$priv_list['page-vpn-ipsec-editphase2']['descr'] = "Allow access to the 'VPN: IPsec: Edit Phase 2' page."; +$priv_list['page-vpn-ipsec-editphase2']['name'] = gettext("WebCfg - VPN: IPsec: Edit Phase 2 page"); +$priv_list['page-vpn-ipsec-editphase2']['descr'] = gettext("Allow access to the 'VPN: IPsec: Edit Phase 2' page."); $priv_list['page-vpn-ipsec-editphase2']['match'] = array(); $priv_list['page-vpn-ipsec-editphase2']['match'][] = "vpn_ipsec_phase2.php*"; $priv_list['page-vpn-vpnl2tp'] = array(); -$priv_list['page-vpn-vpnl2tp']['name'] = "WebCfg - VPN: VPN L2TP page"; -$priv_list['page-vpn-vpnl2tp']['descr'] = "Allow access to the 'VPN: VPN L2TP' page."; +$priv_list['page-vpn-vpnl2tp']['name'] = gettext("WebCfg - VPN: VPN L2TP page"); +$priv_list['page-vpn-vpnl2tp']['descr'] = gettext("Allow access to the 'VPN: VPN L2TP' page."); $priv_list['page-vpn-vpnl2tp']['match'] = array(); $priv_list['page-vpn-vpnl2tp']['match'][] = "vpn_l2tp.php*"; $priv_list['page-vpn-vpnl2tp-users'] = array(); -$priv_list['page-vpn-vpnl2tp-users']['name'] = "WebCfg - VPN: VPN L2TP : Users page"; -$priv_list['page-vpn-vpnl2tp-users']['descr'] = "Allow access to the 'VPN: VPN L2TP : Users' page."; +$priv_list['page-vpn-vpnl2tp-users']['name'] = gettext("WebCfg - VPN: VPN L2TP : Users page"); +$priv_list['page-vpn-vpnl2tp-users']['descr'] = gettext("Allow access to the 'VPN: VPN L2TP : Users' page."); $priv_list['page-vpn-vpnl2tp-users']['match'] = array(); $priv_list['page-vpn-vpnl2tp-users']['match'][] = "vpn_l2tp_users.php*"; $priv_list['page-vpn-vpnl2tp-users-edit'] = array(); -$priv_list['page-vpn-vpnl2tp-users-edit']['name'] = "WebCfg - VPN: VPN L2TP : Users : Edit page"; -$priv_list['page-vpn-vpnl2tp-users-edit']['descr'] = "Allow access to the 'VPN: VPN L2TP : Users : Edit' page."; +$priv_list['page-vpn-vpnl2tp-users-edit']['name'] = gettext("WebCfg - VPN: VPN L2TP : Users : Edit page"); +$priv_list['page-vpn-vpnl2tp-users-edit']['descr'] = gettext("Allow access to the 'VPN: VPN L2TP : Users : Edit' page."); $priv_list['page-vpn-vpnl2tp-users-edit']['match'] = array(); $priv_list['page-vpn-vpnl2tp-users-edit']['match'][] = "vpn_l2tp_users_edit.php*"; $priv_list['page-openvpn-client'] = array(); -$priv_list['page-openvpn-client']['name'] = "WebCfg - OpenVPN: Client page"; -$priv_list['page-openvpn-client']['descr'] = "Allow access to the 'OpenVPN: Client' page."; +$priv_list['page-openvpn-client']['name'] = gettext("WebCfg - OpenVPN: Client page"); +$priv_list['page-openvpn-client']['descr'] = gettext("Allow access to the 'OpenVPN: Client' page."); $priv_list['page-openvpn-client']['match'] = array(); $priv_list['page-openvpn-client']['match'][] = "vpn_openvpn_client.php*"; $priv_list['page-openvpn-csc'] = array(); -$priv_list['page-openvpn-csc']['name'] = "WebCfg - OpenVPN: Client Specific Override page"; -$priv_list['page-openvpn-csc']['descr'] = "Allow access to the 'OpenVPN: Client Specific Override' page."; +$priv_list['page-openvpn-csc']['name'] = gettext("WebCfg - OpenVPN: Client Specific Override page"); +$priv_list['page-openvpn-csc']['descr'] = gettext("Allow access to the 'OpenVPN: Client Specific Override' page."); $priv_list['page-openvpn-csc']['match'] = array(); $priv_list['page-openvpn-csc']['match'][] = "vpn_openvpn_csc.php*"; $priv_list['page-openvpn-server'] = array(); -$priv_list['page-openvpn-server']['name'] = "WebCfg - OpenVPN: Server page"; -$priv_list['page-openvpn-server']['descr'] = "Allow access to the 'OpenVPN: Server' page."; +$priv_list['page-openvpn-server']['name'] = gettext("WebCfg - OpenVPN: Server page"); +$priv_list['page-openvpn-server']['descr'] = gettext("Allow access to the 'OpenVPN: Server' page."); $priv_list['page-openvpn-server']['match'] = array(); $priv_list['page-openvpn-server']['match'][] = "vpn_openvpn_server.php*"; $priv_list['page-services-pppoeserver'] = array(); -$priv_list['page-services-pppoeserver']['name'] = "WebCfg - Services: PPPoE Server page"; -$priv_list['page-services-pppoeserver']['descr'] = "Allow access to the 'Services: PPPoE Server' page."; +$priv_list['page-services-pppoeserver']['name'] = gettext("WebCfg - Services: PPPoE Server page"); +$priv_list['page-services-pppoeserver']['descr'] = gettext("Allow access to the 'Services: PPPoE Server' page."); $priv_list['page-services-pppoeserver']['match'] = array(); $priv_list['page-services-pppoeserver']['match'][] = "vpn_pppoe.php*"; $priv_list['page-services-pppoeserver-users'] = array(); -$priv_list['page-services-pppoeserver-users']['name'] = "WebCfg - Services: PPPoE Server: Users page"; -$priv_list['page-services-pppoeserver-users']['descr'] = "Allow access to the 'Services: PPPoE Server: Users' page."; +$priv_list['page-services-pppoeserver-users']['name'] = gettext("WebCfg - Services: PPPoE Server: Users page"); +$priv_list['page-services-pppoeserver-users']['descr'] = gettext("Allow access to the 'Services: PPPoE Server: Users' page."); $priv_list['page-services-pppoeserver-users']['match'] = array(); $priv_list['page-services-pppoeserver-users']['match'][] = "vpn_pppoe_users.php*"; $priv_list['page-vpn-vpnpptp'] = array(); -$priv_list['page-vpn-vpnpptp']['name'] = "WebCfg - VPN: VPN PPTP page"; -$priv_list['page-vpn-vpnpptp']['descr'] = "Allow access to the 'VPN: VPN PPTP' page."; +$priv_list['page-vpn-vpnpptp']['name'] = gettext("WebCfg - VPN: VPN PPTP page"); +$priv_list['page-vpn-vpnpptp']['descr'] = gettext("Allow access to the 'VPN: VPN PPTP' page."); $priv_list['page-vpn-vpnpptp']['match'] = array(); $priv_list['page-vpn-vpnpptp']['match'][] = "vpn_pptp.php*"; $priv_list['page-vpn-vpnpptp-users'] = array(); -$priv_list['page-vpn-vpnpptp-users']['name'] = "WebCfg - VPN: VPN PPTP: Users page"; -$priv_list['page-vpn-vpnpptp-users']['descr'] = "Allow access to the 'VPN: VPN PPTP: Users' page."; +$priv_list['page-vpn-vpnpptp-users']['name'] = gettext("WebCfg - VPN: VPN PPTP: Users page"); +$priv_list['page-vpn-vpnpptp-users']['descr'] = gettext("Allow access to the 'VPN: VPN PPTP: Users' page."); $priv_list['page-vpn-vpnpptp-users']['match'] = array(); $priv_list['page-vpn-vpnpptp-users']['match'][] = "vpn_pptp_users.php*"; $priv_list['page-vpn-vpnpptp-user-edit'] = array(); -$priv_list['page-vpn-vpnpptp-user-edit']['name'] = "WebCfg - VPN: VPN PPTP: User: Edit page"; -$priv_list['page-vpn-vpnpptp-user-edit']['descr'] = "Allow access to the 'VPN: VPN PPTP: User: Edit' page."; +$priv_list['page-vpn-vpnpptp-user-edit']['name'] = gettext("WebCfg - VPN: VPN PPTP: User: Edit page"); +$priv_list['page-vpn-vpnpptp-user-edit']['descr'] = gettext("Allow access to the 'VPN: VPN PPTP: User: Edit' page."); $priv_list['page-vpn-vpnpptp-user-edit']['match'] = array(); $priv_list['page-vpn-vpnpptp-user-edit']['match'][] = "vpn_pptp_users_edit.php*"; $priv_list['page-firewall-nat-outbound-edit'] = array(); -$priv_list['page-firewall-nat-outbound-edit']['name'] = "WebCfg - Firewall: NAT: Outbound: Edit page"; -$priv_list['page-firewall-nat-outbound-edit']['descr'] = "Allow access to the 'Firewall: NAT: Outbound: Edit' page."; +$priv_list['page-firewall-nat-outbound-edit']['name'] = gettext("WebCfg - Firewall: NAT: Outbound: Edit page"); +$priv_list['page-firewall-nat-outbound-edit']['descr'] = gettext("Allow access to the 'Firewall: NAT: Outbound: Edit' page."); $priv_list['page-firewall-nat-outbound-edit']['match'] = array(); $priv_list['page-firewall-nat-outbound-edit']['match'][] = "firewall_nat_out_edit.php*"; $priv_list['page-xmlrpclibrary'] = array(); -$priv_list['page-xmlrpclibrary']['name'] = "WebCfg - XMLRPC Library page"; -$priv_list['page-xmlrpclibrary']['descr'] = "Allow access to the 'XMLRPC Library' page."; +$priv_list['page-xmlrpclibrary']['name'] = gettext("WebCfg - XMLRPC Library page"); +$priv_list['page-xmlrpclibrary']['descr'] = gettext("Allow access to the 'XMLRPC Library' page."); $priv_list['page-xmlrpclibrary']['match'] = array(); $priv_list['page-xmlrpclibrary']['match'][] = "xmlrpc.php*"; $priv_list['page-interfaces-qinq'] = array(); -$priv_list['page-interfaces-qinq']['name'] = "WebCfg - Interfaces: QinQ page"; -$priv_list['page-interfaces-qinq']['descr'] = "Allow access to the 'Interfaces: QinQ' page."; +$priv_list['page-interfaces-qinq']['name'] = gettext("WebCfg - Interfaces: QinQ page"); +$priv_list['page-interfaces-qinq']['descr'] = gettext("Allow access to the 'Interfaces: QinQ' page."); $priv_list['page-interfaces-qinq']['match'] = array(); $priv_list['page-interfaces-qinq']['match'][] = "interfaces_qinq.php*"; $priv_list['page-pkg-mgr-settings'] = array(); -$priv_list['page-pkg-mgr-settings']['name'] = "WebCfg - Packages: Settings page"; -$priv_list['page-pkg-mgr-settings']['descr'] = "Allow access to the 'Packages: Settings' page."; +$priv_list['page-pkg-mgr-settings']['name'] = gettext("WebCfg - Packages: Settings page"); +$priv_list['page-pkg-mgr-settings']['descr'] = gettext("Allow access to the 'Packages: Settings' page."); $priv_list['page-pkg-mgr-settings']['match'] = array(); $priv_list['page-pkg-mgr-settings']['match'][] = "pkg_mgr_settings.php*"; $priv_list['page-system-groupmanager'] = array(); -$priv_list['page-system-groupmanager']['name'] = "WebCfg - System: Group manager page"; -$priv_list['page-system-groupmanager']['descr'] = "Allow access to the 'System: Group manager' page."; +$priv_list['page-system-groupmanager']['name'] = gettext("WebCfg - System: Group manager page"); +$priv_list['page-system-groupmanager']['descr'] = gettext("Allow access to the 'System: Group manager' page."); $priv_list['page-system-groupmanager']['match'] = array(); $priv_list['page-system-groupmanager']['match'][] = "system_groupmanager.php*"; $priv_list['page-diag-showbogons'] = array(); -$priv_list['page-diag-showbogons']['name'] = "WebCfg - Diagnostics: System Activity"; -$priv_list['page-diag-showbogons']['descr'] = "Allows access to the 'Diagnostics: Show Bogons' page"; +$priv_list['page-diag-showbogons']['name'] = gettext("WebCfg - Diagnostics: System Activity"); +$priv_list['page-diag-showbogons']['descr'] = gettext("Allows access to the 'Diagnostics: Show Bogons' page"); $priv_list['page-diag-showbogons']['match'] = array(); $priv_list['page-diag-showbogons']['match'][] = "diag_showbogons.php"; $priv_list['page-status-trafficgraph'] = array(); -$priv_list['page-status-trafficgraph']['name'] = "WebCfg - Status: Traffic Graph page"; -$priv_list['page-status-trafficgraph']['descr'] = "Allow access to the 'Status: Traffic Graph' page."; +$priv_list['page-status-trafficgraph']['name'] = gettext("WebCfg - Status: Traffic Graph page"); +$priv_list['page-status-trafficgraph']['descr'] = gettext("Allow access to the 'Status: Traffic Graph' page."); $priv_list['page-status-trafficgraph']['match'] = array(); $priv_list['page-status-trafficgraph']['match'][] = "status_graph.php*"; $priv_list['page-status-trafficgraph']['match'][] = "bandwidth_by_ip.php*"; @@ -1115,50 +1115,50 @@ $priv_list['page-status-trafficgraph']['match'][] = "graph.php*"; $priv_list['page-status-trafficgraph']['match'][] = "traffic_graphs.widget.php*"; $priv_list['page-services-captiveportal-vouchers'] = array(); -$priv_list['page-services-captiveportal-vouchers']['name'] = "WebCfg - Services: Captive portal Vouchers page"; -$priv_list['page-services-captiveportal-vouchers']['descr'] = "Allow access to the 'Services: Captive portal Vouchers' page."; +$priv_list['page-services-captiveportal-vouchers']['name'] = gettext("WebCfg - Services: Captive portal Vouchers page"); +$priv_list['page-services-captiveportal-vouchers']['descr'] = gettext("Allow access to the 'Services: Captive portal Vouchers' page."); $priv_list['page-services-captiveportal-vouchers']['match'] = array(); $priv_list['page-services-captiveportal-vouchers']['match'][] = "services_captiveportal_vouchers.php*"; $priv_list['page-services-captiveportal-voucher-edit'] = array(); -$priv_list['page-services-captiveportal-voucher-edit']['name'] = "WebCfg - Services: Captive portal Voucher Rolls page"; -$priv_list['page-services-captiveportal-voucher-edit']['descr'] = "Allow access to the 'Services: Captive portal Edit Voucher Rolls' page."; +$priv_list['page-services-captiveportal-voucher-edit']['name'] = gettext("WebCfg - Services: Captive portal Voucher Rolls page"); +$priv_list['page-services-captiveportal-voucher-edit']['descr'] = gettext("Allow access to the 'Services: Captive portal Edit Voucher Rolls' page."); $priv_list['page-services-captiveportal-voucher-edit']['match'] = array(); $priv_list['page-services-captiveportal-voucher-edit']['match'][] = "services_captiveportal_vouchers_edit.php*"; $priv_list['page-status-captiveportal-test'] = array(); -$priv_list['page-status-captiveportal-test']['name'] = "WebCfg - Status: Captive portal test Vouchers page"; -$priv_list['page-status-captiveportal-test']['descr'] = "Allow access to the 'Status: Captive portal Test Vouchers' page."; +$priv_list['page-status-captiveportal-test']['name'] = gettext("WebCfg - Status: Captive portal test Vouchers page"); +$priv_list['page-status-captiveportal-test']['descr'] = gettext("Allow access to the 'Status: Captive portal Test Vouchers' page."); $priv_list['page-status-captiveportal-test']['match'] = array(); $priv_list['page-status-captiveportal-test']['match'][] = "status_captiveportal_test.php*"; $priv_list['page-status-captiveportal-voucher-rolls'] = array(); -$priv_list['page-status-captiveportal-voucher-rolls']['name'] = "WebCfg - Status: Captive portal Voucher Rolls page"; -$priv_list['page-status-captiveportal-voucher-rolls']['descr'] = "Allow access to the 'Status: Captive portal Voucher Rolls' page."; +$priv_list['page-status-captiveportal-voucher-rolls']['name'] = gettext("WebCfg - Status: Captive portal Voucher Rolls page"); +$priv_list['page-status-captiveportal-voucher-rolls']['descr'] = gettext("Allow access to the 'Status: Captive portal Voucher Rolls' page."); $priv_list['page-status-captiveportal-voucher-rolls']['match'] = array(); $priv_list['page-status-captiveportal-voucher-rolls']['match'][] = "status_captiveportal_voucher_rolls.php*"; $priv_list['page-status-captiveportal-vouchers'] = array(); -$priv_list['page-status-captiveportal-vouchers']['name'] = "WebCfg - Status: Captive portal Vouchers page"; -$priv_list['page-status-captiveportal-vouchers']['descr'] = "Allow access to the 'Status: Captive portal Vouchers' page."; +$priv_list['page-status-captiveportal-vouchers']['name'] = gettext("WebCfg - Status: Captive portal Vouchers page"); +$priv_list['page-status-captiveportal-vouchers']['descr'] = gettext("Allow access to the 'Status: Captive portal Vouchers' page."); $priv_list['page-status-captiveportal-vouchers']['match'] = array(); $priv_list['page-status-captiveportal-vouchers']['match'][] = "status_captiveportal_vouchers.php*"; $priv_list['page-firewall-rules-edit'] = array(); -$priv_list['page-firewall-rules-edit']['name'] = "WebCfg - Firewall: Rules: Edit page"; -$priv_list['page-firewall-rules-edit']['descr'] = "Allow access to the 'Firewall: Rules: Edit' page."; +$priv_list['page-firewall-rules-edit']['name'] = gettext("WebCfg - Firewall: Rules: Edit page"); +$priv_list['page-firewall-rules-edit']['descr'] = gettext("Allow access to the 'Firewall: Rules: Edit' page."); $priv_list['page-firewall-rules-edit']['match'] = array(); $priv_list['page-firewall-rules-edit']['match'][] = "firewall_rules_edit.php*"; $priv_list['page-system-advanced-notifications'] = array(); -$priv_list['page-system-advanced-notifications']['name'] = "WebCfg - System: Advanced: Tunables page"; -$priv_list['page-system-advanced-notifications']['descr'] = "Allow access to the 'System: Advanced: Tunables' page."; +$priv_list['page-system-advanced-notifications']['name'] = gettext("WebCfg - System: Advanced: Tunables page"); +$priv_list['page-system-advanced-notifications']['descr'] = gettext("Allow access to the 'System: Advanced: Tunables' page."); $priv_list['page-system-advanced-notifications']['match'] = array(); $priv_list['page-system-advanced-notifications']['match'][] = "system_advanced-sysctrl.php*"; $priv_list['page-firewall-schedules-edit'] = array(); -$priv_list['page-firewall-schedules-edit']['name'] = "WebCfg - Firewall: Schedules: Edit page"; -$priv_list['page-firewall-schedules-edit']['descr'] = "Allow access to the 'Firewall: Schedules: Edit' page."; +$priv_list['page-firewall-schedules-edit']['name'] = gettext("WebCfg - Firewall: Schedules: Edit page"); +$priv_list['page-firewall-schedules-edit']['descr'] = gettext("Allow access to the 'Firewall: Schedules: Edit' page."); $priv_list['page-firewall-schedules-edit']['match'] = array(); $priv_list['page-firewall-schedules-edit']['match'][] = "firewall_schedule_edit.php*"; From 93fd3db82b8c5852453dae410cbf47d4f6667151 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 12:27:06 -0300 Subject: [PATCH 026/329] Implement gettext() calls on radius.inc --- etc/inc/radius.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/radius.inc b/etc/inc/radius.inc index dddacc30cd..2c433d11bb 100644 --- a/etc/inc/radius.inc +++ b/etc/inc/radius.inc @@ -401,13 +401,13 @@ class Auth_RADIUS extends PEAR { { $req = radius_send_request($this->res); if (!$req) { - return $this->raiseError('Error sending request: ' . $this->getError()); + return $this->raiseError(gettext('Error sending request:') . ' ' . $this->getError()); } switch($req) { case RADIUS_ACCESS_ACCEPT: if (is_subclass_of($this, 'auth_radius_acct')) { - return $this->raiseError('RADIUS_ACCESS_ACCEPT is unexpected for accounting'); + return $this->raiseError(gettext('RADIUS_ACCESS_ACCEPT is unexpected for accounting')); } return true; @@ -416,12 +416,12 @@ class Auth_RADIUS extends PEAR { case RADIUS_ACCOUNTING_RESPONSE: if (is_subclass_of($this, 'auth_radius_pap')) { - return $this->raiseError('RADIUS_ACCOUNTING_RESPONSE is unexpected for authentication'); + return $this->raiseError(gettext('RADIUS_ACCOUNTING_RESPONSE is unexpected for authentication')); } return true; default: - return $this->raiseError("Unexpected return value: $req"); + return $this->raiseError(gettext("Unexpected return value:") . $req); } } From 069503a181bf2a80b32134ec37d0b08d1d5c6c9a Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 12:48:24 -0300 Subject: [PATCH 027/329] Implement gettext() calls on xmlrpc_client.php --- etc/inc/xmlrpc_client.inc | 51 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc index bac5e1fd50..229bb7f2f1 100644 --- a/etc/inc/xmlrpc_client.inc +++ b/etc/inc/xmlrpc_client.inc @@ -166,13 +166,13 @@ $GLOBALS['XML_RPC_err'] = array( * @global array $GLOBALS['XML_RPC_str'] */ $GLOBALS['XML_RPC_str'] = array( - 'unknown_method' => 'Unknown method', - 'invalid_return' => 'Invalid return payload: enable debugging to examine incoming payload', - 'incorrect_params' => 'Incorrect parameters passed to method', - 'introspect_unknown' => 'Can\'t introspect: method unknown', - 'http_error' => 'Didn\'t receive 200 OK from remote server.', - 'not_response_object' => 'The requested method didn\'t return an XML_RPC_Response object.', - 'invalid_request' => 'Invalid request payload', + 'unknown_method' => gettext("Unknown method"), + 'invalid_return' => gettext("Invalid return payload: enable debugging to examine incoming payload"), + 'incorrect_params' => gettext("Incorrect parameters passed to method"), + 'introspect_unknown' => gettext("Can't introspect: method unknown"), + 'http_error' => gettext("Didn't receive 200 OK from remote server."), + 'not_response_object' => gettext("The requested method didn't return an XML_RPC_Response object."), + 'invalid_request' => gettext("Invalid request payload"), ); @@ -295,7 +295,7 @@ function XML_RPC_se($parser_resource, $name, $attrs) if (count($XML_RPC_xh[$parser]['stack']) == 0) { if ($name != 'METHODRESPONSE' && $name != 'METHODCALL') { $XML_RPC_xh[$parser]['isf'] = 2; - $XML_RPC_xh[$parser]['isf_reason'] = 'missing top level xmlrpc element'; + $XML_RPC_xh[$parser]['isf_reason'] = gettext('missing top level xmlrpc element'); return; } } else { @@ -303,7 +303,7 @@ function XML_RPC_se($parser_resource, $name, $attrs) if (!in_array($XML_RPC_xh[$parser]['stack'][0], $XML_RPC_valid_parents[$name])) { $name = $GLOBALS['XML_RPC_func_ereg_replace']('[^a-zA-Z0-9._-]', '', $name); $XML_RPC_xh[$parser]['isf'] = 2; - $XML_RPC_xh[$parser]['isf_reason'] = "xmlrpc element $name cannot be child of {$XML_RPC_xh[$parser]['stack'][0]}"; + $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext("xmlrpc element %s cannot be child of %s"), $name, $XML_RPC_xh[$parser]['stack'][0]); return; } } @@ -466,7 +466,7 @@ function XML_RPC_ee($parser_resource, $name) // we have an I4, INT or a DOUBLE // we must check that only 0123456789-. are characters here if (!$GLOBALS['XML_RPC_func_ereg']("^[+-]?[0123456789 \t\.]+$", $XML_RPC_xh[$parser]['ac'])) { - XML_RPC_Base::raiseError('Non-numeric value received in INT or DOUBLE', + XML_RPC_Base::raiseError(gettext('Non-numeric value received in INT or DOUBLE'), XML_RPC_ERROR_NON_NUMERIC_FOUND); $XML_RPC_xh[$parser]['value'] = XML_RPC_ERROR_NON_NUMERIC_FOUND; } else { @@ -889,8 +889,10 @@ class XML_RPC_Client extends XML_RPC_Base { function send($msg, $timeout = 0) { if (!is_a($msg, 'XML_RPC_Message')) { - $this->errstr = 'send()\'s $msg parameter must be an' - . ' XML_RPC_Message object.'; + $this->errstr = sprintf( + gettext( + "send()'s %s parameter must be an XML_RPC_Message object." + ), $msg); $this->raiseError($this->errstr, XML_RPC_ERROR_PROGRAMMING); return 0; } @@ -960,15 +962,15 @@ class XML_RPC_Client extends XML_RPC_Base { * but keep it here for backwards compatibility. */ if (!$fp && $this->proxy) { - $this->raiseError('Connection to proxy server ' + $this->raiseError(gettext('Connection to proxy server ') . $this->proxy . ':' . $this->proxy_port - . ' failed. ' . $this->errstr, + . gettext(' failed. ') . $this->errstr, XML_RPC_ERROR_CONNECTION_FAILED); return 0; } elseif (!$fp) { - $this->raiseError('Connection to RPC server ' + $this->raiseError(gettext('Connection to RPC server ') . $server . ':' . $port - . ' failed. ' . $this->errstr, + . gettext(' failed. ') . $this->errstr, XML_RPC_ERROR_CONNECTION_FAILED); return 0; } @@ -1351,7 +1353,7 @@ class XML_RPC_Message extends XML_RPC_Base if (isset($this->params[$i])) { return $this->params[$i]; } else { - $this->raiseError('The submitted request did not contain this parameter', + $this->raiseError(gettext('The submitted request did not contain this parameter'), XML_RPC_ERROR_INCORRECT_PARAMS); return new XML_RPC_Response(0, $XML_RPC_err['incorrect_params'], $XML_RPC_str['incorrect_params']); @@ -1382,7 +1384,7 @@ class XML_RPC_Message extends XML_RPC_Base function setConvertPayloadEncoding($in) { if ($in && !function_exists('mb_convert_encoding')) { - return $this->raiseError('mb_convert_encoding() is not available', + return $this->raiseError(gettext('mb_convert_encoding() is not available'), XML_RPC_ERROR_PROGRAMMING); } $this->convert_payload_encoding = $in; @@ -1611,14 +1613,15 @@ class XML_RPC_Value extends XML_RPC_Base function addScalar($val, $type = 'string') { if ($this->mytype == 1) { - $this->raiseError('Scalar can have only one value', + $this->raiseError(gettext('Scalar can have only one value'), XML_RPC_ERROR_INVALID_TYPE); return 0; } $typeof = $GLOBALS['XML_RPC_Types'][$type]; if ($typeof != 1) { - $this->raiseError("Not a scalar type (${typeof})", - XML_RPC_ERROR_INVALID_TYPE); + $this->raiseError( + sprintf(gettext("Not a scalar type (%s)"), $typeof), + XML_RPC_ERROR_INVALID_TYPE); return 0; } @@ -1653,7 +1656,7 @@ class XML_RPC_Value extends XML_RPC_Base { if ($this->mytype != 0) { $this->raiseError( - 'Already initialized as a [' . $this->kindOf() . ']', + sprintf(gettext('Already initialized as a [%s]'), $this->kindOf()), XML_RPC_ERROR_ALREADY_INITIALIZED); return 0; } @@ -1669,7 +1672,7 @@ class XML_RPC_Value extends XML_RPC_Base { if ($this->mytype != 0) { $this->raiseError( - 'Already initialized as a [' . $this->kindOf() . ']', + sprintf(gettext('Already initialized as a [%s]'), $this->kindOf()), XML_RPC_ERROR_ALREADY_INITIALIZED); return 0; } @@ -2077,4 +2080,4 @@ function XML_RPC_encode($php_val) * End: */ -?> \ No newline at end of file +?> From 9eda6186fb788c712b534517f1788bc2522fbc1f Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 12:54:18 -0300 Subject: [PATCH 028/329] Implement gettext() calls on rrd.inc --- etc/inc/rrd.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 96981dae66..da7f7e4131 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -42,7 +42,7 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) { exec("$rrdtool dump {$rrddatabase} {$xmldumpfile} 2>&1", $dumpout, $dumpret); if ($dumpret <> 0) { $dumpout = implode(" ", $dumpout); - log_error("RRD dump failed exited with $dumpret, the error is: $dumpout"); + log_error(sprintf(gettext("RRD dump failed exited with %s, the error is: %s"), $dumpret, $dumpout)); } return($dumpret); } @@ -53,7 +53,7 @@ function create_new_rrd($rrdcreatecmd) { exec("$rrdcreatecmd 2>&1", $rrdcreateoutput, $rrdcreatereturn); if ($rrdcreatereturn <> 0) { $rrdcreateoutput = implode(" ", $rrdcreateoutput); - log_error("RRD create failed exited with $rrdcreatereturn, the error is: $rrdcreateoutput"); + log_error(sprintf(gettext("RRD create failed exited with %s, the error is: %s"), $rrdcreatereturn, $rrdcreateoutput)); } return $rrdcreatereturn; } @@ -67,7 +67,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numdsold = count($rrdoldxml['ds']); $numrranew = count($rrdnewxml['rra']); $numdsnew = count($rrdnewxml['ds']); - log_error("Import RRD has $numdsold DS values and $numrraold RRA databases, new format RRD has $numdsnew DS values and $numrranew RRA databases"); + log_error(sprintf(gettext("Import RRD has %s DS values and %s RRA databases, new format RRD has %s DS values and %s RRA databases"), $numdsold, $numrraold, $numdsnew ,$numrranew)); /* add data sources not found in the old array from the new array */ $i = 0; @@ -151,7 +151,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numrranew = count($rrdoldxml['rra']); $numdsnew = count($rrdoldxml['ds']); - log_error("The new RRD now has $numdsnew DS values and $numrranew RRA databases"); + log_error(sprintf(gettext("The new RRD now has %s DS values and %s RRA databases"), $numdsnew, $numrranew)); return $rrdoldxml; } @@ -159,7 +159,7 @@ function enable_rrd_graphing() { global $config, $g, $altq_list_queues; if($g['booting']) - echo "Generating RRD graphs..."; + echo gettext("Generating RRD graphs..."); $rrddbpath = "/var/db/rrd/"; $rrdgraphpath = "/usr/local/www/rrd"; @@ -238,7 +238,7 @@ function enable_rrd_graphing() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $rrdrestore = implode(" ", $rrdrestore); if($rrdreturn <> 0) { - log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n"); + log_error(sprintf(gettext("RRD restore failed exited with %s, the error is: %s%s"), $rrdreturn, $rrdrestore, "\n")); } } } @@ -662,7 +662,7 @@ function enable_rrd_graphing() { $rrdupdatesh .= "sleep 60\n"; $rrdupdatesh .= "done\n"; - log_error("Creating rrd update script"); + log_error(gettext("Creating rrd update script")); /* write the rrd update script */ $updaterrdscript = "{$g['vardb_path']}/rrd/updaterrd.sh"; $fd = fopen("$updaterrdscript", "w"); @@ -686,7 +686,7 @@ function enable_rrd_graphing() { } if($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } From b53f56d937a5754bc50b0d680c466a7eba59d960 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 13:40:14 -0300 Subject: [PATCH 029/329] Implement gettext() calls on xmlrpc_server.inc --- etc/inc/xmlrpc_server.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/inc/xmlrpc_server.inc b/etc/inc/xmlrpc_server.inc index 8887bdfc66..ff828e683a 100644 --- a/etc/inc/xmlrpc_server.inc +++ b/etc/inc/xmlrpc_server.inc @@ -62,8 +62,8 @@ $GLOBALS['XML_RPC_Server_listMethods_sig'] = array( * docstring for system.listMethods * @global string $GLOBALS['XML_RPC_Server_listMethods_doc'] */ -$GLOBALS['XML_RPC_Server_listMethods_doc'] = 'This method lists all the' - . ' methods that the XML-RPC server knows how to dispatch'; +$GLOBALS['XML_RPC_Server_listMethods_doc'] = gettext('This method lists all the' + . ' methods that the XML-RPC server knows how to dispatch'); /** * signature for system.methodSignature: return = array, @@ -80,10 +80,10 @@ $GLOBALS['XML_RPC_Server_methodSignature_sig'] = array( * docstring for system.methodSignature * @global string $GLOBALS['XML_RPC_Server_methodSignature_doc'] */ -$GLOBALS['XML_RPC_Server_methodSignature_doc'] = 'Returns an array of known' +$GLOBALS['XML_RPC_Server_methodSignature_doc'] = gettext('Returns an array of known' . ' signatures (an array of arrays) for the method name passed. If' . ' no signatures are known, returns a none-array (test for type !=' - . ' array to detect missing signature)'; + . ' array to detect missing signature)'); /** * signature for system.methodHelp: return = string, @@ -100,8 +100,8 @@ $GLOBALS['XML_RPC_Server_methodHelp_sig'] = array( * docstring for methodHelp * @global string $GLOBALS['XML_RPC_Server_methodHelp_doc'] */ -$GLOBALS['XML_RPC_Server_methodHelp_doc'] = 'Returns help text if defined' - . ' for the method passed, otherwise returns an empty string'; +$GLOBALS['XML_RPC_Server_methodHelp_doc'] = gettext('Returns help text if defined' + . ' for the method passed, otherwise returns an empty string'); /** * dispatch map for the automatically declared XML-RPC methods. @@ -685,4 +685,4 @@ class XML_RPC_Server * End: */ -?> \ No newline at end of file +?> From f1a44a3a98814171d36584d1cd35e1c444ccc55a Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 13:55:42 -0300 Subject: [PATCH 030/329] Implement gettext() calls on services.inc --- etc/inc/services.inc | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index de186d0209..95d14fc0a5 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -93,7 +93,7 @@ function services_dhcpd_configure() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn); $dhcprestore = implode(" ", $dhcprestore); if($dhcpreturn <> 0) { - log_error("DHCP leases restore failed exited with $dhcpreturn, the error is: $dhcprestore\n"); + log_error(sprintf(gettext("DHCP leases restore failed exited with %s, the error is: %s%s"), $dhcpreturn, $dhcprestore, "\n")); } } } @@ -104,14 +104,14 @@ function services_dhcpd_configure() { $Iflist = get_configured_interface_list(); if ($g['booting']) - echo "Starting DHCP service..."; + echo gettext("Starting DHCP service..."); else sleep(1); /* write dhcpd.conf */ $fd = fopen("{$g['dhcpd_chroot_path']}/etc/dhcpd.conf", "w"); if (!$fd) { - printf("Error: cannot open dhcpd.conf in services_dhcpd_configure().\n"); + printf(gettext("Error: cannot open dhcpd.conf in services_dhcpd_configure().%s"), "\n"); return 1; } @@ -178,7 +178,7 @@ EOD; } } } else { - log_error("Warning! DHCP Failover setup and no CARP virtual IP's defined!"); + log_error(gettext("Warning! DHCP Failover setup and no CARP virtual IP's defined!")); } if($skew > 10) { $type = "secondary"; @@ -377,7 +377,7 @@ EOD; join(" ", $dhcpdifs)); if ($g['booting']) { - print "done.\n"; + print gettext("done.") . "\n"; } return 0; @@ -426,14 +426,14 @@ EOD; $igmpfl = fopen($g['tmp_path'] . "/igmpproxy.conf", "w"); if (!$igmpfl) { - log_error("Could not write Igmpproxy configuration file!"); + log_error(gettext("Could not write Igmpproxy configuration file!")); return; } fwrite($igmpfl, $igmpconf); fclose($igmpfl); mwexec("/usr/local/sbin/igmpproxy -c " . $g['tmp_path'] . "/igmpproxy.conf"); - log_error("Started Igmpproxy service sucsesfully."); + log_error(gettext("Started Igmpproxy service sucsesfully.")); return 0; } @@ -495,7 +495,7 @@ function services_dhcrelay_configure() { return 0; if ($g['booting']) - echo "Starting DHCP relay service..."; + echo gettext("Starting DHCP relay service..."); else sleep(1); @@ -594,7 +594,7 @@ function services_dyndns_configure($int = "") { if (is_array($dyndnscfg)) { if ($g['booting']) - echo "Starting DynDNS clients..."; + echo gettext("Starting DynDNS clients..."); foreach ($dyndnscfg as $dyndns) { if (!empty($int) && $int != $dyndns['interface']) @@ -609,7 +609,7 @@ function services_dyndns_configure($int = "") { } if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } return 0; @@ -630,7 +630,7 @@ function services_dnsmasq_configure() { if (isset($config['dnsmasq']['enable'])) { if ($g['booting']) - echo "Starting DNS forwarder..."; + echo gettext("Starting DNS forwarder..."); else sleep(1); @@ -667,7 +667,7 @@ function services_dnsmasq_configure() { mwexec("/usr/local/sbin/dnsmasq --local-ttl 1 --all-servers {$dns_rebind} --dns-forward-max=5000 --cache-size=10000 {$args}"); if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } if (!$g['booting']) { @@ -693,12 +693,12 @@ function services_snmpd_configure() { if (isset($config['snmpd']['enable'])) { if ($g['booting']) - echo "Starting SNMP daemon... "; + echo gettext("Starting SNMP daemon... "); /* generate snmpd.conf */ $fd = fopen("{$g['varetc_path']}/snmpd.conf", "w"); if (!$fd) { - printf("Error: cannot open snmpd.conf in services_snmpd_configure().\n"); + printf(gettext("Error: cannot open snmpd.conf in services_snmpd_configure().%s"),"\n"); return 1; } @@ -846,7 +846,7 @@ EOD; "{$bindlan} -p {$g['varrun_path']}/snmpd.pid"); if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } return 0; @@ -1241,8 +1241,8 @@ function configure_cron() { if (is_array($config['cron']['item'])) { $crontab_contents .= "#\n"; - $crontab_contents .= "# pfSense specific crontab entries\n"; - $crontab_contents .= "# Created: " . date("F j, Y, g:i a") . "\n"; + $crontab_contents .= "# " . gettext("pfSense specific crontab entries") . "\n"; + $crontab_contents .= "# " .gettext( "Created:") . " " . date("F j, Y, g:i a") . "\n"; $crontab_contents .= "#\n"; foreach ($config['cron']['item'] as $item) { @@ -1256,8 +1256,8 @@ function configure_cron() { } $crontab_contents .= "\n#\n"; - $crontab_contents .= "# If possible do not add items to this file manually.\n"; - $crontab_contents .= "# If you do so, this file must be terminated with a blank line (e.g. new line)\n"; + $crontab_contents .= "# " . gettext("If possible do not add items to this file manually.") . "\n"; + $crontab_contents .= "# " . gettext("If you do so, this file must be terminated with a blank line (e.g. new line)") . "\n"; $crontab_contents .= "#\n\n"; } @@ -1294,10 +1294,10 @@ function upnp_start() { if($config['installedpackages']['miniupnpd']['config'][0]['enable']) { if($g['booting']) { - echo "Starting UPnP service... "; + echo gettext("Starting UPnP service... "); require_once('/usr/local/pkg/miniupnpd.inc'); sync_package_miniupnpd(); - echo "done.\n"; + echo gettext("done.") . "\n"; } else { upnp_action('start'); @@ -1333,15 +1333,15 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont $cron_item['command'] = $command; if(!$is_installed) { $config['cron']['item'][] = $cron_item; - write_config("Installed cron job for {$command}"); + write_config(sprintf(gettext("Installed cron job for %s"), $command)); } else { $config['cron']['item'][$x] = $cron_item; - write_config("Updated cron job for {$command}"); + write_config(sprintf(gettext("Updated cron job for %s"), $command)); } } else { if(($is_installed == true) && ($x > 0)) { unset($config['cron']['item'][$x]); - write_config("Remvoed cron job for {$command}"); + write_config(sprintf(gettext("Remvoed cron job for %s"), $command)); } } configure_cron(); From 5cfa35dfe4a498d9aa953f8d72399cb2a7eb077f Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 17 Aug 2010 14:17:46 -0300 Subject: [PATCH 031/329] Fix syntax --- etc/inc/xmlreader.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/xmlreader.inc b/etc/inc/xmlreader.inc index 9c6eb99128..a215bc9381 100644 --- a/etc/inc/xmlreader.inc +++ b/etc/inc/xmlreader.inc @@ -126,7 +126,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { add_elements($parsedcfg, $par); $par->close(); } else - log_error(sprintf(gettext("Error returned while trying to parse %s"), $cffile")); + log_error(sprintf(gettext("Error returned while trying to parse %s"), $cffile)); return $parsedcfg[$rootobj]; } From 0b8993076e3188de90e63f769c82d6a68ec1e21e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 14:36:38 -0300 Subject: [PATCH 032/329] Implement gettext() calls on service-utils.inc --- etc/inc/service-utils.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 02b235ce37..cc342c5756 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -41,7 +41,7 @@ function write_rcfile($params) { $fileprefix = "/usr/local/etc/rc.d/"; if(!(is_writable($fileprefix . $params['file']) or $params['start'])) return false; - $towrite .= "#!/bin/sh\n# This file was automatically generated\n# by the {$g['product_website']} service handler.\n\n"; + $towrite .= "#!/bin/sh\n# " . gettext("This file was automatically generated") . "\n# " . gettext("by the") . " {$g['product_website']} service handler.\n\n"; /* write our rc functions */ $towrite .= "rc_start() {\n\t" . $params['start'] . "\n}\n\n"; if($params['stop']) { From 847673aede29142424c282121b79594ea62688cb Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 15:29:50 -0300 Subject: [PATCH 033/329] Implement gettext() calls on smtp.inc --- etc/inc/smtp.inc | 96 ++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/etc/inc/smtp.inc b/etc/inc/smtp.inc index 4f396820fd..7276ed8260 100644 --- a/etc/inc/smtp.inc +++ b/etc/inc/smtp.inc @@ -89,10 +89,10 @@ class smtp_class { $status=socket_get_status($this->connection); if($status["timed_out"]) - $this->error.=": data access time out"; + $this->error.=gettext(": data access time out"); elseif($status["eof"]) { - $this->error.=": the server disconnected"; + $this->error.=gettext(": the server disconnected"); $this->disconnected_error=1; } } @@ -104,13 +104,13 @@ class smtp_class { if(feof($this->connection)) { - $this->error="reached the end of data while reading from the SMTP server conection"; + $this->error=gettext("reached the end of data while reading from the SMTP server conection"); return(""); } if(GetType($data=@fgets($this->connection,100))!="string" || strlen($data)==0) { - $this->SetDataAccessError("it was not possible to read line from the SMTP server"); + $this->SetDataAccessError(gettext("it was not possible to read line from the SMTP server")); return(""); } $line.=$data; @@ -132,7 +132,7 @@ class smtp_class $this->OutputDebug("C $line"); if(!@fputs($this->connection,"$line\r\n")) { - $this->SetDataAccessError("it was not possible to send a line to the SMTP server"); + $this->SetDataAccessError(gettext("it was not possible to send a line to the SMTP server")); return(0); } return(1); @@ -146,7 +146,7 @@ class smtp_class $this->OutputDebug("C $data"); if(!@fputs($this->connection,$data)) { - $this->SetDataAccessError("it was not possible to send data to the SMTP server"); + $this->SetDataAccessError(gettext("it was not possible to send data to the SMTP server")); return(0); } } @@ -218,10 +218,10 @@ class smtp_class $version=explode(".",function_exists("phpversion") ? phpversion() : "3.0.7"); $php_version=intval($version[0])*1000000+intval($version[1])*1000+intval($version[2]); if($php_version<4003000) - return("establishing SSL connections requires at least PHP version 4.3.0"); + return(gettext("establishing SSL connections requires at least PHP version 4.3.0")); if(!function_exists("extension_loaded") || !extension_loaded("openssl")) - return("establishing SSL connections requires the OpenSSL extension enabled"); + return(gettext("establishing SSL connections requires the OpenSSL extension enabled")); } if(ereg('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$',$domain)) $ip=$domain; @@ -230,30 +230,30 @@ class smtp_class if($this->debug) $this->OutputDebug($resolve_message); if(!strcmp($ip=@gethostbyname($domain),$domain)) - return("could not resolve host \"".$domain."\""); + return(sprintf(gettext("could not resolve host \"%s\""), $domain)); } if(strlen($this->exclude_address) && !strcmp(@gethostbyname($this->exclude_address),$ip)) - return("domain \"".$domain."\" resolved to an address excluded to be valid"); + return(sprintf(gettext("domain \"%s\" resolved to an address excluded to be valid"), $domain)); if($this->debug) - $this->OutputDebug("Connecting to host address \"".$ip."\" port ".$port."..."); + $this->OutputDebug(sprintf(gettext("Connecting to host address \"%s\" port %s..."), $ip, $port)); if(($this->connection=($this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port,$errno,$error,$this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port)))) return(""); $error=($this->timeout ? strval($error) : "??"); switch($error) { case "-3": - return("-3 socket could not be created"); + return(gettext("-3 socket could not be created")); case "-4": - return("-4 dns lookup on hostname \"".$domain."\" failed"); + return(sprintf(gettext("-4 dns lookup on hostname \"%s\" failed"), $domain)); case "-5": - return("-5 connection refused or timed out"); + return(gettext("-5 connection refused or timed out")); case "-6": - return("-6 fdopen() call failed"); + return(gettext("-6 fdopen() call failed")); case "-7": - return("-7 setvbuf() call failed"); + return(gettext("-7 setvbuf() call failed")); } - return("could not connect to the host \"".$domain."\": ".$error); + return(sprintf(gettext("could not connect to the host \"%s\": %s"), $domain, $error)); } Function SASLAuthenticate($mechanisms, $credentials, &$authenticated, &$mechanism) @@ -262,7 +262,7 @@ class smtp_class if(!function_exists("class_exists") || !class_exists("sasl_client_class")) { - $this->error="it is not possible to authenticate using the specified mechanism because the SASL library class is not loaded"; + $this->error=gettext("it is not possible to authenticate using the specified mechanism because the SASL library class is not loaded"); return(0); } $sasl=new sasl_client_class; @@ -286,19 +286,19 @@ class smtp_class case SASL_NOMECH: if(strlen($this->authentication_mechanism)) { - $this->error="authenticated mechanism ".$this->authentication_mechanism." may not be used: ".$sasl->error; + $this->error=printf(gettext("authenticated mechanism %s may not be used: %s"), $this->authentication_mechanism, $sasl->error); return(0); } break; default: - $this->error="Could not start the SASL authentication client: ".$sasl->error; + $this->error=gettext("Could not start the SASL authentication client:") . " ".$sasl->error; return(0); } if(strlen($mechanism=$sasl->mechanism)) { if($this->PutLine("AUTH ".$sasl->mechanism.(IsSet($message) ? " ".base64_encode($message) : ""))==0) { - $this->error="Could not send the AUTH command"; + $this->error=gettext("Could not send the AUTH command"); return(0); } if(!$this->VerifyResultLines(array("235","334"),$responses)) @@ -313,7 +313,7 @@ class smtp_class $response=base64_decode($responses[0]); break; default: - $this->error="Authentication error: ".$responses[0]; + $this->error=gettext("Authentication error:") . " ".$responses[0]; return(0); } for(;!$authenticated;) @@ -328,7 +328,7 @@ class smtp_class case SASL_CONTINUE: if($this->PutLine(base64_encode($message))==0) { - $this->error="Could not send the authentication step message"; + $this->error=gettext("Could not send the authentication step message"); return(0); } if(!$this->VerifyResultLines(array("235","334"),$responses)) @@ -343,12 +343,12 @@ class smtp_class $response=base64_decode($responses[0]); break; default: - $this->error="Authentication error: ".$responses[0]; + $this->error=gettext("Authentication error:") . " ".$responses[0]; return(0); } break; default: - $this->error="Could not process the SASL authentication step: ".$sasl->error; + $this->error=gettext("Could not process the SASL authentication step:") . " ".$sasl->error; return(0); } } @@ -362,7 +362,7 @@ class smtp_class { if(strcmp($this->state,"Disconnected")) { - $this->error="connection is already established"; + $this->error=gettext("connection is already established"); return(0); } $this->disconnected_error=0; @@ -400,24 +400,24 @@ class smtp_class $user=$this->user; if(strlen($user)==0) { - $this->error="it was not specified the POP3 authentication user"; + $this->error=gettext("it was not specified the POP3 authentication user"); return(0); } $password=$this->password; if(strlen($password)==0) { - $this->error="it was not specified the POP3 authentication password"; + $this->error=gettext("it was not specified the POP3 authentication password"); return(0); } $domain=$this->pop3_auth_host; - $this->error=$this->ConnectToHost($domain, $this->pop3_auth_port, "Resolving POP3 authentication host \"".$domain."\"..."); + $this->error=$this->ConnectToHost($domain, $this->pop3_auth_port, sprintf(gettext("Resolving POP3 authentication host \"%s\"..."), $domain)); if(strlen($this->error)) return(0); if(strlen($response=$this->GetLine())==0) return(0); if(strcmp($this->Tokenize($response," "),"+OK")) { - $this->error="POP3 authentication server greeting was not found"; + $this->error=gettext("POP3 authentication server greeting was not found"); return(0); } if(!$this->PutLine("USER ".$this->user) @@ -425,7 +425,7 @@ class smtp_class return(0); if(strcmp($this->Tokenize($response," "),"+OK")) { - $this->error="POP3 authentication user was not accepted: ".$this->Tokenize("\r\n"); + $this->error=gettext("POP3 authentication user was not accepted:") . " ".$this->Tokenize("\r\n"); return(0); } if(!$this->PutLine("PASS ".$password) @@ -433,7 +433,7 @@ class smtp_class return(0); if(strcmp($this->Tokenize($response," "),"+OK")) { - $this->error="POP3 authentication password was not accepted: ".$this->Tokenize("\r\n"); + $this->error=gettext("POP3 authentication password was not accepted:") . " ".$this->Tokenize("\r\n"); return(0); } fclose($this->connection); @@ -442,13 +442,13 @@ class smtp_class } if(count($hosts)==0) { - $this->error="could not determine the SMTP to connect"; + $this->error=gettext("could not determine the SMTP to connect"); return(0); } for($host=0, $error="not connected";strlen($error) && $hostConnectToHost($domain, $this->host_port, "Resolving SMTP server domain \"$domain\"..."); + $error=$this->ConnectToHost($domain, $this->host_port, sprintf(gettext("Resolving SMTP server domain \"%s\"..."), $domain)); } if(strlen($error)) { @@ -460,7 +460,7 @@ class smtp_class && function_exists("socket_set_timeout")) socket_set_timeout($this->connection,$timeout,0); if($this->debug) - $this->OutputDebug("Connected to SMTP server \"".$domain."\"."); + $this->OutputDebug(sprintf(gettext("Connected to SMTP server \"%s\"."), $domain)); if(!strcmp($localhost=$this->localhost,"") && !strcmp($localhost=getenv("SERVER_NAME"),"") && !strcmp($localhost=getenv("HOST"),"")) @@ -514,7 +514,7 @@ class smtp_class { if(!IsSet($this->esmtp_extensions["AUTH"])) { - $this->error="server does not require authentication"; + $this->error=gettext("server does not require authentication"); $success=0; } else @@ -578,7 +578,7 @@ class smtp_class if($success && strlen($mechanism)==0) { - $this->error="it is not supported any of the authentication mechanisms required by the server"; + $this->error=gettext("it is not supported any of the authentication mechanisms required by the server"); $success=0; } } @@ -610,7 +610,7 @@ class smtp_class $sender=$this->direct_sender; break; default: - $this->error="direct delivery connection is already established and sender is already set"; + $this->error=gettext("direct delivery connection is already established and sender is already set"); return(0); } } @@ -618,7 +618,7 @@ class smtp_class { if(strcmp($this->state,"Connected")) { - $this->error="connection is not in the initial state"; + $this->error=gettext("connection is not in the initial state"); return(0); } } @@ -640,7 +640,7 @@ class smtp_class if($this->direct_delivery) { if(GetType($at=strrpos($recipient,"@"))!="integer") - return("it was not specified a valid direct recipient"); + return(gettext("it was not specified a valid direct recipient")); $domain=substr($recipient,$at+1); switch($this->state) { @@ -659,12 +659,12 @@ class smtp_class case "RecipientSet": if(strcmp($this->connected_domain,$domain)) { - $this->error="it is not possible to deliver directly to recipients of different domains"; + $this->error=gettext("it is not possible to deliver directly to recipients of different domains"); return(0); } break; default: - $this->error="connection is already established and the recipient is already set"; + $this->error=gettext("connection is already established and the recipient is already set"); return(0); } } @@ -676,7 +676,7 @@ class smtp_class case "RecipientSet": break; default: - $this->error="connection is not in the recipient setting state"; + $this->error=gettext("connection is not in the recipient setting state"); return(0); } } @@ -705,7 +705,7 @@ class smtp_class { if(strcmp($this->state,"RecipientSet")) { - $this->error="connection is not in the start sending data state"; + $this->error=gettext("connection is not in the start sending data state"); return(0); } $this->error=""; @@ -735,7 +735,7 @@ class smtp_class { if(strcmp($this->state,"SendingData")) { - $this->error="connection is not in the sending data state"; + $this->error=gettext("connection is not in the sending data state"); return(0); } $this->error=""; @@ -746,7 +746,7 @@ class smtp_class { if(strcmp($this->state,"SendingData")) { - $this->error="connection is not in the sending data state"; + $this->error=gettext("connection is not in the sending data state"); return(0); } $this->error=""; @@ -782,7 +782,7 @@ class smtp_class { if(!strcmp($this->state,"Disconnected")) { - $this->error="it was not previously established a SMTP connection"; + $this->error=gettext("it was not previously established a SMTP connection"); return(0); } $this->error=""; @@ -840,4 +840,4 @@ class smtp_class }; -?> \ No newline at end of file +?> From 4a896b862460bd026ff9fc055e59e8ec00a467af Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 17 Aug 2010 17:23:58 -0300 Subject: [PATCH 034/329] Implement gettext() calls on system.inc --- etc/inc/system.inc | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index e7fc684da3..3606621007 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -89,7 +89,7 @@ function system_resolvconf_generate($dynupdate = false) { $fd = fopen("{$g['varetc_path']}/resolv.conf", "w"); if (!$fd) { - printf("Error: cannot open resolv.conf in system_resolvconf_generate().\n"); + printf(gettext("Error: cannot open resolv.conf in system_resolvconf_generate().%s"), "\n"); return 1; } @@ -188,7 +188,7 @@ function system_hosts_generate() { $fd = fopen("{$g['varetc_path']}/hosts", "w"); if (!$fd) { - log_error("Error: cannot open hosts file in system_hosts_generate().\n"); + log_error(sprintf(gettext("Error: cannot open hosts file in system_hosts_generate().%s"), "\n")); return 1; } @@ -332,14 +332,14 @@ function system_routing_configure($interface = "") { if(isset($route_arr['default'])) { $action = "change"; } - log_error("ROUTING: $action default route to $gatewayip"); + log_error(sprintf(gettext("ROUTING: %s default route to %s"), $action, $gatewayip)); mwexec("/sbin/route {$action} default " . escapeshellarg($gatewayip)); } else if (is_ipaddr($config['interfaces']['wan']['gateway'])) { /* Adding gateway for 1.2-style configs without the new * gateway setup configured. * Force WAN to be default gateway because that is the 1.2 behavior. */ - log_error("WARNING: There is no default gateway in the configuration."); + log_error(gettext("WARNING: There is no default gateway in the configuration.")); $gatewayip = $config['interfaces']['wan']['gateway']; mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true); } @@ -358,7 +358,7 @@ function system_routing_configure($interface = "") { } else if (is_ipaddr($rtent['gateway'])) { $gatewayip = $rtent['gateway']; } else { - log_error("Static Routes: Gateway IP could not be found for {$rtent['network']}"); + log_error(sprintf(gettext("Static Routes: Gateway IP could not be found for %s"), $rtent['network'])); continue; } @@ -399,7 +399,7 @@ function system_syslogd_start() { $syslogcfg = $config['syslog']; if ($g['booting']) - echo "Starting syslog..."; + echo gettext("Starting syslog..."); else killbypid("{$g['varrun_path']}/syslog.pid"); @@ -440,7 +440,7 @@ function system_syslogd_start() { /* write syslog.conf */ $fd = fopen("{$g['varetc_path']}/syslog.conf", "w"); if (!$fd) { - printf("Error: cannot open syslog.conf in system_syslogd_start().\n"); + printf(gettext("Error: cannot open syslog.conf in system_syslogd_start().%s"), "\n"); return 1; } $syslogconf .= "!ntpdate,!ntpd\n"; @@ -603,7 +603,7 @@ EOD; } if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; return $retval; } @@ -616,7 +616,7 @@ function system_pccard_start() { } if ($g['booting']) - echo "Initializing PCMCIA..."; + echo gettext("Initializing PCMCIA..."); /* kill any running pccardd */ killbypid("{$g['varrun_path']}/pccardd.pid"); @@ -626,9 +626,9 @@ function system_pccard_start() { if ($g['booting']) { if ($res == 0) - echo "done.\n"; + echo gettext("done.") . "\n"; else - echo "failed!\n"; + echo gettext("failed!") . "\n"; } return $res; @@ -639,7 +639,7 @@ function system_webgui_start() { global $config, $g; if ($g['booting']) - echo "Starting webConfigurator..."; + echo gettext("Starting webConfigurator..."); /* kill any running lighttpd */ killbypid("{$g['varrun_path']}/lighty-webConfigurator.pid"); @@ -668,10 +668,10 @@ function system_webgui_start() { if (!is_array($config['system']['cert'])) $config['system']['cert'] = array(); $a_cert =& $config['system']['cert']; - echo "Creating SSL Certificate... "; + echo gettext("Creating SSL Certificate... "); $cert = array(); $cert['refid'] = uniqid(); - $cert['name'] = "webConfigurator default"; + $cert['name'] = gettext("webConfigurator default"); mwexec("/usr/bin/openssl genrsa 1024 > {$g['tmp_path']}/ssl.key"); mwexec("/usr/bin/openssl req -new -x509 -nodes -sha1 -days 2000 -key {$g['tmp_path']}/ssl.key > {$g['tmp_path']}/ssl.crt"); $crt = file_get_contents("{$g['tmp_path']}/ssl.crt"); @@ -681,7 +681,7 @@ function system_webgui_start() { cert_import($cert, $crt, $key); $a_cert[] = $cert; $config['system']['webgui']['ssl-certref'] = $cert['refid']; - write_config("Importing HTTPS certificate"); + write_config(gettext("Importing HTTPS certificate")); if(!$config['system']['webgui']['port']) $portarg = "443"; $ca = ca_chain($cert); @@ -709,9 +709,9 @@ function system_webgui_start() { if ($g['booting']) { if ($res == 0) - echo "done.\n"; + echo gettext("done.") . "\n"; else - echo "failed!\n"; + echo gettext("failed!") . "\n"; } return $res; @@ -1025,7 +1025,7 @@ EOD; if($cert <> "" and $key <> "") { $fd = fopen("{$g['varetc_path']}/{$cert_location}", "w"); if (!$fd) { - printf("Error: cannot open cert.pem in system_webgui_start().\n"); + printf(gettext("Error: cannot open cert.pem in system_webgui_start().%s"), "\n"); return 1; } chmod("{$g['varetc_path']}/{$cert_location}", 0600); @@ -1036,7 +1036,7 @@ EOD; if($ca <> "") { $fd = fopen("{$g['varetc_path']}/{$ca_location}", "w"); if (!$fd) { - printf("Error: cannot open ca.pem in system_webgui_start().\n"); + printf(gettext("Error: cannot open ca.pem in system_webgui_start().%s"), "\n"); return 1; } chmod("{$g['varetc_path']}/{$ca_location}", 0600); @@ -1044,7 +1044,7 @@ EOD; fclose($fd); } $lighty_config .= "\n"; - $lighty_config .= "## ssl configuration\n"; + $lighty_config .= "## " . gettext("ssl configuration") . "\n"; $lighty_config .= "ssl.engine = \"enable\"\n"; $lighty_config .= "ssl.pemfile = \"{$g['varetc_path']}/{$cert_location}\"\n\n"; if($ca <> "") @@ -1066,7 +1066,7 @@ EOD; $fd = fopen("{$filename}", "w"); if (!$fd) { - printf("Error: cannot open {$filename} in system_generate_lighty_config().\n"); + printf(gettext("Error: cannot open %s in system_generate_lighty_config().%s"), $filename, "\n"); return 1; } fwrite($fd, $lighty_config); @@ -1086,7 +1086,7 @@ function system_timezone_configure() { $syscfg = $config['system']; if ($g['booting']) - echo "Setting timezone..."; + echo gettext("Setting timezone..."); /* extract appropriate timezone file */ $timezone = $syscfg['timezone']; @@ -1102,7 +1102,7 @@ function system_timezone_configure() { conf_mount_ro(); if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } function system_ntp_configure() { @@ -1113,17 +1113,17 @@ function system_ntp_configure() { /* 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"); + log_error(sprintf(gettext("Could not open %s/ntpd.conf for writing"), $g['varetc_path'])); return; } fwrite($fd, "# \n"); - fwrite($fd, "# pfSense OpenNTPD configuration file \n"); + fwrite($fd, "# " . gettext("pfSense OpenNTPD configuration file") . " \n"); fwrite($fd, "# \n\n"); /* foreach through servers and write out to ntpd.conf */ foreach (explode(' ', $syscfg['timeservers']) as $ts) - fwrite($fd, "servers {$ts}\n"); + fwrite($fd, sprintf(gettext("servers %s%s"), $ts, "\n")); /* Setup listener(s) if the user has configured one */ if ($config['installedpackages']['openntpd']) { @@ -1172,7 +1172,7 @@ function sync_system_time() { $syscfg = $config['system']; if ($g['booting']) - echo "Syncing system time before startup..."; + echo gettext("Syncing system time before startup..."); /* foreach through servers and write out to ntpd.conf */ foreach (explode(' ', $syscfg['timeservers']) as $ts) { @@ -1180,7 +1180,7 @@ function sync_system_time() { } if ($g['booting']) - echo "done.\n"; + echo gettext("done.") . "\n"; } @@ -1277,7 +1277,7 @@ function system_dmesg_save() { $fd = fopen("{$g['varlog_path']}/dmesg.boot", "w"); if (!$fd) { - printf("Error: cannot open dmesg.boot in system_dmesg_save().\n"); + printf(gettext("Error: cannot open dmesg.boot in system_dmesg_save().%s"), "\n"); return 1; } @@ -1298,7 +1298,7 @@ function system_set_harddisk_standby() { if (isset($config['system']['harddiskstandby'])) { if ($g['booting']) { - echo 'Setting hard disk standby... '; + echo gettext('Setting hard disk standby... '); } $standby = $config['system']['harddiskstandby']; @@ -1310,13 +1310,13 @@ function system_set_harddisk_standby() { // Reinitialize ATA-drives mwexec('/usr/local/sbin/atareinit'); if ($g['booting']) { - echo "done.\n"; + echo gettext("done.") . "\n"; } } else if ($g['booting']) { - echo "failed!\n"; + echo gettext("failed!") . "\n"; } } else if ($g['booting']) { - echo "failed!\n"; + echo gettext("failed!") . "\n"; } } } @@ -1415,10 +1415,10 @@ function system_identify_specific_platform() { global $g; if ($g['platform'] == 'generic-pc') - return array('name' => 'generic-pc', 'descr' => "Generic PC"); + return array('name' => 'generic-pc', 'descr' => gettext("Generic PC")); if ($g['platform'] == 'generic-pc-cdrom') - return array('name' => 'generic-pc-cdrom', 'descr' => "Generic PC (CD-ROM)"); + return array('name' => 'generic-pc-cdrom', 'descr' => gettext("Generic PC (CD-ROM)")); /* the rest of the code only deals with 'embedded' platforms */ if ($g['platform'] != 'nanobsd') @@ -1427,10 +1427,10 @@ function system_identify_specific_platform() { $dmesg = system_get_dmesg_boot(); if (strpos($dmesg, "PC Engines WRAP") !== false) - return array('name' => 'wrap', 'descr' => 'PC Engines WRAP'); + return array('name' => 'wrap', 'descr' => gettext('PC Engines WRAP')); if (strpos($dmesg, "PC Engines ALIX") !== false) - return array('name' => 'alix', 'descr' => 'PC Engines ALIX'); + return array('name' => 'alix', 'descr' => gettext('PC Engines ALIX')); if (preg_match("/Soekris net45../", $dmesg, $matches)) return array('name' => 'net45xx', 'descr' => $matches[0]); @@ -1442,7 +1442,7 @@ function system_identify_specific_platform() { return array('name' => 'net55xx', 'descr' => $matches[0]); /* unknown embedded platform */ - return array('name' => 'embedded', 'descr' => 'embedded (unknown)'); + return array('name' => 'embedded', 'descr' => gettext('embedded (unknown)')); } function system_get_dmesg_boot() { From 4b48d1b9c1b40bfca925458d26e34198a9bf3c8c Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Wed, 18 Aug 2010 08:24:51 -0300 Subject: [PATCH 035/329] Implement gettext() calls on upgrade_config.inc --- etc/inc/upgrade_config.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 574be987f2..3def794dcd 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -110,8 +110,8 @@ function upgrade_010_to_011() { $fr['interface'] = $ifmap[$fr['interface']]; else { /* remove the rule */ - echo "\nWarning: filter rule removed " . - "(interface '{$fr['interface']}' does not exist anymore)."; + printf(gettext("%sWarning: filter rule removed " . + "(interface '%s' does not exist anymore)."), "\n", $fr['interface']); unset($config['filter']['rule'][$i]); continue; } @@ -122,8 +122,8 @@ function upgrade_010_to_011() { $fr['source']['network'] = $ifmap[$fr['source']['network']]; else { /* remove the rule */ - echo "\nWarning: filter rule removed " . - "(source network '{$fr['source']['network']}' does not exist anymore)."; + printf(gettext("%sWarning: filter rule removed " . + "(source network '%s' does not exist anymore)."), "\n", $fr['source']['network']); unset($config['filter']['rule'][$i]); continue; } @@ -135,8 +135,8 @@ function upgrade_010_to_011() { $fr['destination']['network'] = $ifmap[$fr['destination']['network']]; else { /* remove the rule */ - echo "\nWarning: filter rule removed " . - "(destination network '{$fr['destination']['network']}' does not exist anymore)."; + printf(gettext("%sWarning: filter rule removed " . + "(destination network '%s' does not exist anymore)."), "\n", $fr['destination']['network']); unset($config['filter']['rule'][$i]); continue; } @@ -155,8 +155,8 @@ function upgrade_010_to_011() { $fr['interface'] = $ifmap[$fr['interface']]; else { /* remove the rule */ - echo "\nWarning: traffic shaper rule removed " . - "(interface '{$fr['interface']}' does not exist anymore)."; + printf(gettext("%sWarning: traffic shaper rule removed " . + "(interface '%s' does not exist anymore)."), "\n", $fr['interface']); unset($config['pfqueueing']['rule'][$i]); continue; } From dbaf21d4944dd9616c4553a5f8380fa5d3a1fe9d Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 10:36:29 -0300 Subject: [PATCH 036/329] Implement gettext() calls on shaper.inc --- etc/inc/shaper.inc | 391 ++++++++++++++++++++++----------------------- 1 file changed, 194 insertions(+), 197 deletions(-) diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 7d95f82a8c..7f4b644a4d 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -184,13 +184,13 @@ function shaper_do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input /* check for bad control characters */ foreach ($postdata as $pn => $pd) { if (is_string($pd) && preg_match("/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/", $pd)) { - $input_errors[] = "The field '" . $pn . "' contains invalid characters."; + $input_errors[] = sprintf(gettext("The field '%s' contains invalid characters."), $pn); } } for ($i = 0; $i < count($reqdfields); $i++) { if ($postdata[$reqdfields[$i]] == "") { - $input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required."; + $input_errors[] = sprintf(gettext("The field '%s' is required."), $reqdfieldsn[$i]); } } } @@ -309,24 +309,24 @@ class altq_root_queue { function validate_input($data, &$input_errors) { $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Qlimit must be an integer."; + $input_errors[] = gettext("Qlimit must be an integer."); if ($data['qlimit'] < 0) - $input_errors[] = "Qlimit must be an positive."; + $input_errors[] = gettext("Qlimit must be an positive."); if ($data['tbrconfig'] && (!is_numeric($data['tbrconfig']))) - $input_errors[] = "Tbrsize must be an integer."; + $input_errors[] = gettext("Tbrsize must be an integer."); if ($data['tbrconfig'] < 0) - $input_errors[] = "Tbrsize must be an positive."; + $input_errors[] = gettext("Tbrsize must be an positive."); } /* Implement this to shorten some code on the frontend page */ @@ -597,18 +597,18 @@ class altq_root_queue { */ function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= "
"; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/disable discipline and its children"; + $form .= " > " . gettext("Enable/disable discipline and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "".$this->GetQname().""; $form .= ""; - $form .= "Scheduler Type "; + $form .= "" . gettext("Scheduler Type "); $form .= ""; $form .= ""; $form .= ""; $form .= "
"; - $form .= "NOTE: Changing this changes all child queues!"; - $form .= " Beware you can lose information."; + $form .= gettext("NOTE: Changing this changes all child queues!"); + $form .= gettext(" Beware you can lose information."); $form .= ""; $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth"); $form .= ""; $form .= "GetBandwidth() . "\">"; @@ -669,9 +669,9 @@ class altq_root_queue { $form .= $this->GetTbrConfig(); $form .= "\">"; $form .= "
"; - $form .= "Adjusts the size, in bytes, of the token bucket regulator. "; - $form .= "If not specified, heuristics based on the interface "; - $form .= "bandwidth are used to determine the size."; + $form .= gettext("Adjusts the size, in bytes, of the token bucket regulator. " + . "If not specified, heuristics based on the interface " + . "bandwidth are used to determine the size."); $form .= ""; $form .= "GetInterface() . "\">"; @@ -938,19 +938,19 @@ class priq_queue { function validate_input($data, &$input_errors) { $reqdfields[] = "name"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['priority'] && (!is_numeric($data['priority']) || ($data['priority'] < 1) || ($data['priority'] > 15))) { - $input_errors[] = "The priority must be an integer between 1 and 15."; + $input_errors[] = gettext("The priority must be an integer between 1 and 15."); } if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Queue limit must be an integer"; + $input_errors[] = gettext("Queue limit must be an integer"); if ($data['qlimit'] < 0) - $input_errors[] = "Queue limit must be positive"; + $input_errors[] = gettext("Queue limit must be positive"); if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } @@ -1077,12 +1077,12 @@ class priq_queue { */ function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= "
"; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable queue and its children"; + $form .= " > " . gettext("Enable/Disable queue and its children") . ""; $form .= ""; $form .= ""; $form .= ""; @@ -1090,51 +1090,51 @@ class priq_queue { $form .= "GetQname()); $form .= "\">"; - $form .= "
Enter the name of the queue here. Do not use spaces and limit the size to 15 characters."; + $form .= "
" . gettext("Enter the name of the queue here. Do not use spaces and limit the size to 15 characters."); $form .= "
"; $form .= ""; $form .= "Priority"; $form .= " GetQpriority()); $form .= "\">"; - $form .= "
For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload."; + $form .= "
" . gettext("For hfsc, the range is 0 to 7. The default is 1. Hfsc queues with a higher priority are preferred in the case of overload.") . ""; $form .= ""; $form .= ""; - $form .= "Queue limit"; + $form .= "" . gettext("Queue limit") . ""; $form .= " GetQlimit()); $form .= "\">"; - $form .= "
Queue limit in packets per second."; + $form .= "
" . gettext("Queue limit in packets per second."); $form .= ""; $form .= ""; - $form .= "Scheduler options"; + $form .= "" . gettext("Scheduler options") . ""; $form .= ""; $tmpvalue = $this->GetDefault(); if (!empty($tmpvalue)) { $form .= ""; } else { $form .= ""; } $form .= "GetRed(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Random Early Detection
"; + $form .= "> " . gettext("Random Early Detection") . "
"; $form .= "GetRio(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Random Early Detection In and Out
"; + $form .= "> " . gettext("Random Early Detection In and Out") . "
"; $form .= "GetEcn(); if(!empty($tmpvalue)) $form .= " CHECKED"; - $form .= "> Explicit Congestion Notification
"; - $form .= "
Select options for this queue"; + $form .= "> " . gettext("Explicit Congestion Notification") . "
"; + $form .= "
" . gettext("Select options for this queue"); $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetDescription() . "\" >"; $form .= ""; @@ -1160,23 +1160,23 @@ class priq_queue { */ $form .= ""; $form .= ""; - $form .= "Bandwidth: " . $this->GetBandwidth().$this->GetBwscale(); + $form .= gettext("Bandwidth:") . " " . $this->GetBandwidth().$this->GetBwscale(); $form .= ""; $form .= ""; $tmpvalue = $this->GetQpriority(); if (!empty($tmpvalue)) - $form .= "Priority: on "; + $form .= gettext("Priority: on") . " "; $tmpvalue = $this->GetDefault(); if (!empty($tmpvalue)) - $form .= "Default: on "; + $form .= "" . gettext("Default: on") . " "; $form .= ""; $form .= "GetInterface() . "&queue="; $form .= $this->GetQname() . "&action=delete\">"; $form .= ""; - $form .= "Delete queue from interface"; + $form .= " width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("Delete queue from interface") . "\">"; + $form .= "" . gettext("Delete queue from interface") . ""; return $form; @@ -1499,22 +1499,22 @@ class hfsc_queue extends priq_queue { parent::validate_input($data, $input_errors); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if (isset($data['linkshare3']) && $data['linkshare3'] <> "") { if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); - if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + if ($data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['bandwidthtype'] == "%") { if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); } /* $parent =& $this->GetParent(); @@ -1531,15 +1531,15 @@ class hfsc_queue extends priq_queue { } if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") - $input_errors[] = ("upperlimit service curve defined but missing (d) value"); + $input_errors[] = gettext("upperlimit service curve defined but missing (d) value"); if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") - $input_errors[] = ("upperlimit service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("upperlimit service curve defined but missing initial bandwidth (m1) value"); if ($data['upperlimit1'] <> "" && !is_valid_shaperbw($data['upperlimit1'])) - $input_errors[] = ("upperlimit m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("upperlimit m1 value needs to be Kb, Mb, Gb, or %"); if ($data['upperlimit2'] <> "" && !is_numeric($data['upperlimit2'])) - $input_errors[] = ("upperlimit d value needs to be numeric"); + $input_errors[] = gettext("upperlimit d value needs to be numeric"); if ($data['upperlimit3'] <> "" && !is_valid_shaperbw($data['upperlimit3'])) - $input_errors[] = ("upperlimit m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("upperlimit m2 value needs to be Kb, Mb, Gb, or %"); /* if (isset($data['upperlimit']) && $data['upperlimit3'] <> "" && $data['upperlimit1'] <> "") { @@ -1553,19 +1553,19 @@ class hfsc_queue extends priq_queue { } */ if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") - $input_errors[] = ("linkshare service curve defined but missing (d) value"); + $input_errors[] = gettext("linkshare service curve defined but missing (d) value"); if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") - $input_errors[] = ("linkshare service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("linkshare service curve defined but missing initial bandwidth (m1) value"); if ($data['linkshare1'] <> "" && !is_valid_shaperbw($data['linkshare1'])) - $input_errors[] = ("linkshare m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("linkshare m1 value needs to be Kb, Mb, Gb, or %"); if ($data['linkshare2'] <> "" && !is_numeric($data['linkshare2'])) - $input_errors[] = ("linkshare d value needs to be numeric"); + $input_errors[] = gettext("linkshare d value needs to be numeric"); if ($data['linkshare3'] <> "" && !is_valid_shaperbw($data['linkshare3'])) - $input_errors[] = ("linkshare m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("linkshare m2 value needs to be Kb, Mb, Gb, or %"); if ($data['realtime1'] <> "" && $data['realtime2'] == "") - $input_errors[] = ("realtime service curve defined but missing (d) value"); + $input_errors[] = gettext("realtime service curve defined but missing (d) value"); if ($data['realtime2'] <> "" && $data['realtime1'] == "") - $input_errors[] = ("realtime service curve defined but missing initial bandwidth (m1) value"); + $input_errors[] = gettext("realtime service curve defined but missing initial bandwidth (m1) value"); /* if (isset($data['linkshare']) && $data['linkshare3'] <> "" && $data['linkshare1'] <> "" && 0) { @@ -1580,11 +1580,11 @@ class hfsc_queue extends priq_queue { */ if ($data['realtime1'] <> "" && !is_valid_shaperbw($data['realtime1'])) - $input_errors[] = ("realtime m1 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("realtime m1 value needs to be Kb, Mb, Gb, or %"); if ($data['realtime2'] <> "" && !is_numeric($data['realtime2'])) - $input_errors[] = ("realtime d value needs to be numeric"); + $input_errors[] = gettext("realtime d value needs to be numeric"); if ($data['realtime3'] <> "" && !is_valid_shaperbw($data['realtime3'])) - $input_errors[] = ("realtime m2 value needs to be Kb, Mb, Gb, or %"); + $input_errors[] = gettext("realtime m2 value needs to be Kb, Mb, Gb, or %"); /* if (isset($data['realtime']) && $data['realtime3'] <> "" && $data['realtime1'] <> "" && 0) { @@ -1805,7 +1805,7 @@ class hfsc_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth()); $form .= "\">"; @@ -1831,10 +1831,10 @@ class hfsc_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; $form .= ""; - $form .= "Service Curve (sc)"; + $form .= "" . gettext("Service Curve (sc)") . ""; $form .= ""; $form .= ""; $form .= ""; @@ -1856,7 +1856,7 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"upperlimit3\" name=\"upperlimit3\" "; if ($this->GetUpperlimit() == "") $form .= " disabled"; - $form .= ">"; + $form .= ">"; $form .= ""; + $form .= ">"; $form .= ""; + $form .= ">"; $form .= "
 
m1
d
m2
The maximum allowed bandwidth for the queue.
" . gettext("The maximum allowed bandwidth for the queue.") . "
GetRealtime() <> "") $form .= " CHECKED "; @@ -1875,11 +1875,11 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"realtime3\" name=\"realtime3\" "; if ($this->GetRealtime() == "") $form .= " disabled"; - $form .= ">The minimum required bandwidth for the queue.
" . gettext("The minimum required bandwidth for the queue.") . "
GetLinkshare() <> "") $form .= " CHECKED "; - $form .= "onChange=\"enable_linkshare()\"> Link share: " . gettext("Link share:") . "GetL_m1()); $form .= "\" id=\"linkshare1\" name=\"linkshare1\" "; if ($this->GetLinkshare() == "") @@ -1894,12 +1894,12 @@ class hfsc_queue extends priq_queue { $form .= "\" id=\"linkshare3\" name=\"linkshare3\" "; if ($this->GetLinkshare() == "") $form .= " disabled"; - $form .= ">The bandwidth share of a backlogged queue - this overrides priority.
" . gettext("The bandwidth share of a backlogged queue - this overrides priority.") . "

"; - $form .= "The format for service curve specifications is (m1, d, m2). m2 controls"; - $form .= "the bandwidth assigned to the queue. m1 and d are optional and can be"; - $form .= "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value"; - $form .= "given in m2."; + $form .= gettext("The format for service curve specifications is (m1, d, m2). m2 controls " + . "the bandwidth assigned to the queue. m1 and d are optional and can be " + . "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value " + . "given in m2."); $form .= "
"; $form .= ""; @@ -2146,24 +2146,24 @@ class cbq_queue extends priq_queue { parent::validate_input($data, $input_errors); if ($data['priority'] > 7) - $input_errors[] = "Priority must be an integer between 1 and 7."; + $input_errors[] = gettext("Priority must be an integer between 1 and 7."); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && !is_numeric($data['bandwidth'])) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + $input_errors[] = gettext("Bandwidth cannot be negative."); if ($data['bandwidthtype'] == "%") { if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); } /* @@ -2281,7 +2281,7 @@ class cbq_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth() > 0) $form .= htmlspecialchars($this->GetBandwidth()); @@ -2308,13 +2308,13 @@ class cbq_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; - $form .= "Scheduler specific options"; + $form .= "" . gettext("Scheduler specific options") . ""; $form .= "GetBorrow() == "on") $form .= " CHECKED "; - $form .= "> Borrow from other queues when available
"; + $form .= "> " . gettext("Borrow from other queues when available") . "
"; return $form; } @@ -2421,26 +2421,26 @@ class fairq_queue extends priq_queue { parent::validate_input($data, $input_errors); if ($data['priority'] > 255) - $input_errors[] = "Priority must be an integer between 1 and 255."; + $input_errors[] = gettext("Priority must be an integer between 1 and 255."); $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['bandwidth'] && !is_numeric($data['bandwidth'])) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); - if ($data['bandwidth'] < 0) - $input_errors[] = "Bandwidth cannot be negative."; + if ($data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth cannot be negative."); - if ($data['bandwidthtype'] == "%") { - if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) - $input_errors[] = "Bandwidth in percentage should be between 1 and 100 bounds."; - } + if ($data['bandwidthtype'] == "%") { + if ($data['bandwidth'] > 100 || $data['bandwidth'] < 0) + $input_errors[] = gettext("Bandwidth in percentage should be between 1 and 100 bounds."); + } /* $parent =& $this->GetParent(); @@ -2548,7 +2548,7 @@ class fairq_queue extends priq_queue { function build_form() { $form = parent::build_form(); $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth") . ""; $form .= " GetBandwidth() > 0) $form .= htmlspecialchars($this->GetBandwidth()); @@ -2575,20 +2575,20 @@ class fairq_queue extends priq_queue { $form .= " selected=\"yes\""; $form .= ">%"; $form .= "
"; - $form .= "Choose the amount of bandwidth for this queue"; + $form .= "" . gettext("Choose the amount of bandwidth for this queue"); $form .= ""; - $form .= "Scheduler specific options"; + $form .= "" . gettext("Scheduler specific options") . ""; $form .= ""; + $form .= "\"> " . gettext("Number of buckets available.") . "
"; $form .= ""; + $form .= "\"> " . gettext("Bandwidth limit for hosts to not saturate link.") . "
"; $form .= "
"; $form .= "GetBuckets()); if(!empty($tmpvalue)) $form .= $this->GetBuckets(); - $form .= "\"> Number of buckets available.
GetHogs()); if(!empty($tmpvalue)) $form .= $this->GetHogs(); - $form .= "\"> Bandwidth limit for hosts to not saturate link.
"; return $form; } @@ -2742,24 +2742,24 @@ class dummynet_class { function validate_input($data, &$input_errors) { $reqdfields[] = "bandwidth"; - $reqdfieldsn[] = "Bandwidth"; + $reqdfieldsn[] = gettext("Bandwidth"); $reqdfields[] = "bandwidthtype"; - $reqdfieldsn[] = "Bandwidthtype"; + $reqdfieldsn[] = gettext("Bandwidthtype"); $reqdfields[] = "name"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['plr'] && ((!is_numeric($data['plr'])) || ($data['plr'] <= 0 && $data['plr'] > 1))) - $input_errors[] = "Plr must be an integer between 1 and 100."; + $input_errors[] = gettext("Plr must be an integer between 1 and 100."); if (($data['buckets'] && (!is_numeric($data['buckets']))) || ($data['buckets'] < 1 && $data['buckets'] > 100)) - $input_errors[] = "Buckets must be an integer between 16 and 65535."; + $input_errors[] = gettext("Buckets must be an integer between 16 and 65535."); if ($data['qlimit'] && (!is_numeric($data['qlimit']))) - $input_errors[] = "Queue limit must be an integer"; - if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue limit must be an integer"); + if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name'])) + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } } @@ -2851,10 +2851,10 @@ class dnpipe_class extends dummynet_class { parent::validate_input($data, $input_errors); if ($data['bandwidth'] && (!is_numeric($data['bandwidth']))) - $input_errors[] = "Bandwidth must be an integer."; + $input_errors[] = gettext("Bandwidth must be an integer."); if ($data['delay'] && (!is_numeric($data['delay']))) - $input_errors[] = "Delay must be an integer."; - } + $input_errors[] = gettext("Delay must be an integer."); + } function ReadConfig(&$q) { $this->SetQname($q['name']); @@ -2942,19 +2942,19 @@ class dnpipe_class extends dummynet_class { function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable limiter and its children"; + $form .= " > " . gettext("Enable/Disable limiter and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetQname()."\">"; $form .= ""; - $form .= "Bandwidth"; + $form .= "" . gettext("Bandwidth"); $form .= ""; $form .= "GetBandwidth() . "\">"; @@ -2974,10 +2974,10 @@ class dnpipe_class extends dummynet_class { $form .= ""; + $form .= ">" . gettext("Bit/s") . ""; $form .= ""; $form .= ""; - $form .= "Mask"; + $form .= "" . gettext("Mask") . ""; $form .= ""; $form .= ""; $form .= " 
"; - $form .= "If 'source' or 'destination' is chosen, \n"; - $form .= "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"; - $form .= "be created for each source/destination IP address encountered, \n"; - $form .= "respectively. This makes it possible to easily specify bandwidth \n"; - $form .= "limits per host."; + $form .= "" . gettext("If 'source' or 'destination' is chosen, \n" + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . ""; $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; $form .= ""; $form .= ""; $form .= "
"; $form .= "

"; + $form .= " value=\"" . gettext("Show advanced options") . "\">"; $form .= "

"; $form .= ""; @@ -3021,37 +3020,37 @@ class dnpipe_class extends dummynet_class { $form .= ""; $form .= "GetDelay() . "\">"; - $form .= " ms
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)"; + $form .= " ms
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty)") . ""; $form .= "
"; $form .= ""; $form .= "Packet loss rate"; $form .= ""; $form .= "GetPlr() . "\">"; - $form .= " 
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)."; - $form .= "A value of 0.001 means one packet in 1000 gets dropped"; + $form .= " 
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; - $form .= "Queue Size"; + $form .= "" . gettext("Queue Size") . ""; $form .= ""; $form .= "GetQlimit() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first,"; - $form .= "then they are delayed by value specified in the Delay field, and then they "; - $form .= "are delivered to their destination."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; - $form .= "Bucket Size"; + $form .= "" . gettext("Bucket Size") . ""; $form .= ""; $form .= "GetBuckets() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. It increases the hash size set."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. It increases the hash size set."); $form .= ""; return $form; @@ -3108,7 +3107,7 @@ class dnqueue_class extends dummynet_class { if ($data['weight'] && ((!is_numeric($data['weight'])) || ($data['weight'] < 1 && $data['weight'] > 100))) - $input_errors[] = "Weight must be an integer between 1 and 100."; + $input_errors[] = gettext("Weight must be an integer between 1 and 100."); } /* @@ -3185,40 +3184,40 @@ class dnqueue_class extends dummynet_class { function build_form() { $form = "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetEnabled() == "on") $form .= " CHECKED"; - $form .= " > Enable/Disable queue and its children"; + $form .= " > " . gettext("Enable/Disable queue and its children") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetQname()."\">"; $form .= ""; - $form .= "Mask"; + $form .= "" . gettext("Mask") . ""; $form .= ""; $form .= ""; $form .= " slots
"; - $form .= "If 'source' or 'destination' is chosen, \n"; - $form .= "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"; - $form .= "be created for each source/destination IP address encountered, \n"; - $form .= "respectively. This makes it possible to easily specify bandwidth \n"; - $form .= "limits per host."; + $form .= "" . gettext("If 'source' or 'destination' is chosen, \n" + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . ""; $form .= ""; $form .= "Description"; $form .= ""; @@ -3226,51 +3225,50 @@ class dnqueue_class extends dummynet_class { $form .= $this->GetDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; $form .= ""; $form .= ""; $form .= "
"; $form .= "

"; + $form .= " value=\"" . gettext("Show advanced options") . "\">"; $form .= "

"; $form .= ""; - $form .= "Weight"; + $form .= "" . gettext("Weight") . ""; $form .= ""; $form .= "GetWeight() . "\">"; - $form .= " ms
Hint: For queues under the same parent "; - $form .= "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)"; + $form .= " ms
" . gettext("Hint: For queues under the same parent " + . "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . ""; $form .= ""; $form .= ""; - $form .= "Packet loss rate"; + $form .= "" . gettext("Packet loss rate") . ""; $form .= ""; $form .= "GetPlr() . "\">"; - $form .= " 
Hint: in most cases, you "; - $form .= "should specify 0 here (or leave the field empty)."; - $form .= "A value of 0.001 means one packet in 1000 gets dropped"; + $form .= " 
" . gettext("Hint: in most cases, you " + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; - $form .= "Queue Size"; + $form .= "" . gettext("Queue Size") . ""; $form .= ""; $form .= "GetQlimit() . "\">"; $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "; - $form .= "then they are delayed by value specified in the Delay field, and then they "; - $form .= "are delivered to their destination."; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; - $form .= "Bucket Size"; + $form .= "" . gettext("Bucket Size") . ""; $form .= ""; $form .= "GetBuckets() . "\">"; - $form .= " slots
"; - $form .= "Hint: in most cases, you "; - $form .= "should leave the field empty. It increases the hash size set."; + $form .= " " . gettext("slots") . "
"; + $form .= "" . gettext("Hint: in most cases, you " + . "should leave the field empty. It increases the hash size set."); $form .= ""; $form .= "
"; - $form .= "Enable/Disable"; + $form .= gettext("Enable/Disable"); $form .= ""; $form .= " GetREnabled() == "on") { $form .= "checked = \"CHECKED\""; } - $form .= " > Enable/Disable layer7 Container"; + $form .= " > " . gettext("Enable/Disable layer7 Container") . ""; $form .= ""; - $form .= "
Name"; + $form .= "
" . gettext("Name") . ""; $form .= ""; $form .= "GetRName()."\">"; $form .= ""; - $form .= "Description"; + $form .= "" . gettext("Description") . ""; $form .= ""; $form .= "GetRDescription(); $form .= "\">"; $form .= "
"; - $form .= "You may enter a description here "; - $form .= "for your reference (not parsed)."; + $form .= gettext("You may enter a description here for your reference (not parsed).") . "
"; $form .= ""; return $form; @@ -3484,12 +3481,12 @@ class layer7 { function validate_input($data, &$input_errors) { $reqdfields[] = "container"; - $reqdfieldsn[] = "Name"; + $reqdfieldsn[] = gettext("Name"); shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['container'])) - $input_errors[] = "Queue names must be alphanumeric and _ or - only."; + $input_errors[] = gettext("Queue names must be alphanumeric and _ or - only."); } function delete_l7c() { @@ -3966,31 +3963,31 @@ function build_iface_without_this_queue($iface, $qname) { $scheduler = ": " . $altq->GetScheduler(); $form = ""; $form .= "".$iface.": ".$scheduler.""; - $form .= ""; - $form .= ""; - $form .= ""; - $form .= ""; - $form .= " Clone shaper/queue on this interface"; + $form .= ""; + $form .= ""; + $form .= ""; + $form .= ""; + $form .= gettext(" Clone shaper/queue on this interface") . ""; - return $form; + return $form; } $default_shaper_msg = ""; -$default_shaper_msg .= "

Welcome to the {$g['product_name']} Traffic Shaper.
"; -$default_shaper_msg .= "The tree on the left helps you navigate through the queues
"; -$default_shaper_msg .= "buttons at the bottom represent queue actions and are activated accordingly."; +$default_shaper_msg .= "

" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; +$default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" + . "buttons at the bottom represent queue actions and are activated accordingly."); $default_shaper_msg .= "

"; $default_shaper_msg .= ""; $dn_default_shaper_msg = ""; -$dn_default_shaper_msg .= "

Welcome to the {$g['product_name']} Traffic Shaper.
"; -$dn_default_shaper_msg .= "The tree on the left helps you navigate through the queues
"; -$dn_default_shaper_msg .= "buttons at the bottom represent queue actions and are activated accordingly."; +$dn_default_shaper_msg .= "

" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; +$dn_default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" + . "buttons at the bottom represent queue actions and are activated accordingly."); $dn_default_shaper_msg .= "

"; $dn_default_shaper_msg .= ""; From 4d511e5b646c24ced446c528f64336bc78572a2d Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 12:50:18 -0300 Subject: [PATCH 037/329] Implement gettext calls on upgrade_config.inc --- etc/inc/upgrade_config.inc | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 3def794dcd..be3ff31014 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -167,8 +167,8 @@ function upgrade_010_to_011() { $fr['source']['network'] = $ifmap[$fr['source']['network']]; else { /* remove the rule */ - echo "\nWarning: traffic shaper rule removed " . - "(source network '{$fr['source']['network']}' does not exist anymore)."; + printf(gettext("%sWarning: traffic shaper rule removed " . + "(source network '%s' does not exist anymore)."), "\n", $fr['source']['network']); unset($config['pfqueueing']['rule'][$i]); continue; } @@ -180,8 +180,8 @@ function upgrade_010_to_011() { $fr['destination']['network'] = $ifmap[$fr['destination']['network']]; else { /* remove the rule */ - echo "\nWarning: traffic shaper rule removed " . - "(destination network '{$fr['destination']['network']}' does not exist anymore)."; + printf(gettext("%sWarning: traffic shaper rule removed " . + "(destination network '%s' does not exist anymore)."), "\n", $fr['destination']['network']); unset($config['pfqueueing']['rule'][$i]); continue; } @@ -330,7 +330,7 @@ function upgrade_017_to_018() { $vip = array(); $vip['mode'] = "carp"; $vip['interface'] = "AUTO"; - $vip['descr'] = "CARP vhid {$carpent['vhid']}"; + $vip['descr'] = sprintf(gettext("CARP vhid %s"), $carpent['vhid']); $vip['type'] = "single"; $vip['vhid'] = $carpent['vhid']; $vip['advskew'] = $carpent['advskew']; @@ -534,7 +534,7 @@ function upgrade_028_to_029() { $rule_item['type'] = "pass"; $rule_item['source']['any'] = true; $rule_item['destination']['any'] = true; - $rule_item['descr'] = "Permit IPsec traffic."; + $rule_item['descr'] = gettext("Permit IPsec traffic."); $rule_item['statetype'] = "keep state"; $a_filter[] = $rule_item; } @@ -609,7 +609,7 @@ function upgrade_039_to_040() { if (isset ($config['system']['username'])) { $config['system']['group'] = array(); $config['system']['group'][0]['name'] = "admins"; - $config['system']['group'][0]['description'] = "System Administrators"; + $config['system']['group'][0]['description'] = gettext("System Administrators"); $config['system']['group'][0]['scope'] = "system"; $config['system']['group'][0]['pages'] = "ANY"; $config['system']['group'][0]['home'] = "index.php"; @@ -628,19 +628,19 @@ function upgrade_039_to_040() { $config['system']['user'][0]['priv'] = array(); $config['system']['user'][0]['priv'][0]['id'] = "lockwc"; $config['system']['user'][0]['priv'][0]['name'] = "Lock webConfigurator"; - $config['system']['user'][0]['priv'][0]['descr'] = "Indicates whether this user will lock access to the webConfigurator for other users."; + $config['system']['user'][0]['priv'][0]['descr'] = gettext("Indicates whether this user will lock access to the webConfigurator for other users."); $config['system']['user'][0]['priv'][1]['id'] = "lock-ipages"; $config['system']['user'][0]['priv'][1]['name'] = "Lock individual pages"; - $config['system']['user'][0]['priv'][1]['descr'] = "Indicates whether this user will lock individual HTML pages after having accessed a particular page (the lock will be freed if the user leaves or saves the page form)."; + $config['system']['user'][0]['priv'][1]['descr'] = gettext("Indicates whether this user will lock individual HTML pages after having accessed a particular page (the lock will be freed if the user leaves or saves the page form)."); $config['system']['user'][0]['priv'][2]['id'] = "hasshell"; $config['system']['user'][0]['priv'][2]['name'] = "Has shell access"; - $config['system']['user'][0]['priv'][2]['descr'] = "Indicates whether this user is able to login for example via SSH."; + $config['system']['user'][0]['priv'][2]['descr'] = gettext("Indicates whether this user is able to login for example via SSH."); $config['system']['user'][0]['priv'][3]['id'] = "copyfiles"; $config['system']['user'][0]['priv'][3]['name'] = "Is allowed to copy files"; - $config['system']['user'][0]['priv'][3]['descr'] = "Indicates whether this user is allowed to copy files onto the {$g['product_name']} appliance via SCP/SFTP. If you are going to use this privilege, you must install scponly on the appliance (Hint: pkg_add -r scponly)."; + $config['system']['user'][0]['priv'][3]['descr'] = sprintf(gettext("Indicates whether this user is allowed to copy files onto the %s appliance via SCP/SFTP. If you are going to use this privilege, you must install scponly on the appliance (Hint: pkg_add -r scponly)."), $g['product_name']); $config['system']['user'][0]['priv'][4]['id'] = "isroot"; $config['system']['user'][0]['priv'][4]['name'] = "Is root user"; - $config['system']['user'][0]['priv'][4]['descr'] = "This user is associated with the UNIX root user (you should associate this privilege only with one single user)."; + $config['system']['user'][0]['priv'][4]['descr'] = gettext("This user is associated with the UNIX root user (you should associate this privilege only with one single user)."); $config['system']['nextuid'] = "111"; $config['system']['nextgid'] = "111"; @@ -769,10 +769,10 @@ function upgrade_042_to_043() { } if(is_ipaddr($config['interfaces'][$ifname]['gateway'])) { $config['gateways']['gateway_item'][$i]['gateway'] = $config['interfaces'][$ifname]['gateway']; - $config['gateways']['gateway_item'][$i]['descr'] = "Interface $ifname Static Gateway"; + $config['gateways']['gateway_item'][$i]['descr'] = sprintf(gettext("Interface %s Static Gateway"), $ifname); } else { $config['gateways']['gateway_item'][$i]['gateway'] = "dynamic"; - $config['gateways']['gateway_item'][$i]['descr'] = "Interface $ifname Dynamic Gateway"; + $config['gateways']['gateway_item'][$i]['descr'] = sprintf(gettext("Interface %s Dynamic Gateway"), $ifname); } $config['gateways']['gateway_item'][$i]['interface'] = $ifname; $config['gateways']['gateway_item'][$i]['name'] = "GW_" . strtoupper($ifname); @@ -830,7 +830,7 @@ function upgrade_043_to_044() { $gateway['name'] = "SROUTE{$i}"; $gateway['gateway'] = $sroute['gateway']; $gateway['interface'] = $sroute['interface']; - $gateway['descr'] = "Upgraded static route for {$sroute['network']}"; + $gateway['descr'] = sprintf(gettext("Upgraded static route for %s"), $sroute['network']); if (!is_array($config['gateways']['gateway_item'])) $config['gateways']['gateway_item'] = array(); $config['gateways']['gateway_item'][] = $gateway; @@ -883,7 +883,7 @@ function upgrade_045_to_046() { $pool['type'] = 'server'; $pool['behaviour'] = 'balance'; $pool['name'] = "{$vs_a[$i]['name']}-sitedown"; - $pool['desc'] = "Sitedown pool for VS: {$vs_a[$i]['name']}"; + $pool['desc'] = sprintf(gettext("Sitedown pool for VS: %s"), $vs_a[$i]['name']); $pool['port'] = $pools[$vs_a[$i]['pool']]['port']; $pool['servers'] = array(); $pool['servers'][] = $vs_a[$i]['sitedown']; @@ -1028,7 +1028,7 @@ function upgrade_046_to_047() { if (isset($tunnel['disabled'])) $ph1ent['disabled'] = $tunnel['disabled']; - $ph2ent['descr'] = "phase2 for ".$tunnel['descr']; + $ph2ent['descr'] = sprintf(gettext("phase2 for %s"), $tunnel['descr']); $type = "lan"; if ($tunnel['local-subnet']['network']) @@ -1118,7 +1118,7 @@ function upgrade_047_to_048() { $tempdyn['host'] = $config['dyndns'][0]['host']; $tempdyn['mx'] = $config['dyndns'][0]['mx']; $tempdyn['interface'] = "wan"; - $tempdyn['descr'] = "Upgraded Dyndns {$tempdyn['type']}"; + $tempdyn['descr'] = sprintf(gettext("Upgraded Dyndns %s"), $tempdyn['type']); $config['dyndnses']['dyndns'][] = $tempdyn; } unset($config['dyndns']); @@ -1170,7 +1170,7 @@ function upgrade_048_to_049() { /* setup new all users group */ $all = array(); $all['name'] = "all"; - $all['description'] = "All Users"; + $all['description'] = gettext("All Users"); $all['scope'] = "system"; $all['gid'] = 1998; $all['member'] = array(); @@ -1297,7 +1297,7 @@ function upgrade_050_to_051() { if (isset($intf['bridge']) && $intf['bridge'] <> "") { $nbridge = array(); $nbridge['members'] = "{$ifr},{$intf['bridge']}"; - $nbridge['descr'] = "Converted bridged {$ifr}"; + $nbridge['descr'] = sprintf(gettext("Converted bridged %s"), $ifr); $nbridge['bridgeif'] = "bridge{$i}"; $config['bridges']['bridged'][] = $nbridge; unset($intf['bridge']); @@ -1555,7 +1555,7 @@ function upgrade_051_to_052() { $ovpnrule['destination'] = array(); $ovpnrule['source']['any'] = true; $ovpnrule['destination']['any'] = true; - $ovpnrule['descr'] = "Auto added OpenVPN rule from config upgrade."; + $ovpnrule['descr'] = gettext("Auto added OpenVPN rule from config upgrade."); $config['filter']['rule'][] = $ovpnrule; } From fd7b47b6f815a52a8cf699d7506c43d8661109b1 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 14:08:01 -0300 Subject: [PATCH 038/329] Implement gettext() calls on util.inc --- etc/inc/util.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 8632540f10..77af86db2e 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -102,7 +102,7 @@ function mark_subsystem_dirty($subsystem = "") { global $g; if (!file_put_contents("{$g['varrun_path']}/{$subsystem}.dirty", "DIRTY")) - log_error("WARNING: Could not mark subsystem: {$subsytem} dirty"); + log_error(sprintf(gettext("WARNING: Could not mark subsystem: %s dirty"), $subsystem)); } function clear_subsystem_dirty($subsystem = "") { @@ -122,7 +122,7 @@ function config_unlock() { function lock($lock, $op = LOCK_SH) { global $g, $cfglckkeyconsumers; if (!$lock) - die("WARNING: You must give a name as parameter to lock() function."); + die(gettext("WARNING: You must give a name as parameter to lock() function.")); if (!file_exists("{$g['tmp_path']}/{$lock}.lock")) @touch("{$g['tmp_path']}/{$lock}.lock"); $cfglckkeyconsumers++; @@ -169,7 +169,7 @@ function refcount_unreference($reference) { $shm_data = intval($shm_data) - 1; if ($shm_data < 0) { //debug_backtrace(); - log_error("Reference {$reference} is going negative, not doing unreference."); + log_error(sprintf(gettext("Reference %s is going negative, not doing unreference."), $reference)); } else shmop_write($shmid, $shm_data, 0); shmop_close($shmid); @@ -785,7 +785,7 @@ function mwexec($command, $mute = false) { $mute = false; if(($retval <> 0) && ($mute === false)) { $output = implode(" ", $oarr); - log_error("The command '$command' returned exit code '$retval', the output was '$output' "); + log_error(sprintf(gettext("The command '%s' returned exit code '%d', the output was '%s' "), $command, $retval, $output)); } return $retval; } From 89ceb4ba3c6eb536dfd8c5905e3278c6bb27fa6e Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 15:49:52 -0300 Subject: [PATCH 039/329] Implement gettext() calls on vpn.inc --- etc/inc/vpn.inc | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 1c204f0889..33feb8ed69 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -123,7 +123,7 @@ function vpn_ipsec_configure($ipchg = false) mwexec("/sbin/ifconfig enc0 up"); if ($g['booting']) - echo "Configuring IPsec VPN... "; + echo gettext("Configuring IPsec VPN... "); /* fastforwarding is not compatible with ipsec tunnels */ mwexec("/sbin/sysctl net.inet.ip.fastforwarding=0"); @@ -209,18 +209,18 @@ function vpn_ipsec_configure($ipchg = false) if (is_array($config['system']['ca']) && count($config['system']['ca'])) { foreach ($config['system']['ca'] as $ca) { if (!isset($ca['crt'])) { - log_error("Error: Invalid certificate info for {$ca['name']}"); + log_error(sprintf(gettext("Error: Invalid certificate info for %s"), $ca['name'])); continue; } $cert = base64_decode($ca['crt']); $x509cert = openssl_x509_parse(openssl_x509_read($cert)); if (!is_array($x509cert) || !isset($x509cert['hash'])) { - log_error("Error: Invalid certificate hash info for {$ca['name']}"); + log_error(sprintf(gettext("Error: Invalid certificate hash info for %s"), $ca['name'])); continue; } $fname = $g['varetc_path']."/".$x509cert['hash'].".0"; if (!file_put_contents($fname, $cert)) { - log_error("Error: Cannot write IPsec CA file for {$ca['name']}"); + log_error(sprintf(gettext("Error: Cannot write IPsec CA file for %s"), $ca['name'])); continue; } } @@ -229,7 +229,7 @@ function vpn_ipsec_configure($ipchg = false) /* generate psk.txt */ $fd = fopen("{$g['varetc_path']}/psk.txt", "w"); if (!$fd) { - printf("Error: cannot open psk.txt in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open psk.txt in vpn_ipsec_configure().") . "\n"); return 1; } @@ -291,7 +291,7 @@ function vpn_ipsec_configure($ipchg = false) $fd = fopen("{$g['varetc_path']}/racoon.conf", "w"); if (!$fd) { - printf("Error: cannot open racoon.conf in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open racoon.conf in vpn_ipsec_configure().") . "\n"); return 1; } @@ -381,7 +381,7 @@ function vpn_ipsec_configure($ipchg = false) $fn = "{$g['varetc_path']}/racoon.motd"; $fd1 = fopen($fn, "w"); if (!$fd1) { - printf("Error: cannot open server{$fn} in vpn.\n"); + printf(gettext("Error: cannot open server %s in vpn.%s"). $fn, "\n"); return 1; } @@ -509,7 +509,7 @@ function vpn_ipsec_configure($ipchg = false) if (!$cert) { - log_error("Error: Invalid phase1 certificate reference for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Invalid phase1 certificate reference for %s"), $ph1ent['name'])); continue; } @@ -518,7 +518,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($certpath, base64_decode($cert['crt']))) { - log_error("Error: Cannot write phase1 certificate file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 certificate file for %s"), $ph1ent['name'])); continue; } @@ -529,7 +529,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($keypath, base64_decode($cert['prv']))) { - log_error("Error: Cannot write phase1 key file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 key file for %s"), $ph1ent['name'])); continue; } @@ -542,7 +542,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($capath, base64_decode($ca['crt']))) { - log_error("Error: Cannot write phase1 CA certificate file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 CA certificate file for %s"), $ph1ent['name'])); continue; } @@ -761,7 +761,7 @@ EOD; /* generate spd.conf */ $fd = fopen("{$g['varetc_path']}/spd.conf", "w"); if (!$fd) { - printf("Error: cannot open spd.conf in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open spd.conf in vpn_ipsec_configure().") . "\n"); return 1; } @@ -840,7 +840,7 @@ EOD; if(is_ipaddr($gatewayip)) { /* FIXME: does adding route-to and reply-to on the in/outbound * rules fix this? smos@ 13-01-2009 */ - log_error("IPSEC interface is not WAN but {$parentinterface}, adding static route for VPN endpoint {$rgip} via {$gatewayip}"); + log_error(sprintf(gettext("IPSEC interface is not WAN but %s, adding static route for VPN endpoint %s via %s"), $parentinterface, $rgip, $gatewayip)); mwexec("/sbin/route delete -host {$rgip}"); mwexec("/sbin/route add -host {$rgip} {$gatewayip}"); } @@ -931,7 +931,7 @@ function vpn_ipsec_force_reload() { /* if ipsec is enabled, start up again */ if (isset($ipseccfg['enable'])) { - log_error("Forcefully reloading IPsec racoon daemon"); + log_error(gettext("Forcefully reloading IPsec racoon daemon")); vpn_ipsec_configure(); } @@ -959,7 +959,7 @@ function vpn_pptpd_configure() { if (!$pptpdcfg['mode'] || ($pptpdcfg['mode'] == "off")) return 0; - echo "Configuring PPTP VPN service... "; + echo gettext("Configuring PPTP VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/pptp-vpn.pid"); @@ -969,7 +969,7 @@ function vpn_pptpd_configure() { if (is_process_running("mpd -b")) { killbypid("{$g['varrun_path']}/pptp-vpn.pid"); - log_error("Could not kill mpd within 3 seconds. Trying again."); + log_error(gettext("Could not kill mpd within 3 seconds. Trying again.")); } /* remove mpd.conf, if it exists */ @@ -987,7 +987,7 @@ function vpn_pptpd_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1100,7 +1100,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1124,7 +1124,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1168,7 +1168,7 @@ function vpn_pppoe_configure() { if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off")) return 0; - echo "Configuring PPPoE VPN service... "; + echo gettext("Configuring PPPoE VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/pppoe-vpn.pid"); @@ -1196,7 +1196,7 @@ function vpn_pppoe_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_pppoe_configure().") . "\n"); return 1; } $mpdconf = "\n\n"; @@ -1296,7 +1296,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_pppoe_configure().") . "\n"); return 1; } @@ -1321,7 +1321,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_pppoe_configure().") . "\n"); return 1; } @@ -1365,7 +1365,7 @@ function vpn_l2tp_configure() { if (!$l2tpcfg['mode'] || ($l2tpcfg['mode'] == "off")) return 0; - echo "Configuring l2tp VPN service... "; + echo gettext("Configuring l2tp VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/l2tp-vpn.pid"); @@ -1390,7 +1390,7 @@ function vpn_l2tp_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_l2tp_configure().") . "\n"); return 1; } $mpdconf = "\n\n"; @@ -1480,7 +1480,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_l2tp_configure().") . "\n"); return 1; } @@ -1505,7 +1505,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_l2tp_configure().") . "\n"); return 1; } @@ -1636,22 +1636,22 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { $rgip = resolve_retry($phase1['remote-gateway']); add_hostname_to_watch($phase1['remote-gateway']); if (!$rgip) { - log_error("Could not determine VPN endpoint for '{$phase1['descr']}'"); + log_error(sprintf(gettext("Could not determine VPN endpoint for '%s'"), $phase1['descr'])); return false; } } else { $rgip = $phase1['remote-gateway']; } if (!$ep) { - log_error("Could not determine VPN endpoint for '{$phase1['descr']}'"); + log_error(sprintf(gettext("Could not determine VPN endpoint for '%s'"), $phase1['descr'])); return false; } if((!is_ipaddr($old_ep)) || (! is_ipaddr($ep))) { - log_error("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '{$old_ep}' new EP '{$ep}'"); + log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%s' new EP '%s'"), $old_ep, $ep)); } if((! is_ipaddr($rgip)) || (! is_ipaddr($old_gw))) { - log_error("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '{$old_gw}' new RG '{$rgip}'"); + log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%s' new RG '%s'"), $old_gw, $rgip)); } $spdconf = ""; @@ -1697,7 +1697,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { "{$phase2['protocol']}/tunnel/{$rgip}-" . "{$ep}/unique;\n"; - log_error("Reloading IPsec tunnel '{$phase1['descr']}'. Previous IP '{$old_gw}', current IP '{$rgip}'. Reloading policy"); + log_error(sprintf(gettext("Reloading IPsec tunnel '%s'. Previous IP '%s', current IP '%s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); $now = time(); $spdfile = tempnam("{$g['tmp_path']}", "spd.conf.reload.{$now}."); From 6ac0439bbcc38e9d1fdfdbc499563aa374aeab3d Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 18 Aug 2010 16:08:54 -0300 Subject: [PATCH 040/329] Implement gettext() calls on voucher.inc --- etc/inc/voucher.inc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 1cd4679bec..aec3951351 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -89,7 +89,7 @@ function voucher_auth($voucher_received, $test = 0) { list($timestamp,$minutes) = explode(",", $line); // we have an already active voucher here. $remaining = intval((($timestamp + 60*$minutes) - time())/60); - $test_result[] = "$voucher ($roll/$nr) active and good for $remaining Minutes"; + $test_result[] = sprintf(gettext("%s (%s/%s) active and good for %d Minutes"), $voucher, $roll, $nr, $remaining); $total_minutes += $remaining; } else { // voucher not used. Check if ticket Id is on the roll (not too high) @@ -100,22 +100,22 @@ function voucher_auth($voucher_received, $test = 0) { $pos = $nr >> 3; // divide by 8 -> octet $mask = 1 << ($nr % 8); if (ord($bitstring[$roll][$pos]) & $mask) { - $test_result[] = "$voucher ($roll/$nr) already used and expired"; + $test_result[] = sprintf(gettext("%s (%s/%s) already used and expired"), $voucher, $roll, $nr); $total_minutes = -1; // voucher expired $error++; } else { // mark bit for this voucher as used $bitstring[$roll][$pos] = chr(ord($bitstring[$roll][$pos]) | $mask); - $test_result[] = "$voucher ($roll/$nr) good for {$minutes_per_roll[$roll]} Minutes"; + $test_result[] = sprintf(gettext("%s (%s/%s) good for %d Minutes"), $voucher, $roll, $nr, $minutes_per_roll[$roll]); $total_minutes += $minutes_per_roll[$roll]; } } } else { - $test_result[] = "$voucher ($roll/$nr): not found on any registererd Roll"; + $test_result[] = sprintf(gettext("%s (%s/%s): not found on any registererd Roll"), $voucher, $roll, $nr); } } else { // hmm, thats weird ... not what I expected - $test_result[] = "$voucher invalid: $result !!"; + $test_result[] = "$voucher " . gettext("invalid:") . " $result !!"; $error++; } } @@ -123,9 +123,9 @@ function voucher_auth($voucher_received, $test = 0) { // if this was a test call, we're done. Return the result. if ($test) { if ($error) { - $test_result[] = "Access denied!"; + $test_result[] = gettext("Access denied!"); } else { - $test_result[] = "Access granted for $total_minutes Minutes in total."; + $test_result[] = sprintf(gettext("Access granted for %d Minutes in total."), $total_minutes); } unlock($voucherlck); return $test_result; @@ -198,7 +198,7 @@ function voucher_configure() { $pubkey = base64_decode($config['voucher']['publickey']); $fd = fopen("{$g['varetc_path']}/voucher.public", "w"); if (!$fd) { - printf("Error: cannot write voucher.public\n"); + printf(gettext("Error: cannot write voucher.public") . "\n"); unlock($voucherlck); return 1; } @@ -209,7 +209,7 @@ function voucher_configure() { /* write config file used by voucher binary to decode vouchers */ $fd = fopen("{$g['varetc_path']}/voucher.cfg", "w"); if (!$fd) { - printf("Error: cannot write voucher.cfg\n"); + printf(gettext("Error: cannot write voucher.cfg") . "\n"); unlock($voucherlck); return 1; } From 32296995fe9b67d1f89f93a520b7eec8ac19cb38 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Thu, 19 Aug 2010 10:59:53 -0300 Subject: [PATCH 041/329] Fix gettext on upgrade_config.inc --- etc/inc/upgrade_config.inc | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index be3ff31014..a59c855b4f 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -657,91 +657,91 @@ function upgrade_040_to_041() { $config['sysctl']['item'] = array(); $config['sysctl']['item'][0]['tunable'] = "net.inet.tcp.blackhole"; - $config['sysctl']['item'][0]['desc'] = "Drop packets to closed TCP ports without returning a RST"; + $config['sysctl']['item'][0]['desc'] = gettext("Drop packets to closed TCP ports without returning a RST"); $config['sysctl']['item'][0]['value'] = "default"; $config['sysctl']['item'][1]['tunable'] = "net.inet.udp.blackhole"; - $config['sysctl']['item'][1]['desc'] = "Do not send ICMP port unreachable messages for closed UDP ports"; + $config['sysctl']['item'][1]['desc'] = gettext("Do not send ICMP port unreachable messages for closed UDP ports"); $config['sysctl']['item'][1]['value'] = "default"; $config['sysctl']['item'][2]['tunable'] = "net.inet.ip.random_id"; - $config['sysctl']['item'][2]['desc'] = "Randomize the ID field in IP packets (default is 0: sequential IP IDs)"; + $config['sysctl']['item'][2]['desc'] = gettext("Randomize the ID field in IP packets (default is 0: sequential IP IDs)"); $config['sysctl']['item'][2]['value'] = "default"; $config['sysctl']['item'][3]['tunable'] = "net.inet.tcp.drop_synfin"; - $config['sysctl']['item'][3]['desc'] = "Drop SYN-FIN packets (breaks RFC1379, but nobody uses it anyway)"; + $config['sysctl']['item'][3]['desc'] = gettext("Drop SYN-FIN packets (breaks RFC1379, but nobody uses it anyway)"); $config['sysctl']['item'][3]['value'] = "default"; $config['sysctl']['item'][4]['tunable'] = "net.inet.ip.redirect"; - $config['sysctl']['item'][4]['desc'] = "Sending of IPv4 ICMP redirects"; + $config['sysctl']['item'][4]['desc'] = gettext("Sending of IPv4 ICMP redirects"); $config['sysctl']['item'][4]['value'] = "default"; $config['sysctl']['item'][5]['tunable'] = "net.inet6.ip6.redirect"; - $config['sysctl']['item'][5]['desc'] = "Sending of IPv6 ICMP redirects"; + $config['sysctl']['item'][5]['desc'] = gettext("Sending of IPv6 ICMP redirects"); $config['sysctl']['item'][5]['value'] = "default"; $config['sysctl']['item'][6]['tunable'] = "net.inet.tcp.syncookies"; - $config['sysctl']['item'][6]['desc'] = "Generate SYN cookies for outbound SYN-ACK packets"; + $config['sysctl']['item'][6]['desc'] = gettext("Generate SYN cookies for outbound SYN-ACK packets"); $config['sysctl']['item'][6]['value'] = "default"; $config['sysctl']['item'][7]['tunable'] = "net.inet.tcp.recvspace"; - $config['sysctl']['item'][7]['desc'] = "Maximum incoming TCP datagram size"; + $config['sysctl']['item'][7]['desc'] = gettext("Maximum incoming TCP datagram size"); $config['sysctl']['item'][7]['value'] = "default"; $config['sysctl']['item'][8]['tunable'] = "net.inet.tcp.sendspace"; - $config['sysctl']['item'][8]['desc'] = "Maximum outgoing TCP datagram size"; + $config['sysctl']['item'][8]['desc'] = gettext("Maximum outgoing TCP datagram size"); $config['sysctl']['item'][8]['value'] = "default"; $config['sysctl']['item'][9]['tunable'] = "net.inet.ip.fastforwarding"; - $config['sysctl']['item'][9]['desc'] = "Fastforwarding (see http://lists.freebsd.org/pipermail/freebsd-net/2004-January/002534.html)"; + $config['sysctl']['item'][9]['desc'] = gettext("Fastforwarding (see http://lists.freebsd.org/pipermail/freebsd-net/2004-January/002534.html)"); $config['sysctl']['item'][9]['value'] = "default"; $config['sysctl']['item'][10]['tunable'] = "net.inet.tcp.delayed_ack"; - $config['sysctl']['item'][10]['desc'] = "Do not delay ACK to try and piggyback it onto a data packet"; + $config['sysctl']['item'][10]['desc'] = gettext("Do not delay ACK to try and piggyback it onto a data packet"); $config['sysctl']['item'][10]['value'] = "default"; $config['sysctl']['item'][11]['tunable'] = "net.inet.udp.maxdgram"; - $config['sysctl']['item'][11]['desc'] = "Maximum outgoing UDP datagram size"; + $config['sysctl']['item'][11]['desc'] = gettext("Maximum outgoing UDP datagram size"); $config['sysctl']['item'][11]['value'] = "default"; $config['sysctl']['item'][12]['tunable'] = "net.link.bridge.pfil_onlyip"; - $config['sysctl']['item'][12]['desc'] = "Handling of non-IP packets which are not passed to pfil (see if_bridge(4))"; + $config['sysctl']['item'][12]['desc'] = gettext("Handling of non-IP packets which are not passed to pfil (see if_bridge(4))"); $config['sysctl']['item'][12]['value'] = "default"; $config['sysctl']['item'][13]['tunable'] = "net.link.tap.user_open"; - $config['sysctl']['item'][13]['desc'] = "Allow unprivileged access to tap(4) device nodes"; + $config['sysctl']['item'][13]['desc'] = gettext("Allow unprivileged access to tap(4) device nodes"); $config['sysctl']['item'][13]['value'] = "default"; $config['sysctl']['item'][14]['tunable'] = "kern.rndtest.verbose"; - $config['sysctl']['item'][14]['desc'] = "Verbosity of the rndtest driver (0: do not display results on console)"; + $config['sysctl']['item'][14]['desc'] = gettext("Verbosity of the rndtest driver (0: do not display results on console)"); $config['sysctl']['item'][14]['value'] = "default"; $config['sysctl']['item'][15]['tunable'] = "kern.randompid"; - $config['sysctl']['item'][15]['desc'] = "Randomize PID's (see src/sys/kern/kern_fork.c: sysctl_kern_randompid())"; + $config['sysctl']['item'][15]['desc'] = gettext("Randomize PID's (see src/sys/kern/kern_fork.c: sysctl_kern_randompid())"); $config['sysctl']['item'][15]['value'] = "default"; $config['sysctl']['item'][16]['tunable'] = "net.inet.tcp.inflight.enable"; - $config['sysctl']['item'][16]['desc'] = "The system will attempt to calculate the bandwidth delay product for each connection and limit the amount of data queued to the network to just the amount required to maintain optimum throughput. "; + $config['sysctl']['item'][16]['desc'] = gettext("The system will attempt to calculate the bandwidth delay product for each connection and limit the amount of data queued to the network to just the amount required to maintain optimum throughput. "); $config['sysctl']['item'][16]['value'] = "default"; $config['sysctl']['item'][17]['tunable'] = "net.inet.icmp.icmplim"; - $config['sysctl']['item'][17]['desc'] = "Set ICMP Limits"; + $config['sysctl']['item'][17]['desc'] = gettext("Set ICMP Limits"); $config['sysctl']['item'][17]['value'] = "default"; $config['sysctl']['item'][18]['tunable'] = "net.inet.tcp.tso"; - $config['sysctl']['item'][18]['desc'] = "TCP Offload engine"; + $config['sysctl']['item'][18]['desc'] = gettext("TCP Offload engine"); $config['sysctl']['item'][18]['value'] = "default"; $config['sysctl']['item'][19]['tunable'] = "hw.bce.tso_enable"; - $config['sysctl']['item'][19]['desc'] = "TCP Offload engine - BCE"; + $config['sysctl']['item'][19]['desc'] = gettext("TCP Offload engine - BCE"); $config['sysctl']['item'][19]['value'] = "default"; $config['sysctl']['item'][20]['tunable'] = "net.inet.ip.portrange.first"; - $config['sysctl']['item'][20]['desc'] = "Set the ephemeral port range starting port"; + $config['sysctl']['item'][20]['desc'] = gettext("Set the ephemeral port range starting port"); $config['sysctl']['item'][20]['value'] = "default"; $config['sysctl']['item'][21]['tunable'] = "hw.syscons.kbd_reboot "; - $config['sysctl']['item'][21]['desc'] = "Enables ctrl+alt+delete"; + $config['sysctl']['item'][21]['desc'] = gettext("Enables ctrl+alt+delete"); $config['sysctl']['item'][21]['value'] = "default"; } From ed462aae2ba226b0242474f7fd032b7cd988fe0a Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Thu, 19 Aug 2010 16:06:48 -0300 Subject: [PATCH 042/329] Fix gettext on voucher.inc --- etc/inc/voucher.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index aec3951351..29e35c87b0 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -181,7 +181,7 @@ function voucher_configure() { if (isset($config['voucher']['enable'])) { if ($g['booting']) { - echo "Enabling voucher support... "; + echo gettext("Enabling voucher support... "); } // start cron if we're asked to save runtime DB periodically @@ -245,7 +245,7 @@ function voucher_configure() { } unlock($voucherlck); - echo "done\n"; + echo gettext("done") . "\n"; } } return 0; @@ -263,7 +263,7 @@ function voucher_write_used_db($roll, $vdb) { fwrite($fd, $vdb . "\n"); fclose($fd); } else { - voucher_log(LOG_ERR, "cant write {$g['vardb_path']}/voucher_used_$roll.db"); + voucher_log(LOG_ERR, sprintf(gettext("cant write %s/voucher_used_%s.db"), $g['vardb_path'], $roll)); } } @@ -342,7 +342,7 @@ function voucher_read_used_db($roll) { $vdb = trim(fgets($fd)); fclose($fd); } else { - voucher_log(LOG_ERR, "cant read {$g['vardb_path']}/voucher_used_$roll.db"); + voucher_log(LOG_ERR, sprintf(gettext("cant read %s/voucher_used_%s.db"), $g['vardb_path'], $roll)); } } return base64_decode($vdb); @@ -361,7 +361,7 @@ function voucher_log($priority, $message) { define_syslog_variables(); $message = trim($message); openlog("logportalauth", LOG_PID, LOG_LOCAL4); - syslog($priority, "Voucher: " . $message); + syslog($priority, gettext("Voucher: ") . $message); closelog(); } From 561130e43b6b131e94a30852890e1c0cf3b844e9 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Thu, 19 Aug 2010 16:23:38 -0300 Subject: [PATCH 043/329] Fix gettext on vpn.inc --- etc/inc/vpn.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 33feb8ed69..922cd5f8c9 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -1346,7 +1346,7 @@ EOD; } if ($g['booting']) - echo "done\n"; + echo gettext("done") . "\n"; return 0; } From 94258864263fd7f1224c294e836f0a79bdededb5 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Thu, 19 Aug 2010 17:02:40 -0300 Subject: [PATCH 044/329] Fix gettext on xmlrpc_client.inc --- etc/inc/xmlrpc_client.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc index 229bb7f2f1..59a9678560 100644 --- a/etc/inc/xmlrpc_client.inc +++ b/etc/inc/xmlrpc_client.inc @@ -1493,7 +1493,7 @@ class XML_RPC_Message extends XML_RPC_Base !$GLOBALS['XML_RPC_func_ereg']('^HTTP/[0-9\.]+ 10[0-9]([A-Z ]+)?[\r\n]+HTTP/[0-9\.]+ 200', $data)) { $errstr = substr($data, 0, strpos($data, "\n") - 1); - error_log('HTTP error, got response: ' . $errstr); + error_log(gettext("HTTP error, got response: ") . $errstr); $r = new XML_RPC_Response(0, $XML_RPC_err['http_error'], $XML_RPC_str['http_error'] . ' (' . $errstr . ')'); @@ -1519,7 +1519,7 @@ class XML_RPC_Message extends XML_RPC_Base if (!xml_parse($parser_resource, $data, sizeof($data))) { // thanks to Peter Kocks if (xml_get_current_line_number($parser_resource) == 1) { - $errstr = 'XML error at line 1, check URL'; + $errstr = gettext("XML error at line 1, check URL"); } else { $errstr = sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($parser_resource)), From 18efed8bcebbcbcd28e94d9780db8f910f951ceb Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 20 Aug 2010 09:41:26 -0300 Subject: [PATCH 045/329] Fix gettext on shaper.inc --- etc/inc/shaper.inc | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 7f4b644a4d..06cc4baf0f 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -1086,14 +1086,14 @@ class priq_queue { $form .= ""; $form .= ""; $form .= ""; - $form .= "Queue Name"; + $form .= gettext("Queue Name") . ""; $form .= "GetQname()); $form .= "\">"; $form .= "
" . gettext("Enter the name of the queue here. Do not use spaces and limit the size to 15 characters."); $form .= "
"; $form .= ""; - $form .= "Priority"; + $form .= "" . gettext("Priority") . ""; $form .= " GetQpriority()); $form .= "\">"; @@ -1813,19 +1813,19 @@ class hfsc_queue extends priq_queue { $form .= ""; + $form .= ">" . gettext("Gbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Mbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Kbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Bit/s") . ""; $form .= ""; + $form .= ">" . gettext("Gbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Mbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Kbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Bit/s") . ""; $form .= ""; + $form .= ">" . gettext("Gbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Mbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Kbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Bit/s") . ""; $form .= ""; + $form .= ">" .gettext( "Kbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Mbit/s") . ""; $form .= ""; + $form .= ">" . gettext("Gbit/s") . ""; $form .= "
"; $form .= "
"; $form .= ""; - $form .= "Packet loss rate"; + $form .= "" . gettext("Packet loss rate") . ""; $form .= ""; $form .= "GetPlr() . "\">"; @@ -3657,7 +3657,7 @@ function layer7_start_l7daemon() { /* Only reread the configuration rather than restart to avoid loosing information. */ exec("/bin/pgrep -f 'ipfw-classifyd .* -p ". $l7rules->GetRPort() . "'", $l7pid); if (count($l7pid) > 0) { - log_error("Sending HUP signal to {$l7pid[0]}"); + log_error(sprintf(gettext("Sending HUP signal to %s"), $l7pid[0])); mwexec("/bin/kill -HUP {$l7pid[0]}"); } else { // XXX: Hardcoded number of packets to garbage collect and queue length.. From a8cc4ac70e1018f4ce146c909f1e81f2562eef47 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Fri, 20 Aug 2010 10:23:15 -0300 Subject: [PATCH 046/329] Fix gettext on filter.inc --- etc/inc/filter.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 1f5013906d..4371aecb7a 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -213,7 +213,7 @@ function filter_configure_sync() { unlink_if_exists("{$g['tmp_path']}/filter_loading"); update_filter_reload_status(gettext("Filter is disabled. Not loading rules.")); if($g['booting'] == true) - echo "done.\n"; + echo gettext("done.") . "\n"; unlock($filterlck); return; } @@ -385,7 +385,7 @@ function filter_configure_sync() { update_filter_reload_status(gettext("Done")); if($g['booting'] == true) - echo "done.\n"; + echo gettext("done.") . "\n"; return 0; } From 701a250b6ede4936d1dd677b8e1813a440e90c71 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 30 Aug 2010 19:45:58 -0300 Subject: [PATCH 047/329] Fix gettext calls with printf to permit change strings order --- etc/inc/auth.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 6fa418cca6..11801742cb 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -928,7 +928,7 @@ function ldap_backed($username, $passwd, $authcfg) { /* Iterate through the user containers for search */ foreach ($ldac_splits as $i => $ldac_split) { /* Make sure we just use the first user we find */ - log_error(sprintf(gettext("Now Searching in server %s, container %s with filter %s."), $ldapname, $ldac_split, $ldapfilter)); + log_error(sprintf(gettext("Now Searching in server %1$s, container %2$s with filter %3$s."), $ldapname, $ldac_split, $ldapfilter)); if ($ldapscope == "one") $ldapfunc = "ldap_list"; else @@ -961,12 +961,12 @@ function ldap_backed($username, $passwd, $authcfg) { /* Now lets bind as the user we found */ if (!($res = @ldap_bind($ldap, $userdn, $passwd))) { - log_error(sprintf(gettext("ERROR! Could not login to server %s as user %s."), $ldapname, $username)); + log_error(sprintf(gettext("ERROR! Could not login to server %1$s as user %2$s."), $ldapname, $username)); @ldap_unbind($ldap); return false; } - log_error(sprintf(gettext("Logged in successfully as %s via LDAP server %s with DN = %s."), $username, $ldapname, $userdn)); + log_error(sprintf(gettext("Logged in successfully as %1$s via LDAP server %2$s with DN = %3$s."), $username, $ldapname, $userdn)); /* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */ @ldap_unbind($ldap); @@ -1145,7 +1145,7 @@ function session_auth() { $_SESSION['Logged_In'] = "True"; $_SESSION['Username'] = $_POST['usernamefld']; $_SESSION['last_access'] = time(); - log_error(sprintf(gettext("Successful login for user '%s' from: %s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Successful login for user '%1$s' from: %2$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); $HTTP_SERVER_VARS['AUTH_USER'] = $_SESSION['Username']; if (isset($_POST['postafterlogin'])) return true; @@ -1158,7 +1158,7 @@ function session_auth() { } else { /* give the user an error message */ $_SESSION['Login_Error'] = gettext("Username or Password incorrect"); - log_error(sprintf(gettext("Login attempt with user: '%s' from: '%s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Login attempt with user: '%1$s' from: '%2$s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); if(isAjax()) { echo "showajaxmessage('{$_SESSION['Login_Error']}');"; return; @@ -1198,9 +1198,9 @@ function session_auth() { if (isset($_GET['logout'])) { if ($_SESSION['Logout']) - log_error(sprintf(gettext("Session timed out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Session timed out for user '%1$s' from: %2$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); else - log_error(sprintf(gettext("User logged out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("User logged out for user '%1$s' from: %2$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); /* wipe out $_SESSION */ $_SESSION = array(); From 47f12397b3ec7f6fa860d21136a7deca9f6573e8 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 30 Aug 2010 20:36:30 -0300 Subject: [PATCH 048/329] Fix gettext calls with printf to permit change strings order --- etc/inc/authgui.inc | 2 +- etc/inc/cmd_chain.inc | 6 +++--- etc/inc/config.lib.inc | 8 ++++---- etc/inc/filter.inc | 12 ++++++------ etc/inc/filter_log.inc | 2 +- etc/inc/gwlb.inc | 4 ++-- etc/inc/interfaces.inc | 8 ++++---- etc/inc/meta.inc | 8 ++++---- etc/inc/notices.inc | 4 ++-- etc/inc/pfsense-utils.inc | 12 ++++++------ etc/inc/pkg-utils.inc | 4 ++-- etc/inc/rrd.inc | 10 +++++----- etc/inc/services.inc | 2 +- etc/inc/smtp.inc | 6 +++--- etc/inc/system.inc | 2 +- etc/inc/util.inc | 2 +- etc/inc/voucher.inc | 12 ++++++------ etc/inc/vpn.inc | 8 ++++---- etc/inc/xmlparse.inc | 4 ++-- etc/inc/xmlparse_attr.inc | 4 ++-- etc/inc/xmlrpc_client.inc | 2 +- 21 files changed, 61 insertions(+), 61 deletions(-) diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 97b2899b6e..143e4a2ab7 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -88,7 +88,7 @@ function display_error_form($http_code, $desc) { global $config, $g; $g['theme'] = $config['theme']; if(isAjax()) { - printf(gettext("Error: %s Description: %s"), $http_code, $desc); + printf(gettext("Error: %1$s Description: %2$s"), $http_code, $desc); return; } diff --git a/etc/inc/cmd_chain.inc b/etc/inc/cmd_chain.inc index ea295cda85..399210ed0d 100644 --- a/etc/inc/cmd_chain.inc +++ b/etc/inc/cmd_chain.inc @@ -98,7 +98,7 @@ Class CmdCHAIN { $ignore_return_text = $cmd['ignore_return_text']; // Should we perform verbose debugging? if($this->is_debugging == true) { - log_error(sprintf(gettext("CmdCHAIN is executing -> %s - %s"), $cmd_title, $command)); + log_error(sprintf(gettext("CmdCHAIN is executing -> %1$s - %2$s"), $cmd_title, $command)); usleep(100); // give network stack time to deliver network syslog message } // Execute command @@ -106,9 +106,9 @@ Class CmdCHAIN { if($this->ignore_return_text == true) continue; if(intval($status) <> 0) { - log_error(sprintf(gettext("%s failed with return code -> %s. The command was %s"), $cmd_title, $status, $command)); + log_error(sprintf(gettext("%s failed with return code -> %1$s. The command was %2$s"), $cmd_title, $status, $command)); if($this->halt_on_errors == true) - return(sprintf(gettext("%s failed with return code -> %s. The command was %s"), $cmd_title, $status, $command)); + return(sprintf(gettext("%s failed with return code -> %1$s. The command was %2$s"), $cmd_title, $status, $command)); } } return; diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index f38cfd9502..29576cb366 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -201,8 +201,8 @@ function restore_backup($file) { conf_mount_rw(); unlink_if_exists("{$g['tmp_path']}/config.cache"); copy("$file","/cf/conf/config.xml"); - log_error(sprintf(gettext("%s is restoring the configuration %s"), $g['product_name'], $file)); - file_notice("config.xml", sprintf(gettext("%s is restoring the configuration %s"), $g['product_name'], $file), "pfSenseConfigurator", ""); + log_error(sprintf(gettext("%1$s is restoring the configuration %2$s"), $g['product_name'], $file)); + file_notice("config.xml", sprintf(gettext("%1$s is restoring the configuration %2$s"), $g['product_name'], $file), "pfSenseConfigurator", ""); conf_mount_ro(); } } @@ -404,7 +404,7 @@ function convert_config() { log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now)); if ($prev_version != $config['version']) - write_config(sprintf(gettext("Upgraded config version level from %s to %s"), $prev_version, $config['version'])); + write_config(sprintf(gettext("Upgraded config version level from %1$s to %2$s"), $prev_version, $config['version'])); if($g['booting']) echo gettext("Loading new configuration..."); @@ -640,7 +640,7 @@ function config_validate($conffile) { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - $xmlerr = sprintf(gettext("%s at line %d"), + $xmlerr = sprintf(gettext("%1$s at line %2$d"), xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)); return false; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ec11bf0d17..8e7757a1ce 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -319,9 +319,9 @@ function filter_configure_sync() { $line_number = $line_error[1]; $line_split = file("{$g['tmp_path']}/rules.debug"); if(is_array($line_split)) - $line_error = sprintf(gettext("The line in question reads [%d]: %s"), $line_number, $line_split[$line_number-1]); + $line_error = sprintf(gettext("The line in question reads [%1$d]: %2$s"), $line_number, $line_split[$line_number-1]); if($line_error and $line_number) { - $error_msg = sprintf(gettext("There were error(s) loading the rules: %s - %s"), $rules_error, $line_error); + $error_msg = sprintf(gettext("There were error(s) loading the rules: %1$s - %2$s"), $rules_error, $line_error); file_notice("filter_load", $error_msg, "Filter Reload", ""); log_error($error_msg); update_filter_reload_status($error_msg); @@ -608,7 +608,7 @@ function filter_generate_gateways() { $gatewayip = $member['gwip']; if (($int <> "") && is_ipaddr($gatewayip)) { if ($g['debug']) - log_error(sprintf(gettext("Setting up route with %s on %s"), $gatewayip, $int)); + log_error(sprintf(gettext("Setting up route with %1$s on %2$s"), $gatewayip, $int)); if ($member['weight'] > 1) { $routeto .= str_repeat("( {$int} {$gatewayip} ) ", $member['weight']); } else @@ -1254,7 +1254,7 @@ function filter_nat_rules_generate() { } if($numberofnathosts > 0): foreach ($FilterIflist as $if => $ifcfg) { - update_filter_reload_status(sprintf(gettext("Creating outbound rules %s - (%s)"), $if, $ifcfg['descr'])); + update_filter_reload_status(sprintf(gettext("Creating outbound rules %1$s - (%2$s)"), $if, $ifcfg['descr'])); if(interface_has_gateway($if)) { $target = $ifcfg['ip']; /* create outbound nat entries for all local networks */ @@ -2653,12 +2653,12 @@ function discover_pkg_rules($ruletype) { foreach($files as $pkg_inc) { if($pkg_inc == "ls: No match.") continue; - update_filter_reload_status(sprintf(gettext("Checking for %s PF hooks in package %s"), $ruletype, $pkg_inc)); + update_filter_reload_status(sprintf(gettext("Checking for %1$s PF hooks in package %2$s"), $ruletype, $pkg_inc)); require_once($pkg_inc); $pkg = basename($pkg_inc, ".inc"); $pkg_generate_rules = "{$pkg}_generate_rules"; if(function_exists($pkg_generate_rules)) { - update_filter_reload_status(sprintf(gettext("Processing early %s rules for package %s"), $ruletype, $pkg_inc)); + update_filter_reload_status(sprintf(gettext("Processing early %1$s rules for package %2$s"), $ruletype, $pkg_inc)); $tmprules = $pkg_generate_rules("$ruletype"); file_put_contents("{$g['tmp_path']}/rules.test.packages", $tmprules); $status = mwexec("/sbin/pfctl -nf {$g['tmp_path']}/rules.test.packages"); diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index e78bc0cd36..b027f6ee1c 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -203,7 +203,7 @@ function get_port_with_service($port, $proto) { $service = getservbyport($port, $proto); $portstr = ""; if ($service) { - $portstr = sprintf(gettext("%s"), $port, $proto, $service, htmlspecialchars($port)); + $portstr = sprintf(gettext("%4$s"), $port, $proto, $service, htmlspecialchars($port)); } else { $portstr = htmlspecialchars($port); } diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 637d9ac660..0e40341537 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -230,7 +230,7 @@ EOD; mwexec("/sbin/route delete -host " . escapeshellarg($gateway['monitor'])); mwexec("/sbin/route add -host " . escapeshellarg($gateway['monitor']) . " " . escapeshellarg($gateway['gateway'])); - log_error(sprintf(gettext("Removing static route for monitor %s and adding a new route through %s"), $gateway['monitor'], $gateway['gateway'])); + log_error(sprintf(gettext("Removing static route for monitor %1$s and adding a new route through %2$s"), $gateway['monitor'], $gateway['gateway'])); } } } @@ -469,7 +469,7 @@ function dhclient_update_gateway_groups_defaultroute($interface = "wan") { } } if($changed && $current_gw) - write_config(sprintf(gettext("Updating gateway group gateway for %s - new gateway is %s"), $interfac, $current_gw)); + write_config(sprintf(gettext("Updating gateway group gateway for %1$s - new gateway is %2$s"), $interfac, $current_gw)); } function lookup_gateway_ip_by_name($name) { diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 11e83210d4..5366ebcdbb 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1109,7 +1109,7 @@ function interface_ppps_configure($interface) { */ } if(!is_ipaddr($gateways[$pid])){ - log_error(sprintf(gettext("Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure."), $dhcp_gateway, $gway)); + log_error(sprintf(gettext("Could not get a PPTP/L2TP Remote IP address from %1$s for %2$s in interfaces_ppps_configure."), $dhcp_gateway, $gway)); return 0; } break; @@ -1725,7 +1725,7 @@ function interface_carpdev_configure(&$vip) { if($vip['password'] != "") $password = " pass \"" . $vip_password . "\""; - log_error(sprintf(gettext("Found carpdev interface %s on top of interface %s"), $vip['interface'], $interface)); + log_error(sprintf(gettext("Found carpdev interface %1$s on top of interface %2$s"), $vip['interface'], $interface)); if (empty($vip['interface'])) return; @@ -1841,7 +1841,7 @@ function interface_wireless_clone($realif, $wlcfg) { // example: wlan2 exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} bssid 2>&1", $out, $ret); if($ret <> 0) { - log_error(sprintf(gettext("Failed to clone interface %s with error code %s, output %s"), $baseif, $ret, $out[0])); + log_error(sprintf(gettext("Failed to clone interface %1$s with error code %2$s, output %3$s"), $baseif, $ret, $out[0])); return false; } $newif = trim($out[0]); @@ -2358,7 +2358,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven " link " . escapeshellarg($random_mac)); $wancfg['spoofmac'] = $random_mac; write_config(); - file_notice("MAC Address altered", sprintf(gettext("The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %s has been automatically replaced with %s"), $realif, $random_mac), "Interfaces"); + file_notice("MAC Address altered", sprintf(gettext("The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s"), $realif, $random_mac), "Interfaces"); } } diff --git a/etc/inc/meta.inc b/etc/inc/meta.inc index 63c9391f33..4216185167 100644 --- a/etc/inc/meta.inc +++ b/etc/inc/meta.inc @@ -129,7 +129,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $tagend = substr($fdata, $tagend_off + 4, $tagend_len - 4); if ($tagbeg != $tagend) { - printf(gettext("error: tag mismatch ( %s != %s ) in '%s'%s"), $tagbeg, $tagend, $fpath, "\n"); + printf(gettext("error: tag mismatch ( %1$s != %2$s ) in '%3$s'%4$s"), $tagbeg, $tagend, $fpath, "\n"); break; } @@ -140,7 +140,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $mdata = substr($fdata, $mdata_off, $mdata_len); if (!strlen($mdata)) { - printf(gettext("warning: tag %s has no data in '%s'%s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1$s has no data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); break; } @@ -160,7 +160,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $valtag = stripos($line, "##|*"); if ($valtag === false || $valtag) { - printf(gettext("warning: tag %s has malformed data in '%s'%s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1$s has malformed data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); continue; } @@ -182,7 +182,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { } if (!isset($vname) || !isset($vdata)) { - printf(gettext("warning: tag %s has invalid data in '%s'%s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1$s has invalid data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); continue; } diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 6d4ed1e192..224e68048d 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -326,8 +326,8 @@ function notify_via_smtp($message) { log_error(sprintf(gettext("Message sent to %s OK"), $to)); return; } else { - log_error(sprintf(gettext("Could not send the message to %s -- Error: %s"), $to, $smtp->error)); - return(sprintf(gettext("Could not send the message to %s -- Error: %s"), $to, $smtp->error)); + log_error(sprintf(gettext("Could not send the message to %1$s -- Error: %2$s"), $to, $smtp->error)); + return(sprintf(gettext("Could not send the message to %1$s -- Error: %2$s"), $to, $smtp->error)); } } diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 37cb340adb..833c802102 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -483,7 +483,7 @@ function WakeOnLan($addr, $mac) $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if ($s == false) { log_error(gettext("Error creating socket!")); - log_error(sprintf(gettext("Error code is '%s' - %s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); + log_error(sprintf(gettext("Error code is '%1$s' - %2$s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); } else { // setting a broadcast option to socket: $opt_ret = socket_set_option($s, 1, 6, TRUE); @@ -491,7 +491,7 @@ function WakeOnLan($addr, $mac) log_error(sprintf(gettext("setsockopt() failed, error: %s"), strerror($opt_ret))); $e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050); socket_close($s); - log_error(sprintf(gettext("Magic Packet sent (%s) to {%s} MAC=%s"), $e, $addr, $mac)); + log_error(sprintf(gettext("Magic Packet sent (%1$s) to {%2$s} MAC=%3$s"), $e, $addr, $mac)); return true; } @@ -737,7 +737,7 @@ function call_pfsense_method($method, $params, $timeout = 0) { log_error(sprintf(gettext("XMLRPC communication error: %s"), $cli->errstr)); return false; } elseif($resp->faultCode()) { - log_error(sprintf(gettext("XMLRPC request failed with error %s: %s"), $resp->faultCode(), $resp->faultString())); + log_error(sprintf(gettext("XMLRPC request failed with error %1$s: %2$s"), $resp->faultCode(), $resp->faultString())); return false; } else { return XML_RPC_Decode($resp->value()); @@ -1402,7 +1402,7 @@ function compare_hostname_to_dnscache($hostname) { if(trim($oldcontents) != trim($contents)) { if($g['debug']) { - log_error(sprintf(gettext("DNSCACHE: Found old IP %s and new IP %s"), $oldcontents, $contents)); + log_error(sprintf(gettext("DNSCACHE: Found old IP %1$s and new IP %2$s"), $oldcontents, $contents)); } return ($oldcontents); } else { @@ -1573,7 +1573,7 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($debug) fwrite($fd, "$i\n"); if($config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] == $origname) { - if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %s to %s%s"), $origname, $new_alias_name, "\n")); + if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %1$s to %2$s%3$s"), $origname, $new_alias_name, "\n")); $config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] = $new_alias_name; } } @@ -1582,7 +1582,7 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($config["$section"]["$subsection"][$i]["$fielda"] == $origname) { $config["$section"]["$subsection"][$i]["$fielda"] = $new_alias_name; - if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %s to %s%s"), $origname, $new_alias_name, "\n")); + if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %1$s to %2$s%3$s"), $origname, $new_alias_name, "\n")); } } } diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index d3d0e48efd..376635052a 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -224,7 +224,7 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu } $package = $config['installedpackages']['package'][$pkg_id]; if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - log_error(sprintf(gettext("The %s package is missing required dependencies and must be reinstalled. %s"), $package['name'], $package['configurationfile'])); + log_error(sprintf(gettext("The %1$s package is missing required dependencies and must be reinstalled. %2$s"), $package['name'], $package['configurationfile'])); install_package($package['name']); uninstall_package_from_name($package['name']); install_package($package['name']); @@ -641,7 +641,7 @@ function install_package_xml($pkg) { fwrite($fd_log, print_r($tarout, true) . "\n"); } if($pkg_chmod <> "") { - fwrite($fd_log, sprintf(gettext("Changing file mode to %s for %s%s%s"), $pkg_chmod, $prefix, $filename, "\n")); + fwrite($fd_log, sprintf(gettext("Changing file mode to %1$s for %2$s%3$s%4$s"), $pkg_chmod, $prefix, $filename, "\n")); @chmod($prefix . $filename, $pkg_chmod); system("/bin/chmod {$pkg_chmod} {$prefix}{$filename}"); } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 574c6a634d..34ed887122 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -42,7 +42,7 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) { exec("$rrdtool dump {$rrddatabase} {$xmldumpfile} 2>&1", $dumpout, $dumpret); if ($dumpret <> 0) { $dumpout = implode(" ", $dumpout); - log_error(sprintf(gettext("RRD dump failed exited with %s, the error is: %s"), $dumpret, $dumpout)); + log_error(sprintf(gettext("RRD dump failed exited with %1$s, the error is: %2$s"), $dumpret, $dumpout)); } return($dumpret); } @@ -53,7 +53,7 @@ function create_new_rrd($rrdcreatecmd) { exec("$rrdcreatecmd 2>&1", $rrdcreateoutput, $rrdcreatereturn); if ($rrdcreatereturn <> 0) { $rrdcreateoutput = implode(" ", $rrdcreateoutput); - log_error(sprintf(gettext("RRD create failed exited with %s, the error is: %s"), $rrdcreatereturn, $rrdcreateoutput)); + log_error(sprintf(gettext("RRD create failed exited with %1$s, the error is: %2$s"), $rrdcreatereturn, $rrdcreateoutput)); } return $rrdcreatereturn; } @@ -67,7 +67,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numdsold = count($rrdoldxml['ds']); $numrranew = count($rrdnewxml['rra']); $numdsnew = count($rrdnewxml['ds']); - log_error(sprintf(gettext("Import RRD has %s DS values and %s RRA databases, new format RRD has %s DS values and %s RRA databases"), $numdsold, $numrraold, $numdsnew ,$numrranew)); + log_error(sprintf(gettext("Import RRD has %1$s DS values and %2$s RRA databases, new format RRD has %3$s DS values and %4$s RRA databases"), $numdsold, $numrraold, $numdsnew ,$numrranew)); /* add data sources not found in the old array from the new array */ $i = 0; @@ -151,7 +151,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numrranew = count($rrdoldxml['rra']); $numdsnew = count($rrdoldxml['ds']); - log_error(sprintf(gettext("The new RRD now has %s DS values and %s RRA databases"), $numdsnew, $numrranew)); + log_error(sprintf(gettext("The new RRD now has %1$s DS values and %2$s RRA databases"), $numdsnew, $numrranew)); return $rrdoldxml; } @@ -238,7 +238,7 @@ function enable_rrd_graphing() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $rrdrestore = implode(" ", $rrdrestore); if($rrdreturn <> 0) { - log_error(sprintf(gettext("RRD restore failed exited with %s, the error is: %s%s"), $rrdreturn, $rrdrestore, "\n")); + log_error(sprintf(gettext("RRD restore failed exited with %1$s, the error is: %2$s%3$s"), $rrdreturn, $rrdrestore, "\n")); } } } diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 682472ae0e..1c1f1fdb9a 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -94,7 +94,7 @@ function services_dhcpd_configure() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn); $dhcprestore = implode(" ", $dhcprestore); if($dhcpreturn <> 0) { - log_error(sprintf(gettext("DHCP leases restore failed exited with %s, the error is: %s%s"), $dhcpreturn, $dhcprestore, "\n")); + log_error(sprintf(gettext("DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s"), $dhcpreturn, $dhcprestore, "\n")); } } } diff --git a/etc/inc/smtp.inc b/etc/inc/smtp.inc index 7276ed8260..c33978dfbf 100644 --- a/etc/inc/smtp.inc +++ b/etc/inc/smtp.inc @@ -236,7 +236,7 @@ class smtp_class && !strcmp(@gethostbyname($this->exclude_address),$ip)) return(sprintf(gettext("domain \"%s\" resolved to an address excluded to be valid"), $domain)); if($this->debug) - $this->OutputDebug(sprintf(gettext("Connecting to host address \"%s\" port %s..."), $ip, $port)); + $this->OutputDebug(sprintf(gettext("Connecting to host address \"%1$s\" port %2$s..."), $ip, $port)); if(($this->connection=($this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port,$errno,$error,$this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port)))) return(""); $error=($this->timeout ? strval($error) : "??"); @@ -253,7 +253,7 @@ class smtp_class case "-7": return(gettext("-7 setvbuf() call failed")); } - return(sprintf(gettext("could not connect to the host \"%s\": %s"), $domain, $error)); + return(sprintf(gettext("could not connect to the host \"%1$s\": %2$s"), $domain, $error)); } Function SASLAuthenticate($mechanisms, $credentials, &$authenticated, &$mechanism) @@ -286,7 +286,7 @@ class smtp_class case SASL_NOMECH: if(strlen($this->authentication_mechanism)) { - $this->error=printf(gettext("authenticated mechanism %s may not be used: %s"), $this->authentication_mechanism, $sasl->error); + $this->error=printf(gettext("authenticated mechanism %1$s may not be used: %2$s"), $this->authentication_mechanism, $sasl->error); return(0); } break; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index bcc0e0e738..c21be1911d 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -338,7 +338,7 @@ function system_routing_configure($interface = "") { if(isset($route_arr['default'])) { $action = "change"; } - log_error(sprintf(gettext("ROUTING: %s default route to %s"), $action, $gatewayip)); + log_error(sprintf(gettext("ROUTING: %1$s default route to %2$s"), $action, $gatewayip)); mwexec("/sbin/route {$action} default " . escapeshellarg($gatewayip)); } else if (is_ipaddr($config['interfaces']['wan']['gateway'])) { /* Adding gateway for 1.2-style configs without the new diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 77af86db2e..8a9db4ffd0 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -785,7 +785,7 @@ function mwexec($command, $mute = false) { $mute = false; if(($retval <> 0) && ($mute === false)) { $output = implode(" ", $oarr); - log_error(sprintf(gettext("The command '%s' returned exit code '%d', the output was '%s' "), $command, $retval, $output)); + log_error(sprintf(gettext("The command '%1$s' returned exit code '%2$d', the output was '%3$s' "), $command, $retval, $output)); } return $retval; } diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 978b1d2677..e746d8a2c2 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -89,7 +89,7 @@ function voucher_auth($voucher_received, $test = 0) { list($timestamp,$minutes) = explode(",", $line); // we have an already active voucher here. $remaining = intval((($timestamp + 60*$minutes) - time())/60); - $test_result[] = sprintf(gettext("%s (%s/%s) active and good for %d Minutes"), $voucher, $roll, $nr, $remaining); + $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s) active and good for %4$d Minutes"), $voucher, $roll, $nr, $remaining); $total_minutes += $remaining; } else { // voucher not used. Check if ticket Id is on the roll (not too high) @@ -100,18 +100,18 @@ function voucher_auth($voucher_received, $test = 0) { $pos = $nr >> 3; // divide by 8 -> octet $mask = 1 << ($nr % 8); if (ord($bitstring[$roll][$pos]) & $mask) { - $test_result[] = sprintf(gettext("%s (%s/%s) already used and expired"), $voucher, $roll, $nr); + $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s) already used and expired"), $voucher, $roll, $nr); $total_minutes = -1; // voucher expired $error++; } else { // mark bit for this voucher as used $bitstring[$roll][$pos] = chr(ord($bitstring[$roll][$pos]) | $mask); - $test_result[] = sprintf(gettext("%s (%s/%s) good for %d Minutes"), $voucher, $roll, $nr, $minutes_per_roll[$roll]); + $test_result[] = sprintf(gettext("%1$s (%2$s/%3$) good for %4$d Minutes"), $voucher, $roll, $nr, $minutes_per_roll[$roll]); $total_minutes += $minutes_per_roll[$roll]; } } } else { - $test_result[] = sprintf(gettext("%s (%s/%s): not found on any registererd Roll"), $voucher, $roll, $nr); + $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s): not found on any registererd Roll"), $voucher, $roll, $nr); } } else { // hmm, thats weird ... not what I expected @@ -330,7 +330,7 @@ function voucher_write_used_db($roll, $vdb) { fwrite($fd, $vdb . "\n"); fclose($fd); } else { - voucher_log(LOG_ERR, sprintf(gettext("cant write %s/voucher_used_%s.db"), $g['vardb_path'], $roll)); + voucher_log(LOG_ERR, sprintf(gettext("cant write %1$s/voucher_used_%2$s.db"), $g['vardb_path'], $roll)); } } @@ -409,7 +409,7 @@ function voucher_read_used_db($roll) { $vdb = trim(fgets($fd)); fclose($fd); } else { - voucher_log(LOG_ERR, sprintf(gettext("cant read %s/voucher_used_%s.db"), $g['vardb_path'], $roll)); + voucher_log(LOG_ERR, sprintf(gettext("cant read %1$s/voucher_used_%2$s.db"), $g['vardb_path'], $roll)); } } return base64_decode($vdb); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index ab8d4748ab..ce7d501831 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -840,7 +840,7 @@ EOD; if(is_ipaddr($gatewayip)) { /* FIXME: does adding route-to and reply-to on the in/outbound * rules fix this? smos@ 13-01-2009 */ - log_error(sprintf(gettext("IPSEC interface is not WAN but %s, adding static route for VPN endpoint %s via %s"), $parentinterface, $rgip, $gatewayip)); + log_error(sprintf(gettext("IPSEC interface is not WAN but %1$s, adding static route for VPN endpoint %2$s via %3$s"), $parentinterface, $rgip, $gatewayip)); mwexec("/sbin/route delete -host {$rgip}"); mwexec("/sbin/route add -host {$rgip} {$gatewayip}"); } @@ -1648,10 +1648,10 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { } if((!is_ipaddr($old_ep)) || (! is_ipaddr($ep))) { - log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%s' new EP '%s'"), $old_ep, $ep)); + log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%1$s' new EP '%2$s'"), $old_ep, $ep)); } if((! is_ipaddr($rgip)) || (! is_ipaddr($old_gw))) { - log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%s' new RG '%s'"), $old_gw, $rgip)); + log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%1$s' new RG '%2$s'"), $old_gw, $rgip)); } $spdconf = ""; @@ -1697,7 +1697,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { "{$phase2['protocol']}/tunnel/{$rgip}-" . "{$ep}/unique;\n"; - log_error(sprintf(gettext("Reloading IPsec tunnel '%s'. Previous IP '%s', current IP '%s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); + log_error(sprintf(gettext("Reloading IPsec tunnel '%1$s'. Previous IP '%2$s', current IP '%3$s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); $now = time(); $spdfile = tempnam("{$g['tmp_path']}", "spd.conf.reload.{$now}."); diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index aa4d7e48d3..013f81d149 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -82,7 +82,7 @@ function startElement($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext("XML error: %s at line %d cannot occur more than once") . "\n", + die(sprintf(gettext("XML error: %1$s at line %2$d cannot occur more than once") . "\n", $name, xml_get_current_line_number($parser))); } @@ -179,7 +179,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext("XML error: %s at line %d") . "\n", + log_error(sprintf(gettext("XML error: %1$s at line %2$d") . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); return -1; diff --git a/etc/inc/xmlparse_attr.inc b/etc/inc/xmlparse_attr.inc index 04428ccad5..534ffb5d80 100644 --- a/etc/inc/xmlparse_attr.inc +++ b/etc/inc/xmlparse_attr.inc @@ -75,7 +75,7 @@ function startElement_attr($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext("XML error: %s at line %d cannot occur more than once") . "\n", + die(sprintf(gettext("XML error: %1$s at line %2$d cannot occur more than once") . "\n", $name, xml_get_current_line_number($parser))); } else if (isset($writeattrs)) { @@ -194,7 +194,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext("XML error: %s at line %d") . "\n", + log_error(sprintf(gettext("XML error: %1$s at line %2$d") . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); if (isset($parsed_attributes)) { diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc index 59a9678560..bd0f1bd95b 100644 --- a/etc/inc/xmlrpc_client.inc +++ b/etc/inc/xmlrpc_client.inc @@ -303,7 +303,7 @@ function XML_RPC_se($parser_resource, $name, $attrs) if (!in_array($XML_RPC_xh[$parser]['stack'][0], $XML_RPC_valid_parents[$name])) { $name = $GLOBALS['XML_RPC_func_ereg_replace']('[^a-zA-Z0-9._-]', '', $name); $XML_RPC_xh[$parser]['isf'] = 2; - $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext("xmlrpc element %s cannot be child of %s"), $name, $XML_RPC_xh[$parser]['stack'][0]); + $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext("xmlrpc element %1$s cannot be child of %2$s"), $name, $XML_RPC_xh[$parser]['stack'][0]); return; } } From addc0439931fb28c626c7024b1e9857adfe29f29 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 1 Oct 2010 10:17:13 -0300 Subject: [PATCH 049/329] Fix quotes to use %N$X on gettext calls --- etc/inc/auth.inc | 14 +++++++------- etc/inc/authgui.inc | 2 +- etc/inc/cmd_chain.inc | 6 +++--- etc/inc/config.lib.inc | 8 ++++---- etc/inc/filter.inc | 12 ++++++------ etc/inc/filter_log.inc | 2 +- etc/inc/gwlb.inc | 2 +- etc/inc/interfaces.inc | 8 ++++---- etc/inc/meta.inc | 8 ++++---- etc/inc/notices.inc | 4 ++-- etc/inc/pfsense-utils.inc | 12 ++++++------ etc/inc/pkg-utils.inc | 4 ++-- etc/inc/rrd.inc | 10 +++++----- etc/inc/services.inc | 2 +- etc/inc/smtp.inc | 6 +++--- etc/inc/system.inc | 2 +- etc/inc/util.inc | 2 +- etc/inc/voucher.inc | 12 ++++++------ etc/inc/vpn.inc | 8 ++++---- etc/inc/xmlparse.inc | 4 ++-- etc/inc/xmlparse_attr.inc | 4 ++-- etc/inc/xmlrpc_client.inc | 2 +- 22 files changed, 67 insertions(+), 67 deletions(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 59e912868a..f48a9bc925 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -930,7 +930,7 @@ function ldap_backed($username, $passwd, $authcfg) { /* Iterate through the user containers for search */ foreach ($ldac_splits as $i => $ldac_split) { /* Make sure we just use the first user we find */ - log_error(sprintf(gettext("Now Searching in server %1$s, container %2$s with filter %3$s."), $ldapname, $ldac_split, $ldapfilter)); + log_error(sprintf(gettext('Now Searching in server %1$s, container %2$s with filter %3$s.'), $ldapname, $ldac_split, $ldapfilter)); if ($ldapscope == "one") $ldapfunc = "ldap_list"; else @@ -963,12 +963,12 @@ function ldap_backed($username, $passwd, $authcfg) { /* Now lets bind as the user we found */ if (!($res = @ldap_bind($ldap, $userdn, $passwd))) { - log_error(sprintf(gettext("ERROR! Could not login to server %1$s as user %2$s."), $ldapname, $username)); + log_error(sprintf(gettext('ERROR! Could not login to server %1$s as user %2$s.'), $ldapname, $username)); @ldap_unbind($ldap); return false; } - log_error(sprintf(gettext("Logged in successfully as %1$s via LDAP server %2$s with DN = %3$s."), $username, $ldapname, $userdn)); + log_error(sprintf(gettext('Logged in successfully as %1$s via LDAP server %2$s with DN = %3$s.'), $username, $ldapname, $userdn)); /* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */ @ldap_unbind($ldap); @@ -1147,7 +1147,7 @@ function session_auth() { $_SESSION['Logged_In'] = "True"; $_SESSION['Username'] = $_POST['usernamefld']; $_SESSION['last_access'] = time(); - log_error(sprintf(gettext("Successful login for user '%1$s' from: %2$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Successful login for user '%1\$s' from: %2\$s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); $HTTP_SERVER_VARS['AUTH_USER'] = $_SESSION['Username']; if (isset($_POST['postafterlogin'])) return true; @@ -1160,7 +1160,7 @@ function session_auth() { } else { /* give the user an error message */ $_SESSION['Login_Error'] = gettext("Username or Password incorrect"); - log_error(sprintf(gettext("Login attempt with user: '%1$s' from: '%2$s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Login attempt with user: '%1\$s' from: '%2\$s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR'])); if(isAjax()) { echo "showajaxmessage('{$_SESSION['Login_Error']}');"; return; @@ -1200,9 +1200,9 @@ function session_auth() { if (isset($_GET['logout'])) { if ($_SESSION['Logout']) - log_error(sprintf(gettext("Session timed out for user '%1$s' from: %2$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("Session timed out for user '%1\$s' from: %2\$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); else - log_error(sprintf(gettext("User logged out for user '%1$s' from: %2$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); + log_error(sprintf(gettext("User logged out for user '%1\$s' from: %2\$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR'])); /* wipe out $_SESSION */ $_SESSION = array(); diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 143e4a2ab7..a42b9f91d2 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -88,7 +88,7 @@ function display_error_form($http_code, $desc) { global $config, $g; $g['theme'] = $config['theme']; if(isAjax()) { - printf(gettext("Error: %1$s Description: %2$s"), $http_code, $desc); + printf(gettext('Error: %1$s Description: %2$s'), $http_code, $desc); return; } diff --git a/etc/inc/cmd_chain.inc b/etc/inc/cmd_chain.inc index 399210ed0d..4c1e69e372 100644 --- a/etc/inc/cmd_chain.inc +++ b/etc/inc/cmd_chain.inc @@ -98,7 +98,7 @@ Class CmdCHAIN { $ignore_return_text = $cmd['ignore_return_text']; // Should we perform verbose debugging? if($this->is_debugging == true) { - log_error(sprintf(gettext("CmdCHAIN is executing -> %1$s - %2$s"), $cmd_title, $command)); + log_error(sprintf(gettext('CmdCHAIN is executing -> %1$s - %2$s'), $cmd_title, $command)); usleep(100); // give network stack time to deliver network syslog message } // Execute command @@ -106,9 +106,9 @@ Class CmdCHAIN { if($this->ignore_return_text == true) continue; if(intval($status) <> 0) { - log_error(sprintf(gettext("%s failed with return code -> %1$s. The command was %2$s"), $cmd_title, $status, $command)); + log_error(sprintf(gettext('%1$s failed with return code -> %2$s. The command was %3$s'), $cmd_title, $status, $command)); if($this->halt_on_errors == true) - return(sprintf(gettext("%s failed with return code -> %1$s. The command was %2$s"), $cmd_title, $status, $command)); + return(sprintf(gettext('%1$s failed with return code -> %2$s. The command was %3$s'), $cmd_title, $status, $command)); } } return; diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 29576cb366..ebcfb649db 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -201,8 +201,8 @@ function restore_backup($file) { conf_mount_rw(); unlink_if_exists("{$g['tmp_path']}/config.cache"); copy("$file","/cf/conf/config.xml"); - log_error(sprintf(gettext("%1$s is restoring the configuration %2$s"), $g['product_name'], $file)); - file_notice("config.xml", sprintf(gettext("%1$s is restoring the configuration %2$s"), $g['product_name'], $file), "pfSenseConfigurator", ""); + log_error(sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file)); + file_notice("config.xml", sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file), "pfSenseConfigurator", ""); conf_mount_ro(); } } @@ -404,7 +404,7 @@ function convert_config() { log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now)); if ($prev_version != $config['version']) - write_config(sprintf(gettext("Upgraded config version level from %1$s to %2$s"), $prev_version, $config['version'])); + write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version'])); if($g['booting']) echo gettext("Loading new configuration..."); @@ -640,7 +640,7 @@ function config_validate($conffile) { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - $xmlerr = sprintf(gettext("%1$s at line %2$d"), + $xmlerr = sprintf(gettext('%1$s at line %2$d'), xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)); return false; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 211f33ae75..d01ac41c12 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -323,9 +323,9 @@ function filter_configure_sync() { $line_number = $line_error[1]; $line_split = file("{$g['tmp_path']}/rules.debug"); if(is_array($line_split)) - $line_error = sprintf(gettext("The line in question reads [%1$d]: %2$s"), $line_number, $line_split[$line_number-1]); + $line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]); if($line_error and $line_number) { - $error_msg = sprintf(gettext("There were error(s) loading the rules: %1$s - %2$s"), $rules_error, $line_error); + $error_msg = sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error, $line_error); file_notice("filter_load", $error_msg, "Filter Reload", ""); log_error($error_msg); update_filter_reload_status($error_msg); @@ -612,7 +612,7 @@ function filter_generate_gateways() { $gatewayip = $member['gwip']; if (($int <> "") && is_ipaddr($gatewayip)) { if ($g['debug']) - log_error(sprintf(gettext("Setting up route with %1$s on %2$s"), $gatewayip, $int)); + log_error(sprintf(gettext('Setting up route with %1$s on %2$s'), $gatewayip, $int)); if ($member['weight'] > 1) { $routeto .= str_repeat("( {$int} {$gatewayip} ) ", $member['weight']); } else @@ -1285,7 +1285,7 @@ function filter_nat_rules_generate() { } if($numberofnathosts > 0): foreach ($FilterIflist as $if => $ifcfg) { - update_filter_reload_status(sprintf(gettext("Creating outbound rules %1$s - (%2$s)"), $if, $ifcfg['descr'])); + update_filter_reload_status(sprintf(gettext('Creating outbound rules %1$s - (%2$s)'), $if, $ifcfg['descr'])); if(interface_has_gateway($if)) { $target = $ifcfg['ip']; /* create outbound nat entries for all local networks */ @@ -2701,12 +2701,12 @@ function discover_pkg_rules($ruletype) { $rules = ""; $files = glob("/usr/local/pkg/*.inc"); foreach($files as $pkg_inc) { - update_filter_reload_status(sprintf(gettext("Checking for %1$s PF hooks in package %2$s"), $ruletype, $pkg_inc)); + update_filter_reload_status(sprintf(gettext('Checking for %1$s PF hooks in package %2$s'), $ruletype, $pkg_inc)); require_once($pkg_inc); $pkg = basename($pkg_inc, ".inc"); $pkg_generate_rules = "{$pkg}_generate_rules"; if(function_exists($pkg_generate_rules)) { - update_filter_reload_status(sprintf(gettext("Processing early %1$s rules for package %2$s"), $ruletype, $pkg_inc)); + update_filter_reload_status(sprintf(gettext('Processing early %1$s rules for package %2$s'), $ruletype, $pkg_inc)); $tmprules = $pkg_generate_rules("$ruletype"); file_put_contents("{$g['tmp_path']}/rules.test.packages", $aliases . $tmprules); $status = mwexec("/sbin/pfctl -nf {$g['tmp_path']}/rules.test.packages"); diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index b027f6ee1c..9fe6b6d4a8 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -203,7 +203,7 @@ function get_port_with_service($port, $proto) { $service = getservbyport($port, $proto); $portstr = ""; if ($service) { - $portstr = sprintf(gettext("%4$s"), $port, $proto, $service, htmlspecialchars($port)); + $portstr = sprintf('' . htmlspecialchars($port) . '', $port, $proto, $service); } else { $portstr = htmlspecialchars($port); } diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 03cbf6fb52..66696a2854 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -452,7 +452,7 @@ function dhclient_update_gateway_groups_defaultroute($interface = "wan") { } } if($changed && $current_gw) - write_config(sprintf(gettext("Updating gateway group gateway for %1$s - new gateway is %2$s"), $interfac, $current_gw)); + write_config(sprintf(gettext('Updating gateway group gateway for %1$s - new gateway is %2$s'), $interfac, $current_gw)); } function lookup_gateway_ip_by_name($name) { diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 93ff1635d7..78a883b92a 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1113,7 +1113,7 @@ function interface_ppps_configure($interface) { */ } if(!is_ipaddr($gateways[$pid])){ - log_error(sprintf(gettext("Could not get a PPTP/L2TP Remote IP address from %1$s for %2$s in interfaces_ppps_configure."), $dhcp_gateway, $gway)); + log_error(sprintf(gettext('Could not get a PPTP/L2TP Remote IP address from %1$s for %2$s in interfaces_ppps_configure.'), $dhcp_gateway, $gway)); return 0; } break; @@ -1737,7 +1737,7 @@ function interface_carpdev_configure(&$vip) { if($vip['password'] != "") $password = " pass \"" . $vip_password . "\""; - log_error(sprintf(gettext("Found carpdev interface %1$s on top of interface %2$s"), $vip['interface'], $interface)); + log_error(sprintf(gettext('Found carpdev interface %1$s on top of interface %2$s'), $vip['interface'], $interface)); if (empty($vip['interface'])) return; @@ -1853,7 +1853,7 @@ function interface_wireless_clone($realif, $wlcfg) { // example: wlan2 exec("/sbin/ifconfig wlan create wlandev {$baseif} {$mode} bssid 2>&1", $out, $ret); if($ret <> 0) { - log_error(sprintf(gettext("Failed to clone interface %1$s with error code %2$s, output %3$s"), $baseif, $ret, $out[0])); + log_error(sprintf(gettext('Failed to clone interface %1$s with error code %2$s, output %3$s'), $baseif, $ret, $out[0])); return false; } $newif = trim($out[0]); @@ -2397,7 +2397,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven " link " . escapeshellarg($random_mac)); $wancfg['spoofmac'] = $random_mac; write_config(); - file_notice("MAC Address altered", sprintf(gettext("The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s"), $realif, $random_mac), "Interfaces"); + file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s'), $realif, $random_mac), "Interfaces"); } } diff --git a/etc/inc/meta.inc b/etc/inc/meta.inc index 4216185167..cad79420c0 100644 --- a/etc/inc/meta.inc +++ b/etc/inc/meta.inc @@ -129,7 +129,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $tagend = substr($fdata, $tagend_off + 4, $tagend_len - 4); if ($tagbeg != $tagend) { - printf(gettext("error: tag mismatch ( %1$s != %2$s ) in '%3$s'%4$s"), $tagbeg, $tagend, $fpath, "\n"); + printf(gettext("error: tag mismatch ( %1\$s != %2\$s ) in '%3\$s'%4\$s"), $tagbeg, $tagend, $fpath, "\n"); break; } @@ -140,7 +140,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $mdata = substr($fdata, $mdata_off, $mdata_len); if (!strlen($mdata)) { - printf(gettext("warning: tag %1$s has no data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1\$s has no data in '%2\$s'%3\$s"), $tagbeg, $fpath, "\n"); break; } @@ -160,7 +160,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $valtag = stripos($line, "##|*"); if ($valtag === false || $valtag) { - printf(gettext("warning: tag %1$s has malformed data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1\$s has malformed data in '%2\$s'%3\$s"), $tagbeg, $fpath, "\n"); continue; } @@ -182,7 +182,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { } if (!isset($vname) || !isset($vdata)) { - printf(gettext("warning: tag %1$s has invalid data in '%2$s'%3$s"), $tagbeg, $fpath, "\n"); + printf(gettext("warning: tag %1\$s has invalid data in '%2\$s'%3\$s"), $tagbeg, $fpath, "\n"); continue; } diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 224e68048d..f1510ee6fe 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -326,8 +326,8 @@ function notify_via_smtp($message) { log_error(sprintf(gettext("Message sent to %s OK"), $to)); return; } else { - log_error(sprintf(gettext("Could not send the message to %1$s -- Error: %2$s"), $to, $smtp->error)); - return(sprintf(gettext("Could not send the message to %1$s -- Error: %2$s"), $to, $smtp->error)); + log_error(sprintf(gettext('Could not send the message to %1$s -- Error: %2$s'), $to, $smtp->error)); + return(sprintf(gettext('Could not send the message to %1$s -- Error: %2$s'), $to, $smtp->error)); } } diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 8e0233e09b..8bfb3ec6e3 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -483,7 +483,7 @@ function WakeOnLan($addr, $mac) $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if ($s == false) { log_error(gettext("Error creating socket!")); - log_error(sprintf(gettext("Error code is '%1$s' - %2$s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); + log_error(sprintf(gettext("Error code is '%1\$s' - %2\$s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); } else { // setting a broadcast option to socket: $opt_ret = socket_set_option($s, 1, 6, TRUE); @@ -491,7 +491,7 @@ function WakeOnLan($addr, $mac) log_error(sprintf(gettext("setsockopt() failed, error: %s"), strerror($opt_ret))); $e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050); socket_close($s); - log_error(sprintf(gettext("Magic Packet sent (%1$s) to {%2$s} MAC=%3$s"), $e, $addr, $mac)); + log_error(sprintf(gettext('Magic Packet sent (%1$s) to {%2$s} MAC=%3$s'), $e, $addr, $mac)); return true; } @@ -737,7 +737,7 @@ function call_pfsense_method($method, $params, $timeout = 0) { log_error(sprintf(gettext("XMLRPC communication error: %s"), $cli->errstr)); return false; } elseif($resp->faultCode()) { - log_error(sprintf(gettext("XMLRPC request failed with error %1$s: %2$s"), $resp->faultCode(), $resp->faultString())); + log_error(sprintf(gettext('XMLRPC request failed with error %1$s: %2$s'), $resp->faultCode(), $resp->faultString())); return false; } else { return XML_RPC_Decode($resp->value()); @@ -1402,7 +1402,7 @@ function compare_hostname_to_dnscache($hostname) { if(trim($oldcontents) != trim($contents)) { if($g['debug']) { - log_error(sprintf(gettext("DNSCACHE: Found old IP %1$s and new IP %2$s"), $oldcontents, $contents)); + log_error(sprintf(gettext('DNSCACHE: Found old IP %1$s and new IP %2$s'), $oldcontents, $contents)); } return ($oldcontents); } else { @@ -1573,7 +1573,7 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($debug) fwrite($fd, "$i\n"); if($config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] == $origname) { - if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %1$s to %2$s%3$s"), $origname, $new_alias_name, "\n")); + if($debug) fwrite($fd, sprintf(gettext('Setting old alias value %1$s to %2$s%3$s'), $origname, $new_alias_name, "\n")); $config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] = $new_alias_name; } } @@ -1582,7 +1582,7 @@ function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) { if($config["$section"]["$subsection"][$i]["$fielda"] == $origname) { $config["$section"]["$subsection"][$i]["$fielda"] = $new_alias_name; - if($debug) fwrite($fd, sprintf(gettext("Setting old alias value %1$s to %2$s%3$s"), $origname, $new_alias_name, "\n")); + if($debug) fwrite($fd, sprintf(gettext('Setting old alias value %1$s to %2$s%3$s'), $origname, $new_alias_name, "\n")); } } } diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index cbeb855632..e88897ce81 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -236,7 +236,7 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu $package =& $config['installedpackages']['package'][$pkg_id]; if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { - log_error(sprintf(gettext("The %1$s package is missing required dependencies and must be reinstalled. %2$s"), $package['name'], $package['configurationfile'])); + log_error(sprintf(gettext('The %1$s package is missing required dependencies and must be reinstalled. %2$s'), $package['name'], $package['configurationfile'])); uninstall_package_from_name($package['name']); install_package($package['name']); return; @@ -662,7 +662,7 @@ function install_package_xml($pkg) { fwrite($fd_log, print_r($tarout, true) . "\n"); } if($pkg_chmod <> "") { - fwrite($fd_log, sprintf(gettext("Changing file mode to %1$s for %2$s%3$s%4$s"), $pkg_chmod, $prefix, $filename, "\n")); + fwrite($fd_log, sprintf(gettext('Changing file mode to %1$s for %2$s%3$s%4$s'), $pkg_chmod, $prefix, $filename, "\n")); @chmod($prefix . $filename, $pkg_chmod); system("/bin/chmod {$pkg_chmod} {$prefix}{$filename}"); } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 34ed887122..365ba9f2ea 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -42,7 +42,7 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) { exec("$rrdtool dump {$rrddatabase} {$xmldumpfile} 2>&1", $dumpout, $dumpret); if ($dumpret <> 0) { $dumpout = implode(" ", $dumpout); - log_error(sprintf(gettext("RRD dump failed exited with %1$s, the error is: %2$s"), $dumpret, $dumpout)); + log_error(sprintf(gettext('RRD dump failed exited with %1$s, the error is: %2$s'), $dumpret, $dumpout)); } return($dumpret); } @@ -53,7 +53,7 @@ function create_new_rrd($rrdcreatecmd) { exec("$rrdcreatecmd 2>&1", $rrdcreateoutput, $rrdcreatereturn); if ($rrdcreatereturn <> 0) { $rrdcreateoutput = implode(" ", $rrdcreateoutput); - log_error(sprintf(gettext("RRD create failed exited with %1$s, the error is: %2$s"), $rrdcreatereturn, $rrdcreateoutput)); + log_error(sprintf(gettext('RRD create failed exited with %1$s, the error is: %2$s'), $rrdcreatereturn, $rrdcreateoutput)); } return $rrdcreatereturn; } @@ -67,7 +67,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numdsold = count($rrdoldxml['ds']); $numrranew = count($rrdnewxml['rra']); $numdsnew = count($rrdnewxml['ds']); - log_error(sprintf(gettext("Import RRD has %1$s DS values and %2$s RRA databases, new format RRD has %3$s DS values and %4$s RRA databases"), $numdsold, $numrraold, $numdsnew ,$numrranew)); + log_error(sprintf(gettext('Import RRD has %1$s DS values and %2$s RRA databases, new format RRD has %3$s DS values and %4$s RRA databases'), $numdsold, $numrraold, $numdsnew ,$numrranew)); /* add data sources not found in the old array from the new array */ $i = 0; @@ -151,7 +151,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { $numrranew = count($rrdoldxml['rra']); $numdsnew = count($rrdoldxml['ds']); - log_error(sprintf(gettext("The new RRD now has %1$s DS values and %2$s RRA databases"), $numdsnew, $numrranew)); + log_error(sprintf(gettext('The new RRD now has %1$s DS values and %2$s RRA databases'), $numdsnew, $numrranew)); return $rrdoldxml; } @@ -238,7 +238,7 @@ function enable_rrd_graphing() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn); $rrdrestore = implode(" ", $rrdrestore); if($rrdreturn <> 0) { - log_error(sprintf(gettext("RRD restore failed exited with %1$s, the error is: %2$s%3$s"), $rrdreturn, $rrdrestore, "\n")); + log_error(sprintf(gettext('RRD restore failed exited with %1$s, the error is: %2$s%3$s'), $rrdreturn, $rrdrestore, "\n")); } } } diff --git a/etc/inc/services.inc b/etc/inc/services.inc index b784108ebe..c91071c705 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -94,7 +94,7 @@ function services_dhcpd_configure() { exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcpleases.tgz 2>&1", $dhcprestore, $dhcpreturn); $dhcprestore = implode(" ", $dhcprestore); if($dhcpreturn <> 0) { - log_error(sprintf(gettext("DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s"), $dhcpreturn, $dhcprestore, "\n")); + log_error(sprintf(gettext('DHCP leases restore failed exited with %1$s, the error is: %2$s%3$s'), $dhcpreturn, $dhcprestore, "\n")); } } } diff --git a/etc/inc/smtp.inc b/etc/inc/smtp.inc index c33978dfbf..1f371f6154 100644 --- a/etc/inc/smtp.inc +++ b/etc/inc/smtp.inc @@ -236,7 +236,7 @@ class smtp_class && !strcmp(@gethostbyname($this->exclude_address),$ip)) return(sprintf(gettext("domain \"%s\" resolved to an address excluded to be valid"), $domain)); if($this->debug) - $this->OutputDebug(sprintf(gettext("Connecting to host address \"%1$s\" port %2$s..."), $ip, $port)); + $this->OutputDebug(sprintf(gettext('Connecting to host address "%1$s" port %2$s...'), $ip, $port)); if(($this->connection=($this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port,$errno,$error,$this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "").$ip,$port)))) return(""); $error=($this->timeout ? strval($error) : "??"); @@ -253,7 +253,7 @@ class smtp_class case "-7": return(gettext("-7 setvbuf() call failed")); } - return(sprintf(gettext("could not connect to the host \"%1$s\": %2$s"), $domain, $error)); + return(sprintf(gettext('could not connect to the host "%1$s": %2$s'), $domain, $error)); } Function SASLAuthenticate($mechanisms, $credentials, &$authenticated, &$mechanism) @@ -286,7 +286,7 @@ class smtp_class case SASL_NOMECH: if(strlen($this->authentication_mechanism)) { - $this->error=printf(gettext("authenticated mechanism %1$s may not be used: %2$s"), $this->authentication_mechanism, $sasl->error); + $this->error=printf(gettext('authenticated mechanism %1$s may not be used: %2$s'), $this->authentication_mechanism, $sasl->error); return(0); } break; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 59ea4eaf3f..69fb427dc2 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -362,7 +362,7 @@ function system_routing_configure($interface = "") { if(isset($route_arr['default'])) { $action = "change"; } - log_error(sprintf(gettext("ROUTING: %1$s default route to %2$s"), $action, $gatewayip)); + log_error(sprintf(gettext('ROUTING: %1$s default route to %2$s'), $action, $gatewayip)); mwexec("/sbin/route {$action} default " . escapeshellarg($gatewayip)); } } diff --git a/etc/inc/util.inc b/etc/inc/util.inc index a46fae3906..3517c325ee 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -783,7 +783,7 @@ function mwexec($command, $mute = false) { $mute = false; if(($retval <> 0) && ($mute === false)) { $output = implode(" ", $oarr); - log_error(sprintf(gettext("The command '%1$s' returned exit code '%2$d', the output was '%3$s' "), $command, $retval, $output)); + log_error(sprintf(gettext("The command '%1\$s' returned exit code '%2\$d', the output was '%3\$s' "), $command, $retval, $output)); } return $retval; } diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 58c6dc54ab..27e6763e69 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -153,7 +153,7 @@ function voucher_auth($voucher_received, $test = 0) { list($timestamp,$minutes) = explode(",", $line); // we have an already active voucher here. $remaining = intval((($timestamp + 60*$minutes) - time())/60); - $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s) active and good for %4$d Minutes"), $voucher, $roll, $nr, $remaining); + $test_result[] = sprintf(gettext('%1$s (%2$s/%3$s) active and good for %4$d Minutes'), $voucher, $roll, $nr, $remaining); $total_minutes += $remaining; } else { // voucher not used. Check if ticket Id is on the roll (not too high) @@ -164,18 +164,18 @@ function voucher_auth($voucher_received, $test = 0) { $pos = $nr >> 3; // divide by 8 -> octet $mask = 1 << ($nr % 8); if (ord($bitstring[$roll][$pos]) & $mask) { - $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s) already used and expired"), $voucher, $roll, $nr); + $test_result[] = sprintf(gettext('%1$s (%2$s/%3$s) already used and expired'), $voucher, $roll, $nr); $total_minutes = -1; // voucher expired $error++; } else { // mark bit for this voucher as used $bitstring[$roll][$pos] = chr(ord($bitstring[$roll][$pos]) | $mask); - $test_result[] = sprintf(gettext("%1$s (%2$s/%3$) good for %4$d Minutes"), $voucher, $roll, $nr, $minutes_per_roll[$roll]); + $test_result[] = sprintf(gettext('%1$s (%2$s/%3$) good for %4$d Minutes'), $voucher, $roll, $nr, $minutes_per_roll[$roll]); $total_minutes += $minutes_per_roll[$roll]; } } } else { - $test_result[] = sprintf(gettext("%1$s (%2$s/%3$s): not found on any registererd Roll"), $voucher, $roll, $nr); + $test_result[] = sprintf(gettext('%1$s (%2$s/%3$s): not found on any registererd Roll'), $voucher, $roll, $nr); } } else { // hmm, thats weird ... not what I expected @@ -339,7 +339,7 @@ function voucher_write_used_db($roll, $vdb) { fwrite($fd, $vdb . "\n"); fclose($fd); } else { - voucher_log(LOG_ERR, sprintf(gettext("cant write %1$s/voucher_used_%2$s.db"), $g['vardb_path'], $roll)); + voucher_log(LOG_ERR, sprintf(gettext('cant write %1$s/voucher_used_%2$s.db'), $g['vardb_path'], $roll)); } } @@ -418,7 +418,7 @@ function voucher_read_used_db($roll) { $vdb = trim(fgets($fd)); fclose($fd); } else { - voucher_log(LOG_ERR, sprintf(gettext("cant read %1$s/voucher_used_%2$s.db"), $g['vardb_path'], $roll)); + voucher_log(LOG_ERR, sprintf(gettext('cant read %1$s/voucher_used_%2$s.db'), $g['vardb_path'], $roll)); } } return base64_decode($vdb); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index c5802fc965..040184a381 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -839,7 +839,7 @@ EOD; if(is_ipaddr($gatewayip)) { /* FIXME: does adding route-to and reply-to on the in/outbound * rules fix this? smos@ 13-01-2009 */ - log_error(sprintf(gettext("IPSEC interface is not WAN but %1$s, adding static route for VPN endpoint %2$s via %3$s"), $parentinterface, $rgip, $gatewayip)); + log_error(sprintf(gettext('IPSEC interface is not WAN but %1$s, adding static route for VPN endpoint %2$s via %3$s'), $parentinterface, $rgip, $gatewayip)); mwexec("/sbin/route delete -host {$rgip}"); mwexec("/sbin/route add -host {$rgip} {$gatewayip}"); } @@ -1650,10 +1650,10 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { } if((!is_ipaddr($old_ep)) || (! is_ipaddr($ep))) { - log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%1$s' new EP '%2$s'"), $old_ep, $ep)); + log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%1\$s' new EP '%2\$s'"), $old_ep, $ep)); } if((! is_ipaddr($rgip)) || (! is_ipaddr($old_gw))) { - log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%1$s' new RG '%2$s'"), $old_gw, $rgip)); + log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%1\$s' new RG '%2\$s'"), $old_gw, $rgip)); } $spdconf = ""; @@ -1699,7 +1699,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { "{$phase2['protocol']}/tunnel/{$rgip}-" . "{$ep}/unique;\n"; - log_error(sprintf(gettext("Reloading IPsec tunnel '%1$s'. Previous IP '%2$s', current IP '%3$s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); + log_error(sprintf(gettext("Reloading IPsec tunnel '%1\$s'. Previous IP '%2\$s', current IP '%3\$s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); $now = time(); $spdfile = tempnam("{$g['tmp_path']}", "spd.conf.reload.{$now}."); diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index 79bbad01e8..1738370ab1 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -82,7 +82,7 @@ function startElement($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext("XML error: %1$s at line %2$d cannot occur more than once") . "\n", + die(sprintf(gettext('XML error: %1$s at line %2$d cannot occur more than once') . "\n", $name, xml_get_current_line_number($parser))); } @@ -179,7 +179,7 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext("XML error: %1$s at line %2$d") . "\n", + log_error(sprintf(gettext('XML error: %1$s at line %2$d') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); return -1; diff --git a/etc/inc/xmlparse_attr.inc b/etc/inc/xmlparse_attr.inc index 534ffb5d80..933caba696 100644 --- a/etc/inc/xmlparse_attr.inc +++ b/etc/inc/xmlparse_attr.inc @@ -75,7 +75,7 @@ function startElement_attr($parser, $name, $attrs) { } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ - die(sprintf(gettext("XML error: %1$s at line %2$d cannot occur more than once") . "\n", + die(sprintf(gettext('XML error: %1$s at line %2$d cannot occur more than once') . "\n", $name, xml_get_current_line_number($parser))); } else if (isset($writeattrs)) { @@ -194,7 +194,7 @@ function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isst while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { - log_error(sprintf(gettext("XML error: %1$s at line %2$d") . "\n", + log_error(sprintf(gettext('XML error: %1$s at line %2$d') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); if (isset($parsed_attributes)) { diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc index bd0f1bd95b..5a9f55978a 100644 --- a/etc/inc/xmlrpc_client.inc +++ b/etc/inc/xmlrpc_client.inc @@ -303,7 +303,7 @@ function XML_RPC_se($parser_resource, $name, $attrs) if (!in_array($XML_RPC_xh[$parser]['stack'][0], $XML_RPC_valid_parents[$name])) { $name = $GLOBALS['XML_RPC_func_ereg_replace']('[^a-zA-Z0-9._-]', '', $name); $XML_RPC_xh[$parser]['isf'] = 2; - $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext("xmlrpc element %1$s cannot be child of %2$s"), $name, $XML_RPC_xh[$parser]['stack'][0]); + $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext('xmlrpc element %1$s cannot be child of %2$s'), $name, $XML_RPC_xh[$parser]['stack'][0]); return; } } From 8e1fd4fea9d0d6f16f3119b36bd8323e9b76d5ef Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 1 Oct 2010 10:29:29 -0300 Subject: [PATCH 050/329] More gettext fixes --- etc/inc/PEAR.inc | 4 ++-- etc/inc/auth.inc | 4 ++-- etc/inc/config.console.inc | 2 +- etc/inc/meta.inc | 4 ++-- etc/inc/system.inc | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/inc/PEAR.inc b/etc/inc/PEAR.inc index ac5cc120c1..961a5489e1 100644 --- a/etc/inc/PEAR.inc +++ b/etc/inc/PEAR.inc @@ -158,7 +158,7 @@ class PEAR { $classname = strtolower(get_class($this)); if ($this->_debug) { - printf(gettext("PEAR constructor called, class=%s%s"), $classname, "\n"); + printf(gettext("PEAR constructor called, class=%s\n"), $classname); } if ($error_class !== null) { $this->_error_class = $error_class; @@ -195,7 +195,7 @@ class PEAR */ function _PEAR() { if ($this->_debug) { - printf(gettext("PEAR destructor called, class=%s%s"), strtolower(get_class($this)), "\n"); + printf(gettext("PEAR destructor called, class=%s\n"), strtolower(get_class($this))); } } diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index f48a9bc925..0d01e5022a 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -999,7 +999,7 @@ function radius_backed($username, $passwd, $authcfg){ $retvalue['auth_val'] = 1; $retvalue['error'] = $rauth->getError(); if ($debug) - printf(gettext("Radius start: %s%s"), $retvalue['error'], "
\n"); + printf(gettext("Radius start: %s
\n"), $retvalue['error']); } // XXX - billm - somewhere in here we need to handle securid challenge/response @@ -1010,7 +1010,7 @@ function radius_backed($username, $passwd, $authcfg){ $retvalue['auth_val'] = 1; $retvalue['error'] = $result->getMessage(); if ($debug) - printf(gettext("Radius send failed: %s%s"), $retvalue['error'], "
\n"); + printf(gettext("Radius send failed: %s
\n"), $retvalue['error']); } else if ($result === true) { $retvalue['auth_val'] = 2; if ($debug) diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 3c783b2551..934f0d1f9e 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -301,7 +301,7 @@ EOD; } } - printf(gettext("%sThe interfaces will be assigned as follows: %s%s"), "\n", "\n", "\n"); + echo "\n" . gettext("The interfaces will be assigned as follows:") . "\n\n"; if ($lanif != "") echo "LAN -> " . $lanif . "\n"; diff --git a/etc/inc/meta.inc b/etc/inc/meta.inc index cad79420c0..11295f532e 100644 --- a/etc/inc/meta.inc +++ b/etc/inc/meta.inc @@ -65,7 +65,7 @@ function list_phpfiles($path, & $found) { $dir = opendir($path); if (!$dir) { - printf(gettext("list_phpfiles: unable to examine path %s%s"), $path, "\n"); + printf(gettext("list_phpfiles: unable to examine path %s\n"), $path); return; } @@ -96,7 +96,7 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $fdata = @file_get_contents($fpath); if (!$fdata) { - printf(gettext("unable to read %s%s"), $fpath, "\n"); + printf(gettext("unable to read %s\n"), $fpath); continue; } diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 69fb427dc2..43184467dc 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1142,7 +1142,7 @@ function system_ntp_configure() { /* foreach through servers and write out to ntpd.conf */ foreach (explode(' ', $syscfg['timeservers']) as $ts) - fwrite($fd, sprintf(gettext("servers %s%s"), $ts, "\n")); + fwrite($fd, sprintf(gettext("servers %s\n"), $ts)); /* Setup listener(s) if the user has configured one */ if ($config['installedpackages']['openntpd']) { From 26f131b816e4925b94a7c74601238e5250c620c8 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 15 Oct 2010 09:14:56 -0300 Subject: [PATCH 051/329] Fix typo --- etc/inc/voucher.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 27e6763e69..1aaf91e3d8 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -170,7 +170,7 @@ function voucher_auth($voucher_received, $test = 0) { } else { // mark bit for this voucher as used $bitstring[$roll][$pos] = chr(ord($bitstring[$roll][$pos]) | $mask); - $test_result[] = sprintf(gettext('%1$s (%2$s/%3$) good for %4$d Minutes'), $voucher, $roll, $nr, $minutes_per_roll[$roll]); + $test_result[] = sprintf(gettext('%1$s (%2$s/%3$s) good for %4$d Minutes'), $voucher, $roll, $nr, $minutes_per_roll[$roll]); $total_minutes += $minutes_per_roll[$roll]; } } From 47593ac6ff761622a43e16cacb421acecede209d Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 22 Oct 2010 13:28:51 +0200 Subject: [PATCH 052/329] Allow for configuring a IPv6 address on the interfaces page. Add code to verify a ipv6 address Let is_ipaddr() return true on a v4 and v6 address. Change system gateways edit to fetch the global ipv6 interface ipv6 addresses and subnets The current ipv6 function might need folding into filter_var() when that catches some documented corner cases. The ajax widget on interfaces.php does not currently work for saving a IPv6 gateway address. Gateways edit screen does not complain when using it's own IP address as the gateway. FIXME. --- etc/inc/interfaces.inc | 79 ++++++++ etc/inc/util.inc | 47 ++++- usr/local/www/interfaces.php | 258 ++++++++++++++++++++++--- usr/local/www/system_gateways_edit.php | 6 +- 4 files changed, 365 insertions(+), 25 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 89915bdcdb..980371bd0b 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3124,6 +3124,29 @@ function find_interface_ip($interface, $flush = false) return $interface_ip_arr_cache[$interface]; } +/* + * find_interface_ipv6($interface): return the interface ip (first found) + */ +function find_interface_ipv6($interface, $flush = false) +{ + global $interface_ipv6_arr_cache; + global $interface_snv6_arr_cache; + + $interface = str_replace("\n", "", $interface); + + if (!does_interface_exist($interface)) + return; + + /* Setup IP cache */ + if (!isset($interface_ipv6_arr_cache[$interface]) or $flush) { + $ifinfo = pfSense_get_interface_addresses($interface); + $interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6']; + $interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6']; + } + + return $interface_ipv6_arr_cache[$interface]; +} + function find_interface_subnet($interface, $flush = false) { global $interface_sn_arr_cache; @@ -3142,6 +3165,24 @@ function find_interface_subnet($interface, $flush = false) return $interface_sn_arr_cache[$interface]; } +function find_interface_subnetv6($interface, $flush = false) +{ + global $interface_snv6_arr_cache; + global $interface_ipv6_arr_cache; + + $interface = str_replace("\n", "", $interface); + if (does_interface_exist($interface) == false) + return; + + if (!isset($interface_snv6_arr_cache[$interface]) or $flush) { + $ifinfo = pfSense_get_interface_addresses($interface); + $interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6']; + $interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6']; + } + + return $interface_snv6_arr_cache[$interface]; +} + function ip_in_interface_alias_subnet($interface, $ipalias) { global $config; @@ -3182,6 +3223,25 @@ function get_interface_ip($interface = "wan") return null; } +function get_interface_ipv6($interface = "wan") +{ + $realif = get_real_interface($interface); + if (!$realif) { + if (preg_match("/^carp/i", $interface)) + $realif = $interface; + else if (preg_match("/^vip/i", $interface)) + $realif = $interface; + else + return null; + } + + $curip = find_interface_ipv6($realif); + if ($curip && is_ipaddrv6($curip) && ($curip != "::")) + return $curip; + else + return null; +} + function get_interface_subnet($interface = "wan") { $realif = get_real_interface($interface); @@ -3201,6 +3261,25 @@ function get_interface_subnet($interface = "wan") return null; } +function get_interface_subnetv6($interface = "wan") +{ + $realif = get_real_interface($interface); + if (!$realif) { + if (preg_match("/^carp/i", $interface)) + $realif = $interface; + else if (preg_match("/^vip/i", $interface)) + $realif = $interface; + else + return null; + } + + $cursn = find_interface_subnetv6($realif); + if (!empty($cursn)) + return $cursn; + + return null; +} + /* return outside interfaces with a gateway */ function get_interfaces_with_gateway() { global $config; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 90a5f9f7e9..10fa6a5926 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -382,8 +382,53 @@ function is_numericint($arg) { return (preg_match("/[^0-9]/", $arg) ? false : true); } -/* returns true if $ipaddr is a valid dotted IPv4 address */ + +/* returns true if $ipaddr is a valid dotted IPv4 address or a IPv6 */ function is_ipaddr($ipaddr) { + if(is_ipaddrv4($ipaddr)) { + return true; + } + if(is_ipaddrv6($ipaddr)) { + return true; + } + return false; +} + +function is_ipaddrv6($ipaddr) { + /* Not using filter_var here. It misses some test cases */ + /* http://crisp.tweakblogs.net/blog/2031 */ + // fast exit for localhost + if (strlen($ipaddr) < 3) + return $ipaddr == '::'; + + // Check if part is in IPv4 format + if (strpos($ipaddr, '.')) { + $lastcolon = strrpos($ipaddr, ':'); + if (!($lastcolon && validateIPv4(substr(ipaddr, $lastcolon + 1)))) + return false; + + // replace IPv4 part with dummy + $ipaddr = substr($ipaddr, 0, $lastcolon) . ':0:0'; + } + + // check uncompressed + if (strpos($ipaddr, '::') === false) { + return preg_match('/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i', $ipaddr); + } + + // check colon-count for compressed format + if (substr_count($ipaddr, ':') < 8) { + return preg_match('/^(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?$/i', $ipaddr); + } + return false; +} + +function validateIPv4($ipaddr) { + return $ipaddr == long2ip(ip2long($ipaddr)); +} + +/* returns true if $ipaddr is a valid dotted IPv4 address */ +function is_ipaddrv4($ipaddr) { if (!is_string($ipaddr)) return false; diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index f08ca3ca3b..d2e3269f31 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -172,7 +172,6 @@ if($if == "wan" && !$wancfg['descr']) { $wancfg['descr'] = "LAN"; } $pconfig['descr'] = remove_bad_chars($wancfg['descr']); - $pconfig['enable'] = isset($wancfg['enable']); if (is_array($config['aliases']['alias'])) { @@ -198,16 +197,39 @@ switch($wancfg['ipaddr']) { break; default: if(is_ipaddr($wancfg['ipaddr'])) { - $pconfig['type'] = "static"; + $pconfig['type'] = "staticv4"; $pconfig['ipaddr'] = $wancfg['ipaddr']; $pconfig['subnet'] = $wancfg['subnet']; $pconfig['gateway'] = $wancfg['gateway']; + if((is_ipaddr($wancfg['ipaddrv6'])) && (is_ipaddr($wancfg['ipaddr']))) { + $pconfig['type'] = "staticv4v6"; + } } else { $pconfig['type'] = "none"; } break; } +switch($wancfg['ipaddrv6']) { + case "dhcpv6": + $pconfig['type'] = "dhcpv6"; + break; + default: + /* if we have dual stack we need a combined type */ + if(is_ipaddr($wancfg['ipaddrv6'])) { + $pconfig['type'] = "staticv6"; + $pconfig['ipaddrv6'] = $wancfg['ipaddrv6']; + $pconfig['subnetv6'] = $wancfg['subnetv6']; + $pconfig['gatewayv6'] = $wancfg['gatewayv6']; + if((is_ipaddr($wancfg['ipaddrv6'])) && (is_ipaddr($wancfg['ipaddr']))) { + $pconfig['type'] = "staticv4v6"; + } + } + break; +} + +// print_r($pconfig); + $pconfig['blockpriv'] = isset($wancfg['blockpriv']); $pconfig['blockbogons'] = isset($wancfg['blockbogons']); $pconfig['spoofmac'] = $wancfg['spoofmac']; @@ -370,9 +392,19 @@ if ($_POST) { $input_errors[] = gettext("The DHCP Server is active on this interface and it can be used only with a static IP configuration. Please disable the DHCP Server service on this interface first, then change the interface configuration."); switch($_POST['type']) { - case "static": + case "staticv4": $reqdfields = explode(" ", "ipaddr subnet gateway"); - $reqdfieldsn = array(gettext("IP address"),gettext("Subnet bit count"),gettext("Gateway")); + $reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway")); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; + case "staticv6": + $reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6"); + $reqdfieldsn = array(gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway")); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + break; + case "staticv4v6": + $reqdfields = explode(" ", "ipaddr subnet gateway ipaddrv6 subnetv6 gatewayv6"); + $reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway"),gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); break; case "none": @@ -386,6 +418,10 @@ if ($_POST) { if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) $input_errors[] = gettext("You have to reassign the interface to be able to configure as {$_POST['type']}."); break; + case "dhcpv6": + if (in_array($wancfg['ipaddrv6'], array("ppp", "pppoe", "pptp", "l2tp"))) + $input_errors[] = gettext("You have to reassign the interface to be able to configure as {$_POST['type']}."); + break; case "ppp": $reqdfields = explode(" ", "port phone"); $reqdfieldsn = array(gettext("Modem Port"),gettext("Phone Number")); @@ -416,20 +452,29 @@ if ($_POST) { /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) - $input_errors[] = gettext("A valid IP address must be specified."); + $input_errors[] = gettext("A valid IPv4 address must be specified."); + if (($_POST['ipaddrv6'] && !is_ipaddr($_POST['ipaddrv6']))) + $input_errors[] = gettext("A valid IPv6 address must be specified."); if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) $input_errors[] = gettext("A valid subnet bit count must be specified."); + if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6']))) + $input_errors[] = gettext("A valid subnet bit count must be specified."); if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) $input_errors[] = gettext("A valid alias IP address must be specified."); if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) $input_errors[] = gettext("A valid alias subnet bit count must be specified."); - if ($_POST['gateway'] != "none") { + if (($_POST['gateway'] != "none") || ($_POST['gatewayv6'] != "none")) { $match = false; foreach($a_gateways as $gateway) { if(in_array($_POST['gateway'], $gateway)) { $match = true; } } + foreach($a_gateways as $gateway) { + if(in_array($_POST['gatewayv6'], $gateway)) { + $match = true; + } + } if(!$match) { $input_errors[] = gettext("A valid gateway must be specified."); } @@ -512,8 +557,12 @@ if ($_POST) { $ppp = array(); if ($wancfg['ipaddr'] != "ppp") unset($wancfg['ipaddr']); + if ($wancfg['ipaddrv6'] != "ppp") + unset($wancfg['ipaddrv6']); unset($wancfg['subnet']); unset($wancfg['gateway']); + unset($wancfg['subnetv6']); + unset($wancfg['gatewayv6']); unset($wancfg['dhcphostname']); unset($wancfg['pppoe_username']); unset($wancfg['pppoe_password']); @@ -525,7 +574,6 @@ if ($_POST) { if (isset($wancfg['pppoe']['pppoe-reset-type'])) unset($wancfg['pppoe']['pppoe-reset-type']); unset($wancfg['local']); - unset($wancfg['subnet']); unset($wancfg['remote']); unset($a_ppps[$pppid]['apn']); unset($a_ppps[$pppid]['phone']); @@ -551,7 +599,7 @@ if ($_POST) { } } if($skip == false) { - $gateway_item['gateway'] = gettext("dynamic"); + $gateway_item['gateway'] = "dynamic"; $gateway_item['descr'] = gettext("Interface") . $if . gettext("dynamic gateway"); $gateway_item['name'] = "GW_" . strtoupper($if); $gateway_item['interface'] = "{$if}"; @@ -561,13 +609,32 @@ if ($_POST) { } switch($_POST['type']) { - case "static": + case "staticv4": $wancfg['ipaddr'] = $_POST['ipaddr']; $wancfg['subnet'] = $_POST['subnet']; if ($_POST['gateway'] != "none") { $wancfg['gateway'] = $_POST['gateway']; } break; + case "staticv6": + $wancfg['ipaddrv6'] = $_POST['ipaddrv6']; + $wancfg['subnetv6'] = $_POST['subnetv6']; + if ($_POST['gatewayv6'] != "none") { + $wancfg['gatewayv6'] = $_POST['gatewayv6']; + } + break; + case "staticv4v6": + $wancfg['ipaddr'] = $_POST['ipaddr']; + $wancfg['subnet'] = $_POST['subnet']; + if ($_POST['gateway'] != "none") { + $wancfg['gateway'] = $_POST['gateway']; + } + $wancfg['ipaddrv6'] = $_POST['ipaddrv6']; + $wancfg['subnetv6'] = $_POST['subnetv6']; + if ($_POST['gatewayv6'] != "none") { + $wancfg['gatewayv6'] = $_POST['gatewayv6']; + } + break; case "dhcp": $wancfg['ipaddr'] = "dhcp"; $wancfg['dhcphostname'] = $_POST['dhcphostname']; @@ -577,6 +644,15 @@ if ($_POST) { $a_gateways[] = $gateway_item; } break; + case "dhcpv6": + $wancfg['ipaddrv6'] = "dhcpv6"; + $wancfg['dhcphostname'] = $_POST['dhcphostname']; + $wancfg['alias-address'] = $_POST['alias-address']; + $wancfg['alias-subnet'] = $_POST['alias-subnet']; + if($gateway_item) { + $a_gateways[] = $gateway_item; + } + break; case "carpdev-dhcp": $wancfg['ipaddr'] = "carpdev-dhcp"; $wancfg['dhcphostname'] = $_POST['dhcphostname']; @@ -865,7 +941,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"), "staticv4" => gettext("Static IPv4"), "staticv6" => gettext("Static IPv6"), "staticv4v6" => gettext("Static IPv4 + IPv6"), "dhcp" => gettext("DHCP"), "dhcpv6" => gettext("DHCPv6"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP") /* , "carpdev-dhcp" => "CarpDev"*/); ?> @@ -878,28 +954,42 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" function updateType(t) { switch(t) { case "none": { - $('static','dhcp','pppoe','pptp', 'ppp').invoke('hide'); + $('staticv4','staticv6','dhcp','dhcpv6','pppoe','pptp', 'ppp').invoke('hide'); break; } - case "static": { - $('none','dhcp','pppoe','pptp', 'ppp').invoke('hide'); + case "staticv4": { + $('none','staticv6','dhcp','dhcpv6','pppoe','pptp', 'ppp').invoke('hide'); + break; + } + case "staticv6": { + $('none','staticv4','dhcp','dhcpv6','pppoe','pptp', 'ppp').invoke('hide'); + break; + } + case "staticv4v6": { + $('none','dhcp','dhcpv6','pppoe','pptp', 'ppp').invoke('hide'); + $('staticv4').show(); + $('staticv6').show(); break; } case "dhcp": { - $('none','static','pppoe','pptp', 'ppp').invoke('hide'); + $('none','staticv4','staticv6','dhcpv6','pppoe','pptp', 'ppp').invoke('hide'); + break; + } + case "dhcpv6": { + $('none','staticv4','staticv6','dhcp','pppoe','pptp', 'ppp').invoke('hide'); break; } case "ppp": { - $('none','static','dhcp','pptp', 'pppoe').invoke('hide'); + $('none','staticv4','staticv6','dhcp','dhcpv6','pptp', 'pppoe').invoke('hide'); country_list(); break; } case "pppoe": { - $('none','static','dhcp','pptp', 'ppp').invoke('hide'); + $('none','staticv4','staticv6','dhcp','dhcpv6','pptp', 'ppp').invoke('hide'); break; } case "pptp": { - $('none','static','dhcp','pppoe', 'ppp').invoke('hide'); + $('none','staticv4','staticv6','dhcp','dhcpv6','pppoe', 'ppp').invoke('hide'); break; } } @@ -1118,14 +1208,14 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" - + - + - + - + @@ -1221,11 +1311,114 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
/ @@ -1150,7 +1240,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" 0) { foreach ($a_gateways as $gateway) { - if($gateway['interface'] == $if) { + if(($gateway['interface'] == $if) && (is_ipaddrv4($gateway['gateway']))) { ?> ">
+ + + + + + + + + + + + + + +
+ + / + +
+ +
+
+ +
+
+
+
+
+ +
+ + - + @@ -1259,6 +1452,25 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
+ + + + + + + + + + +
+ +
+ +
+ + diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 4848bed5e5..8db28530f9 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -113,7 +113,11 @@ if ($_POST) { if (is_ipaddr($config['interfaces'][$_POST['interface']]['ipaddr']) && (empty($_POST['gateway']) || $_POST['gateway'] == "dynamic")) $input_errors[] = gettext("Dynamic gateway values cannot be specified for interfaces with a static ip configuration."); } - $parent_ip = get_interface_ip($_POST['interface']); + if(is_ipaddrv6($_POST['gateway'])) { + $parent_ip = get_interface_ipv6($_POST['interface']); + } else { + $parent_ip = get_interface_ip($_POST['interface']); + } if (is_ipaddr($parent_ip)) { $parent_sn = get_interface_subnet($_POST['interface']); if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) { From 5a5413bb5227e084703515007cc28fd746183c9b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 22 Oct 2010 16:01:30 +0200 Subject: [PATCH 053/329] Add the default ipv4 route and the default ipv6 route, check both routing tables before adding or changing. set the ipv6 IP address via a mwexec() until the pfsense module is adapted. FIXME. Add filter rules for ipv6 to let traffic out of the firewall. FilterIflist not cooperating yet. --- etc/inc/filter.inc | 21 ++++++++++--- etc/inc/gwlb.inc | 71 +++++++++++++++++++++++++++++------------- etc/inc/interfaces.inc | 14 +++++++++ etc/inc/system.inc | 67 +++++++++++++++++++++++++++++++++++---- 4 files changed, 141 insertions(+), 32 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 01e37ce36f..26f8c15aa9 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -723,17 +723,21 @@ function filter_generate_optcfg_array() { if (!does_interface_exist($oic['if'])) continue; $oic['ip'] = get_interface_ip($if); + $oic['ipv6'] = get_interface_ipv6($if); if(!is_ipaddr($oc['ipaddr']) && !empty($oc['ipaddr'])) $oic['type'] = $oc['ipaddr']; $oic['sn'] = get_interface_subnet($if); + $oic['snv6'] = get_interface_subnetv6($if); $oic['mtu'] = empty($oc['mtu']) ? 1500 : $oc['mtu']; $oic['mss'] = empty($oc['mss']) ? '' : $oc['mss']; $oic['descr'] = $ifdetail; $oic['sa'] = gen_subnet($oic['ip'], $oic['sn']); + $oic['sav6'] = gen_subnet($oic['ipv6'], $oic['snv6']); $oic['nonat'] = $oc['nonat']; $oic['alias-address'] = $oc['alias-address']; $oic['alias-subnet'] = $oc['alias-subnet']; $oic['gateway'] = $oc['gateway']; + $oic['gatewayv6'] = $oc['gatewayv6']; $oic['spoofcheck'] = "yes"; $oic['bridge'] = link_interface_to_bridge($if); $FilterIflist[$if] = $oic; @@ -1981,8 +1985,8 @@ EOD; if(!isset($config['system']['ipv6allow'])) { $ipfrules .= "# Block all IPv6\n"; - $ipfrules .= "block in quick inet6 all\n"; - $ipfrules .= "block out quick inet6 all\n"; + $ipfrules .= "block in inet6 all label \"Default Deny ipv6 rule\"\n"; + $ipfrules .= "block out inet6 all label \"Default Deny ipv6 rule\"\n"; } $ipfrules .= << $ifcfg) { - if(isset($ifcfg['virtual'])) - continue; + if(isset($ifcfg['virtual'])) + continue; + $gw = get_interface_gateway($ifdescr); + echo "gw $gw, ip {$ifcfg['ip']} \n"; if (is_ipaddr($gw) && is_ipaddr($ifcfg['ip'])) $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$ifcfg['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; - } + $gwv6 = get_interface_gateway_v6($ifdescr); + echo "gwv6 $gwv6, ip {$ifcfg['ipv6']}\n"; + if (is_ipaddrv6($gwv6) && is_ipaddrv6($ifcfg['ipv6'])) + $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gwv6} ) from {$ifcfg['ipv6']} to !{$ifcfg['sav6']}/{$ifcfg['snv6']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; + } + /* add ipsec interfaces */ if(isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable'])) diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 540a0a742c..d8bd05a4bf 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -501,35 +501,64 @@ function lookup_gateway_interface_by_name($name) { } function get_interface_gateway($interface, &$dynamic = false) { - global $config, $g; + global $config, $g; - $gw = NULL; + $gw = NULL; - $gwcfg = $config['interfaces'][$interface]; - if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if ($gateway['name'] == $gwcfg['gateway']) { - $gw = $gateway['gateway']; + $gwcfg = $config['interfaces'][$interface]; + if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if(($gateway['name'] == $gwcfg['gateway']) && (is_ipaddrv4($gateway['gateway']))) { + $gw = $gateway['gateway']; break; } - } + } } - // for dynamic interfaces we handle them through the $interface_router file. - if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) { - $realif = get_real_interface($interface); - if (file_exists("{$g['tmp_path']}/{$realif}_router")) { - $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_router"), " \n"); - $dynamic = true; - } - if (file_exists("{$g['tmp_path']}/{$realif}_defaultgw")) - $dynamic = "default"; + // for dynamic interfaces we handle them through the $interface_router file. + if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) { + $realif = get_real_interface($interface); + if (file_exists("{$g['tmp_path']}/{$realif}_router")) { + $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_router"), " \n"); + $dynamic = true; + } + if (file_exists("{$g['tmp_path']}/{$realif}_defaultgw")) + $dynamic = "default"; - - } + } - /* return gateway */ - return ($gw); + /* return gateway */ + return ($gw); +} + +function get_interface_gateway_v6($interface, &$dynamic = false) { + global $config, $g; + + $gw = NULL; + + $gwcfg = $config['interfaces'][$interface]; + if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if(($gateway['name'] == $gwcfg['gateway']) && (is_ipaddrv6($gateway['gateway']))) { + $gw = $gateway['gateway']; + break; + } + } + } + + // for dynamic interfaces we handle them through the $interface_router file. + if (!is_ipaddrv6($gw) && !is_ipaddr($gwcfg['ipaddrv6'])) { + $realif = get_real_interface($interface); + if (file_exists("{$g['tmp_path']}/{$realif}_routerv6")) { + $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_routerv6"), " \n"); + $dynamic = true; + } + if (file_exists("{$g['tmp_path']}/{$realif}_defaultgwv6")) + $dynamic = "default"; + + } + /* return gateway */ + return ($gw); } ?> diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 980371bd0b..aacacfd157 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2467,6 +2467,8 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven get_interface_arr(true); unset($interface_ip_arr_cache[$realif]); unset($interface_sn_arr_cache[$realif]); + unset($interface_ipv6_arr_cache[$realif]); + unset($interface_snv6_arr_cache[$realif]); switch ($wancfg['ipaddr']) { case 'carpdev-dhcp': @@ -2502,6 +2504,18 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven break; } + switch ($wancfg['ipaddrv6']) { + case 'dhcpv6': + interface_dhcpv6_configure($interface); + break; + default: + if ($wancfg['ipaddrv6'] <> "" && $wancfg['subnetv6'] <> "") { + pfSense_interface_setaddress($realif, "{$wancfg['ipaddrv6']}/{$wancfg['subnetv6']}"); + mwexec("/sbin/ifconfig {$realif} inet6 {$wancfg['ipaddrv6']} prefixlen {$wancfg['subnetv6']} "); + } + break; + } + if(does_interface_exist($wancfg['if'])) interfaces_bring_up($wancfg['if']); diff --git a/etc/inc/system.inc b/etc/inc/system.inc index ba9ad05cff..022e1be683 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -307,11 +307,14 @@ function system_routing_configure($interface = "") { $gatewayip = ""; $interfacegw = ""; $foundgw = false; + $gatewayipv6 = ""; + $interfacegwv6 = ""; + $foundgwv6 = false; /* tack on all the hard defined gateways as well */ if (is_array($config['gateways']['gateway_item'])) { mwexec("/bin/rm {$g['tmp_path']}/*_defaultgw", true); foreach ($config['gateways']['gateway_item'] as $gateway) { - if (isset($gateway['defaultgw'])) { + if (isset($gateway['defaultgw']) && (is_ipaddrv4($gateway['gateway']))) { if ($gateway['gateway'] == "dynamic") $gateway['gateway'] = get_interface_gateway($gateway['interface']); $gatewayip = $gateway['gateway']; @@ -325,6 +328,21 @@ function system_routing_configure($interface = "") { break; } } + foreach ($config['gateways']['gateway_item'] as $gateway) { + if (isset($gateway['defaultgw']) && (is_ipaddrv6($gateway['gateway']))) { + if ($gateway['gateway'] == "dynamic") + $gateway['gateway'] = get_interface_gateway_v6($gateway['interface']); + $gatewayipv6 = $gateway['gateway']; + $interfacegwv6 = $gateway['interface']; + if (!empty($interfacegwv6)) { + $defaultif = get_real_interface($gateway['interface']); + if ($defaultif) + @file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgwv6", $gatewayipv6); + } + $foundgwv6 = true; + break; + } + } } if ($foundgw == false) { $defaultif = get_real_interface("wan"); @@ -332,6 +350,12 @@ function system_routing_configure($interface = "") { $gatewayip = get_interface_gateway("wan"); @touch("{$g['tmp_path']}/{$defaultif}_defaultgw"); } + if ($foundgwv6 == false) { + $defaultif = get_real_interface("wan"); + $interfacegw = "wan"; + $gatewayip = get_interface_gateway_v6("wan"); + @touch("{$g['tmp_path']}/{$defaultif}_defaultgwv6"); + } $dont_add_route = false; /* if OLSRD is enabled, allow WAN to house DHCP. */ if($config['installedpackages']['olsrd']) { @@ -342,7 +366,7 @@ function system_routing_configure($interface = "") { } } } - /* Create a array from the existing route table */ + /* Create a array from the existing inet route table */ exec("/usr/bin/netstat -rnf inet", $route_str); array_shift($route_str); array_shift($route_str); @@ -357,16 +381,42 @@ function system_routing_configure($interface = "") { if ($dont_add_route == false ) { if (!empty($interface) && $interface != $interfacegw) ; - else if (($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) { + else if (($interfacegw <> "bgpd") && (is_ipaddrv4($gatewayip))) { $action = "add"; if(isset($route_arr['default'])) { $action = "change"; } - log_error("ROUTING: $action default route to $gatewayip"); + log_error("ROUTING: $action IPv4 default route to $gatewayip"); mwexec("/sbin/route {$action} default " . escapeshellarg($gatewayip)); } } + /* Create a array from the existing inet6 route table */ + exec("/usr/bin/netstat -rnf inet6", $routev6_str); + array_shift($routev6_str); + array_shift($routev6_str); + array_shift($routev6_str); + array_shift($routev6_str); + array_shift($routev6_str); + $routev6_arr = array(); + foreach($routev6_str as $routeline) { + $items = preg_split("/[ ]+/i", $routeline); + $route_arr[$items[0]] = array($items[0], $items[1], $items[5]); + } + + if ($dont_add_route == false ) { + if (!empty($interface) && $interface != $interfacegw) + ; + else if (($interfacegwv6 <> "bgpd") && (is_ipaddrv6($gatewayipv6))) { + $action = "add"; + if(isset($routev6_arr['default'])) { + $action = "change"; + } + log_error("ROUTING: $action IPv6 default route to $gatewayipv6"); + mwexec("/sbin/route {$action} -inet6 default " . escapeshellarg($gatewayipv6)); + } + } + if (is_array($config['staticroutes']['route'])) { $gateways_arr = return_gateways_array(); @@ -385,11 +435,16 @@ function system_routing_configure($interface = "") { if (isset($route_arr[$rtent['network']])) $action = "change"; + if(is_ipaddrv6($gatewayip)) { + $inet6 = "-inet6"; + } else { + $inet6 = ""; + } if (is_ipaddr($gatewayip)) { - mwexec("/sbin/route {$action} " . escapeshellarg($rtent['network']) . + mwexec("/sbin/route {$action} {$inet6} " . escapeshellarg($rtent['network']) . " " . escapeshellarg($gatewayip)); } else if (!empty($interfacegw)) { - mwexec("/sbin/route {$action} " . escapeshellarg($rtent['network']) . + mwexec("/sbin/route {$action} {$inet6} " . escapeshellarg($rtent['network']) . " -iface " . escapeshellarg($interfacegw)); } } From 86551a0623d80616bc7c6cc3a5ca6e122274b8c6 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:19:11 +0200 Subject: [PATCH 054/329] Do a gethostbyname() on the host address to get a IP address, then perform ping or ping6 for correct type. --- usr/local/www/diag_ping.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 0bbc7d59ab..3715cf8c82 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -61,7 +61,7 @@ if ($_POST || $_REQUEST['host']) { if (!$input_errors) { $do_ping = true; - $host = $_REQUEST['host']; + $host = gethostbyname($_REQUEST['host']); $interface = $_REQUEST['interface']; $count = $_POST['count']; if (preg_match('/[^0-9]/', $count) ) @@ -125,11 +125,21 @@ include("head.inc"); ?> echo ""; echo "" . gettext("Ping output") . ":
"; echo('
');
-					$ifaddr = get_interface_ip($interface);
-					if ($ifaddr)
-						system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
-					else
-						system("/sbin/ping -c$count " . escapeshellarg($host));
+					if(is_ipaddrv4($host)) {
+						$ifaddr = get_interface_ip($interface);
+						if ($ifaddr)
+							system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
+						else
+							system("/sbin/ping -c$count " . escapeshellarg($host));
+					}
+					if(is_ipaddrv6($host)) {
+						$ifaddr = get_interface_ipv6($interface);
+						if ($ifaddr)
+							system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
+						else
+							system("/sbin/ping6 -c$count " . escapeshellarg($host));
+					}
+					
 					echo('
'); } ?> From 8bea96391f790fa48156d2e26c6e75455e50138b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:28:14 +0200 Subject: [PATCH 055/329] So gethostbyname() does not work for ipv6, instead run both ping and ping6. That works too. --- usr/local/www/diag_ping.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 3715cf8c82..155f0f7466 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -29,7 +29,7 @@ */ /* - pfSense_BUILDER_BINARIES: /sbin/ping + pfSense_BUILDER_BINARIES: /sbin/ping /sbin/ping6 pfSense_MODULE: routing */ @@ -61,7 +61,7 @@ if ($_POST || $_REQUEST['host']) { if (!$input_errors) { $do_ping = true; - $host = gethostbyname($_REQUEST['host']); + $host = $_REQUEST['host']; $interface = $_REQUEST['interface']; $count = $_POST['count']; if (preg_match('/[^0-9]/', $count) ) @@ -125,20 +125,16 @@ include("head.inc"); ?> echo ""; echo "" . gettext("Ping output") . ":
"; echo('
');
-					if(is_ipaddrv4($host)) {
-						$ifaddr = get_interface_ip($interface);
-						if ($ifaddr)
-							system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
-						else
-							system("/sbin/ping -c$count " . escapeshellarg($host));
-					}
-					if(is_ipaddrv6($host)) {
-						$ifaddr = get_interface_ipv6($interface);
-						if ($ifaddr)
-							system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
-						else
-							system("/sbin/ping6 -c$count " . escapeshellarg($host));
-					}
+					$ifaddr = get_interface_ip($interface);
+					if ($ifaddr)
+						system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
+					else
+						system("/sbin/ping -c$count " . escapeshellarg($host));
+					$ifaddr = get_interface_ipv6($interface);
+					if ($ifaddr)
+						system("/sbin/ping6 -S$ifaddr -c$count " . escapeshellarg($host));
+					else
+						system("/sbin/ping6 -c$count " . escapeshellarg($host));
 					
 					echo('
'); } From 66e0ff494c2892058c8903dde7ba43d810c8aa41 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:32:23 +0200 Subject: [PATCH 056/329] Run both traceroute and traceroute6 for ipv6 functionaility --- usr/local/www/diag_traceroute.php | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/local/www/diag_traceroute.php b/usr/local/www/diag_traceroute.php index 6c9df57d02..5a94f4c57f 100755 --- a/usr/local/www/diag_traceroute.php +++ b/usr/local/www/diag_traceroute.php @@ -125,6 +125,7 @@ if (!isset($do_traceroute)) { else $useicmp = ""; system("/usr/sbin/traceroute $useicmp -w 2 -m " . escapeshellarg($ttl) . " " . escapeshellarg($host)); + system("/usr/sbin/traceroute6 $useicmp -w 2 -m " . escapeshellarg($ttl) . " " . escapeshellarg($host)); echo(''); } ?> From 640b3a9ac1d40dd9a0b5354c848045f5cb301fd3 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:49:19 +0200 Subject: [PATCH 057/329] remove some debugging from filter inc, show correct ipv6 gateway from function --- etc/inc/filter.inc | 2 -- etc/inc/gwlb.inc | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 26f8c15aa9..4b98a59e97 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2139,12 +2139,10 @@ EOD; continue; $gw = get_interface_gateway($ifdescr); - echo "gw $gw, ip {$ifcfg['ip']} \n"; if (is_ipaddr($gw) && is_ipaddr($ifcfg['ip'])) $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gw} ) from {$ifcfg['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; $gwv6 = get_interface_gateway_v6($ifdescr); - echo "gwv6 $gwv6, ip {$ifcfg['ipv6']}\n"; if (is_ipaddrv6($gwv6) && is_ipaddrv6($ifcfg['ipv6'])) $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gwv6} ) from {$ifcfg['ipv6']} to !{$ifcfg['sav6']}/{$ifcfg['snv6']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; } diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index d8bd05a4bf..3d1ec939f1 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -147,7 +147,12 @@ EOD; } /* Interface ip is needed since apinger will bind a socket to it. */ - $gwifip = find_interface_ip($gateway['interface'], true); + if (is_ipaddrv4($gateway['gateway'])) { + $gwifip = find_interface_ip($gateway['interface'], true); + } + if (is_ipaddrv6($gateway['gateway'])) { + $gwifip = find_interface_ipv6($gateway['interface'], true); + } if (!is_ipaddr($gwifip)) continue; //Skip this target @@ -535,11 +540,10 @@ function get_interface_gateway_v6($interface, &$dynamic = false) { global $config, $g; $gw = NULL; - $gwcfg = $config['interfaces'][$interface]; if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) { foreach($config['gateways']['gateway_item'] as $gateway) { - if(($gateway['name'] == $gwcfg['gateway']) && (is_ipaddrv6($gateway['gateway']))) { + if(($gateway['name'] == $gwcfg['gatewayv6']) && (is_ipaddrv6($gateway['gateway']))) { $gw = $gateway['gateway']; break; } From 6538e6605a7f8b91fb3d62fc578827750ea7bb68 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 12:54:23 +0200 Subject: [PATCH 058/329] fix filter rule error --- etc/inc/filter.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 4b98a59e97..e39bf06160 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -732,7 +732,7 @@ function filter_generate_optcfg_array() { $oic['mss'] = empty($oc['mss']) ? '' : $oc['mss']; $oic['descr'] = $ifdetail; $oic['sa'] = gen_subnet($oic['ip'], $oic['sn']); - $oic['sav6'] = gen_subnet($oic['ipv6'], $oic['snv6']); + $oic['sav6'] = "{$oic['ipv6']}"; $oic['nonat'] = $oc['nonat']; $oic['alias-address'] = $oc['alias-address']; $oic['alias-subnet'] = $oc['alias-subnet']; From bbcc0f9c816a707969e2dfea0d62c28063f037a6 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 21:26:02 +0200 Subject: [PATCH 059/329] splay the IPv6 information on status interfaces. --- usr/local/www/status_interfaces.php | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php index d6fdcede2f..047a053afd 100755 --- a/usr/local/www/status_interfaces.php +++ b/usr/local/www/status_interfaces.php @@ -167,7 +167,7 @@ include("head.inc");
- + - + - + + + + + + + + + + + + + + + + + From 2bbb79cbe1cef645d0bb95ca36987f68fe8b4703 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 23 Oct 2010 21:27:17 +0200 Subject: [PATCH 060/329] tack on the ipv6 information via the old fashioned way until the pfsense module is up to speed --- etc/inc/pfsense-utils.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index ba774b76d4..4c9e2b565a 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1124,6 +1124,8 @@ function get_interface_info($ifdescr) { $ifinfo['macaddr'] = $ifinfotmp['macaddr']; $ifinfo['ipaddr'] = $ifinfotmp['ipaddr']; $ifinfo['subnet'] = $ifinfotmp['subnet']; + $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr);; + $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr);; if (isset($ifinfotmp['link0'])) $link0 = "down"; $ifinfotmp = pfSense_get_interface_stats($chkif); @@ -1276,8 +1278,10 @@ function get_interface_info($ifdescr) { } /* lookup the gateway */ - if (interface_has_gateway($ifdescr)) + if (interface_has_gateway($ifdescr)) { $ifinfo['gateway'] = get_interface_gateway($ifdescr); + $ifinfo['gatewayv6'] = get_interface_gateway_v6($ifdescr); + } } $bridge = ""; From a268a57678ab9d41c2e83a805d0970080d82358e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 24 Oct 2010 17:34:10 +0200 Subject: [PATCH 061/329] Add a rule so that the bare icmp ipv6 traffic can get out, otherwise the box can not communicate properly on ipv6 --- etc/inc/filter.inc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index e39bf06160..2c638d448c 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1975,10 +1975,12 @@ function filter_rules_generate() { #--------------------------------------------------------------------------- block in $log all label "Default deny rule" block out $log all label "Default deny rule" +block in $log inet6 all label "Default deny rule IPv6" +block out $log inet6 all label "Default deny rule IPv6" # We use the mighty pf, we cannot be fooled. -block quick proto { tcp, udp } from any port = 0 to any -block quick proto { tcp, udp } from any to any port = 0 +#block quick inet proto { tcp, udp } from any port = 0 to any +#block quick inet proto { tcp, udp } from any to any port = 0 EOD; @@ -2124,6 +2126,8 @@ anchor "spoofing" anchor "loopback" pass in on \$loopback all label "pass loopback" pass out on \$loopback all label "pass loopback" +pass in on \$loopback inet6 all label "pass loopback" +pass out on \$loopback inet6 all label "pass loopback" anchor "firewallout" @@ -2131,7 +2135,13 @@ EOD; $ipfrules .= << $ifcfg) { @@ -2144,7 +2154,7 @@ EOD; $gwv6 = get_interface_gateway_v6($ifdescr); if (is_ipaddrv6($gwv6) && is_ipaddrv6($ifcfg['ipv6'])) - $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gwv6} ) from {$ifcfg['ipv6']} to !{$ifcfg['sav6']}/{$ifcfg['snv6']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; + $ipfrules .= "pass out route-to ( {$ifcfg['if']} {$gwv6} ) inet6 from {$ifcfg['ipv6']} to !{$ifcfg['sav6']}/{$ifcfg['snv6']} keep state allow-opts label \"let out anything from firewall host itself\"\n"; } From 1306c7dd6b66bdf41d5e06e03905ea1ddcc6a30d Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 25 Oct 2010 12:59:33 +0200 Subject: [PATCH 062/329] Change the firewall rule generation to look for the ipprotocol tag which defines inet or inet6. This makes sure that we use ipv6 addresses and change to the correct ipv6-icmp tag. --- etc/inc/filter.inc | 163 ++++++++++++++++++-------- etc/inc/util.inc | 11 +- usr/local/www/firewall_rules_edit.php | 23 ++++ 3 files changed, 144 insertions(+), 53 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 2c638d448c..45c47464bb 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1514,50 +1514,89 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { if(strstr($rule[$target]['network'], "opt")) { $optmatch = ""; $matches = ""; - if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { - $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ip']; - if(!is_ipaddr($opt_ip)) - return ""; - $src = $opt_ip . "/" . - $FilterIflist["opt{$optmatch[1]}"]['sn']; - /* check for opt$NUMip here */ - } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { - $src = $FilterIflist["opt{$matches[1]}"]['ip']; - if(!is_ipaddr($src)) - return ""; + if($rule['ipprotocol'] == "inet6") { + if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { + $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ipv6']; + if(!is_ipaddr($opt_ip)) + return ""; + $src = $opt_ip . "/" . + $FilterIflist["opt{$optmatch[1]}"]['snv6']; + /* check for opt$NUMip here */ + } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { + $src = $FilterIflist["opt{$matches[1]}"]['ipv6']; + if(!is_ipaddr($src)) + return ""; + } + if(isset($rule[$target]['not'])) + $src = " !{$src}"; + } else { + if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { + $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ip']; + if(!is_ipaddr($opt_ip)) + return ""; + $src = $opt_ip . "/" . + $FilterIflist["opt{$optmatch[1]}"]['sn']; + /* check for opt$NUMip here */ + } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { + $src = $FilterIflist["opt{$matches[1]}"]['ip']; + if(!is_ipaddr($src)) + return ""; + } + if(isset($rule[$target]['not'])) + $src = " !{$src}"; } - if(isset($rule[$target]['not'])) - $src = " !{$src}"; } else { - switch ($rule[$target]['network']) { - case 'wan': - $wansa = $FilterIflist['wan']['sa']; - $wansn = $FilterIflist['wan']['sn']; - $src = "{$wansa}/{$wansn}"; - break; - case 'wanip': - $src = $FilterIflist["wan"]['ip']; - break; - case 'lanip': - $src = $FilterIflist["lan"]['ip']; - break; - case 'lan': - $lansa = $FilterIflist['lan']['sa']; - $lansn = $FilterIflist['lan']['sn']; - $src = "{$lansa}/{$lansn}"; - break; - case 'pptp': - $pptpsa = gen_subnet($FilterIflist['pptp']['ip'], $FilterIflist['pptp']['sn']); - $pptpsn = $FilterIflist['pptp']['sn']; - $src = "{$pptpsa}/{$pptpsn}"; - break; - case 'pppoe': - $pppoesa = gen_subnet($FilterIflist['pppoe']['ip'], $FilterIflist['pppoe']['sn']); - $pppoesn = $FilterIflist['pppoe']['sn']; - $src = "{$pppoesa}/{$pppoesn}"; - break; + if($rule['ipprotocol'] == "inet6") { + switch ($rule[$target]['network']) { + case 'wan': + $wansa = $FilterIflist['wan']['sav6']; + $wansn = $FilterIflist['wan']['snv6']; + $src = "{$wansa}/{$wansn}"; + break; + case 'wanip': + $src = $FilterIflist["wan"]['ipv6']; + break; + case 'lanip': + $src = $FilterIflist["lan"]['ipv6']; + break; + case 'lan': + $lansa = $FilterIflist['lan']['sav6']; + $lansn = $FilterIflist['lan']['snv6']; + $src = "{$lansa}/{$lansn}"; + break; + } + if(isset($rule[$target]['not'])) $src = "!{$src}"; + } else { + switch ($rule[$target]['network']) { + case 'wan': + $wansa = $FilterIflist['wan']['sa']; + $wansn = $FilterIflist['wan']['sn']; + $src = "{$wansa}/{$wansn}"; + break; + case 'wanip': + $src = $FilterIflist["wan"]['ip']; + break; + case 'lanip': + $src = $FilterIflist["lan"]['ip']; + break; + case 'lan': + $lansa = $FilterIflist['lan']['sa']; + $lansn = $FilterIflist['lan']['sn']; + $src = "{$lansa}/{$lansn}"; + break; + case 'pptp': + $pptpsa = gen_subnet($FilterIflist['pptp']['ip'], $FilterIflist['pptp']['sn']); + $pptpsn = $FilterIflist['pptp']['sn']; + $src = "{$pptpsa}/{$pptpsn}"; + break; + case 'pppoe': + $pppoesa = gen_subnet($FilterIflist['pppoe']['ip'], $FilterIflist['pppoe']['sn']); + $pppoesn = $FilterIflist['pppoe']['sn']; + $src = "{$pppoesa}/{$pppoesn}"; + break; + } + if(isset($rule[$target]['not'])) $src = "!{$src}"; } - if(isset($rule[$target]['not'])) $src = "!{$src}"; } } else if($rule[$target]['address']) { $expsrc = alias_expand($rule[$target]['address']); @@ -1641,6 +1680,17 @@ function filter_generate_user_rule($rule) { return "# source network or destination network == pptp on " . $rule['descr']; } + if(isset($rule['iprotocol']) && $rule['ipprotocol'] <> "") { + switch($rule['ipprotocol']) { + case "inet": + $aline['ipprotocol'] = "inet"; + break; + case "inet": + $aline['ipprotocol'] = "inet6"; + break; + } + } + /* check for unresolvable aliases */ if($rule['source']['address'] && !alias_expand($rule['source']['address'])) { file_notice("Filter_Reload", "# unresolvable source aliases {$rule['descr']}"); @@ -1677,12 +1727,23 @@ function filter_generate_user_rule($rule) { /* do not process reply-to for gateway'd rules */ if($rule['gateway'] == "" && interface_has_gateway($rule['interface']) && !isset($rule['disablereplyto'])) { - $rg = get_interface_gateway($rule['interface']); - if(is_ipaddr($rg)) { - $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; + if($rule['ipprotocol'] == "inet6") { + $rg = get_interface_gateway_v6($rule['interface']); + if(is_ipaddrv6($rg)) { + $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; + } else { + if($rule['interface'] <> "pptp") { + log_error("Could not find gateway for interface({$rule['interface']})."); + } + } } else { - if($rule['interface'] <> "pptp") { - log_error("Could not find gateway for interface({$rule['interface']})."); + $rg = get_interface_gateway($rule['interface']); + if(is_ipaddr($rg)) { + $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; + } else { + if($rule['interface'] <> "pptp") { + log_error("Could not find gateway for interface({$rule['interface']})."); + } } } } @@ -1698,6 +1759,8 @@ function filter_generate_user_rule($rule) { if(isset($rule['protocol'])) { if($rule['protocol'] == "tcp/udp") $aline['prot'] = " proto { tcp udp } "; + elseif(($rule['protocol'] == "icmp") && ($rule['ipprotocol'] == "inet6")) + $aline['prot'] = " inet6 proto ipv6-icmp "; elseif($rule['protocol'] == "icmp") $aline['prot'] = " inet proto icmp "; else @@ -1737,6 +1800,8 @@ function filter_generate_user_rule($rule) { } if(($rule['protocol'] == "icmp") && $rule['icmptype']) $aline['icmp-type'] = "icmp-type {$rule['icmptype']} "; + if(($rule['protocol'] == "icmp6") && $rule['icmptype']) + $aline['icmp6-type'] = "icmp-type {$rule['icmptype']} "; if(!empty($rule['tag'])) $aline['tag'] = " tag " .$rule['tag']. " "; if(!empty($rule['tagged'])) @@ -1892,8 +1957,8 @@ function filter_generate_user_rule($rule) { /* negate VPN/PPTP/PPPoE networks for load balancer/gateway rules */ $vpns = " to "; $line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . - $aline['interface'] . $aline['prot'] . $aline['src'] . $aline['os'] . - $vpns . $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . + $aline['interface'] . $aline['ipprotocol'] . $aline['prot'] . $aline['src'] . $aline['os'] . + $vpns . $aline['icmp-type'] . $aline['icmp6-type'] . $aline['tag'] . $aline['tagged'] . $aline['dscp'] . $aline['allowopts'] . $aline['flags'] . $aline['queue'] . $aline['dnpipe'] . $aline['schedlabel'] . " label \"NEGATE_ROUTE: Negate policy route for vpn(s)\"\n"; @@ -1901,7 +1966,7 @@ function filter_generate_user_rule($rule) { } /* piece together the actual user rule */ $line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . - $aline['reply'] . $aline['route'] . $aline['prot'] . $aline['src'] . $aline['os'] . $aline['dst'] . + $aline['reply'] . $aline['route'] . $aline['ipprotocol'] . $aline['prot'] . $aline['src'] . $aline['os'] . $aline['dst'] . $aline['divert'] . $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . $aline['dscp'] . $aline['allowopts'] . $aline['flags'] . $aline['queue'] . $aline['dnpipe'] . $aline['schedlabel']; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 10fa6a5926..e28192a75c 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -218,10 +218,13 @@ function is_module_loaded($module_name) { /* return the subnet address given a host address and a subnet bit count */ function gen_subnet($ipaddr, $bits) { - if (!is_ipaddr($ipaddr) || !is_numeric($bits)) - return ""; - - return long2ip(ip2long($ipaddr) & gen_subnet_mask_long($bits)); + if(is_ipaddrv6($ipaddr)) { + return "{$ipaddr}/{$bits}"; + } else { + if (!is_ipaddr($ipaddr) || !is_numeric($bits)) + return ""; + return long2ip(ip2long($ipaddr) & gen_subnet_mask_long($bits)); + } } /* return the highest (broadcast) address in the subnet given a host address and a subnet bit count */ diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index a51fdf2164..cc3fdfcf84 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -95,6 +95,9 @@ if (isset($id) && $a_filter[$id]) { if (isset($a_filter[$id]['direction'])) $pconfig['direction'] = $a_filter[$id]['direction']; + if (isset($a_filter[$id]['ipprotocol'])) + $pconfig['ipprotocol'] = $a_filter[$id]['ipprotocol']; + if (isset($a_filter[$id]['protocol'])) $pconfig['proto'] = $a_filter[$id]['protocol']; else @@ -401,6 +404,9 @@ if ($_POST) { if (isset($_POST['interface'] )) $filterent['interface'] = $_POST['interface']; + if (isset($_POST['ipprotocol'] )) + $filterent['ipprotocol'] = $_POST['ipprotocol']; + if ($_POST['tcpflags_any']) { $filterent['tcpflags_any'] = true; } else { @@ -532,6 +538,7 @@ if ($_POST) { $filterent['icmptype'] = $a_filter[$id]['icmptype']; else if (isset($filterent['icmptype'])) unset($filterent['icmptype']); + $filterent['source'] = $a_filter[$id]['source']; $filterent['destination'] = $a_filter[$id]['destination']; $filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id']; @@ -717,6 +724,22 @@ include("head.inc"); + + + + + + + +
  @@ -175,19 +175,43 @@ include("head.inc");
+ +   +
+ +
+ + +
+ +
+
From 290797ea64be6e28c97e563dd688e373263f0154 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 25 Oct 2010 13:48:12 +0200 Subject: [PATCH 063/329] Fix the filter.inc rule generation for icmp to prevent a double inet6 in the rule Add inet6 for user defined rules to ipv6 addresses. --- etc/inc/filter.inc | 8 ++++---- usr/local/www/firewall_rules.php | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 45c47464bb..6905e6165b 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1680,12 +1680,12 @@ function filter_generate_user_rule($rule) { return "# source network or destination network == pptp on " . $rule['descr']; } - if(isset($rule['iprotocol']) && $rule['ipprotocol'] <> "") { + if(isset($rule['ipprotocol'])) { switch($rule['ipprotocol']) { case "inet": $aline['ipprotocol'] = "inet"; break; - case "inet": + case "inet6": $aline['ipprotocol'] = "inet6"; break; } @@ -1760,7 +1760,7 @@ function filter_generate_user_rule($rule) { if($rule['protocol'] == "tcp/udp") $aline['prot'] = " proto { tcp udp } "; elseif(($rule['protocol'] == "icmp") && ($rule['ipprotocol'] == "inet6")) - $aline['prot'] = " inet6 proto ipv6-icmp "; + $aline['prot'] = " proto ipv6-icmp "; elseif($rule['protocol'] == "icmp") $aline['prot'] = " inet proto icmp "; else @@ -1967,7 +1967,7 @@ function filter_generate_user_rule($rule) { /* piece together the actual user rule */ $line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . $aline['reply'] . $aline['route'] . $aline['ipprotocol'] . $aline['prot'] . $aline['src'] . $aline['os'] . $aline['dst'] . - $aline['divert'] . $aline['icmp-type'] . $aline['tag'] . $aline['tagged'] . $aline['dscp'] . + $aline['divert'] . $aline['icmp-type'] . $aline['icmp6-type'] . $aline['tag'] . $aline['tagged'] . $aline['dscp'] . $aline['allowopts'] . $aline['flags'] . $aline['queue'] . $aline['dnpipe'] . $aline['schedlabel']; diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index cdd417a9e5..b3533e2f4b 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -632,6 +632,18 @@ if($_REQUEST['undodrag']) { Date: Mon, 25 Oct 2010 15:54:46 +0200 Subject: [PATCH 064/329] up the subnet bits from 32 to 128 so that the access can be locked down to the host for ipv6. This will require a javascript routine that prevents a subnet mask higher then 32 bits for a ipv4 address. Alternatively the subnet bits should be steered by javascript to prevent use of more then 32 bits on a ipv4 address. When a hostname is used all bets are off, even worse if the hostname is a combined ipv4/ipv6. --- usr/local/www/firewall_aliases_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index 457198cf17..8aa43f67fc 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -632,7 +632,7 @@ EOD; From 22b5abac48ce99350c7e3d750bfeb0748663bd26 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 26 Oct 2010 11:44:25 +0200 Subject: [PATCH 065/329] Switch over the IPv6 functions from IPv6.inc, these are from the PHP PEAR library --- etc/inc/config.inc | 4 +++- etc/inc/filter.inc | 2 +- etc/inc/util.inc | 50 ++++++++++++---------------------------------- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 724615a53a..a00f910ef8 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -60,6 +60,8 @@ require_once('config.lib.inc'); if($g['booting']) echo "."; require_once("util.inc"); if($g['booting']) echo "."; +require_once("IPv6.inc"); +if($g['booting']) echo "."; if(file_exists("/cf/conf/use_xmlreader")) require_once("xmlreader.inc"); else @@ -211,4 +213,4 @@ if($config_parsed == true) { } } -?> \ No newline at end of file +?> diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6905e6165b..170de9038a 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -732,7 +732,7 @@ function filter_generate_optcfg_array() { $oic['mss'] = empty($oc['mss']) ? '' : $oc['mss']; $oic['descr'] = $ifdetail; $oic['sa'] = gen_subnet($oic['ip'], $oic['sn']); - $oic['sav6'] = "{$oic['ipv6']}"; + $oic['sav6'] = gen_subnetv6($oic['ipv6'], $oic['snv6']); $oic['nonat'] = $oc['nonat']; $oic['alias-address'] = $oc['alias-address']; $oic['alias-subnet'] = $oc['alias-subnet']; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index e28192a75c..af88d2c5f7 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -218,13 +218,16 @@ function is_module_loaded($module_name) { /* return the subnet address given a host address and a subnet bit count */ function gen_subnet($ipaddr, $bits) { - if(is_ipaddrv6($ipaddr)) { - return "{$ipaddr}/{$bits}"; - } else { - if (!is_ipaddr($ipaddr) || !is_numeric($bits)) - return ""; - return long2ip(ip2long($ipaddr) & gen_subnet_mask_long($bits)); - } + if (!is_ipaddr($ipaddr) || !is_numeric($bits)) + return ""; + return long2ip(ip2long($ipaddr) & gen_subnet_mask_long($bits)); +} + +/* return the subnet address given a host address and a subnet bit count */ +function gen_subnetv6($ipaddr, $bits) { + if (!is_ipaddrv6($ipaddr) || !is_numeric($bits)) + return ""; + return Net_IPv6::getNetmask($ipaddr, $bits); } /* return the highest (broadcast) address in the subnet given a host address and a subnet bit count */ @@ -397,37 +400,10 @@ function is_ipaddr($ipaddr) { return false; } +/* returns true if $ipaddr is a valid IPv6 address */ function is_ipaddrv6($ipaddr) { - /* Not using filter_var here. It misses some test cases */ - /* http://crisp.tweakblogs.net/blog/2031 */ - // fast exit for localhost - if (strlen($ipaddr) < 3) - return $ipaddr == '::'; - - // Check if part is in IPv4 format - if (strpos($ipaddr, '.')) { - $lastcolon = strrpos($ipaddr, ':'); - if (!($lastcolon && validateIPv4(substr(ipaddr, $lastcolon + 1)))) - return false; - - // replace IPv4 part with dummy - $ipaddr = substr($ipaddr, 0, $lastcolon) . ':0:0'; - } - - // check uncompressed - if (strpos($ipaddr, '::') === false) { - return preg_match('/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i', $ipaddr); - } - - // check colon-count for compressed format - if (substr_count($ipaddr, ':') < 8) { - return preg_match('/^(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?$/i', $ipaddr); - } - return false; -} - -function validateIPv4($ipaddr) { - return $ipaddr == long2ip(ip2long($ipaddr)); + $result = Net_IPv6::checkIPv6($ipaddr); + return $result; } /* returns true if $ipaddr is a valid dotted IPv4 address */ From 9b1ff0286c36c76e71f01a6664901b69d7c8c598 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 26 Oct 2010 15:40:37 +0200 Subject: [PATCH 066/329] Allow for creation of a ipv6 tunnel for he.net by creating a gif interface. This is the recommended procedure as advised by he.net This allows for using ipv6 local and remote addresses, you will need to add a ipv6 default gateway on the routing tab --- etc/inc/config.gui.inc | 3 ++- etc/inc/interfaces.inc | 8 ++++++-- usr/local/www/interfaces_gif_edit.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/etc/inc/config.gui.inc b/etc/inc/config.gui.inc index eea6f33eb8..b41073f428 100644 --- a/etc/inc/config.gui.inc +++ b/etc/inc/config.gui.inc @@ -63,6 +63,7 @@ ini_set("memory_limit","128M"); require_once('config.lib.inc'); require_once("notices.inc"); require_once("util.inc"); +require_once("IPv6.inc"); if(file_exists("/cf/conf/use_xmlreader")) require_once("xmlreader.inc"); else @@ -92,4 +93,4 @@ if($config_parsed == true) { } } -?> \ No newline at end of file +?> diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index aacacfd157..d9b70ae584 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -665,7 +665,11 @@ function interface_gif_configure(&$gif) { /* Do not change the order here for more see gif(4) NOTES section. */ mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} {$gif['remote-addr']}"); - mwexec("/sbin/ifconfig {$gifif} {$gif['tunnel-local-addr']} {$gif['tunnel-remote-addr']} netmask " . gen_subnet_mask($gif['tunnel-remote-net'])); + if((is_ipaddrv6($gif['tunnel-local-addr'])) || (is_ipaddrv6($gif['tunnel-remote-addr']))) { + mwexec("/sbin/ifconfig {$gifif} inet6 {$gif['tunnel-local-addr']} {$gif['tunnel-remote-addr']} prefixlen {$gif['tunnel-remote-net']} "); + } else { + mwexec("/sbin/ifconfig {$gifif} {$gif['tunnel-local-addr']} {$gif['tunnel-remote-addr']} netmask " . gen_subnet_mask($gif['tunnel-remote-net'])); + } if (isset($gif['link0']) && $gif['link0']) pfSense_interface_flags($gifif, IFF_LINK0); if (isset($gif['link1']) && $gif['link1']) @@ -675,7 +679,7 @@ function interface_gif_configure(&$gif) { else log_error("could not bring gifif up -- variable not defined"); - /* XXX: Needed?! */ + /* XXX: Needed?! Let them use the defined gateways instead */ //mwexec("/sbin/route add {$gif['tunnel-remote-addr']}/{$gif['tunnel-remote-net']} -iface {$gifif}"); file_put_contents("{$g['tmp_path']}/{$gifif}_router", $gif['tunnel-remote-addr']); diff --git a/usr/local/www/interfaces_gif_edit.php b/usr/local/www/interfaces_gif_edit.php index fdde8d4e72..18fa3a2b43 100644 --- a/usr/local/www/interfaces_gif_edit.php +++ b/usr/local/www/interfaces_gif_edit.php @@ -167,7 +167,7 @@ include("head.inc"); +
+ $ifname) { + $oc = $config['interfaces'][$ifent]; + if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && (!is_ipaddrv6($oc['ipaddrv6']))) || + (!is_array($config['dhcpdv6'][$ifent]) && (!is_ipaddrv6($oc['ipaddrv6'])))) + continue; + if ($ifent == $if) + $active = true; + else + $active = false; + $tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}"); + $tabscounter++; + } + if ($tabscounter == 0) { + echo "
"; + include("fend.inc"); + echo ""; + echo ""; + exit; + } + display_top_tabs($tab_array); +?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + onClick="enable_change(false)"> +
  + > +
+
+ +
+ bits +
+ + - + +
+ +
+ +    +
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ + + + + + + + + +
+ >  +
  + +
+
+
+ "> - +
+ +
+
+ "> - +
+ +
+
+ "> - +
+ +
+
+ "> - +
+ +
+
+ "> - +
+ +
+
+ "> - +
+ + +
  + + " onclick="enable_change(true)"> +
 


+
,

+
+
+

+
+ + + + + + + + + + + "" or $mapent['ipaddr'] <> ""): ?> + + + + + + + + + + + + + + +
+ + + + + +
+
+ + +   + +   + +   + + + + + + +
')">
+
+ + + + + +
+
+
+
+ + + + + From 65b1e7d56bf793bc302918d1a127e3ccf5faa337 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 28 Oct 2010 12:56:26 +0200 Subject: [PATCH 072/329] Make sure that if either v4 or v6 dhcp servers are enabled that is_dhcp_enabled() will trigger --- etc/inc/pfsense-utils.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 4c9e2b565a..4372daae44 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1054,7 +1054,7 @@ function is_dhcp_server_enabled() $dhcpdenable = false; - if (!is_array($config['dhcpd'])) + if ((!is_array($config['dhcpd'])) && (!is_array($config['dhcpdv6']))) return false; $Iflist = get_configured_interface_list(); @@ -1066,6 +1066,13 @@ function is_dhcp_server_enabled() } } + foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { + if (isset($dhcpv6ifconf['enable']) && isset($Iflist[$dhcpv6if])) { + $dhcpdenable = true; + break; + } + } + return $dhcpdenable; } From 2a1bd0273dcd9ef5748dc9790b103fb9f3ace64e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 28 Oct 2010 14:29:23 +0200 Subject: [PATCH 073/329] Add the rtadvd deamon to advertise the routing. We still need to make a proper config file if we want it to advertise the Carp IP instead of the interface IP Also added safety guard for empty dhcp configs --- etc/inc/services.inc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index a68c537672..a18bb487e3 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -51,8 +51,10 @@ function services_dhcpd_configure() { } /* kill any running dhcpd */ - if(is_process_running("dhcpd")) + if(is_process_running("dhcpd")) { mwexec("killall dhcpd", true); + mwexec("killall -9 rtadvd", true); + } /* DHCP enabled on any interfaces? */ if (!is_dhcp_server_enabled()) @@ -630,11 +632,16 @@ EOD; /* fire up dhcpd in a chroot */ - mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpd.conf " . - join(" ", $dhcpdifs)); - mwexec("/usr/local/sbin/dhcpd -6 -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpdv6.conf " . - join(" ", $dhcpdv6ifs)); + if(count($dhcpdifs) > 0) { + mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpd.conf " . + join(" ", $dhcpdifs)); + } + if(count($dhcpdv6ifs) > 0) { + mwexec("/usr/local/sbin/dhcpd -6 -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpdv6.conf " . + join(" ", $dhcpdv6ifs)); + mwexec("/usr/sbin/rtadvd " . join(" ", $dhcpdv6ifs)); + } if ($g['booting']) { print "done.\n"; } From ce76a45cc910be25d9e024753811e37a77bf95c0 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 28 Oct 2010 14:50:44 +0200 Subject: [PATCH 074/329] Add icmp6 rules so that stateless autoconfiguration can be used, this also requires that link local addresses work. --- etc/inc/filter.inc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 170de9038a..e94720acb7 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1762,7 +1762,7 @@ function filter_generate_user_rule($rule) { elseif(($rule['protocol'] == "icmp") && ($rule['ipprotocol'] == "inet6")) $aline['prot'] = " proto ipv6-icmp "; elseif($rule['protocol'] == "icmp") - $aline['prot'] = " inet proto icmp "; + $aline['prot'] = " proto icmp "; else $aline['prot'] = " proto {$rule['protocol']} "; } else { @@ -2044,8 +2044,8 @@ block in $log inet6 all label "Default deny rule IPv6" block out $log inet6 all label "Default deny rule IPv6" # We use the mighty pf, we cannot be fooled. -#block quick inet proto { tcp, udp } from any port = 0 to any -#block quick inet proto { tcp, udp } from any to any port = 0 +block quick inet proto { tcp, udp } from any port = 0 to any +block quick inet proto { tcp, udp } from any to any port = 0 EOD; @@ -2174,6 +2174,18 @@ pass in on \${$oc['descr']} proto udp from any port = 68 to 255.255.255.255 port pass in on \${$oc['descr']} proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server" pass out on \${$oc['descr']} proto udp from {$oc['ip']} port = 67 to any port = 68 label "allow access to DHCP server" + +EOD; + } + if(isset($config['dhcpdv6'][$on]['enable'])) { + $ipfrules .= << Date: Thu, 28 Oct 2010 15:37:39 +0200 Subject: [PATCH 075/329] Fix typo in services_dhcp_configure() for dhcp6 naming --- etc/inc/services.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index a18bb487e3..4f7cd03a19 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -485,7 +485,7 @@ EOD; $dnscfgv6 = ""; if ($dhcpv6ifconf['domain']) { - $dnscfgv6 .= " dhcp6.option domain-name \"{$dhcpv6ifconf['domain']}\";\n"; + $dnscfgv6 .= " option dhcp6.domain-name \"{$dhcpv6ifconf['domain']}\";\n"; } if($dhcpv6ifconf['domainsearchlist'] <> "") { @@ -512,7 +512,7 @@ EOD; /* is failover dns setup? */ if (is_array($dhcpv6ifconf['dnsserver']) && $dhcpv6ifconf['dnsserver'][0] <> "") { - $dhcpdv6conf .= " option domain-name-servers {$dhcpv6ifconf['dnsserver'][0]}"; + $dhcpdv6conf .= " option dhcp6.name-servers {$dhcpv6ifconf['dnsserver'][0]}"; if($dhcpv6ifconf['dnsserver'][1] <> "") $dhcpdv6conf .= ",{$dhcpv6ifconf['dnsserver'][1]}"; $dhcpdv6conf .= ";\n"; From c75a81850258cbfb62c43e0302b7cea985e7ed77 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 31 Oct 2010 22:36:27 +0100 Subject: [PATCH 076/329] Add function for generating ipv6 subnet mask end, hook into ipv4 subnet mask check as well. --- etc/inc/util.inc | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index af88d2c5f7..7bea4898e3 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -238,6 +238,49 @@ function gen_subnet_max($ipaddr, $bits) { return long2ip32(ip2long($ipaddr) | ~gen_subnet_mask_long($bits)); } +/* Generate end number for a given ipv6 subnet mask + * no, it does not perform math */ +function gen_subnetv6_max($ipaddr, $bits) { + if(!is_ipaddrv6($ipaddr)) + return false; + + $subnetstart = gen_subnetv6($ipaddr, $bits); + /* we should have a expanded full ipv6 subnet starting at 0. + * Now split those by the semicolon so we can do 16 bit math */ + $parts = explode(":", $subnetstart); + if(count($parts) <> 8) + return false; + + /* reverse the array, we start with the lsb */ + $parts = array_reverse($parts); + /* set the itteration count properly */ + $bitsleft = 128 - $bits; + $i = 0; + foreach($parts as $part) { + /* foreach 16 bits we go to the next part */ + /* no this isn't proper hex math, neither does it overflow properly */ + while($bitsleft > 0) { + if($part == "0") { + $part = "f"; + } else { + $part = $part . "f"; + } + $bitsleft = $bitsleft - 4; + $j++; + if($j == 4) { + $parts[$i] = $part; + $j = 0; + $i++; + continue 2; + } + } + $i++; + } + $parts = array_reverse($parts); + $subnet_end = implode(":", $parts); + return $subnet_end; +} + /* returns a subnet mask (long given a bit count) */ function gen_subnet_mask_long($bits) { $sm = 0; @@ -920,6 +963,13 @@ function ipcmp($a, $b) { /* return true if $addr is in $subnet, false if not */ function ip_in_subnet($addr,$subnet) { + if(is_ipaddrv6($addr)) { + $result = Net_IPv6::IsInNetmask($addr, $subnet); + if($result) + return true; + else + return false; + } list($ip, $mask) = explode('/', $subnet); $mask = (0xffffffff << (32 - $mask)) & 0xffffffff; return ((ip2long($addr) & $mask) == (ip2long($ip) & $mask)); From a8a98fb45f17db850c79f6915fb78ac5e3a60498 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 1 Nov 2010 08:31:20 +0100 Subject: [PATCH 077/329] Do not throw warnings on empty dhcpd arrays --- etc/inc/pfsense-utils.inc | 20 ++++++++++++-------- etc/inc/services.inc | 6 ++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 4372daae44..9214b6aa2a 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1059,17 +1059,21 @@ function is_dhcp_server_enabled() $Iflist = get_configured_interface_list(); - foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { - if (isset($dhcpifconf['enable']) && isset($Iflist[$dhcpif])) { - $dhcpdenable = true; - break; + if(is_array($config['dhcpd'])) { + foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { + if (isset($dhcpifconf['enable']) && isset($Iflist[$dhcpif])) { + $dhcpdenable = true; + break; + } } } - foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { - if (isset($dhcpv6ifconf['enable']) && isset($Iflist[$dhcpv6if])) { - $dhcpdenable = true; - break; + if(is_array($config['dhcpdv6'])) { + foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { + if (isset($dhcpv6ifconf['enable']) && isset($Iflist[$dhcpv6if])) { + $dhcpdenable = true; + break; + } } } diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 4f7cd03a19..65e50ff7cf 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -112,8 +112,10 @@ function services_dhcpd_configure() { } $syscfg = $config['system']; - $dhcpdcfg = $config['dhcpd']; - $dhcpdv6cfg = $config['dhcpdv6']; + if (!is_array($config['dhcpd'])) + $config['dhcpd'] = array(); + if (!is_array($config['dhcpdv6'])) + $config['dhcpdv6'] = array(); $Iflist = get_configured_interface_list(); if ($g['booting']) From d57293a4f7c48035b026592feaf550f43feca6f3 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 2 Nov 2010 10:13:51 +0100 Subject: [PATCH 078/329] Fix services.inc dhcp6 configuration, add route advertising deamon config --- etc/inc/filter.inc | 51 +++++++++++++++-------------- etc/inc/services.inc | 78 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 100 insertions(+), 29 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 7448ac4a7f..15282eba29 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1514,35 +1514,34 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { if(strstr($rule[$target]['network'], "opt")) { $optmatch = ""; $matches = ""; - if($rule['ipprotocol'] == "inet6") { - /* check for opt$NUMip here */ - if (preg_match("/opt([0-9]*)ip/", $rule[$target]['networkv6'], $matches)) { - $src = $FilterIflist["opt{$matches[1]}"]['ipv6']; - if(!is_ipaddrv6($src)) + if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { + $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ipv6']; + if(!is_ipaddr($opt_ip)) return ""; - } else if (preg_match("/opt([0-9]*)$/", $rule[$target]['networkv6'], $optmatch)) { - $opt_ipv6 = $FilterIflist["opt{$optmatch[1]}"]['ipv6']; - if(!is_ipaddr($opt_ipv6)) - return ""; - $src = $opt_ipv6 . "/" . + $src = $opt_ip . "/" . $FilterIflist["opt{$optmatch[1]}"]['snv6']; - + /* check for opt$NUMip here */ + } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { + $src = $FilterIflist["opt{$matches[1]}"]['ipv6']; + if(!is_ipaddr($src)) + return ""; + } if(isset($rule[$target]['not'])) $src = " !{$src}"; } else { - /* check for opt$NUMip here */ - if (preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { - $src = $FilterIflist["opt{$matches[1]}"]['ip']; - if(!is_ipaddr($src)) - return ""; - } else if (preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { + if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ip']; if(!is_ipaddr($opt_ip)) return ""; $src = $opt_ip . "/" . $FilterIflist["opt{$optmatch[1]}"]['sn']; - + /* check for opt$NUMip here */ + } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { + $src = $FilterIflist["opt{$matches[1]}"]['ip']; + if(!is_ipaddr($src)) + return ""; + } if(isset($rule[$target]['not'])) $src = " !{$src}"; } @@ -1596,8 +1595,7 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { $src = "{$pppoesa}/{$pppoesn}"; break; } - if(isset($rule[$target]['not'])) - $src = "!{$src}"; + if(isset($rule[$target]['not'])) $src = "!{$src}"; } } } else if($rule[$target]['address']) { @@ -2170,23 +2168,26 @@ EOD; /* allow access to DHCP server on interfaces */ if(isset($config['dhcpd'][$on]['enable'])) { $ipfrules .= << $dhcpv6ifconf) { + $rtadvdnum++; + $realif = get_real_interface($dhcpv6if); + $rtadvdifs[] = $realif; + + $ifcfgipv6 = get_interface_ipv6($dhcpv6if); + $ifcfgsnv6 = get_interface_subnetv6($dhcpv6if); + $subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6); + $subnetmaskv6 = gen_subnet_mask($ifcfgsnv6); + + $rtadvdconf .= "{$realif}:\\\n"; + $rtadvdconf .= "\t:addr=\"{$subnetv6}\":\\\n"; + $rtadvdconf .= "\t:prefixlen#{$ifcfgsnv6}:\\\n"; + $rtadvdconf .= "\t:raflags#192:\n"; + $rtadvdconf .= "\n"; + + } + + fwrite($fd, $rtadvdconf); + fclose($fd); + + if(count($rtadvdifs) > 0) { + mwexec("/usr/sbin/rtadvd -d -c {$g['varetc_path']}/rtadvd.conf " . join(" ", $rtadvdifs)); + } + return 0; +} + function services_dhcpd_configure() { global $config, $g; @@ -53,7 +117,6 @@ function services_dhcpd_configure() { /* kill any running dhcpd */ if(is_process_running("dhcpd")) { mwexec("killall dhcpd", true); - mwexec("killall -9 rtadvd", true); } /* DHCP enabled on any interfaces? */ @@ -116,6 +179,8 @@ function services_dhcpd_configure() { $config['dhcpd'] = array(); if (!is_array($config['dhcpdv6'])) $config['dhcpdv6'] = array(); + $dhcpdcfg = $config['dhcpd']; + $dhcpdv6cfg = $config['dhcpdv6']; $Iflist = get_configured_interface_list(); if ($g['booting']) @@ -477,8 +542,8 @@ EOD; continue; $ifcfgipv6 = get_interface_ipv6($dhcpv6if); $ifcfgsnv6 = get_interface_subnetv6($dhcpv6if); - $subnetv6 = gen_subnetv6($ifcfgip, $ifcfgsn); - $subnetmaskv6 = gen_subnet_mask($ifcfgsn); + $subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6); + $subnetmaskv6 = gen_subnet_mask($ifcfgsnv6); if($is_olsr_enabled == true) if($dhcpv6ifconf['netmask']) @@ -644,6 +709,10 @@ EOD; join(" ", $dhcpdv6ifs)); mwexec("/usr/sbin/rtadvd " . join(" ", $dhcpdv6ifs)); } + + /* start ipv6 route advertising if required */ + services_rtadvd_configure(); + if ($g['booting']) { print "done.\n"; } @@ -869,6 +938,7 @@ function services_dyndns_configure_client($conf) { $dnsWilcard = $conf['wildcard'], $dnsMX = $conf['mx'], $dnsIf = "{$conf['interface']}"); + } function services_dyndns_configure($int = "") { From 27b82e7cee50762b61b796223602ec896b32136c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 2 Nov 2010 14:21:32 +0100 Subject: [PATCH 079/329] Remove debug flag from rtadvd --- etc/inc/services.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 6067d93072..f3e9cd3e4c 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -98,7 +98,7 @@ function services_rtadvd_configure() { fclose($fd); if(count($rtadvdifs) > 0) { - mwexec("/usr/sbin/rtadvd -d -c {$g['varetc_path']}/rtadvd.conf " . join(" ", $rtadvdifs)); + mwexec("/usr/sbin/rtadvd -c {$g['varetc_path']}/rtadvd.conf " . join(" ", $rtadvdifs)); } return 0; } From 7617e245bb6886848a23cd453fb720eefe2bff8b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 2 Nov 2010 21:43:07 +0100 Subject: [PATCH 080/329] Verify that we validate against a ipv6 subnet properly. This should help for static route gateways --- usr/local/www/system_gateways_edit.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 8db28530f9..166e6ab8bc 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -118,12 +118,18 @@ if ($_POST) { } else { $parent_ip = get_interface_ip($_POST['interface']); } - if (is_ipaddr($parent_ip)) { + if (is_ipaddrv4($parent_ip)) { $parent_sn = get_interface_subnet($_POST['interface']); if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) { $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); } } + if (is_ipaddrv6($parent_ip)) { + $parent_sn = get_interface_subnetv6($_POST['interface']); + if(!ip_in_subnet($_POST['gateway'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn)) { + $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); + } + } } if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { $input_errors[] = gettext("A valid monitor IP address must be specified."); From 14f565b4210af36dc26af97a3cecdd966af791a9 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 2 Nov 2010 22:00:05 +0100 Subject: [PATCH 081/329] Allow the entry of ipv6 networks, needs verification to prevent ipv4 gateways for ipv6 networks and vice versa --- usr/local/www/system_routes_edit.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 96d24d5851..d48c542da8 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -104,7 +104,12 @@ if ($_POST) { } /* check for overlaps */ - $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; + if(is_ipaddrv6($_POST['network'])) { + $osn = Net_IPv6::compress(gen_subnetv6($_POST['network'], $_POST['network_subnet'])) . "/" . $_POST['network_subnet']; + } + if(is_ipaddrv4($POST['network'])) { + $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; + } foreach ($a_routes as $route) { if (isset($id) && ($a_routes[$id]) && ($a_routes[$id] === $route)) continue; From 4ebde16510a7626f411253e70be0143c8376ae18 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 2 Nov 2010 23:01:40 +0100 Subject: [PATCH 082/329] Make sure that the filter rules for static routes are correctly generated for ipv4 and ipv6 --- etc/inc/filter.inc | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 15282eba29..2b338583b9 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2347,19 +2347,37 @@ EOD; $friendly = $GatewaysList[$route['gateway']]['friendlyiface']; if(is_array($FilterIflist[$friendly])) { $oc = $FilterIflist[$friendly]; - if($oc['ip']) { - $sa = $oc['sa']; - $sn = $oc['sn']; - $if = $oc['if']; - } - if($sa) { - $ipfrules .= << Date: Wed, 3 Nov 2010 10:30:03 +0100 Subject: [PATCH 083/329] Make it possible to create a inet6 carp address. This works surprisingly What doesn't work is removing the previous IPv6 address from a interface. This should be hooked into the edit page --- etc/inc/interfaces.inc | 35 +++++++++++++++++----- usr/local/www/firewall_virtual_ip_edit.php | 34 +++++++++++++++------ 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 2227788de2..f1b7179013 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1701,12 +1701,23 @@ function interface_carp_configure(&$vip) { return; } - /* Ensure CARP IP really exists prior to loading up. */ - $ww_subnet_ip = find_interface_ip($realif); - $ww_subnet_bits = find_interface_subnet($realif); - if (!ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits) && !ip_in_interface_alias_subnet($vip['interface'], $vip['subnet'])) { - file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IP address {$vip['subnet']}.", "Firewall: Virtual IP", ""); - return; + if(is_ipaddrv4($vip['subnet'])) { + /* Ensure CARP IP really exists prior to loading up. */ + $ww_subnet_ip = find_interface_ip($realif); + $ww_subnet_bits = find_interface_subnet($realif); + if (!ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits) && !ip_in_interface_alias_subnet($vip['interface'], $vip['subnet'])) { + file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IP address {$vip['subnet']}.", "Firewall: Virtual IP", ""); + return; + } + } + if(is_ipaddrv6($vip['subnet'])) { + /* Ensure CARP IP really exists prior to loading up. */ + $ww_subnet_ip = find_interface_ipv6($realif); + $ww_subnet_bits = find_interface_subnetv6($realif); + if (!ip_in_subnet($vip['subnet'], gen_subnetv6($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits) && !ip_in_interface_alias_subnet($vip['interface'], $vip['subnet'])) { + file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IPv6 address {$vip['subnet']}.", "Firewall: Virtual IP", ""); + return; + } } /* create the carp interface and setup */ @@ -1721,8 +1732,14 @@ function interface_carp_configure(&$vip) { /* invalidate interface cache */ get_interface_arr(true); - $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); - mwexec("/sbin/ifconfig {$vipif} {$vip['subnet']}/{$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} {$password}"); + if(is_ipaddrv4($vip['subnet'])) { + $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); + mwexec("/sbin/ifconfig {$vipif} {$vip['subnet']}/{$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} {$password}"); + } + if(is_ipaddrv6($vip['subnet'])) { + $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); + mwexec("/sbin/ifconfig {$vipif} inet6 {$vip['subnet']} prefixlen {$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} {$password}"); + } interfaces_bring_up($vipif); @@ -2347,6 +2364,7 @@ function find_dhclient_process($interface) { function interface_configure($interface = "wan", $reloadall = false, $linkupevent = false) { global $config, $g; global $interface_sn_arr_cache, $interface_ip_arr_cache; + global $interface_snv6_arr_cache, $interface_ipv6_arr_cache; $wancfg = $config['interfaces'][$interface]; @@ -2355,6 +2373,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if (!$g['booting']) { /* remove all IPv4 addresses */ while (mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " -alias", true) == 0); + while (mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 -alias", true) == 0); switch ($wancfg['ipaddr']) { case 'pppoe': diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 79398bd076..1706cfd421 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -116,9 +116,14 @@ if ($_POST) { $input_errors[] = sprintf(gettext("The %s IP address may not be used in a virtual entry."),$natdescr); } - if($_POST['subnet_bits'] == "32" and $_POST['type'] == "carp") - $input_errors[] = gettext("The /32 subnet mask is invalid for CARP IPs."); - + if(is_ipaddrv4($_POST['subnet'])) { + if($_POST['subnet_bits'] == "32" and $_POST['type'] == "carp") + $input_errors[] = gettext("The /32 subnet mask is invalid for CARP IPs."); + } + if(is_ipaddrv6($_POST['subnet'])) { + if($_POST['subnet_bits'] == "128" and $_POST['type'] == "carp") + $input_errors[] = gettext("The /128 subnet mask is invalid for CARP IPs."); + } /* check for overlaps with other virtual IP */ foreach ($a_vip as $vipent) { if (isset($id) && ($a_vip[$id]) && ($a_vip[$id] === $vipent)) @@ -144,11 +149,22 @@ if ($_POST) { if($_POST['password'] == "") $input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members."); - $parent_ip = get_interface_ip($_POST['interface']); - $parent_sn = get_interface_subnet($_POST['interface']); - if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { - $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; - $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); + if(is_ipaddrv4($_POST['subnet'])) { + $parent_ip = get_interface_ip($_POST['interface']); + $parent_sn = get_interface_subnet($_POST['interface']); + if (!ip_in_subnet($_POST['subnet'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { + $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; + $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); + } + } + if(is_ipaddrv6($_POST['subnet'])) { + $parent_ip = get_interface_ipv6($_POST['interface']); + $parent_sn = get_interface_subnetv6($_POST['interface']); + $subnet = gen_subnetv6($parent_ip, $parent_sn); + if (!ip_in_subnet($_POST['subnet'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { + $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; + $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); + } } } @@ -400,7 +416,7 @@ function typesel_change() {    / +
- +
- + autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value=""> / @@ -932,7 +932,8 @@ include("head.inc"); / diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 3fb4fba15c..08deb77544 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -173,7 +173,7 @@ include("head.inc"); / > +
+ + + + + +
+ .
+ .
+ + + + + > + +
+ +
+
+ + + + + +
   + / + +
+
+ + + + + + + > + +
+ +
+
+ + + + + +
   + + / + +
+
+
+ + + + + +
+ + +   + + "> " onclick="history.back()"> + + + + + + + + + + From 462f9006075313e1bdeb0cfe07db54e3156fda16 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 21 Jan 2011 09:48:53 +0100 Subject: [PATCH 114/329] Add filter code for adding the binat rules required for Network Prefix Translation --- etc/inc/filter.inc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 72435de4bf..c3044bd861 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1228,6 +1228,35 @@ function filter_nat_rules_generate() { $reflection_txt .= filter_generate_reflection_nat($rule, $route_table, $nat_if_list, "", $srcaddr, $srcip, $sn); } } + + /* Add binat rules for Network Prefix translation */ + if(is_array($config['nat']['npt'])) { + foreach ($config['nat']['npt'] as $rule) { + if (isset($rule['disabled'])) + continue; + + if (!$rule['interface']) + $natif = "wan"; + else + $natif = $rule['interface']; + if (!isset($FilterIflist[$natif])) + continue; + + $srcaddr = filter_generate_address($rule, 'source'); + $dstaddr = filter_generate_address($rule, 'destination'); + + $srcaddr = trim($srcaddr); + $dstaddr = trim($dstaddr); + + $natif = $FilterIflist[$natif]['descr']; + + $natrules .= "binat on \${$natif} from {$srcaddr} to any -> {$dstaddr}\n"; + $natrules .= "binat on \${$natif} from any to {$dstaddr} -> {$srcaddr}\n"; + + } + } + + $natrules .= "\n# Outbound NAT rules\n"; /* outbound rules - advanced or standard */ if(isset($config['nat']['advancedoutbound']['enable'])) { From e5d83b70cfb8ee128cc71b842e080abc7f8b218b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 22 Jan 2011 22:04:45 +0100 Subject: [PATCH 115/329] Fix dhcp server group --- etc/inc/services.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 1d923b05be..0fa3c98ee3 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -717,12 +717,12 @@ EOD; /* fire up dhcpd in a chroot */ if(count($dhcpdifs) > 0) { - mwexec("/usr/local/sbin/dhcpd -user dhcpd -group dhcpd -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpd.conf " . + mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpd.conf " . join(" ", $dhcpdifs)); } if(count($dhcpdv6ifs) > 0) { - mwexec("/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpdv6.conf " . + mwexec("/usr/local/sbin/dhcpd -6 -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpdv6.conf " . join(" ", $dhcpdv6ifs)); mwexec("/usr/sbin/rtadvd " . join(" ", $dhcpdv6ifs)); } From eac181cad00c25a90432ebbc35327ac9cfbed5b0 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 25 Jan 2011 16:50:23 -0200 Subject: [PATCH 116/329] BP: Add gettext() function #multilang --- usr/local/www/guiconfig.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 70f9459d8c..1e30482064 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -290,7 +290,7 @@ function print_info_box_np($msg, $name="apply",$value="Apply changes") { if($nifty_background == "") $nifty_background = "#FFF"; - if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { + if(stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false) { $savebutton = ""; $savebutton .= ""; if($_POST['if']) From b638ef519a8e1ad3e843c55e091fc2649e834797 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Ramos Date: Tue, 25 Jan 2011 16:50:23 -0200 Subject: [PATCH 117/329] BP: Add gettext() function #multilang --- usr/local/www/guiconfig.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 70f9459d8c..1e30482064 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -290,7 +290,7 @@ function print_info_box_np($msg, $name="apply",$value="Apply changes") { if($nifty_background == "") $nifty_background = "#FFF"; - if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { + if(stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false) { $savebutton = ""; $savebutton .= ""; if($_POST['if']) From 29bed6ca0b1755508fe94e4e73cc4eb306d1f2e8 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 11:41:16 +0100 Subject: [PATCH 118/329] Adjust the loopback firewall rules for inet and inet6 and give them unique labels --- etc/inc/filter.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index c3044bd861..1be7faa570 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2280,10 +2280,10 @@ EOD; $ipfrules .= << Date: Wed, 26 Jan 2011 11:43:27 +0100 Subject: [PATCH 119/329] Adjust firewall rule to reflect inet or inet6 --- etc/inc/filter.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 1be7faa570..686462492b 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2289,7 +2289,7 @@ EOD; $ipfrules .= << Date: Wed, 26 Jan 2011 11:45:11 +0100 Subject: [PATCH 120/329] Setup packet spoofing rules for inet and inet6 Adjust the default Deny All rules for inet and inet6, rename labels --- etc/inc/filter.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 686462492b..091f026d16 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2082,14 +2082,16 @@ function filter_rules_generate() { #--------------------------------------------------------------------------- # default deny rules #--------------------------------------------------------------------------- -block in $log all label "Default deny rule" -block out $log all label "Default deny rule" +block in $log inet all label "Default deny rule IPv4" +block out $log inet all label "Default deny rule IPv4" block in $log inet6 all label "Default deny rule IPv6" block out $log inet6 all label "Default deny rule IPv6" # We use the mighty pf, we cannot be fooled. block quick inet proto { tcp, udp } from any port = 0 to any block quick inet proto { tcp, udp } from any to any port = 0 +block quick inet6 proto { tcp, udp } from any port = 0 to any +block quick inet6 proto { tcp, udp } from any to any port = 0 EOD; From b0538842600fe7bd8af9124d637a31c232ccc35d Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 11:54:36 +0100 Subject: [PATCH 121/329] Add the IPv6 fc00::/7 and fEc0::/10 to the Private block on WAN --- etc/inc/filter.inc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 091f026d16..b6c39dcfc4 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2214,10 +2214,12 @@ EOD; $ipfrules .= << Date: Wed, 26 Jan 2011 12:53:20 +0100 Subject: [PATCH 122/329] Add the bogonsv6 table for the IPv6 bogons --- etc/rc.update_bogons.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/etc/rc.update_bogons.sh b/etc/rc.update_bogons.sh index 52cfc1abf3..52ec92f151 100755 --- a/etc/rc.update_bogons.sh +++ b/etc/rc.update_bogons.sh @@ -28,6 +28,15 @@ if [ ! -f /tmp/bogons ]; then exit fi +/usr/bin/fetch -q -o /tmp/bogonsv6 "http://files.pfsense.org/mirrors/fullbogons-ipv6.txt" +if [ ! -f /tmp/bogonsv6 ]; then + echo "Could not download http://files.pfsense.org/mirrors/fullbogons-ipv6.txt" | logger + # Relaunch and sleep + sh /etc/rc.update_bogons.sh & + exit +fi + + BOGON_MD5=`/usr/bin/fetch -q -o - "http://files.pfsense.org/mirrors/bogon-bn-nonagg.txt.md5" | awk '{ print $4 }'` ON_DISK_MD5=`md5 /tmp/bogons | awk '{ print $4 }'` if [ "$BOGON_MD5" = "$ON_DISK_MD5" ]; then @@ -42,5 +51,19 @@ else sh /etc/rc.update_bogons.sh & fi +BOGON_MD5=`/usr/bin/fetch -q -o - "http://files.pfsense.org/mirrors/fullbogons-ipv6.txt.md5" | awk '{ print $4 }'` +ON_DISK_MD5=`md5 /tmp/bogonsv6 | awk '{ print $4 }'` +if [ "$BOGON_MD5" = "$ON_DISK_MD5" ]; then + egrep -v "^#" /tmp/bogonsv6 > /etc/bogonsv6 + /etc/rc.conf_mount_ro + RESULT=`/sbin/pfctl -t bogonsv6 -T replace -f /etc/bogonsv6 2>&1` + rm /tmp/bogons + echo "Bogons files downloaded: $RESULT" | logger +else + echo "Could not download http://files.pfsense.org/mirrors/fullbogons-ipv6.txt.md5 (md5 mismatch)" | logger + # Relaunch and sleep + sh /etc/rc.update_bogons.sh & +fi + echo "rc.update_bogons.sh is ending the update cycle." | logger From 1525ca4c9dcf2816f76ced484eb3b9c7b4dc035c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 12:55:22 +0100 Subject: [PATCH 123/329] reference the IPv6 bogons table as well --- etc/inc/filter.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index b6c39dcfc4..ad7a98651f 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2189,10 +2189,13 @@ EOD; if(isset($config['interfaces'][$on]['blockbogons'])) { if($bogontableinstalled == 0) $ipfrules .= "table persist file \"/etc/bogons\"\n"; + $ipfrules .= "table persist file \"/etc/bogonsv6\"\n"; $ipfrules .= << to any label "block bogon networks from {$oc['descr']}" +# http://www.team-cymru.org/Services/Bogons/fullbogons-ipv6.txt +block in $log quick on \${$oc['descr']} from to any label "block bogon IPv4 networks from {$oc['descr']}" +block in $log quick on \${$oc['descr']} from to any label "block bogon IPv6 networks from {$oc['descr']}" EOD; $bogontableinstalled++; From 80766f711abe51660dd18cf721452aff48aad370 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 13:14:00 +0100 Subject: [PATCH 124/329] Do not block fec0::/10 as this includes fe80:: local link addresses which breaks everything else --- etc/inc/filter.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ad7a98651f..635afbd70e 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2222,7 +2222,6 @@ block in $log quick on \${$oc['descr']} from 127.0.0.0/8 to any label "Block pri block in $log quick on \${$oc['descr']} from 172.16.0.0/12 to any label "Block private networks from {$oc['descr']} block 172.16/12" block in $log quick on \${$oc['descr']} from 192.168.0.0/16 to any label "Block private networks from {$oc['descr']} block 192.168/16" block in $log quick on \${$oc['descr']} from fc00::/7 to any label "Block ULA networks from {$oc['descr']} block fc00::/7" -block in $log quick on \${$oc['descr']} from fec0::/10 to any label "Block ULA networks from {$oc['descr']} block fec0::/10" EOD; } From 1f321f668f823128894465f9f764a369b4abc22b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 13:22:46 +0100 Subject: [PATCH 125/329] Move the ICMP rules further to the top in order for normal neighbour contact via icmp6 to work --- etc/inc/filter.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 635afbd70e..ae54409d37 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2087,6 +2087,11 @@ block out $log inet all label "Default deny rule IPv4" block in $log inet6 all label "Default deny rule IPv6" block out $log inet6 all label "Default deny rule IPv6" +# IPv6 ICMP is not auxilary, it is required for operation +#pass out quick proto ipv6-icmp from any to any keep state +# Allow only bare essential icmpv6 packets (NS, NA, and RA) +pass quick inet6 proto ipv6-icmp from any to any icmp6-type {neighbradv,neighbrsol,routeradv} + # We use the mighty pf, we cannot be fooled. block quick inet proto { tcp, udp } from any port = 0 to any block quick inet proto { tcp, udp } from any to any port = 0 @@ -2298,11 +2303,6 @@ EOD; pass out inet all keep state allow-opts label "let out anything IPv4 from firewall host itself" pass out inet6 all keep state allow-opts label "let out anything IPv6 from firewall host itself" -# IPv6 ICMP is not auxilary, it is required for operation -#pass out quick proto ipv6-icmp from any to any keep state -# Allow only bare essential icmpv6 packets (NS, NA, and RA) -pass quick inet6 proto ipv6-icmp from any to any icmp6-type {neighbradv,neighbrsol,routeradv} - EOD; foreach ($FilterIflist as $ifdescr => $ifcfg) { if(isset($ifcfg['virtual'])) From 2259901018552f8a8432e295b8d6064fa918cda0 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 14:27:08 +0100 Subject: [PATCH 126/329] Show the TCP protocol for ipv6 filter rules --- etc/inc/filter_log.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index ed4b311790..1c0e9ef6fe 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -135,6 +135,8 @@ function parse_filter_line($line) { * boolean FALSE because it could return a valid answer of 0 upon success. */ if (!(strpos($details, 'proto ') === FALSE)) { preg_match("/.*\sproto\s(.*)\s\(/", $details, $proto); + } elseif (!(strpos($details, 'next-header ') === FALSE)) { + preg_match("/.*\snext-header\s(.*)\s\(/", $details, $proto); } elseif (!(strpos($details, 'proto: ') === FALSE)) { preg_match("/.*\sproto\:(.*)\s\(/", $details, $proto); } elseif (!(strpos($leftovers, 'sum ok] ') === FALSE)) { @@ -279,4 +281,4 @@ function handle_ajax($nentries, $tail = 50) { } } -?> \ No newline at end of file +?> From 9caffe86931b6db4002c4323ec6ec4bced96e422 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 26 Jan 2011 17:21:29 +0100 Subject: [PATCH 127/329] Remove duplicate advbase in ifconfig command --- etc/inc/interfaces.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 035a6c293e..fa1203b249 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1852,11 +1852,11 @@ function interface_carp_configure(&$vip) { if(is_ipaddrv4($vip['subnet'])) { $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); - mwexec("/sbin/ifconfig {$vipif} {$vip['subnet']}/{$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} advbase {$advbase} {$password}"); + mwexec("/sbin/ifconfig {$vipif} {$vip['subnet']}/{$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} {$advbase} {$password}"); } if(is_ipaddrv6($vip['subnet'])) { $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); - mwexec("/sbin/ifconfig {$vipif} inet6 {$vip['subnet']} prefixlen {$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} advbase {$advbase} {$password}"); + mwexec("/sbin/ifconfig {$vipif} inet6 {$vip['subnet']} prefixlen {$vip['subnet_bits']} vhid {$vip['vhid']} advskew {$vip['advskew']} {$advbase} {$password}"); } interfaces_bring_up($vipif); From 6ac28fbd1c8337dac96dd25a06b7d3d47ca13a98 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 27 Jan 2011 08:34:35 +0100 Subject: [PATCH 128/329] Add the bogonsv6 file, it's empty for now --- etc/bogonsv6 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 etc/bogonsv6 diff --git a/etc/bogonsv6 b/etc/bogonsv6 new file mode 100644 index 0000000000..e69de29bb2 From b3cf4d5abd6b3b186c54c98dd4f04dcdbec6b20f Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 28 Jan 2011 15:17:04 +0100 Subject: [PATCH 129/329] adjust the firewall rules to allow for proper ICMP6 allow so that normal pmtu works --- etc/inc/filter.inc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6fbcbcaa69..e9537cb330 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1380,8 +1380,6 @@ function filter_nat_rules_generate() { } if($numberofnathosts > 0): foreach ($FilterIflist as $if => $ifcfg) { - if (substr($ifcfg['if'], 0, 4) == "ovpn") - continue; update_filter_reload_status("Creating outbound rules {$if} - ({$ifcfg['descr']})"); if(interface_has_gateway($if)) { $target = $ifcfg['ip']; @@ -2090,9 +2088,22 @@ block in $log inet6 all label "Default deny rule IPv6" block out $log inet6 all label "Default deny rule IPv6" # IPv6 ICMP is not auxilary, it is required for operation -#pass out quick proto ipv6-icmp from any to any keep state -# Allow only bare essential icmpv6 packets (NS, NA, and RA) -pass quick inet6 proto ipv6-icmp from any to any icmp6-type {neighbradv,neighbrsol,routeradv} +# See man icmp6(4) +# 1 unreach Destination unreachable +# 2 toobig Packet too big +# 128 echoreq Echo service request +# 129 echorep Echo service reply +# 133 routersol Router solicitation +# 134 routeradv Router advertisement +# 135 neighbrsol Neighbor solicitation +# 136 neighbradv Neighbor advertisement +pass quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,128,129,135,136} keep state + +# Allow only bare essential icmpv6 packets (NS, NA, and RA, echoreq, echorep) +pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} keep state +pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} keep state +pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} keep state +pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {129,133,134,135,136} keep state # We use the mighty pf, we cannot be fooled. block quick inet proto { tcp, udp } from any port = 0 to any From 161cc65b3f28bd50ef53eab3493cea23786d722e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 28 Jan 2011 15:27:59 +0100 Subject: [PATCH 130/329] Activate the firewall rules for DHCPDv6. Add pass in to port 546, pass out to 547 --- etc/inc/filter.inc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index e9537cb330..8628fee896 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2285,11 +2285,9 @@ EOD; # allow access to DHCPv6 server on {$oc['descr']} anchor "dhcpv6server{$oc['descr']}" # We need inet6 icmp for stateless autoconfig and dhcpv6 -pass in on \${$oc['descr']} inet6 proto ipv6-icmp from fe80::/10 to ff02::/10 label "allow access to DHCPv6 server" -pass out on \${$oc['descr']} inet6 proto ipv6-icmp from fe80::/10 to ff02::/10 label "allow access to DHCPv6 server" -#pass in on \${$oc['descr']} inet6 proto udp from fe80::/10 to ff02::/10 port = 546 label "allow access to DHCPv6 server" -#pass in on \${$oc['descr']} inet6 proto udp from fe80::/10 to {$oc['ipv6']} port = 546 label "allow access to DHCPv6 server" -#pass out on \${$oc['descr']} inet6 proto udp from {$oc['ipv6']} port = 546 to any label "allow access to DHCPv6 server" +pass in on \${$oc['descr']} inet6 proto udp from fe80::/10 to ff02::/16 port = 546 label "allow access to DHCPv6 server" +pass in on \${$oc['descr']} inet6 proto udp from fe80::/10 to {$oc['ipv6']} port = 546 label "allow access to DHCPv6 server" +pass out on \${$oc['descr']} inet6 proto udp from {$oc['ipv6']} port = 547 to fe80::/10 label "allow access to DHCPv6 server" EOD; } From 9bc8b6b61d92d1dea51a325337d07f305ddac816 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 31 Jan 2011 20:36:24 +0100 Subject: [PATCH 131/329] Add support for IPv6 counters to the RRD graphs. This adds 4 more data sources in the rrd file. The graphing code colors are currently a mismatch and sorts waiting for someone with eyes to adjust to something useful Other themes still need adjusting Packets graph isn't done, that needs the same modification as the traffic counters. updaterrd.sh shell script needs simplyfying and using variables instead of huge amounts of pfctl commands --- etc/inc/globals.inc | 2 +- etc/inc/rrd.inc | 24 ++++-- etc/inc/upgrade_config.inc | 84 ++++++++++++++++++- usr/local/www/status_rrd_graph_img.php | 80 ++++++++++++++++-- .../www/themes/pfsense_ng/rrdcolors.inc.php | 8 +- .../www/themes/the_wall/rrdcolors.inc.php | 8 +- 6 files changed, 182 insertions(+), 24 deletions(-) diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index 6f64478e23..b20700420e 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -89,7 +89,7 @@ $g = array( "disablehelpmenu" => false, "disablehelpicon" => false, "debug" => false, - "latest_config" => "7.6", + "latest_config" => "7.7", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "105", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 21de58bc39..7ff761f31e 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -278,6 +278,10 @@ function enable_rrd_graphing() { $rrdcreate .= "DS:outpass:COUNTER:$trafficvalid:0:$upstream "; $rrdcreate .= "DS:inblock:COUNTER:$trafficvalid:0:$downstream "; $rrdcreate .= "DS:outblock:COUNTER:$trafficvalid:0:$upstream "; + $rrdcreate .= "DS:inpass6:COUNTER:$trafficvalid:0:$downstream "; + $rrdcreate .= "DS:outpass6:COUNTER:$trafficvalid:0:$upstream "; + $rrdcreate .= "DS:inblock6:COUNTER:$trafficvalid:0:$downstream "; + $rrdcreate .= "DS:outblock6:COUNTER:$trafficvalid:0:$upstream "; $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 "; $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 "; @@ -288,14 +292,16 @@ function enable_rrd_graphing() { /* enter UNKNOWN values in the RRD so it knows we rebooted. */ if($g['booting']) { - mwexec("$rrdtool update $rrddbpath$ifname$traffic N:U:U:U:U"); + mwexec("$rrdtool update $rrddbpath$ifname$traffic N:U:U:U:U:U:U:U:U"); } $rrdupdatesh .= "\n"; - $rrdupdatesh .= "# polling traffic for interface $ifname $realif \n"; + $rrdupdatesh .= "# polling traffic for interface $ifname $realif IPv4/IPv6 counters \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$traffic N:\\\n"; $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$6 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'`\\\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Pass|Out6\/Pass/ {printf \$6 \":\"}'`\\\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Block|Out6\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; /* PACKETS, set up the rrd file */ if (!file_exists("$rrddbpath$ifname$packets")) { @@ -304,6 +310,10 @@ function enable_rrd_graphing() { $rrdcreate .= "DS:outpass:COUNTER:$packetsvalid:0:$upstream "; $rrdcreate .= "DS:inblock:COUNTER:$packetsvalid:0:$downstream "; $rrdcreate .= "DS:outblock:COUNTER:$packetsvalid:0:$upstream "; + $rrdcreate .= "DS:inpass6:COUNTER:$packetsvalid:0:$downstream "; + $rrdcreate .= "DS:outpass6:COUNTER:$packetsvalid:0:$upstream "; + $rrdcreate .= "DS:inblock6:COUNTER:$packetsvalid:0:$downstream "; + $rrdcreate .= "DS:outblock6:COUNTER:$packetsvalid:0:$upstream "; $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 "; $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 "; @@ -314,14 +324,16 @@ function enable_rrd_graphing() { /* enter UNKNOWN values in the RRD so it knows we rebooted. */ if($g['booting']) { - mwexec("$rrdtool update $rrddbpath$ifname$packets N:U:U:U:U"); + mwexec("$rrdtool update $rrddbpath$ifname$packets N:U:U:U:U:U:U:U:U"); } $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling packets for interface $ifname $realif \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$packets N:\\\n"; $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'`\\\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Pass|Out6\/Pass/ {printf \$4 \":\"}'`\\\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Block|Out6\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; /* WIRELESS, set up the rrd file */ if($config['interfaces'][$ifname]['wireless']['mode'] == "bss") { @@ -695,4 +707,4 @@ function kill_traffic_collector() { mwexec("/bin/pkill -f updaterrd.sh", true); } -?> \ No newline at end of file +?> diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 0454475980..3da149ac4c 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -1748,7 +1748,7 @@ function upgrade_054_to_055() { $xmldumpnew = "{$database}.new.xml"; if ($g['booting']) - echo "Migrate RRD database {$database} to new format \n"; + echo "Migrate RRD database {$database} to new format for IPv6 \n"; mwexec("$rrdtool tune {$rrddbpath}{$database} -r roundtrip:delay 2>&1"); dump_rrd_to_xml("{$rrddbpath}/{$database}", "{$g['tmp_path']}/{$xmldump}"); @@ -2298,4 +2298,86 @@ function upgrade_075_to_076() { $config['cron']['item'][] = $cron_item; } +function upgrade_076_to_077() { + global $config; + global $g; + + /* RRD files changed for quality, traffic and packets graphs */ + /* convert traffic RRD file */ + global $parsedcfg, $listtags; + $listtags = array("ds", "v", "rra", "row"); + + $rrddbpath = "/var/db/rrd/"; + $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; + + $rrdinterval = 60; + $valid = $rrdinterval * 2; + + /* Asume GigE for now */ + $downstream = 125000000; + $upstream = 125000000; + + /* build a list of traffic and packets databases */ + $databases = array(); + exec("cd $rrddbpath;/usr/bin/find *-traffic.rrd *-packets.rrd", $databases); + rsort($databases); + foreach($databases as $database) { + $databasetmp = "{$database}.tmp"; + $xmldump = "{$database}.old.xml"; + $xmldumptmp = "{$database}.tmp.xml"; + $xmldumpnew = "{$database}.new.xml"; + + if ($g['booting']) + echo "Migrate RRD database {$database} to new format.\n"; + + /* 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}"); + + $rrdoldxml = file_get_contents("{$g['tmp_path']}/{$xmldump}"); + $rrdold = xml2array($rrdoldxml, 1, "tag"); + $rrdold = $rrdold['rrd']; + + $rrdnewxml = file_get_contents("{$g['tmp_path']}/{$xmldumptmp}"); + $rrdnew = xml2array($rrdnewxml, 1, "tag"); + $rrdnew = $rrdnew['rrd']; + + /* remove any MAX RRA's. Not needed for traffic. */ + $i = 0; + foreach ($rrdold['rra'] as $rra) { + if(trim($rra['cf']) == "MAX") { + unset($rrdold['rra'][$i]); + } + $i++; + } + + $rrdxmlarray = migrate_rrd_format($rrdold, $rrdnew); + $rrdxml = dump_xml_config_raw($rrdxmlarray, "rrd"); + file_put_contents("{$g['tmp_path']}/{$xmldumpnew}", $rrdxml); + mwexec("$rrdtool restore -f {$g['tmp_path']}/{$xmldumpnew} {$rrddbpath}/{$database} 2>&1"); + + } + enable_rrd_graphing(); + if ($g['booting']) + echo "Updating configuration..."; +} + ?> diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 46102337b2..a7bd375fb8 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -192,10 +192,10 @@ if(file_exists($rrdcolors)) { include($rrdcolors); } else { log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme'])); - $colortrafficup = array("666666", "CCCCCC"); - $colortrafficdown = array("990000", "CC0000"); - $colorpacketsup = array("666666", "CCCCCC"); - $colorpacketsdown = array("990000", "CC0000"); + $colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); + $colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); @@ -281,67 +281,131 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "DEF:$curif-in_bytes_block=$rrddbpath$curdatabase:inblock:AVERAGE "; $graphcmd .= "DEF:$curif-out_bytes_block=$rrddbpath$curdatabase:outblock:AVERAGE "; + $graphcmd .= "DEF:$curif-in6_bytes_pass=$rrddbpath$curdatabase:inpass6:AVERAGE "; + $graphcmd .= "DEF:$curif-out6_bytes_pass=$rrddbpath$curdatabase:outpass6:AVERAGE "; + $graphcmd .= "DEF:$curif-in6_bytes_block=$rrddbpath$curdatabase:inblock6:AVERAGE "; + $graphcmd .= "DEF:$curif-out6_bytes_block=$rrddbpath$curdatabase:outblock6:AVERAGE "; + $graphcmd .= "CDEF:\"$curif-in_bits_pass=$curif-in_bytes_pass,8,*\" "; $graphcmd .= "CDEF:\"$curif-out_bits_pass=$curif-out_bytes_pass,8,*\" "; $graphcmd .= "CDEF:\"$curif-in_bits_block=$curif-in_bytes_block,8,*\" "; $graphcmd .= "CDEF:\"$curif-out_bits_block=$curif-out_bytes_block,8,*\" "; + $graphcmd .= "CDEF:\"$curif-in6_bits_pass=$curif-in6_bytes_pass,8,*\" "; + $graphcmd .= "CDEF:\"$curif-out6_bits_pass=$curif-out6_bytes_pass,8,*\" "; + $graphcmd .= "CDEF:\"$curif-in6_bits_block=$curif-in6_bytes_block,8,*\" "; + $graphcmd .= "CDEF:\"$curif-out6_bits_block=$curif-out6_bytes_block,8,*\" "; + $graphcmd .= "CDEF:\"$curif-in_bytes=$curif-in_bytes_pass,$curif-in_bytes_block,+\" "; $graphcmd .= "CDEF:\"$curif-out_bytes=$curif-out_bytes_pass,$curif-out_bytes_block,+\" "; $graphcmd .= "CDEF:\"$curif-in_bits=$curif-in_bits_pass,$curif-in_bits_block,+\" "; $graphcmd .= "CDEF:\"$curif-out_bits=$curif-out_bits_pass,$curif-out_bits_block,+\" "; + $graphcmd .= "CDEF:\"$curif-in6_bytes=$curif-in6_bytes_pass,$curif-in6_bytes_block,+\" "; + $graphcmd .= "CDEF:\"$curif-out6_bytes=$curif-out6_bytes_pass,$curif-out6_bytes_block,+\" "; + $graphcmd .= "CDEF:\"$curif-in6_bits=$curif-in6_bits_pass,$curif-in6_bits_block,+\" "; + $graphcmd .= "CDEF:\"$curif-out6_bits=$curif-out6_bits_pass,$curif-out6_bits_block,+\" "; + $graphcmd .= "CDEF:\"$curif-bits_io=$curif-in_bits,$curif-out_bits,+\" "; $graphcmd .= "CDEF:\"$curif-out_bits_block_neg=$curif-out_bits_block,$multiplier,*\" "; $graphcmd .= "CDEF:\"$curif-out_bits_pass_neg=$curif-out_bits_pass,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-bits6_io=$curif-in6_bits,$curif-out6_bits,+\" "; + $graphcmd .= "CDEF:\"$curif-out6_bits_block_neg=$curif-out6_bits_block,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-out6_bits_pass_neg=$curif-out6_bits_pass,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_out_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_in_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_out_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in6_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_out6_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in6_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_out6_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_pass=$curif-bytes_in_pass,$curif-bytes_out_pass,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_block=$curif-bytes_in_block,$curif-bytes_out_block,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_pass6=$curif-bytes_in6_pass,$curif-bytes_out6_pass,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_block6=$curif-bytes_in6_block,$curif-bytes_out6_block,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in_t_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_out_t_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_in_t_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-bytes_out_t_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in6_t_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_out6_t_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_in6_t_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_out6_t_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-bytes_t_pass=$curif-bytes_in_t_pass,$curif-bytes_out_t_pass,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_t_block=$curif-bytes_in_t_block,$curif-bytes_out_t_block,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_t=$curif-bytes_in_t_pass,$curif-bytes_out_t_block,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_t_pass6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_pass,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_t_block6=$curif-bytes_in6_t_block,$curif-bytes_out6_t_block,+\" "; + $graphcmd .= "CDEF:\"$curif-bytes_t6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_block,+\" "; + $graphcmd .= "AREA:\"$curif-in_bits_block#{$colortrafficdown[1]}:$curif-in-block\" "; $graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" "; + $graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block\" "; + $graphcmd .= "AREA:\"$curif-in6_bits_pass#{$colortrafficdown[2]}:$curif-in6-pass:STACK\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" "; + $graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block\" "; + $graphcmd .= "{$AREA}:\"$curif-out6_bits_pass_neg#{$colortrafficup[2]}:$curif-out6-pass:STACK\" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" "; - $graphcmd .= "COMMENT:\"in-pass\t\" "; + $graphcmd .= "COMMENT:\"IPv4 in-pass\t\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:LAST:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-bytes_in_t_pass:AVERAGE:%7.2lf %sB i\" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"out-pass\t\" "; + $graphcmd .= "COMMENT:\"IPv4 out-pass\t\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_pass:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_pass:LAST:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-bytes_out_t_pass:AVERAGE:%7.2lf %sB o\" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"in-block\t\" "; + $graphcmd .= "COMMENT:\"IPv4 in-block\t\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_block:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_block:AVERAGE:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_block:LAST:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-bytes_in_t_block:AVERAGE:%7.2lf %sB i\" "; $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"out-block\t\" "; + $graphcmd .= "COMMENT:\"IPv4 out-block\t\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_block:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_block:AVERAGE:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-out_bits_block:LAST:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" "; $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"IPv6 in-pass\t\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_pass:MAX:%7.2lf %sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_pass:LAST:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-bytes_in6_t_pass:AVERAGE:%7.2lf %sB i\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"IPv6 out-pass\t\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_pass:MAX:%7.2lf %sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_pass:LAST:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-bytes_out6_t_pass:AVERAGE:%7.2lf %sB o\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"IPv6 in-block\t\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_block:MAX:%7.2lf %sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_block:AVERAGE:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-in6_bits_block:LAST:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-bytes_in6_t_block:AVERAGE:%7.2lf %sB i\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"IPv6 out-block\t\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_block:MAX:%7.2lf %sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_block:AVERAGE:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" "; + $graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" "; + $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, "-throughput.rrd")) { diff --git a/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php b/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php index 8e7454552a..246b717d76 100644 --- a/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php @@ -30,10 +30,10 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); + $colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); + $colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/the_wall/rrdcolors.inc.php b/usr/local/www/themes/the_wall/rrdcolors.inc.php index 8e7454552a..246b717d76 100644 --- a/usr/local/www/themes/the_wall/rrdcolors.inc.php +++ b/usr/local/www/themes/the_wall/rrdcolors.inc.php @@ -30,10 +30,10 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); + $colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); + $colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); + $colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); From d55ea9701f45ea85d840ca850f44382aa138014c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 09:12:22 +0100 Subject: [PATCH 132/329] Change wording --- etc/inc/upgrade_config.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 3da149ac4c..1ae34d13d4 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2328,7 +2328,7 @@ function upgrade_076_to_077() { $xmldumpnew = "{$database}.new.xml"; if ($g['booting']) - echo "Migrate RRD database {$database} to new format.\n"; + echo "Migrate RRD database {$database} to new format for IPv6.\n"; /* dump contents to xml and move database out of the way */ dump_rrd_to_xml("{$rrddbpath}/{$database}", "{$g['tmp_path']}/{$xmldump}"); From 41dfef338f87734930eb2bea25450057e22d237a Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 09:19:07 +0100 Subject: [PATCH 133/329] Show IPv6 addresses in the banner message --- etc/rc.banner | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/etc/rc.banner b/etc/rc.banner index 6f81cb99a2..d80ed07b74 100755 --- a/etc/rc.banner +++ b/etc/rc.banner @@ -70,15 +70,23 @@ break; } $ipaddr = get_interface_ip($ifname); + $subnet = get_interface_subnet($ifname); + $ipaddr6 = get_interface_ipv6($ifname); + $subnet6 = get_interface_subnetv6($ifname); $realif = get_real_interface($ifname); $tobanner = "{$friendly} ({$ifname})"; - printf("\n %-25s -> %-10s -> %s %s", + $ipaddr ? $ipaddr : "NONE"; + + printf("\n %-18s -> %-8s -> %s/%s %s/%s %s", $tobanner, $realif, - $ipaddr ? $ipaddr : "NONE", + $ipaddr, + $subnet, + $ipaddr6, + $subnet6, $class ); } -?> \ No newline at end of file +?> From eef5ca2e53e2c56aeae86029a3efbda6731a895c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 09:41:09 +0100 Subject: [PATCH 134/329] Simplify the updaterrd.sh to reduce the amount of pfctl calls --- etc/inc/rrd.inc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 7ff761f31e..6914b2ea02 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -298,10 +298,7 @@ function enable_rrd_graphing() { $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling traffic for interface $ifname $realif IPv4/IPv6 counters \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$traffic N:\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$6 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Pass|Out6\/Pass/ {printf \$6 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Block|Out6\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass|In6\/Pass|Out6\/Pass|In4\/Block|Out4\/Block|In6\/Block|Out6\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; /* PACKETS, set up the rrd file */ if (!file_exists("$rrddbpath$ifname$packets")) { @@ -330,10 +327,7 @@ function enable_rrd_graphing() { $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling packets for interface $ifname $realif \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$packets N:\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Pass|Out6\/Pass/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In6\/Block|Out6\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass|In6\/Pass|Out6\/Pass|In4\/Block|Out4\/Block|In6\/Block|Out6\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; /* WIRELESS, set up the rrd file */ if($config['interfaces'][$ifname]['wireless']['mode'] == "bss") { From f668cbcf712a5f19e9e9261ae9757914da285435 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 09:53:46 +0100 Subject: [PATCH 135/329] Make interface name 2 longer --- etc/rc.banner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.banner b/etc/rc.banner index d80ed07b74..7a3d50ffb3 100755 --- a/etc/rc.banner +++ b/etc/rc.banner @@ -78,7 +78,7 @@ $ipaddr ? $ipaddr : "NONE"; - printf("\n %-18s -> %-8s -> %s/%s %s/%s %s", + printf("\n %-18s -> %-10s -> %s/%s %s/%s %s", $tobanner, $realif, $ipaddr, From fea1b66d061a6b7b42f9d791ac03db156bc4b145 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 10:02:23 +0100 Subject: [PATCH 136/329] Further rc.banner display adjustment --- etc/rc.banner | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/etc/rc.banner b/etc/rc.banner index 7a3d50ffb3..1134565f83 100755 --- a/etc/rc.banner +++ b/etc/rc.banner @@ -76,15 +76,13 @@ $realif = get_real_interface($ifname); $tobanner = "{$friendly} ({$ifname})"; - $ipaddr ? $ipaddr : "NONE"; - - printf("\n %-18s -> %-10s -> %s/%s %s/%s %s", + printf("\n %-15s -> %-10s -> %s/%s %s/%s %s", $tobanner, $realif, - $ipaddr, - $subnet, - $ipaddr6, - $subnet6, + $ipaddr ? $ipaddr : "NONE", + $subnet ? $subnet : "NONE", + $ipaddr6 ? $ipaddr6 : "NONE", + $subnet6 ? $subnet6 : "NONE", $class ); } From 2845d097c35cf32aca6c227c4d32c7a6519e28f5 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 10:08:04 +0100 Subject: [PATCH 137/329] Further improvements on the ICMP6 allow rules --- etc/inc/filter.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 8628fee896..8b6b5d21fa 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2104,6 +2104,7 @@ pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128 pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} keep state pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {129,133,134,135,136} keep state +pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe02::/16 icmp6-type {129,133,134,135,136} keep state # We use the mighty pf, we cannot be fooled. block quick inet proto { tcp, udp } from any port = 0 to any From 9991ff2c7f1f06068d0184d63e907c2e118063ce Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 10:43:02 +0100 Subject: [PATCH 138/329] Fix the find_subnet v6 function to properly return the tunnel subnet --- etc/inc/interfaces.inc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index fa1203b249..05427c7018 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3424,7 +3424,10 @@ function find_interface_ipv6($interface, $flush = false) $parts = explode(" ", $line); if(! preg_match("/fe80::/", $parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; - $ifinfo['subnetbitsv6'] = $parts[3]; + if($parts[2] == "-->") + $ifinfo['subnetbitsv6'] = $parts[5]; + else + $ifinfo['subnetbitsv6'] = $parts[3]; } } } @@ -3464,6 +3467,19 @@ function find_interface_subnetv6($interface, $flush = false) if (!isset($interface_snv6_arr_cache[$interface]) or $flush) { $ifinfo = pfSense_get_interface_addresses($interface); + exec("/sbin/ifconfig {$interface} inet6", $output); + foreach($output as $line) { + if(preg_match("/inet6/", $line)) { + $parts = explode(" ", $line); + if(! preg_match("/fe80::/", $parts[1])) { + $ifinfo['ipaddrv6'] = $parts[1]; + if($parts[2] == "-->") + $ifinfo['subnetbitsv6'] = $parts[5]; + else + $ifinfo['subnetbitsv6'] = $parts[3]; + } + } + } $interface_ipv6_arr_cache[$interface] = $ifinfo['ipaddrv6']; $interface_snv6_arr_cache[$interface] = $ifinfo['subnetbitsv6']; } From d49816e58e8b46fc946c2637295ba18afbc4767a Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 12:28:41 +0100 Subject: [PATCH 139/329] kill rrdtool before killing shellscripts --- etc/inc/rrd.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 6914b2ea02..d811a8561b 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -698,6 +698,8 @@ function enable_rrd_graphing() { } function kill_traffic_collector() { + mwexec("killall rrdtool", true); + sleep(1); mwexec("/bin/pkill -f updaterrd.sh", true); } From bf7c16747836677c90c68716372691fb5c88c02b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 15:16:42 +0100 Subject: [PATCH 140/329] Add the IPv6 counters to the packets graph, also make all traffic counters stack --- usr/local/www/status_rrd_graph_img.php | 59 +++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index a7bd375fb8..6f924982a6 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -350,11 +350,11 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "AREA:\"$curif-in_bits_block#{$colortrafficdown[1]}:$curif-in-block\" "; $graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" "; - $graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block\" "; + $graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block:STACK\" "; $graphcmd .= "AREA:\"$curif-in6_bits_pass#{$colortrafficdown[2]}:$curif-in6-pass:STACK\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" "; - $graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block\" "; + $graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block:STACK\" "; $graphcmd .= "{$AREA}:\"$curif-out6_bits_pass_neg#{$colortrafficup[2]}:$curif-out6-pass:STACK\" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" "; @@ -549,33 +549,64 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat $graphcmd .= "DEF:\"$curif-in_pps_block=$rrddbpath$curdatabase:inblock:AVERAGE\" "; $graphcmd .= "DEF:\"$curif-out_pps_block=$rrddbpath$curdatabase:outblock:AVERAGE\" "; + $graphcmd .= "DEF:\"$curif-in6_pps_pass=$rrddbpath$curdatabase:inpass6:AVERAGE\" "; + $graphcmd .= "DEF:\"$curif-out6_pps_pass=$rrddbpath$curdatabase:outpass6:AVERAGE\" "; + $graphcmd .= "DEF:\"$curif-in6_pps_block=$rrddbpath$curdatabase:inblock6:AVERAGE\" "; + $graphcmd .= "DEF:\"$curif-out6_pps_block=$rrddbpath$curdatabase:outblock6:AVERAGE\" "; + $graphcmd .= "CDEF:\"$curif-in_pps=$curif-in_pps_pass,$curif-in_pps_block,+\" "; $graphcmd .= "CDEF:\"$curif-out_pps=$curif-out_pps_pass,$curif-out_pps_block,+\" "; $graphcmd .= "CDEF:\"$curif-out_pps_pass_neg=$curif-out_pps_pass,$multiplier,*\" "; $graphcmd .= "CDEF:\"$curif-out_pps_block_neg=$curif-out_pps_block,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-in6_pps=$curif-in6_pps_pass,$curif-in6_pps_block,+\" "; + $graphcmd .= "CDEF:\"$curif-out6_pps=$curif-out6_pps_pass,$curif-out6_pps_block,+\" "; + $graphcmd .= "CDEF:\"$curif-out6_pps_pass_neg=$curif-out6_pps_pass,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-out6_pps_block_neg=$curif-out6_pps_block,$multiplier,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_in_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-pps_out_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-pps_in_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$average,*\" "; $graphcmd .= "CDEF:\"$curif-pps_out_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_in6_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_out6_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_in6_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_out6_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$average,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_io=$curif-in_pps,$curif-out_pps,+\" "; $graphcmd .= "CDEF:\"$curif-pps_pass=$curif-pps_in_pass,$curif-pps_out_pass,+\" "; $graphcmd .= "CDEF:\"$curif-pps_block=$curif-pps_in_block,$curif-pps_out_block,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_io6=$curif-in6_pps,$curif-out6_pps,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_pass6=$curif-pps_in6_pass,$curif-pps_out6_pass,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_block6=$curif-pps_in6_block,$curif-pps_out6_block,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_in_t_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-pps_out_t_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-pps_in_t_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$seconds,*\" "; $graphcmd .= "CDEF:\"$curif-pps_out_t_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_in6_t_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_out6_t_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_in6_t_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_out6_t_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$seconds,*\" "; + $graphcmd .= "CDEF:\"$curif-pps_t_pass=$curif-pps_in_t_pass,$curif-pps_out_t_pass,+\" "; $graphcmd .= "CDEF:\"$curif-pps_t_block=$curif-pps_in_t_block,$curif-pps_out_t_block,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_t_pass6=$curif-pps_in6_t_pass,$curif-pps_out6_t_pass,+\" "; + $graphcmd .= "CDEF:\"$curif-pps_t_block6=$curif-pps_in6_t_block,$curif-pps_out6_t_block,+\" "; + $graphcmd .= "AREA:\"$curif-in_pps_block#{$colorpacketsdown[1]}:$curif-in-block\" "; $graphcmd .= "AREA:\"$curif-in_pps_pass#{$colorpacketsdown[0]}:$curif-in-pass:STACK\" "; + $graphcmd .= "AREA:\"$curif-in6_pps_block#{$colorpacketsdown[3]}:$curif-in6-block:STACK\" "; + $graphcmd .= "AREA:\"$curif-in6_pps_pass#{$colorpacketsdown[2]}:$curif-in6-pass:STACK\" "; $graphcmd .= "$AREA:\"$curif-out_pps_block_neg#{$colorpacketsup[1]}:$curif-out-block\" "; $graphcmd .= "$AREA:\"$curif-out_pps_pass_neg#{$colorpacketsup[0]}:$curif-out-pass:STACK\" "; + $graphcmd .= "$AREA:\"$curif-out6_pps_block_neg#{$colorpacketsup[3]}:$curif-out6-block:STACK\" "; + $graphcmd .= "$AREA:\"$curif-out6_pps_pass_neg#{$colorpacketsup[2]}:$curif-out6-pass:STACK\" "; $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" "; @@ -603,6 +634,30 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat $graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" "; $graphcmd .= "GPRINT:\"$curif-pps_out_t_block:AVERAGE:%7.2lf %s pkts\" "; $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"in-pass6\t\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_pass:MAX:%7.2lf %s pps\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_pass:AVERAGE:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_pass:LAST:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-pps_in6_t_pass:AVERAGE:%7.2lf %s pkts\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"out-pass6\t\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_pass:MAX:%7.2lf %s pps\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_pass:AVERAGE:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_pass:LAST:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-pps_out6_t_pass:AVERAGE:%7.2lf %s pkts\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"in-block6\t\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_block:MAX:%7.2lf %s pps\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_block:AVERAGE:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-in6_pps_block:LAST:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-pps_in6_t_block:AVERAGE:%7.2lf %s pkts\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"out-pass6\t\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_block:MAX:%7.2lf %s pps\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_block:AVERAGE:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" "; + $graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" "; + $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, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { From cebd086a856086529728d2d8592ebd9687451ca3 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 15:23:27 +0100 Subject: [PATCH 141/329] Adjust layout --- usr/local/www/status_rrd_graph_img.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 6f924982a6..3943b514dd 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -352,6 +352,8 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" "; $graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block:STACK\" "; $graphcmd .= "AREA:\"$curif-in6_bits_pass#{$colortrafficdown[2]}:$curif-in6-pass:STACK\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" "; $graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block:STACK\" "; @@ -382,6 +384,7 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "GPRINT:\"$curif-out_bits_block:LAST:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" "; $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"IPv6 in-pass\t\" "; $graphcmd .= "GPRINT:\"$curif-in6_bits_pass:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in6_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; @@ -602,7 +605,7 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat $graphcmd .= "AREA:\"$curif-in_pps_pass#{$colorpacketsdown[0]}:$curif-in-pass:STACK\" "; $graphcmd .= "AREA:\"$curif-in6_pps_block#{$colorpacketsdown[3]}:$curif-in6-block:STACK\" "; $graphcmd .= "AREA:\"$curif-in6_pps_pass#{$colorpacketsdown[2]}:$curif-in6-pass:STACK\" "; - + $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "$AREA:\"$curif-out_pps_block_neg#{$colorpacketsup[1]}:$curif-out-block\" "; $graphcmd .= "$AREA:\"$curif-out_pps_pass_neg#{$colorpacketsup[0]}:$curif-out-pass:STACK\" "; $graphcmd .= "$AREA:\"$curif-out6_pps_block_neg#{$colorpacketsup[3]}:$curif-out6-block:STACK\" "; @@ -633,6 +636,8 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat $graphcmd .= "GPRINT:\"$curif-out_pps_block:AVERAGE:%7.2lf %S pps\" "; $graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" "; $graphcmd .= "GPRINT:\"$curif-pps_out_t_block:AVERAGE:%7.2lf %s pkts\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"in-pass6\t\" "; $graphcmd .= "GPRINT:\"$curif-in6_pps_pass:MAX:%7.2lf %s pps\" "; From 01ee74a8cef5f8ba29e0ab6d8faa0bba48c5e4de Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Feb 2011 16:08:59 +0100 Subject: [PATCH 142/329] Add a tab between ipv4 and ipv6 addresses --- etc/rc.banner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.banner b/etc/rc.banner index 1134565f83..2e016ceb87 100755 --- a/etc/rc.banner +++ b/etc/rc.banner @@ -76,7 +76,7 @@ $realif = get_real_interface($ifname); $tobanner = "{$friendly} ({$ifname})"; - printf("\n %-15s -> %-10s -> %s/%s %s/%s %s", + printf("\n %-15s -> %-10s -> %s/%s\t%s/%s %s", $tobanner, $realif, $ipaddr ? $ipaddr : "NONE", From 9d7dd0be5ba6525dc787ada121fcb55df4a90ef6 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 2 Feb 2011 13:57:07 +0100 Subject: [PATCH 143/329] Add a newline to this command --- etc/inc/rrd.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index cdb90c1379..e698a19ca7 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -571,7 +571,7 @@ function enable_rrd_graphing() { $rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n"; $rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { processes = \$1; } \\\n"; $rrdupdatesh .= "else if ( \$1 == \"CPU:\" ) { user = \$2; nice = \$4; sys = \$6; interrupt = \$8; } \\\n"; - $rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n"; + $rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes \"\\\n\"}'`\n\n"; /* End CPU statistics */ From 31a7477d2819afae9ea82117b69a78d872d60f85 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 2 Feb 2011 15:24:00 +0100 Subject: [PATCH 144/329] Fix the TERM setting in the updaterrd script. Only get the last part of the top outpuT --- etc/inc/rrd.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index e698a19ca7..a419c29883 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -252,6 +252,7 @@ function enable_rrd_graphing() { /* db update script */ $rrdupdatesh = "#!/bin/sh\n"; $rrdupdatesh .= "\n"; + $rrdupdatesh .= "export TERM=dumb\n"; $rrdupdatesh .= "counter=1\n"; $rrdupdatesh .= "while [ \"\$counter\" -ne 0 ]\n"; $rrdupdatesh .= "do\n"; @@ -567,11 +568,11 @@ function enable_rrd_graphing() { } /* the CPU stats gathering function. */ - $rrdupdatesh .= "`$top -d 2 -s 1 0 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n"; + $rrdupdatesh .= "`$top -d 2 -s 1 0 | tail -n7 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n"; $rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n"; $rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { processes = \$1; } \\\n"; $rrdupdatesh .= "else if ( \$1 == \"CPU:\" ) { user = \$2; nice = \$4; sys = \$6; interrupt = \$8; } \\\n"; - $rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes \"\\\n\"}'`\n\n"; + $rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n"; /* End CPU statistics */ From 396243e9b5dd4ea6a0eb0d59adaaf96782e1d5e2 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 2 Feb 2011 16:26:45 +0100 Subject: [PATCH 145/329] Alter the traffic collector kill function, alter the output of top from a pipe to a file. We can now have /tmp/top_output.txt for status --- etc/inc/rrd.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index a419c29883..56d00fc98a 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -252,7 +252,7 @@ function enable_rrd_graphing() { /* db update script */ $rrdupdatesh = "#!/bin/sh\n"; $rrdupdatesh .= "\n"; - $rrdupdatesh .= "export TERM=dumb\n"; + $rrdupdatesh .= "export TERM=serial\n"; $rrdupdatesh .= "counter=1\n"; $rrdupdatesh .= "while [ \"\$counter\" -ne 0 ]\n"; $rrdupdatesh .= "do\n"; @@ -568,11 +568,12 @@ function enable_rrd_graphing() { } /* the CPU stats gathering function. */ - $rrdupdatesh .= "`$top -d 2 -s 1 0 | tail -n7 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n"; - $rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n"; + $rrdupdatesh .= "$top -d 2 -s 1 0 | tail -n7 > /tmp/top_output.txt\n"; + $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$proc N:\\\n"; + $rrdupdatesh .= "`$awk < /tmp/top_output.txt '{gsub(/%/, \"\")} \\\n"; $rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { processes = \$1; } \\\n"; $rrdupdatesh .= "else if ( \$1 == \"CPU:\" ) { user = \$2; nice = \$4; sys = \$6; interrupt = \$8; } \\\n"; - $rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n"; + $rrdupdatesh .= "} END { printf user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n"; /* End CPU statistics */ @@ -776,8 +777,8 @@ function enable_rrd_graphing() { } function kill_traffic_collector() { + mwexec("killall top", true); mwexec("killall rrdtool", true); - sleep(1); mwexec("/bin/pkill -f updaterrd.sh", true); } From a23a99cb13af898ec662872dcd2ba544ea4ccbad Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Feb 2011 22:38:54 +0100 Subject: [PATCH 146/329] Lie to the system and report a subnetmask of 127 instead of 128. This should fix the subnetmask check --- etc/inc/interfaces.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 05427c7018..c12f0f6599 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3424,10 +3424,12 @@ function find_interface_ipv6($interface, $flush = false) $parts = explode(" ", $line); if(! preg_match("/fe80::/", $parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; - if($parts[2] == "-->") + if($parts[2] == "-->") { + $parts[5] = "127"; $ifinfo['subnetbitsv6'] = $parts[5]; - else + } else { $ifinfo['subnetbitsv6'] = $parts[3]; + } } } } @@ -3473,10 +3475,12 @@ function find_interface_subnetv6($interface, $flush = false) $parts = explode(" ", $line); if(! preg_match("/fe80::/", $parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; - if($parts[2] == "-->") + if($parts[2] == "-->") { + $parts[5] = "127"; $ifinfo['subnetbitsv6'] = $parts[5]; - else + } else { $ifinfo['subnetbitsv6'] = $parts[3]; + } } } } From cf6bc278670a76710a364ccc42ab77a2b061ba14 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Feb 2011 23:07:52 +0100 Subject: [PATCH 147/329] Fix the subnet check for gif tunnels by dropping the bits to 126. Always compress the subnet address for easier reading --- etc/inc/interfaces.inc | 4 ++-- etc/inc/util.inc | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index c12f0f6599..bc8fdb84b3 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3425,7 +3425,7 @@ function find_interface_ipv6($interface, $flush = false) if(! preg_match("/fe80::/", $parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; if($parts[2] == "-->") { - $parts[5] = "127"; + $parts[5] = "126"; $ifinfo['subnetbitsv6'] = $parts[5]; } else { $ifinfo['subnetbitsv6'] = $parts[3]; @@ -3476,7 +3476,7 @@ function find_interface_subnetv6($interface, $flush = false) if(! preg_match("/fe80::/", $parts[1])) { $ifinfo['ipaddrv6'] = $parts[1]; if($parts[2] == "-->") { - $parts[5] = "127"; + $parts[5] = "126"; $ifinfo['subnetbitsv6'] = $parts[5]; } else { $ifinfo['subnetbitsv6'] = $parts[3]; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index f3cb60b2a9..4d939dd0a7 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -226,7 +226,10 @@ function gen_subnet($ipaddr, $bits) { function gen_subnetv6($ipaddr, $bits) { if (!is_ipaddrv6($ipaddr) || !is_numeric($bits)) return ""; - return Net_IPv6::getNetmask($ipaddr, $bits); + + $address = Net_IPv6::getNetmask($ipaddr, $bits); + $address = Net_IPv6::Compress($address); + return $address; } /* return the highest (broadcast) address in the subnet given a host address and a subnet bit count */ From 54ac51b569af3db2a0d4fe29563090265355725e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Feb 2011 23:08:58 +0100 Subject: [PATCH 148/329] Make the subnet check failure better readable --- usr/local/www/system_gateways_edit.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 8db8764ec4..66ee192275 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -120,14 +120,16 @@ if ($_POST) { } if (is_ipaddrv4($parent_ip)) { $parent_sn = get_interface_subnet($_POST['interface']); - if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['gateway'])) { - $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); + $subnet = gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn; + if(!ip_in_subnet($_POST['gateway'], $subnet) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['gateway'])) { + $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet '{$subnet}'."), $_POST['gateway']); } } if (is_ipaddrv6($parent_ip)) { $parent_sn = get_interface_subnetv6($_POST['interface']); - if(!ip_in_subnet($_POST['gateway'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn)) { - $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); + $subnet = gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn; + if(!ip_in_subnet($_POST['gateway'], $subnet)) { + $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet '{$subnet}'."), $_POST['gateway']); } } } From 3fc4a490effa9575dfc53d42739ee8fa1a4acd64 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 4 Feb 2011 15:18:26 +0100 Subject: [PATCH 149/329] Remove this compress line, it breaks the dhcpv6 config --- etc/inc/util.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 4d939dd0a7..370f89192d 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -228,7 +228,6 @@ function gen_subnetv6($ipaddr, $bits) { return ""; $address = Net_IPv6::getNetmask($ipaddr, $bits); - $address = Net_IPv6::Compress($address); return $address; } From 56f024e8f9779273e3143730ad03df2f1feaec98 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 16:32:06 -0500 Subject: [PATCH 150/329] Add
between ipv6 and ipv4 blocks --- usr/local/www/interfaces.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 76f618bb26..86d795bc9e 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -1338,6 +1338,9 @@ $types = array("none" => gettext("None"), "staticv4" => gettext("Static IPv4"), + + + From 7f00aface2d9208199e965c0372f9a0272bee778 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 7 Feb 2011 08:23:06 +0100 Subject: [PATCH 151/329] Remove the icmp6 ping requests from the mandatory allow rulE --- etc/inc/filter.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index fc3f73471f..b694677273 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2100,7 +2100,7 @@ block out $log inet6 all label "Default deny rule IPv6" # 134 routeradv Router advertisement # 135 neighbrsol Neighbor solicitation # 136 neighbradv Neighbor advertisement -pass quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,128,129,135,136} keep state +pass quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,135,136} keep state # Allow only bare essential icmpv6 packets (NS, NA, and RA, echoreq, echorep) pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} keep state From 2f14d0213c1dd0c9759adba87ba4ce503a0990df Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 7 Feb 2011 08:34:33 +0100 Subject: [PATCH 152/329] Make it possible to set the default gateway bit for 1 ipv4 gateway and 1 ipv6 gateway --- usr/local/www/system_gateways_edit.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 66ee192275..6eef520da5 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -238,10 +238,18 @@ if ($_POST) { if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") { $i = 0; + /* remove the default gateway bits for all gateways with the same address family */ foreach($a_gateway_item as $gw) { - unset($config['gateways']['gateway_item'][$i]['defaultgw']); - if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw']) - $reloadif = $gw['interface']; + if(is_ipaddrv4($gateway['gateway']) && is_ipaddrv4($gw['gateway'])) { + unset($config['gateways']['gateway_item'][$i]['defaultgw']); + if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw']) + $reloadif = $gw['interface']; + } + if(is_ipaddrv6($gateway['gateway']) && is_ipaddrv6($gw['gateway'])) { + unset($config['gateways']['gateway_item'][$i]['defaultgw']); + if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw']) + $reloadif = $gw['interface']; + } $i++; } $gateway['defaultgw'] = true; From aa0103f5d3c98fddb32866d3665ee8ecf8e9f108 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 8 Feb 2011 16:18:40 +0100 Subject: [PATCH 153/329] Disable the wins server input boxes, these don't work on v6 --- etc/inc/services.inc | 6 ------ usr/local/www/services_dhcpv6.php | 17 ----------------- 2 files changed, 23 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 0fa3c98ee3..d40accb3b2 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -632,12 +632,6 @@ EOD; if ($dhcpv6ifconf['maxleasetime']) $dhcpdv6conf .= " max-lease-time {$dhcpv6ifconf['maxleasetime']};\n"; - // netbios-name* - if (is_array($dhcpv6ifconf['winsserver']) && $dhcpv6ifconf['winsserver'][0]) { - $dhcpdv6conf .= " option netbios-name-servers " . join(",", $dhcpv6ifconf['winsserver']) . ";\n"; - $dhcpdv6conf .= " option netbios-node-type 8;\n"; - } - // ntp-servers if (is_array($dhcpv6ifconf['ntpserver']) && $dhcpv6ifconf['ntpserver'][0]) $dhcpdv6conf .= " option ntp-servers " . join(",", $dhcpv6ifconf['ntpserver']) . ";\n"; diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 08776d3eba..1e9a918ccf 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -143,8 +143,6 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['gateway'] = $config['dhcpdv6'][$if]['gateway']; $pconfig['domain'] = $config['dhcpdv6'][$if]['domain']; $pconfig['domainsearchlist'] = $config['dhcpdv6'][$if]['domainsearchlist']; - list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver']; - list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpdv6'][$if]['dnsserver']; $pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']); $pconfig['denyunknown'] = isset($config['dhcpdv6'][$if]['denyunknown']); $pconfig['staticarp'] = isset($config['dhcpdv6'][$if]['staticarp']); @@ -223,8 +221,6 @@ if ($_POST) { $input_errors[] = gettext("A valid range must be specified."); if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) $input_errors[] = gettext("A valid IPv6 address must be specified for the gateway."); - if (($_POST['wins1'] && !is_ipaddrv6($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddrv6($_POST['wins2']))) - $input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary WINS servers."); if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddrv6($_POST['dns2']))) $input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary DNS servers."); @@ -320,10 +316,6 @@ if ($_POST) { $config['dhcpdv6'][$if]['failover_peerip'] = $_POST['failover_peerip']; unset($config['dhcpdv6'][$if]['winsserver']); - if ($_POST['wins1']) - $config['dhcpdv6'][$if]['winsserver'][] = $_POST['wins1']; - if ($_POST['wins2']) - $config['dhcpdv6'][$if]['winsserver'][] = $_POST['wins2']; unset($config['dhcpdv6'][$if]['dnsserver']); if ($_POST['dns1']) @@ -426,8 +418,6 @@ include("head.inc"); endis = !(document.iform.enable.checked || enable_over); document.iform.range_from.disabled = endis; document.iform.range_to.disabled = endis; - document.iform.wins1.disabled = endis; - document.iform.wins2.disabled = endis; document.iform.dns1.disabled = endis; document.iform.dns2.disabled = endis; document.iform.deftime.disabled = endis; @@ -607,13 +597,6 @@ include("head.inc"); - - - - Date: Wed, 16 Feb 2011 16:40:43 -0500 Subject: [PATCH 162/329] Minor english fixes from Bill --- usr/local/www/interfaces_gif_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/interfaces_gif_edit.php b/usr/local/www/interfaces_gif_edit.php index 73cd456d17..958b5c05fa 100644 --- a/usr/local/www/interfaces_gif_edit.php +++ b/usr/local/www/interfaces_gif_edit.php @@ -184,7 +184,7 @@ include("head.inc"); ?>
- + From 2936a57e2e9c378edafe2ab936b8b3ad90cf83fe Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 1 Mar 2011 14:11:23 +0100 Subject: [PATCH 163/329] add subnet mask clarification for IPv6 and correct default count to 128 bits --- usr/local/www/firewall_aliases_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index 5bc44bcab7..825bbae312 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -396,7 +396,7 @@ function typesel_change() { for(i=0; i Date: Thu, 3 Mar 2011 21:12:57 +0100 Subject: [PATCH 164/329] Add the IPv6 Neighbour list status page --- usr/local/www/diag_ndp.php | 163 +++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100755 usr/local/www/diag_ndp.php diff --git a/usr/local/www/diag_ndp.php b/usr/local/www/diag_ndp.php new file mode 100755 index 0000000000..c99da4e005 --- /dev/null +++ b/usr/local/www/diag_ndp.php @@ -0,0 +1,163 @@ + + Copyright (C) 2011 Seth Mos + + + originally part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2005 Paul Taylor (paultaylor@winndixie.com) and Manuel Kasper . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 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. + + 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. +*/ + +/* + pfSense_BUILDER_BINARIES: /bin/cat /usr/sbin/arp + pfSense_MODULE: arp +*/ + +##|+PRIV +##|*IDENT=page-diagnostics-ndptable +##|*NAME=Diagnostics: NDP Table page +##|*DESCR=Allow access to the 'Diagnostics: NDP Table' page. +##|*MATCH=diag_ndp.php* +##|-PRIV + +@ini_set('zlib.output_compression', 0); +@ini_set('implicit_flush', 1); + +require("guiconfig.inc"); + +exec("/usr/sbin/ndp -na", $rawdata); + +$i = 0; + +/* if list */ +$ifdescrs = get_configured_interface_with_descr(); + +foreach ($ifdescrs as $key =>$interface) { + $hwif[$config['interfaces'][$key]['if']] = $interface; +} + +/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address +[3] => Netif [4] => Expire [5] => S +[6] => Flags ) */ +$data = array(); +array_shift($rawdata); +foreach ($rawdata as $line) { + $elements = preg_split('/[ ]+/', $line); + + $ndpent = array(); + $ndpent['ipv6'] = trim($elements[0]); + $ndpent['mac'] = trim($elements[1]); + $ndpent['interface'] = trim($elements[2]); + $data[] = $ndpent; +} + +/* FIXME: Not ipv6 compatible dns resolving. PHP needs fixing */ +function _getHostName($mac,$ip) +{ + if(is_ipaddr($ip)) { + if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip) + return gethostbyaddr($ip); + else + return ""; + } +} + +// Resolve hostnames and replace Z_ with "". The intention +// is to sort the list by hostnames, alpha and then the non +// resolvable addresses will appear last in the list. +foreach ($data as &$entry) { + $dns = trim(_getHostName($entry['mac'], $entry['ipv6'])); + if(trim($dns)) + $entry['dnsresolve'] = "$dns"; + else + $entry['dnsresolve'] = "Z_ "; +} + +// Sort the data alpha first +$data = msort($data, "dnsresolve"); + +$pgtitle = array(gettext("Diagnostics"),gettext("NDP Table")); +include("head.inc"); + +?> + + + + + +
+ +

  +

+ + +
 
-
- -

From a120c194b5d55f806d3402a30d68594b6b9994f5 Mon Sep 17 00:00:00 2001 From: Vinicius Coque Date: Tue, 8 Feb 2011 13:51:19 -0200 Subject: [PATCH 154/329] BP: Fix gettext implementation --- etc/inc/config.console.inc | 2 +- etc/inc/notices.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 536c976d5d..7b2cab7f41 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -258,7 +258,7 @@ EOD; $i1 = $i + 1; if($config['interfaces']['opt' . $i1]['descr']) - printf(gettext("%sOptional interface %s description found: %s"), "\n", $config['interfaces']['opt' . $i1]['descr']); + printf(gettext("%sOptional interface %s description found: %s"), "\n", $i1, $config['interfaces']['opt' . $i1]['descr']); printf(gettext("%sEnter the Optional %s{$i1} interface name or 'a' for auto-detection%s" . "(or nothing if finished):%s"), "\n", $i1, "\n", " "); diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index b0e95c580d..54a8489cba 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -78,7 +78,7 @@ function file_notice($id, $notice, $category = "General", $url = "", $priority = } fwrite($queueout, serialize($queue)); fclose($queueout); - log_error(printf(gettext("New alert found: %s"), $notice)); + log_error("New alert found: $notice"); /* soekris */ if(file_exists("/dev/led/error")) exec("/bin/echo 1 > /dev/led/error"); From 8b0041e092274a63002f716515faaa082dfc0693 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 9 Feb 2011 16:41:41 +0100 Subject: [PATCH 155/329] Fix typo in the subnetmask for the unblockable icmp types. This makes the all-routers work again --- etc/inc/filter.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index b694677273..438b1c8f0f 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2107,7 +2107,7 @@ pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128 pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} keep state pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {129,133,134,135,136} keep state -pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe02::/16 icmp6-type {129,133,134,135,136} keep state +pass in quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {129,133,134,135,136} keep state # We use the mighty pf, we cannot be fooled. block quick inet proto { tcp, udp } from any port = 0 to any From 6715c2a295ecdee663e5d185284c72dff815518e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 10 Feb 2011 11:18:28 +0100 Subject: [PATCH 156/329] Fix the IP address check to allow for interfaces that just have a IPv6 address but no IPv4 --- usr/local/www/firewall_virtual_ip_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 3dbb31c8a0..e5581ca312 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -112,8 +112,8 @@ if ($_POST) { $natiflist = get_configured_interface_with_descr(); foreach ($natiflist as $natif => $natdescr) { - if ($_POST['interface'] == $natif && empty($config['interfaces'][$natif]['ipaddr'])) - $input_errors[] = gettext("The interface chosen for the VIP has no ip configured so it cannot be used as a parent for the VIP."); + if ($_POST['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) + $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP."); if ($_POST['subnet'] == get_interface_ip($natif)) $input_errors[] = sprintf(gettext("The %s IP address may not be used in a virtual entry."),$natdescr); } From 9103d9ee6c46a3fd36f2dfb5cd624a8e6a5366a8 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 10 Feb 2011 16:05:27 +0100 Subject: [PATCH 157/329] Fix static routes, typo in the variable name --- usr/local/www/system_routes_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 08deb77544..5847011996 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -107,7 +107,7 @@ if ($_POST) { if(is_ipaddrv6($_POST['network'])) { $osn = Net_IPv6::compress(gen_subnetv6($_POST['network'], $_POST['network_subnet'])) . "/" . $_POST['network_subnet']; } - if(is_ipaddrv4($POST['network'])) { + if(is_ipaddrv4($_POST['network'])) { $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; } foreach ($a_routes as $route) { From 07dfd12159413d2bcb91c5e17952284e9b128ab7 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 11 Feb 2011 09:09:06 +0100 Subject: [PATCH 158/329] Add a IPv6 enable option in the mpd5 config --- etc/inc/interfaces.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index bc8fdb84b3..a0741f9592 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1303,6 +1303,7 @@ startup: default: {$ppp['type']}client: create bundle static {$interface} + set bundle enable ipv6cp set iface name {$pppif} EOD; From d610946897da3d693ae4b372ce2edf0545d29daf Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 11 Feb 2011 09:28:11 +0100 Subject: [PATCH 159/329] Delay resolving dynamic DNS tunnels during boot --- etc/inc/vpn.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index caf8006544..ea4940ea67 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -1677,8 +1677,13 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { /* see if this tunnel has a hostname for the remote-gateway, and if so, * try to resolve it now and add it to the list for filterdns */ if (!is_ipaddr($phase1['remote-gateway'])) { - $rgip = resolve_retry($phase1['remote-gateway']); - add_hostname_to_watch($phase1['remote-gateway']); + if(! $g['booting']) { + $rgip = resolve_retry($phase1['remote-gateway']); + add_hostname_to_watch($phase1['remote-gateway']); + return false; + } else { + add_hostname_to_watch($phase1['remote-gateway']); + } if (!$rgip) { log_error("Could not determine VPN endpoint for '{$phase1['descr']}'"); return false; From b845290619244e8cfe3bc2aa6271c6629eeb86b5 Mon Sep 17 00:00:00 2001 From: Vinicius Coque Date: Fri, 11 Feb 2011 09:40:03 -0200 Subject: [PATCH 160/329] BP: fix syntax error on gettext implementation --- etc/inc/gwlb.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 1dcd6c1239..8ca69ccad6 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -210,7 +210,7 @@ EOD; * not strictly necessary but is a added level of protection. */ if (is_ipaddr($gateway['gateway']) && $gateway['monitor'] != $gateway['gateway']) { - log_error(sprintf(gettext('Removing static route for monitor %1$s and adding a new route through %2$s'), $gateway['monitor']. $gateway['gateway'])); + log_error(sprintf(gettext('Removing static route for monitor %1$s and adding a new route through %2$s'), $gateway['monitor'], $gateway['gateway'])); mwexec("/sbin/route delete -host " . escapeshellarg($gateway['monitor']), true); mwexec("/sbin/route add -host " . escapeshellarg($gateway['monitor']) . " " . escapeshellarg($gateway['gateway']), true); From bd40781aaa7aa947e924f21e2845d87be5993bbd Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Feb 2011 22:27:46 +0100 Subject: [PATCH 161/329] add a ipprotocol variable to the easy add rules --- etc/inc/easyrule.inc | 14 ++++++++------ usr/local/www/diag_logs_filter.php | 6 ++++-- usr/local/www/easyrule.php | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/etc/inc/easyrule.inc b/etc/inc/easyrule.inc index b5b162074f..45d3f748c0 100644 --- a/etc/inc/easyrule.inc +++ b/etc/inc/easyrule.inc @@ -46,7 +46,7 @@ function easyrule_find_rule_interface($int) { if ($config['pptpd']['mode'] == "server") $iflist['pptp'] = "PPTP VPN"; - if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) + if ($config['pppoe']['mode'] == "server") $iflist['pppoe'] = "PPPoE VPN"; if ($config['l2tp']['mode'] == "server") @@ -229,7 +229,7 @@ function easyrule_block_host_add($host, $int = 'wan') { } } -function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport) { +function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport, $ipproto) { global $config; /* No rules, start a new array */ @@ -244,6 +244,7 @@ function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport) { $filterent = array(); $filterent['type'] = 'pass'; $filterent['interface'] = $int; + $filterent['ipprotocol'] = $ipproto; $filterent['descr'] = "Easy Rule: Passed from Firewall Log View"; if ($proto != "any") @@ -271,7 +272,8 @@ function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport) { } } -function easyrule_parse_block($int, $src) { +function easyrule_parse_block($int, $src, $ipproto) { + $filterent['ipprotocol'] = $ipproto; if (!empty($src) && !empty($int)) { if (!is_ipaddr($src)) { return "Tried to block invalid IP: " . htmlspecialchars($src); @@ -290,7 +292,7 @@ function easyrule_parse_block($int, $src) { } return "Unknown block error."; } -function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0) { +function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0, $ipproto = inet) { /* Check for valid int, srchost, dsthost, dstport, and proto */ global $protocols_with_ports; @@ -319,7 +321,7 @@ function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0) { $dstport = 0; } /* Should have valid input... */ - if (easyrule_pass_rule_add($int, $proto, $src, $dst, $dstport)) { + if (easyrule_pass_rule_add($int, $proto, $src, $dst, $dstport, $ipproto)) { return "Successfully added pass rule!"; } else { return "Failed to add pass rule."; @@ -330,4 +332,4 @@ function easyrule_parse_pass($int, $proto, $src, $dst, $dstport = 0) { return "Unknown pass error."; } -?> \ No newline at end of file +?> diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index 5fb94cff68..ec56ce0d93 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -150,18 +150,20 @@ include("head.inc");
"> - " title="" onclick="return confirm('')"> + " title="" onclick="return confirm('')"> "> - " title="" onclick="return confirm('')"> + " title="" onclick="return confirm('')">
+ + + +
+ + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + From aed4775862015400017397b95b187aebbb7d5c03 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Mar 2011 21:16:13 +0100 Subject: [PATCH 165/329] Fix the link to point to the v6 edit page instead --- usr/local/www/services_dhcpv6.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 1e9a918ccf..4d6251a9b4 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -835,7 +835,7 @@ include("head.inc"); - +
@@ -844,22 +844,22 @@ include("head.inc"); "" or $mapent['ipaddr'] <> ""): ?> - + - +   - +   - +   - +
')">
@@ -874,7 +874,7 @@ include("head.inc"); - +
From 11085d2abc88851f5dca2ffd3f1e8053d822d593 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Mar 2011 21:18:05 +0100 Subject: [PATCH 166/329] Add the neighbour table to the menu --- usr/local/www/fbegin.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index ed07813da9..e88df50657 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -188,6 +188,7 @@ $diagnostics_menu[] = array("Edit File", "/edit.php"); $diagnostics_menu[] = array("Factory Defaults", "/diag_defaults.php"); $diagnostics_menu[] = array("Halt System", "/halt.php" ); $diagnostics_menu[] = array("Limiter Info", "/diag_limiter_info.php" ); +$diagnostics_menu[] = array("NDP Table", "/diag_ndp.php" ); $diagnostics_menu[] = array("Tables", "/diag_tables.php"); $diagnostics_menu[] = array("Ping", "/diag_ping.php"); From 4e8e7662c0309f6c83ca9b2ee3eb2e9f1aa95e52 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 3 Mar 2011 21:30:06 +0100 Subject: [PATCH 167/329] Blind coded a edit page for IPv6. the subnet check needs to be written entirely. Checking if the IP address falls within the v6 subnet isn't so hard, what is harder is making sure that the ip does not fall within the dynamic subnet. For that we need proper subnet math calculus. Which we don't have yet. --- usr/local/www/services_dhcpv6.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 4d6251a9b4..27c4443786 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -848,7 +848,7 @@ include("head.inc"); -   +     From 4f33246696457207f14e18dbfa4c543e9e71ace4 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 4 Mar 2011 16:51:39 +0100 Subject: [PATCH 168/329] Fix broken gateway logic that mixed up v4 and v6 --- etc/inc/system.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 4403c6f1db..4ed6813f6d 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -353,8 +353,8 @@ function system_routing_configure($interface = "") { $gatewayipv6 = $gateway['gateway']; $interfacegwv6 = $gateway['interface']; if (!empty($interfacegwv6)) { - $defaultif = get_real_interface($gateway['interface']); - if ($defaultif) + $defaultifv6 = get_real_interface($gateway['interface']); + if ($defaultifv6) @file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgwv6", $gatewayipv6); } $foundgwv6 = true; @@ -369,9 +369,9 @@ function system_routing_configure($interface = "") { @touch("{$g['tmp_path']}/{$defaultif}_defaultgw"); } if ($foundgwv6 == false) { - $defaultif = get_real_interface("wan"); - $interfacegw = "wan"; - $gatewayip = get_interface_gateway_v6("wan"); + $defaultifv6 = get_real_interface("wan"); + $interfacegwv6 = "wan"; + $gatewayipv6 = get_interface_gateway_v6("wan"); @touch("{$g['tmp_path']}/{$defaultif}_defaultgwv6"); } $dont_add_route = false; From 17a5b09514ef2f9b56324c2ec42408506775d42c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 4 Mar 2011 17:01:52 +0100 Subject: [PATCH 169/329] Correct one more variable in the process --- etc/inc/system.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 4ed6813f6d..535b4d8da0 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -355,7 +355,7 @@ function system_routing_configure($interface = "") { if (!empty($interfacegwv6)) { $defaultifv6 = get_real_interface($gateway['interface']); if ($defaultifv6) - @file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgwv6", $gatewayipv6); + @file_put_contents("{$g['tmp_path']}/{$defaultifv6}_defaultgwv6", $gatewayipv6); } $foundgwv6 = true; break; @@ -373,7 +373,7 @@ function system_routing_configure($interface = "") { $interfacegwv6 = "wan"; $gatewayipv6 = get_interface_gateway_v6("wan"); @touch("{$g['tmp_path']}/{$defaultif}_defaultgwv6"); - } + } $dont_add_route = false; /* if OLSRD is enabled, allow WAN to house DHCP. */ if($config['installedpackages']['olsrd']) { @@ -422,7 +422,7 @@ function system_routing_configure($interface = "") { } if ($dont_add_route == false ) { - if (!empty($interface) && $interface != $interfacegw) + if (!empty($interface) && $interface != $interfacegwv6) ; else if (($interfacegwv6 <> "bgpd") && (is_ipaddrv6($gatewayipv6))) { $action = "add"; From de1407305813f8ea41a62775a023a4b70cb9f7da Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 6 Mar 2011 20:17:01 +0100 Subject: [PATCH 170/329] First stab at generating a link local address for the bridge interface if it's used by DHCP. --- etc/inc/services.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 1afc23ae73..3e22efb144 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -693,7 +693,13 @@ EOD; } } - $dhcpdv6ifs[] = get_real_interface($dhcpv6if); + + $realif = escapeshellcmd(get_real_interface($dhcpv6if)); + $dhcpdv6ifs[] = $realif; + /* Create link local address for bridges */ + if(stristr("$realif", "bridge")) { + mwexec("$ifconfig {$realif} inet6 fe80::/64 eui64"); + } } fwrite($fd, $dhcpdconf); From 283e918079536f7f5fda6cb4866fd82f4ec4421e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 6 Mar 2011 20:44:18 +0100 Subject: [PATCH 171/329] More fixes to differentiate between v4 and v6 gateways on the same interface. --- etc/inc/interfaces.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index be86bac26b..3405838def 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -735,7 +735,10 @@ function interface_gre_configure(&$gre, $grekey = "") { if (isset($gre['link1']) && $gre['link1']) mwexec("/sbin/route add {$gre['tunnel-remote-addr']}/{$gre['tunnel-remote-net']} {$gre['tunnel-local-addr']}"); - file_put_contents("{$g['tmp_path']}/{$greif}_router", $gre['tunnel-remote-addr']); + if(is_ipaddrv4($gre['tunnel-remote-addr'])) + file_put_contents("{$g['tmp_path']}/{$greif}_router", $gre['tunnel-remote-addr']); + if(is_ipaddrv6($gre['tunnel-remote-addr'])) + file_put_contents("{$g['tmp_path']}/{$greif}_routerv6", $gre['tunnel-remote-addr']); return $greif; } @@ -794,7 +797,11 @@ function interface_gif_configure(&$gif, $gifkey = "") { /* XXX: Needed?! Let them use the defined gateways instead */ //mwexec("/sbin/route add {$gif['tunnel-remote-addr']}/{$gif['tunnel-remote-net']} -iface {$gifif}"); - file_put_contents("{$g['tmp_path']}/{$gifif}_router", $gif['tunnel-remote-addr']); + + if(is_ipaddrv4($gif['tunnel-remote-addr'])) + file_put_contents("{$g['tmp_path']}/{$gifif}_router", $gif['tunnel-remote-addr']); + if(is_ipaddrv6($gif['tunnel-remote-addr'])) + file_put_contents("{$g['tmp_path']}/{$gifif}_routerv6", $gif['tunnel-remote-addr']); return $gifif; } From ae091de305647e9c3e294a8647fa781dae3d36a9 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 7 Mar 2011 09:13:38 +0100 Subject: [PATCH 172/329] Commit the forgotten edit page for the dhcpv6 reservations --- usr/local/www/services_dhcpv6_edit.php | 254 +++++++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 usr/local/www/services_dhcpv6_edit.php diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php new file mode 100644 index 0000000000..2c9f5744a9 --- /dev/null +++ b/usr/local/www/services_dhcpv6_edit.php @@ -0,0 +1,254 @@ +. + Copyright (C) 2011 Seth Mos . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 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. + + 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. +*/ +/* + pfSense_BUILDER_BINARIES: /usr/sbin/arp + pfSense_MODULE: dhcpserver +*/ + +##|+PRIV +##|*IDENT=page-services-dhcpserverv6-editstaticmapping +##|*NAME=Services: DHCPv6 Server : Edit static mapping page +##|*DESCR=Allow access to the 'Services: DHCPv6 Server : Edit static mapping' page. +##|*MATCH=services_dhcpv6_edit.php* +##|-PRIV + +function staticmapcmp($a, $b) { + return ipcmp($a['ipaddrv6'], $b['ipaddrv6']); +} + +function staticmaps_sort($ifgui) { + global $g, $config; + + usort($config['dhcpd'][$ifgui]['staticmap'], "staticmapcmp"); +} + +require_once('globals.inc'); + +if(!$g['services_dhcp_server_enable']) { + Header("Location: /"); + exit; +} + +require("guiconfig.inc"); + +$if = $_GET['if']; +if ($_POST['if']) + $if = $_POST['if']; + +if (!$if) { + header("Location: services_dhcpv6.php"); + exit; +} + +if (!is_array($config['dhcpdv6'][$if]['staticmap'])) { + $config['dhcpdv6'][$if]['staticmap'] = array(); +} + +$static_arp_enabled=isset($config['dhcpdv6'][$if]['staticarp']); +$netboot_enabled=isset($config['dhcpdv6'][$if]['netboot']); +$a_maps = &$config['dhcpdv6'][$if]['staticmap']; +$ifcfgipv6 = get_interface_ipv6($if); +$ifcfgsnv6 = get_interface_subnetv6($if); +$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if); + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +if (isset($id) && $a_maps[$id]) { + $pconfig['mac'] = $a_maps[$id]['mac']; + $pconfig['hostname'] = $a_maps[$id]['hostname']; + $pconfig['ipaddrv6'] = $a_maps[$id]['ipaddrv6']; + $pconfig['netbootfile'] = $a_maps[$id]['netbootfile']; + $pconfig['descr'] = $a_maps[$id]['descr']; +} else { + $pconfig['mac'] = $_GET['mac']; + $pconfig['hostname'] = $_GET['hostname']; + $pconfig['netbootfile'] = $_GET['netbootfile']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "mac"); + $reqdfieldsn = array(gettext("MAC address")); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ + $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac'])); + + if ($_POST['hostname']) { + preg_match("/^[0-9]/", $_POST['hostname'], $matches); + if($matches) + $input_errors[] = gettext("The hostname cannot start with a numeric character according to RFC952"); + preg_match("/\-\$/", $_POST['hostname'], $matches); + if($matches) + $input_errors[] = gettext("The hostname cannot end with a hyphen according to RFC952"); + if (!is_hostname($_POST['hostname'])) { + $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'."); + } else { + if (strpos($_POST['hostname'],'.')) { + $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted"); + } + } + } + if (($_POST['ipaddrv6'] && !is_ipaddrv6($_POST['ipaddrv6']))) { + $input_errors[] = gettext("A valid IPv6 address must be specified."); + } + if (($_POST['mac'] && !is_macaddr($_POST['mac']))) { + $input_errors[] = gettext("A valid MAC address must be specified."); + } + if($static_arp_enabled && !$_POST['ipaddrv6']) { + $input_errors[] = gettext("Static ARP is enabled. You must specify an IPv6 address."); + } + + /* check for overlaps */ + foreach ($a_maps as $mapent) { + if (isset($id) && ($a_maps[$id]) && ($a_maps[$id] === $mapent)) + continue; + + if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || ($mapent['mac'] == $_POST['mac'])) { + $input_errors[] = gettext("This Hostname, IP or MAC address already exists."); + break; + } + } + + /* make sure it's not within the dynamic subnet */ + if ($_POST['ipaddrv6']) { + /* oh boy, we need to be able to somehow do this at some point. skip */ + } + + if (!$input_errors) { + $mapent = array(); + $mapent['mac'] = $_POST['mac']; + $mapent['ipaddrv6'] = $_POST['ipaddrv6']; + $mapent['hostname'] = $_POST['hostname']; + $mapent['descr'] = $_POST['descr']; + $mapent['netbootfile'] = $_POST['netbootfile']; + + if (isset($id) && $a_maps[$id]) + $a_maps[$id] = $mapent; + else + $a_maps[] = $mapent; + staticmaps_sort($if); + + write_config(); + + if(isset($config['dhcpdv6'][$if]['enable'])) { + mark_subsystem_dirty('staticmaps'); + if (isset($config['dnsmasq']['regdhcpstatic'])) + mark_subsystem_dirty('hosts'); + } + + header("Location: services_dhcpv6.php?if={$if}"); + exit; + } +} + +$pgtitle = array(gettext("Services"),gettext("DHCPv6"),gettext("Edit static mapping")); +$statusurl = "status_dhcpv6_leases.php"; +$logurl = "diag_logs_dhcp.php"; + +include("head.inc"); + +?> + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+
+ +
Netboot filename + +
Name of the file that should be loaded when this host boots off of the network, overrides setting on main page.
+ +
  + "> " onclick="history.back()"> + + + + +
+
+ + + From d2627d7c7c3ddb9f2d65fdaf8fa737a57a34e33e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 8 Mar 2011 09:14:46 +0100 Subject: [PATCH 173/329] Correct the link to the proper page for deleting a static mapping --- usr/local/www/services_dhcpv6.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 27c4443786..2c7f6bfaa6 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -860,7 +860,7 @@ include("head.inc"); - +
')">')">
From 9956b38ae11ca0abd75a367f54009052a2126181 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 9 Mar 2011 08:20:27 +0100 Subject: [PATCH 174/329] Merge the config upgrade code, there was a mismatch, the one who merged this wrong should get a pointy hat. --- etc/inc/globals.inc | 2 +- etc/inc/upgrade_config.inc | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index 21460c548c..4e150f82ef 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.7", + "latest_config" => "7.8", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index fee37864a5..df4ede83c0 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2307,6 +2307,14 @@ function upgrade_075_to_076() { } function upgrade_076_to_077() { + global $config; + foreach($config['filter']['rule'] as & $rule) { + if (isset($rule['protocol']) && !empty($rule['protocol'])) + $rule['protocol'] = strtolower($rule['protocol']); + } +} + +function upgrade_077_to_078() { global $config; global $g; From 9c5ad16762b0922cc7224ef3b1531a778100551b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 9 Mar 2011 12:50:05 +0100 Subject: [PATCH 175/329] unbreak the broken merge --- etc/inc/rrd.inc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index c5171feb11..56d00fc98a 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -332,16 +332,8 @@ function enable_rrd_graphing() { $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling packets for interface $ifname $realif \n"; -<<<<<<< HEAD $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$packets N:\\\n"; $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass|In6\/Pass|Out6\/Pass|In4\/Block|Out4\/Block|In6\/Block|Out6\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; -======= - $rrdupdatesh .= "unset PACKETS \n"; - $rrdupdatesh .= "PACKETS=`cat \$TMPFILE | awk '/In4\/Pass|Out4\/Pass/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; - $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$packets N:\$PACKETS\n"; - $rrdupdatesh .= "rm \$TMPFILE \n"; ->>>>>>> upstream/master /* WIRELESS, set up the rrd file */ if($config['interfaces'][$ifname]['wireless']['mode'] == "bss") { From 354796f06cdd0ca8e7fae3cac3245ae3cea3a803 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 9 Mar 2011 14:40:24 +0100 Subject: [PATCH 176/329] Unbreak the rrd graph img page --- usr/local/www/status_rrd_graph_img.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 0242f33a34..2838a68894 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -346,14 +346,11 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "CDEF:\"$curif-bytes_t_block=$curif-bytes_in_t_block,$curif-bytes_out_t_block,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_t=$curif-bytes_in_t_pass,$curif-bytes_out_t_block,+\" "; -<<<<<<< HEAD $graphcmd .= "CDEF:\"$curif-bytes_t_pass6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_pass,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_t_block6=$curif-bytes_in6_t_block,$curif-bytes_out6_t_block,+\" "; $graphcmd .= "CDEF:\"$curif-bytes_t6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_block,+\" "; -======= $graphcmd .= "VDEF:\"$curif-in_bits_95=$curif-in_bits,95,PERCENT\" "; $graphcmd .= "VDEF:\"$curif-out_bits_95=$curif-out_bits,95,PERCENT\" "; ->>>>>>> upstream/master $graphcmd .= "AREA:\"$curif-in_bits_block#{$colortrafficdown[1]}:$curif-in-block\" "; $graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" "; @@ -363,21 +360,13 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas $graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" "; $graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" "; -<<<<<<< HEAD $graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block:STACK\" "; $graphcmd .= "{$AREA}:\"$curif-out6_bits_pass_neg#{$colortrafficup[2]}:$curif-out6-pass:STACK\" "; - $graphcmd .= "COMMENT:\"\\n\" "; - $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" "; - $graphcmd .= "COMMENT:\"IPv4 in-pass\t\" "; -======= $graphcmd .= "HRULE:\"$curif-in_bits_95#{$colortraffic95[1]}:$curif-in (95%)\" "; $graphcmd .= "HRULE:\"$curif-out_bits_95#{$colortraffic95[0]}:$curif-out (95%)\" "; - $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t maximum average current period 95th percentile\\n\" "; - - $graphcmd .= "COMMENT:\"in-pass\t\" "; ->>>>>>> upstream/master + $graphcmd .= "COMMENT:\"IPv4 in-pass\t\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:MAX:%7.2lf %sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" "; $graphcmd .= "GPRINT:\"$curif-in_bits_pass:LAST:%7.2lf %Sb/s\" "; From 1529458011a6aabcf39f01592a9971bf2c337696 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 9 Mar 2011 22:21:14 +0100 Subject: [PATCH 177/329] Add the IPv6 tag to the version so that BSD perimeter can seen these installs from a mile away --- conf.default/config.xml | 2 +- etc/version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.default/config.xml b/conf.default/config.xml index 6074c02b92..42662f709c 100644 --- a/conf.default/config.xml +++ b/conf.default/config.xml @@ -1,7 +1,7 @@ - 7.6 + 7.8 pfsense_ng diff --git a/etc/version b/etc/version index 73a14bbb3f..e252e34bdb 100644 --- a/etc/version +++ b/etc/version @@ -1 +1 @@ -2.0-RC1 +2.0-RC1-IPv6 From 3795d067c95977ec4b4ddf95714236185cce5ac5 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 11 Mar 2011 22:34:53 +0100 Subject: [PATCH 178/329] Add the ability to differentiate between v4 and v6 tunnels. Bill says he can test --- etc/inc/ipsec.inc | 3 ++- usr/local/www/vpn_ipsec_phase2.php | 30 +++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index e15a14c6c9..76f94ec78f 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -82,7 +82,8 @@ $p1_authentication_methods = array( 'pre_shared_key' => array( 'name' => 'Mutual PSK', 'mobile' => false ) ); $p2_modes = array( - 'tunnel' => 'Tunnel', + 'tunnel' => 'Tunnel v4', + 'tunnel6' => 'Tunnel v6', 'transport' => 'Transport'); $p2_protos = array( diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index d45b0d69dc..a4dcbdb1a3 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -118,7 +118,7 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if($pconfig['mode'] == "tunnel") + if(($pconfig['mode'] == "tunnel") || ($pconfig['mode'] == "tunnel6")) { switch ($pconfig['localid_type']) { case "network": @@ -158,7 +158,7 @@ if ($_POST) { $ph2ent['mode'] = $pconfig['mode']; $ph2ent['disabled'] = $pconfig['disabled'] ? true : false; - if($ph2ent['mode'] == "tunnel") { + if(($ph2ent['mode'] == "tunnel") || ($ph2ent['mode'] == "tunnel6")){ $ph2ent['localid'] = pconfig_to_idinfo("local",$pconfig); $ph2ent['remoteid'] = pconfig_to_idinfo("remote",$pconfig); } @@ -216,7 +216,7 @@ include("head.inc"); function change_mode() { index = document.iform.mode.selectedIndex; value = document.iform.mode.options[index].value; - if (value == 'tunnel') { + if ((value == 'tunnel') || (value == 'tunnel6')) { document.getElementById('opt_localid').style.display = ''; document.getElementById('opt_remoteid').style.display = ''; @@ -231,8 +231,14 @@ function change_mode() { function typesel_change_local(bits) { - if (typeof(bits)=="undefined") - bits = 24; + if (typeof(bits)=="undefined") { + if (value == 'tunnel') { + bits = 24; + } + if (value == 'tunnel6') { + bits = 64; + } + } switch (document.iform.localid_type.selectedIndex) { case 0: /* single */ @@ -262,8 +268,14 @@ function typesel_change_local(bits) { function typesel_change_remote(bits) { - if (typeof(bits)=="undefined") - bits = 24; + if (typeof(bits)=="undefined") { + if (value == 'tunnel') { + bits = 24; + } + if (value == 'tunnel6') { + bits = 64; + } + } switch (document.iform.remoteid_type.selectedIndex) { case 0: /* single */ @@ -376,7 +388,7 @@ function change_protocol() { / / + + +"> + + +"> + + + +

?

+ + + + + From fbcbfa44ee959ebbebf51cb1a20237fba54ce584 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Mar 2011 21:30:45 +0100 Subject: [PATCH 183/329] Add the dhcp v6 page to the menu, eventhough it is broken. Tabs for later integration --- usr/local/www/fbegin.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index e88df50657..e2f5d72267 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -153,6 +153,7 @@ $status_menu[] = array("CARP (failover)", "/carp_status.php"); $status_menu[] = array("Dashboard", "/index.php"); $status_menu[] = array("Gateways", "/status_gateways.php"); $status_menu[] = array("DHCP Leases", "/status_dhcp_leases.php"); +$status_menu[] = array("DHCPv6 Leases", "/status_dhcpv6_leases.php"); $status_menu[] = array("Filter Reload", "/status_filter_reload.php"); $status_menu[] = array("Interfaces", "/status_interfaces.php"); $status_menu[] = array("IPsec", "/diag_ipsec.php"); From 6c4f3b54a05b20bfe5fbc52206a1980308b539b3 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Mar 2011 21:40:12 +0100 Subject: [PATCH 184/329] Make sure to note the limitations to gethostbyname, it does not work for Quad A records. Fix resolve_retry in the process, use that. --- etc/inc/ipsec.inc | 2 +- etc/inc/util.inc | 1 + etc/inc/vpn.inc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index 76f94ec78f..c7cbcf6744 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -270,7 +270,7 @@ function ipsec_phase1_status(& $ph1ent) { function ipsec_phase2_status(& $spd,& $sad,& $ph1ent,& $ph2ent) { $loc_ip = ipsec_get_phase1_src($ph1ent); - $rmt_ip = gethostbyname(ipsec_get_phase1_dst($ph1ent)); + $rmt_ip = resolve_retry(ipsec_get_phase1_dst($ph1ent)); $loc_id = ipsec_idinfo_to_cidr($ph2ent['localid'],true); $rmt_id = ipsec_idinfo_to_cidr($ph2ent['remoteid'],true); diff --git a/etc/inc/util.inc b/etc/inc/util.inc index cf531cee1d..48b1de136c 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1102,6 +1102,7 @@ function resolve_retry($hostname, $retries = 5) { return $hostname; for ($i = 0; $i < $retries; $i++) { + // FIXME: gethostbyname does not work for AAAA hostnames, boo, hiss $ip = gethostbyname($hostname); if ($ip && $ip != $hostname) { diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 6f48820bff..a1d4cef81f 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -436,7 +436,7 @@ function vpn_ipsec_configure($ipchg = false) case "dyn_dns": $myid_type = "address"; - $myid_data = gethostbyname($ph1ent['myid_data']); + $myid_data = resolve_retry($ph1ent['myid_data']); break; case "address"; From e79b24ab3534ac2af7d832038155a99902bc2c49 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Mar 2011 22:02:50 +0100 Subject: [PATCH 185/329] Extend the IPsec configuration with a protocol family for the phase 1 --- etc/inc/ipsec.inc | 15 +++++++++++---- usr/local/www/vpn_ipsec_phase1.php | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index c7cbcf6744..adfea0524c 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -127,14 +127,21 @@ function ipsec_get_phase1_src(& $ph1ent) { if ($ph1ent['interface']) { if (!is_ipaddr($ph1ent['interface'])) { $if = $ph1ent['interface']; - $interfaceip = get_interface_ip($if); + if($ph1ent['protocol'] == "inet6") { + $interfaceip = get_interface_ipv6($if); + } else { + $interfaceip = get_interface_ip($if); + } } else { $interfaceip=$ph1ent['interface']; } - } - else { + } else { $if = "wan"; - $interfaceip = get_interface_ip($if); + if($ph1ent['protocol'] == "inet6") { + $interfaceip = get_interface_ipv6($if); + } else { + $interfaceip = get_interface_ip($if); + } } return $interfaceip; diff --git a/usr/local/www/vpn_ipsec_phase1.php b/usr/local/www/vpn_ipsec_phase1.php index 12bb235a5a..c537f9f28e 100644 --- a/usr/local/www/vpn_ipsec_phase1.php +++ b/usr/local/www/vpn_ipsec_phase1.php @@ -80,6 +80,7 @@ if (isset($p1index) && $a_phase1[$p1index]) { $pconfig['remotegw'] = $a_phase1[$p1index]['remote-gateway']; $pconfig['mode'] = $a_phase1[$p1index]['mode']; + $pconfig['protocol'] = $a_phase1[$p1index]['protocol']; $pconfig['myid_type'] = $a_phase1[$p1index]['myid_type']; $pconfig['myid_data'] = $a_phase1[$p1index]['myid_data']; $pconfig['peerid_type'] = $a_phase1[$p1index]['peerid_type']; @@ -113,6 +114,7 @@ if (isset($p1index) && $a_phase1[$p1index]) { if($config['interfaces']['lan']) $pconfig['localnet'] = "lan"; $pconfig['mode'] = "aggressive"; + $pconfig['protocol'] = "inet"; $pconfig['myid_type'] = "myaddress"; $pconfig['peerid_type'] = "peeraddress"; $pconfig['authentication_method'] = "pre_shared_key"; @@ -292,6 +294,7 @@ if ($_POST) { $ph1ent['remote-gateway'] = $pconfig['remotegw']; $ph1ent['mode'] = $pconfig['mode']; + $ph1ent['protocol'] = $pconfig['protocol']; $ph1ent['myid_type'] = $pconfig['myid_type']; $ph1ent['myid_data'] = $pconfig['myid_data']; @@ -509,6 +512,21 @@ function dpdchkbox_change() {
+ + + +
. + + From fb17f629ee27e837735aeb48b93ead69d2a64754 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Mar 2011 22:03:54 +0100 Subject: [PATCH 186/329] Commit the backend function that writes out the racoon.conf --- etc/inc/vpn.inc | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index a1d4cef81f..d1eb8d88ca 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -142,7 +142,7 @@ function vpn_ipsec_configure($ipchg = false) continue; $ep = ipsec_get_phase1_src($ph1ent); - if (!$ep) + if (!is_ipaddr($ep)) continue; if(!in_array($ep,$ipmap)) @@ -186,16 +186,30 @@ function vpn_ipsec_configure($ipchg = false) if ($ph2ent['pinghost']) { $iflist = get_configured_interface_list(); foreach ($iflist as $ifent => $ifname) { - $interface_ip = get_interface_ip($ifent); - $local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); - if (ip_in_subnet($interface_ip, $local_subnet)) { - $srcip = $interface_ip; - break; + if(is_ipaddrv6($ph1ent['src'])) { + $interface_ip = get_interface_ipv6($ifent); + $local_subnetv6 = ipsec_idinfo_to_cidr($ph2ent['localid'], true); + if (ip_in_subnetv6($interface_ip, $local_subnet)) { + $srcip = $interface_ip; + break; + } + } else { + $interface_ip = get_interface_ip($ifent); + $local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); + if (ip_in_subnet($interface_ip, $local_subnet)) { + $srcip = $interface_ip; + break; + } } } $dstip = $ph2ent['pinghost']; + if(is_ipaddrv6($srcip)) { + $family = "inet6"; + } else { + $family = "inet"; + } if (is_ipaddr($srcip)) - $ipsecpinghosts .= "{$srcip}|{$dstip}|3\n"; + $ipsecpinghosts .= "{$srcip}|{$dstip}|3|{$family}\n"; } } $pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "w"); From 1778480dbe583323acbacd0805bbfd9cbf3ef5b0 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Mar 2011 22:09:47 +0100 Subject: [PATCH 187/329] Show the proper Phase entry for the IPv6 tunnels --- usr/local/www/vpn_ipsec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/local/www/vpn_ipsec.php b/usr/local/www/vpn_ipsec.php index 40879f6660..16231abacc 100755 --- a/usr/local/www/vpn_ipsec.php +++ b/usr/local/www/vpn_ipsec.php @@ -281,7 +281,7 @@ include("head.inc"); - + @@ -317,11 +317,11 @@ include("head.inc"); "tunnel") { + if(($ph2ent['mode'] <> "tunnel") and ($ph2ent['mode'] <> "tunnel6")) { echo ""; } ?> - + + + + + + + + + +
+
+
+
+
+ + From 8336846a33ef73a335cf2acbb296ed7b28f34a21 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 15 Mar 2011 12:05:15 +0100 Subject: [PATCH 191/329] More html fine tuning --- usr/local/www/widgets/widgets/interfaces.widget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/widgets/widgets/interfaces.widget.php b/usr/local/www/widgets/widgets/interfaces.widget.php index c05e99b72d..d2db3b19ee 100644 --- a/usr/local/www/widgets/widgets/interfaces.widget.php +++ b/usr/local/www/widgets/widgets/interfaces.widget.php @@ -71,7 +71,7 @@ require_once("/usr/local/www/widgets/include/interfaces.inc"); ?> - +
@@ -648,7 +648,7 @@ include("head.inc"); @@ -681,7 +681,7 @@ include("head.inc");

-
+

@@ -694,8 +694,8 @@ include("head.inc"); "> -

@@ -734,9 +734,9 @@ include("head.inc");

- + -
+

- diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php index 2c9f5744a9..bc51f83f26 100644 --- a/usr/local/www/services_dhcpv6_edit.php +++ b/usr/local/www/services_dhcpv6_edit.php @@ -212,21 +212,21 @@ include("head.inc");

From c271c485ea62a4ecca2136c1d8c9400bd0f2bd09 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 17 Mar 2011 12:45:09 +0100 Subject: [PATCH 201/329] enlarge various address fields for IPv6 addresses --- usr/local/www/firewall_virtual_ip_edit.php | 6 +++--- usr/local/www/interfaces.php | 2 +- usr/local/www/system.php | 2 +- usr/local/www/vpn_ipsec_phase1.php | 2 +- usr/local/www/vpn_ipsec_phase2.php | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index e5581ca312..dd10780027 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -464,7 +464,7 @@ function typesel_change() { - - */ diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 86d795bc9e..ad253a1e4f 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -1347,7 +1347,7 @@ $types = array("none" => gettext("None"), "staticv4" => gettext("Static IPv4"), diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index a4dcbdb1a3..5957c9ecac 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -385,7 +385,7 @@ function change_protocol() { From 9498c8d7280f59b5ff15dd12b50dfd5ca3273c89 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 17 Mar 2011 12:52:26 +0100 Subject: [PATCH 202/329] Fix field lengths for IPv6 addresses --- usr/local/www/system_gateways_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 6eef520da5..02fac7c51f 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -354,7 +354,7 @@ function show_advanced_gateway() { @@ -374,7 +374,7 @@ function show_advanced_gateway() { else $monitor = htmlspecialchars($pconfig['monitor']); ?> - +
Date: Fri, 18 Mar 2011 10:06:48 +0100 Subject: [PATCH 203/329] Fix edit bug that duplicated records. --- usr/local/www/firewall_nat_npt_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/firewall_nat_npt_edit.php b/usr/local/www/firewall_nat_npt_edit.php index e06cc13bbc..3537186a89 100644 --- a/usr/local/www/firewall_nat_npt_edit.php +++ b/usr/local/www/firewall_nat_npt_edit.php @@ -268,7 +268,7 @@ external prefix."); From 755405c1c775fa830b0880b4639bf4368d663832 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Fri, 18 Mar 2011 10:18:50 +0100 Subject: [PATCH 204/329] fix filter rules for requested ipv6 icmp types --- etc/inc/filter.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 77e27b4e49..6c56bc85b2 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1839,16 +1839,16 @@ function filter_generate_user_rule($rule) { $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; } else { if($rule['interface'] <> "pptp") { - log_error("Could not find gateway for interface({$rule['interface']})."); + log_error("Could not find IPv6 gateway for interface({$rule['interface']})."); } } } else { $rg = get_interface_gateway($rule['interface']); - if(is_ipaddr($rg)) { + if(is_ipaddrv4($rg)) { $aline['reply'] = "reply-to ( {$ifcfg['if']} {$rg} ) "; } else { if($rule['interface'] <> "pptp") { - log_error("Could not find gateway for interface({$rule['interface']})."); + log_error("Could not find IPv4 gateway for interface({$rule['interface']})."); } } } @@ -1904,10 +1904,10 @@ function filter_generate_user_rule($rule) { $l7_structures = $l7rule->get_unique_structures(); $aline['divert'] = "divert " . $l7rule->GetRPort() . " "; } - if(($rule['protocol'] == "icmp") && $rule['icmptype']) + if(($rule['protocol'] == "icmp") && $rule['icmptype'] && ($rule['ipprotocol'] == "inet")) $aline['icmp-type'] = "icmp-type {$rule['icmptype']} "; - if(($rule['protocol'] == "icmp6") && $rule['icmptype']) - $aline['icmp6-type'] = "icmp-type {$rule['icmptype']} "; + if(($rule['protocol'] == "icmp") && $rule['icmptype'] && ($rule['ipprotocol'] == "inet6")) + $aline['icmp6-type'] = "icmp6-type {$rule['icmptype']} "; if(!empty($rule['tag'])) $aline['tag'] = " tag " .$rule['tag']. " "; if(!empty($rule['tagged'])) From 0999192417ca0457d681a62ab61ce139246a732b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 20 Mar 2011 10:12:26 +0100 Subject: [PATCH 205/329] Merge commit from Bill M for ipv6 counters and interface stats --- etc/inc/pfsense-utils.inc | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 27641354b1..a65f27caaf 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1121,13 +1121,13 @@ function get_interface_info($ifdescr) { $ifinfo['macaddr'] = $ifinfotmp['macaddr']; $ifinfo['ipaddr'] = $ifinfotmp['ipaddr']; $ifinfo['subnet'] = $ifinfotmp['subnet']; - $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr);; - $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr);; + $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr); + $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr); if (isset($ifinfotmp['link0'])) $link0 = "down"; $ifinfotmp = pfSense_get_interface_stats($chkif); - $ifinfo['inpkts'] = $ifinfotmp['inpkts']; - $ifinfo['outpkts'] = $ifinfotmp['outpkts']; + // $ifinfo['inpkts'] = $ifinfotmp['inpkts']; + // $ifinfo['outpkts'] = $ifinfotmp['outpkts']; $ifinfo['inerrs'] = $ifinfotmp['inerrs']; $ifinfo['outerrs'] = $ifinfotmp['outerrs']; $ifinfo['collisions'] = $ifinfotmp['collisions']; @@ -1137,31 +1137,43 @@ function get_interface_info($ifdescr) { exec("/sbin/pfctl -vvsI -i {$chkif}", $pfctlstats); $pf_in4_pass = preg_split("/ +/ ", $pfctlstats[3]); $pf_out4_pass = preg_split("/ +/", $pfctlstats[5]); + $pf_in6_pass = preg_split("/ +/ ", $pfctlstats[7]); + $pf_out6_pass = preg_split("/ +/", $pfctlstats[9]); $in4_pass = $pf_in4_pass[5]; $out4_pass = $pf_out4_pass[5]; $in4_pass_packets = $pf_in4_pass[3]; $out4_pass_packets = $pf_out4_pass[3]; - $ifinfo['inbytespass'] = $in4_pass; - $ifinfo['outbytespass'] = $out4_pass; - $ifinfo['inpktspass'] = $in4_pass_packets; - $ifinfo['outpktspass'] = $out4_pass_packets; + $in6_pass = $pf_in6_pass[5]; + $out6_pass = $pf_out6_pass[5]; + $in6_pass_packets = $pf_in6_pass[3]; + $out6_pass_packets = $pf_out6_pass[3]; + $ifinfo['inbytespass'] = $in4_pass + $in6_pass; + $ifinfo['outbytespass'] = $out4_pass + $out6_pass; + $ifinfo['inpktspass'] = $in4_pass_packets + $in6_pass_packets; + $ifinfo['outpktspass'] = $out4_pass_packets + $in6_pass_packets; /* Block */ $pf_in4_block = preg_split("/ +/", $pfctlstats[4]); $pf_out4_block = preg_split("/ +/", $pfctlstats[6]); + $pf_in6_block = preg_split("/ +/", $pfctlstats[8]); + $pf_out6_block = preg_split("/ +/", $pfctlstats[10]); $in4_block = $pf_in4_block[5]; $out4_block = $pf_out4_block[5]; $in4_block_packets = $pf_in4_block[3]; $out4_block_packets = $pf_out4_block[3]; - $ifinfo['inbytesblock'] = $in4_block; - $ifinfo['outbytesblock'] = $out4_block; - $ifinfo['inpktsblock'] = $in4_block_packets; - $ifinfo['outpktsblock'] = $out4_block_packets; + $in6_block = $pf_in6_block[5]; + $out6_block = $pf_out6_block[5]; + $in6_block_packets = $pf_in6_block[3]; + $out6_block_packets = $pf_out6_block[3]; + $ifinfo['inbytesblock'] = $in4_block + $in6_block; + $ifinfo['outbytesblock'] = $out4_block + $out6_block; + $ifinfo['inpktsblock'] = $in4_block_packets + $in6_block_packets; + $ifinfo['outpktsblock'] = $out4_block_packets + $out6_block_packets; - $ifinfo['inbytes'] = $in4_pass + $in4_block; - $ifinfo['outbytes'] = $out4_pass + $out4_block; - $ifinfo['inpkts'] = $in4_pass_packets + $in4_block_packets; - $ifinfo['outpkts'] = $in4_pass_packets + $out4_block_packets; + $ifinfo['inbytes'] = $in4_pass + $in6_pass; + $ifinfo['outbytes'] = $out4_pass + $out6_pass; + $ifinfo['inpkts'] = $in4_pass_packets + $in6_pass_packets; + $ifinfo['outpkts'] = $in4_pass_packets + $out6_pass_packets; $ifconfiginfo = ""; $link_type = $config['interfaces'][$ifdescr]['ipaddr']; From 22dae8531b63c10e4d9708ff42377cc9a202c3da Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 20 Mar 2011 23:07:09 +0100 Subject: [PATCH 206/329] Add a function that will calculate the ipv6 address for a given hardware address --- etc/inc/pfsense-utils.inc | 78 +++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index a65f27caaf..d2fb4b5939 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1121,13 +1121,13 @@ function get_interface_info($ifdescr) { $ifinfo['macaddr'] = $ifinfotmp['macaddr']; $ifinfo['ipaddr'] = $ifinfotmp['ipaddr']; $ifinfo['subnet'] = $ifinfotmp['subnet']; - $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr); - $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr); + $ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr);; + $ifinfo['subnetv6'] = get_interface_subnetv6($ifdescr);; if (isset($ifinfotmp['link0'])) $link0 = "down"; $ifinfotmp = pfSense_get_interface_stats($chkif); - // $ifinfo['inpkts'] = $ifinfotmp['inpkts']; - // $ifinfo['outpkts'] = $ifinfotmp['outpkts']; + $ifinfo['inpkts'] = $ifinfotmp['inpkts']; + $ifinfo['outpkts'] = $ifinfotmp['outpkts']; $ifinfo['inerrs'] = $ifinfotmp['inerrs']; $ifinfo['outerrs'] = $ifinfotmp['outerrs']; $ifinfo['collisions'] = $ifinfotmp['collisions']; @@ -1137,43 +1137,31 @@ function get_interface_info($ifdescr) { exec("/sbin/pfctl -vvsI -i {$chkif}", $pfctlstats); $pf_in4_pass = preg_split("/ +/ ", $pfctlstats[3]); $pf_out4_pass = preg_split("/ +/", $pfctlstats[5]); - $pf_in6_pass = preg_split("/ +/ ", $pfctlstats[7]); - $pf_out6_pass = preg_split("/ +/", $pfctlstats[9]); $in4_pass = $pf_in4_pass[5]; $out4_pass = $pf_out4_pass[5]; $in4_pass_packets = $pf_in4_pass[3]; $out4_pass_packets = $pf_out4_pass[3]; - $in6_pass = $pf_in6_pass[5]; - $out6_pass = $pf_out6_pass[5]; - $in6_pass_packets = $pf_in6_pass[3]; - $out6_pass_packets = $pf_out6_pass[3]; - $ifinfo['inbytespass'] = $in4_pass + $in6_pass; - $ifinfo['outbytespass'] = $out4_pass + $out6_pass; - $ifinfo['inpktspass'] = $in4_pass_packets + $in6_pass_packets; - $ifinfo['outpktspass'] = $out4_pass_packets + $in6_pass_packets; + $ifinfo['inbytespass'] = $in4_pass; + $ifinfo['outbytespass'] = $out4_pass; + $ifinfo['inpktspass'] = $in4_pass_packets; + $ifinfo['outpktspass'] = $out4_pass_packets; /* Block */ $pf_in4_block = preg_split("/ +/", $pfctlstats[4]); $pf_out4_block = preg_split("/ +/", $pfctlstats[6]); - $pf_in6_block = preg_split("/ +/", $pfctlstats[8]); - $pf_out6_block = preg_split("/ +/", $pfctlstats[10]); $in4_block = $pf_in4_block[5]; $out4_block = $pf_out4_block[5]; $in4_block_packets = $pf_in4_block[3]; $out4_block_packets = $pf_out4_block[3]; - $in6_block = $pf_in6_block[5]; - $out6_block = $pf_out6_block[5]; - $in6_block_packets = $pf_in6_block[3]; - $out6_block_packets = $pf_out6_block[3]; - $ifinfo['inbytesblock'] = $in4_block + $in6_block; - $ifinfo['outbytesblock'] = $out4_block + $out6_block; - $ifinfo['inpktsblock'] = $in4_block_packets + $in6_block_packets; - $ifinfo['outpktsblock'] = $out4_block_packets + $out6_block_packets; + $ifinfo['inbytesblock'] = $in4_block; + $ifinfo['outbytesblock'] = $out4_block; + $ifinfo['inpktsblock'] = $in4_block_packets; + $ifinfo['outpktsblock'] = $out4_block_packets; - $ifinfo['inbytes'] = $in4_pass + $in6_pass; - $ifinfo['outbytes'] = $out4_pass + $out6_pass; - $ifinfo['inpkts'] = $in4_pass_packets + $in6_pass_packets; - $ifinfo['outpkts'] = $in4_pass_packets + $out6_pass_packets; + $ifinfo['inbytes'] = $in4_pass + $in4_block; + $ifinfo['outbytes'] = $out4_pass + $out4_block; + $ifinfo['inpkts'] = $in4_pass_packets + $in4_block_packets; + $ifinfo['outpkts'] = $in4_pass_packets + $out4_block_packets; $ifconfiginfo = ""; $link_type = $config['interfaces'][$ifdescr]['ipaddr']; @@ -2185,4 +2173,38 @@ function filter_rules_compare($a, $b) { return compare_interface_friendly_names($a['interface'], $b['interface']); } +function generate_ipv6_from_mac($mac) { + $elements = explode(":", $mac); + if(count($elements) <> 6) + return false; + + $i = 0; + $ipv6 = ""; + foreach($elements as $byte) { + if($i == 0) { + $hexadecimal = substr($byte, 1, 2); + $bitmap = base_convert($hexadecimal, 16, 2); + $bitmap = str_pad($bitmap, 4, "0", STR_PAD_LEFT); + $bitmap = substr($bitmap, 0, 2) ."1". substr($bitmap, 3,4); + $byte = substr($byte, 0, 1) . base_convert($bitmap, 2, 16); + } + $ipv6 .= $byte; + if($i == 1) { + $ipv6 .= ":"; + } + if($i == 3) { + $ipv6 .= ":"; + } + if($i == 5) { + $ipv6 .= ":"; + } + if($i == 2) { + $ipv6 .= "ff:fe"; + $i++; + } + + $i++; + } + return $ipv6; +} ?> From 32018396bac5f070139a339762ee449bf7c51f5b Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sun, 20 Mar 2011 23:11:17 +0100 Subject: [PATCH 207/329] Attempt to manually generate a ipv6 address --- etc/inc/services.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 873b06f32c..ae8b9a8a9a 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -701,7 +701,9 @@ EOD; $dhcpdv6ifs[] = $realif; /* Create link local address for bridges */ if(stristr("$realif", "bridge")) { - mwexec("$ifconfig {$realif} inet6 fe80::/64 eui64"); + exec("ifconfig {$realif}|awk '/ether/ {print \$NF}'", $mac); + $autoaddress = generate_ipv6_from_mac($mac); + mwexec("$ifconfig {$realif} inet6 fe80::{autoaddress}/64"); } } From 5ceb19429be99993a905dab84ed060a1e8e3df41 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 21 Mar 2011 09:17:25 +0100 Subject: [PATCH 208/329] Further fixup the fetch Mac address exec() this hopefully works --- etc/inc/services.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index ae8b9a8a9a..b65c0fc1b0 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -701,8 +701,8 @@ EOD; $dhcpdv6ifs[] = $realif; /* Create link local address for bridges */ if(stristr("$realif", "bridge")) { - exec("ifconfig {$realif}|awk '/ether/ {print \$NF}'", $mac); - $autoaddress = generate_ipv6_from_mac($mac); + exec("ifconfig {$realif}|awk '/ether/ {print \$2}'", $mac); + $autoaddress = generate_ipv6_from_mac(trim($mac[0])); mwexec("$ifconfig {$realif} inet6 fe80::{autoaddress}/64"); } } From 656f17638f5f72ecf218a7b23228be9b54c18353 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 21 Mar 2011 16:40:22 +0100 Subject: [PATCH 209/329] Correct typo in array name. Add select box for operating mode of rtadvd and dhcpv6 combination --- etc/inc/services.inc | 27 ++++++++++++++++++-------- usr/local/www/services_dhcpv6.php | 15 +++++++++++++- usr/local/www/services_dhcpv6_edit.php | 2 +- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index b65c0fc1b0..d4ad63a492 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -96,7 +96,18 @@ function services_rtadvd_configure() { $rtadvdconf .= "{$realif}:\\\n"; $rtadvdconf .= "\t:addr=\"{$subnetv6}\":\\\n"; $rtadvdconf .= "\t:prefixlen#{$ifcfgsnv6}:\\\n"; - $rtadvdconf .= "\t:raflags#192:\n"; + switch($dhcpv6ifconf['mode']) { + case "managed": + $rtadvdconf .= "\t:raflags#64:\n"; + break; + case "assist": + $rtadvdconf .= "\t:raflags#192:\n"; + break; + default: + $rtadvdconf .= "\t:raflags#0:\n"; + break; + + } $rtadvdconf .= "\n"; } @@ -697,13 +708,13 @@ EOD; } */ - $realif = escapeshellcmd(get_real_interface($dhcpv6if)); - $dhcpdv6ifs[] = $realif; - /* Create link local address for bridges */ - if(stristr("$realif", "bridge")) { - exec("ifconfig {$realif}|awk '/ether/ {print \$2}'", $mac); - $autoaddress = generate_ipv6_from_mac(trim($mac[0])); - mwexec("$ifconfig {$realif} inet6 fe80::{autoaddress}/64"); + if($config['dhcpdv6'][$dhcpv6if]['mode'] <> "unmanaged") { + $realif = escapeshellcmd(get_real_interface($dhcpv6if)); + $dhcpdv6ifs[] = $realif; + /* Create link local address for bridges */ + if(stristr("$realif", "bridge")) { + mwexec("$ifconfig {$realif} inet6 fe80::/64 eui64"); + } } } diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 7d00b0c761..701d87e7f8 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -138,6 +138,7 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from']; $pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to']; } + $pconfig['mode'] = $config['dhcpdv6'][$if]['mode']; $pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime']; $pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime']; $pconfig['gateway'] = $config['dhcpdv6'][$if]['gateway']; @@ -190,6 +191,8 @@ function is_inrange($test, $start, $end) { return false; } +$modes = array("unmanaged" => "Unmanaged", "managed" => "Managed", "assist" => "Assisted"); + if ($_POST) { unset($input_errors); @@ -304,6 +307,7 @@ if ($_POST) { if (!is_array($config['dhcpdv6'][$if]['range'])) $config['dhcpdv6'][$if]['range'] = array(); + $config['dhcpdv6'][$if]['mode'] = $_POST['mode']; $config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from']; $config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to']; $config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime']; @@ -415,7 +419,7 @@ include("head.inc"); @@ -151,6 +154,15 @@ function enable_change(enable_over) { "System: General setup%s to the proper value."),'','');?>

+ + + From 3994cc70cf43cbd3d90188739c05d1a552ab5c69 Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 12 Jul 2011 16:59:29 +0000 Subject: [PATCH 302/329] Do a more strict check on this to avoid warnings --- etc/rc.filter_synchronize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize index fe8a30f2e4..4b52f22815 100755 --- a/etc/rc.filter_synchronize +++ b/etc/rc.filter_synchronize @@ -272,7 +272,7 @@ global $g; if (file_exists("{$g['varrun_path']}/booting") || $g['booting']) return; -if (is_array($config['installedpackages']['carpsettings']['config'])) { +if (is_array($config['installedpackages']['carpsettings']) && is_array($config['installedpackages']['carpsettings']['config'])) { update_filter_reload_status("Building CARP sync information"); foreach($config['installedpackages']['carpsettings']['config'] as $carp) { if (empty($carp['synchronizetoip'])) { From fd3e19f3bf9499b944263c0acaeaa6446260f197 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 12 Jul 2011 15:38:58 -0400 Subject: [PATCH 303/329] Create dynamodules in the order they where touched --- etc/rc.php_ini_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 7dfcdddf28..77b9375556 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -192,7 +192,7 @@ fi # Read in dynamodules if [ -d /etc/php_dynamodules ]; then - DYNA_MODULES=`/bin/ls /etc/php_dynamodules/` + DYNA_MODULES=`/bin/ls -Utr /etc/php_dynamodules/` PHPMODULES="$PHPMODULES $DYNA_MODULES" fi From a213ad18911f400b64c37481c16d4c152c13acc6 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 13 Jul 2011 16:20:52 +1200 Subject: [PATCH 304/329] Allow a ZMQ syslog address --- etc/inc/system.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 1b2bc343da..ed7e6af398 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -638,6 +638,12 @@ EOD; EOD; } + if (isset($syslogcfg['zmqserver'])) { + $syslogconf .= << Date: Wed, 13 Jul 2011 07:26:43 -0400 Subject: [PATCH 305/329] fix missing " --- etc/inc/pkg-utils.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 2f47f3ce8f..6891eab5b6 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -547,7 +547,7 @@ function install_package($package, $pkg_info = "") { update_status($static_output); /* fetch the package's configuration file */ if($pkg_info['config_file'] != "") { - $static_output .= "\n" . gettext(Downloading package configuration file... "); + $static_output .= "\n" . gettext("Downloading package configuration file... "); update_output_window($static_output); pkg_debug(gettext("Downloading package configuration file...") . "\n"); $fetchto = substr(strrchr($pkg_info['config_file'], '/'), 1); From cdfdb1a7f64846c34c642606a789b003624b20b9 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 13 Jul 2011 08:31:39 -0400 Subject: [PATCH 306/329] Fix merge conflict --- etc/inc/easyrule.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/inc/easyrule.inc b/etc/inc/easyrule.inc index 39a4f24bd5..d176f78f56 100644 --- a/etc/inc/easyrule.inc +++ b/etc/inc/easyrule.inc @@ -245,12 +245,8 @@ function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport, $ipp $filterent = array(); $filterent['type'] = 'pass'; $filterent['interface'] = $int; -<<<<<<< HEAD $filterent['ipprotocol'] = $ipproto; - $filterent['descr'] = "Easy Rule: Passed from Firewall Log View"; -======= $filterent['descr'] = gettext("Easy Rule: Passed from Firewall Log View"); ->>>>>>> upstream/master if ($proto != "any") $filterent['protocol'] = $proto; From b2484fd23cdd5f22cc3d9a3a1b3ba883db17221f Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Wed, 13 Jul 2011 15:39:16 +0200 Subject: [PATCH 307/329] Remove extra "/" --- etc/rc.php_ini_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 77b9375556..db3d364430 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -230,7 +230,7 @@ done for EXT in $PHP_ZEND_MODULES; do # Ensure extension exists before adding. if [ -f "${EXTENSIONSDIR}${EXT}.so" ]; then - echo "zend_extension=${EXTENSIONSDIR}/${EXT}.so" >> /usr/local/lib/php.ini + echo "zend_extension=${EXTENSIONSDIR}${EXT}.so" >> /usr/local/lib/php.ini fi done From 17ad7de4b959cd9d572d059615219578ef93738f Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 13 Jul 2011 13:45:46 +0000 Subject: [PATCH 308/329] Correct version in /etc/version to say what it is rather than the wrong thing from the merge. --- etc/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/version b/etc/version index 064823b0f6..91b8825ff8 100644 --- a/etc/version +++ b/etc/version @@ -1 +1 @@ -2.0-RC3-IPv6 +2.1-DEVELOPMENT From 4a79ec20cb254f378d61709991b28370ea7921d2 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 13 Jul 2011 16:43:17 -0400 Subject: [PATCH 309/329] Adding ioncube_loader --- etc/rc.php_ini_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index db3d364430..49bc9ccd25 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -118,7 +118,7 @@ PHPMODULES="$PHPMODULES ssh2" PHPMODULES="$PHPMODULES pfSense" PHP_ZEND_MODULES="" -PHP_ZEND_MODULES_TS="" +PHP_ZEND_MODULES_TS="ioncube_loader" # Modules previously included. # can be turned on by touching From cfcc69946ca8ca1916ea5f6ee73aadd46966177a Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 13 Jul 2011 17:16:07 -0400 Subject: [PATCH 310/329] CRL fixes for empty CRLs (so they don't kill OpenVPN) --- etc/inc/openvpn.inc | 1 + usr/local/www/system_crlmanager.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index bf109f40f6..0555fca2df 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -562,6 +562,7 @@ function openvpn_reconfigure($mode, $settings) { $conf .= "dh {$g['etc_path']}/dh-parameters.{$settings['dh_length']}\n"; if (!empty($settings['crlref'])) { $crl = lookup_crl($settings['crlref']); + crl_update($crl); openvpn_add_keyfile($crl['text'], $conf, $mode_id, "crl-verify"); } if ($settings['tls']) { diff --git a/usr/local/www/system_crlmanager.php b/usr/local/www/system_crlmanager.php index 1beb75b503..2ecc866bdd 100644 --- a/usr/local/www/system_crlmanager.php +++ b/usr/local/www/system_crlmanager.php @@ -145,9 +145,9 @@ if ($act == "addcert") { if (!$input_errors) { $reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason']; cert_revoke($cert, $crl, $reason); - write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}."); require_once('openvpn.inc'); openvpn_refresh_crls(); + write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}."); pfSenseHeader("system_crlmanager.php"); exit; } @@ -172,10 +172,10 @@ if ($act == "delcert") { } $name = $thiscert['descr']; if (cert_unrevoke($thiscert, $thiscrl)) { - write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr'])); $savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "
"; require_once('openvpn.inc'); openvpn_refresh_crls(); + write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr'])); } else { $savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "
"; } From e4f3307c8bd1673bb6fbf74eed6aababb88c83e2 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 13 Jul 2011 18:36:26 -0400 Subject: [PATCH 311/329] Only load modules once --- etc/rc.php_ini_setup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 49bc9ccd25..626e61ec41 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -295,6 +295,8 @@ for EXT in $PHPMODULES; do PHPMODULESLC="$PHPMODULESLC `echo "$EXT" | /usr/bin/tr '[:upper:]' '[:lower:]'`" done +PHPMODULES=`echo $PHPMODULES | sort -u` + # Check loaded modules and remove anything that did not load correctly LOADED_MODULES=`/usr/local/bin/php -m | /usr/bin/tr '[:upper:]' '[:lower:]' 2>/dev/null | /usr/bin/grep -v "\["` for EXT in $PHPMODULESLC; do From fc23b860eb933ee557cd5cc3d5816f732360a54c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 13 Jul 2011 18:42:55 -0400 Subject: [PATCH 312/329] Revert "Only load modules once" This reverts commit 00b9730d6fe20272a40e707b709e677a847b7863. --- etc/rc.php_ini_setup | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index 626e61ec41..49bc9ccd25 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -295,8 +295,6 @@ for EXT in $PHPMODULES; do PHPMODULESLC="$PHPMODULESLC `echo "$EXT" | /usr/bin/tr '[:upper:]' '[:lower:]'`" done -PHPMODULES=`echo $PHPMODULES | sort -u` - # Check loaded modules and remove anything that did not load correctly LOADED_MODULES=`/usr/local/bin/php -m | /usr/bin/tr '[:upper:]' '[:lower:]' 2>/dev/null | /usr/bin/grep -v "\["` for EXT in $PHPMODULESLC; do From 87f0f42c3230ad7ad15b14a8a9d63c58f8b2e379 Mon Sep 17 00:00:00 2001 From: Ermal Date: Thu, 14 Jul 2011 13:12:04 +0000 Subject: [PATCH 313/329] Already doing this no need to duplicate --- etc/rc.newwanip | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/etc/rc.newwanip b/etc/rc.newwanip index 1ae72ed878..07ff33f86d 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -112,23 +112,6 @@ if (!empty($grouptmp)) /* reconfigure static routes (kernel may have deleted them) */ system_routing_configure($interface); -/* Check Gif tunnels */ -foreach($config['gifs']['gif'] as $gif) { - if($gif['if'] == $interface) { - foreach($config['interfaces'] as $ifname => $ifparent) { - // echo "interface $ifparent, ifname $ifname, gif {$gif['gifif']}\n"; - if(($ifparent['if'] == $gif['gifif']) && (isset($ifparent['enable']))) { - // echo "Running routing configure for $ifname\n"; - $gif['gifif'] = interface_gif_configure($gif); - $confif = convert_real_interface_to_friendly_interface_name($gif['gifif']); - if ($confif <> "") - interface_configure($confif); - system_routing_configure($ifname); - } - } - } -} - /* reconfigure our gateway monitor */ setup_gateways_monitor(); From 84bc8eb79a5f03f6dfc511508b1c3a5b35f916d8 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 14 Jul 2011 15:18:18 -0400 Subject: [PATCH 314/329] Fix missing " in gettext line --- etc/inc/pkg-utils.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 6891eab5b6..ecd0f1c4ca 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -553,7 +553,7 @@ function install_package($package, $pkg_info = "") { $fetchto = substr(strrchr($pkg_info['config_file'], '/'), 1); download_file_with_progress_bar($pkg_info['config_file'], '/usr/local/pkg/' . $fetchto); if(!file_exists('/usr/local/pkg/' . $fetchto)) { - pkg_debug(gettext("ERROR! Unable to fetch package configuration file. Aborting installation.") . \n"); + pkg_debug(gettext("ERROR! Unable to fetch package configuration file. Aborting installation.") . "\n"); if($pkg_interface == "console") print "\n" . gettext("ERROR! Unable to fetch package configuration file. Aborting package installation.") . "\n"; else { From e6bd231242cb43ad7e8fca8635d6adcb17f38186 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 15 Jul 2011 08:01:52 +0000 Subject: [PATCH 315/329] Fixes #1618. Always convert the NAS_PORT value to int in php and pass the attribute type during encoding to guarantee that it is encoded as an integer. --- usr/local/captiveportal/radius_accounting.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index 2e189791dd..704c2293ae 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -56,7 +56,7 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers, $retvalue = array(); $nas_mac = mac_format(get_interface_mac("wan")); $clientmac = mac_format($clientmac); - $nas_port = $ruleno; + $nas_port = intval($ruleno); $radiusvendor = $config['captiveportal']['radiusvendor'] ? $config['captiveportal']['radiusvendor'] : null; switch($radiusvendor) { @@ -171,7 +171,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius $retvalue = array(); $nas_mac = mac_format(get_interface_mac("wan")); $clientmac = mac_format($clientmac); - $nas_port = $ruleno; + $nas_port = intval($ruleno); $radiusvendor = $config['captiveportal']['radiusvendor'] ? $config['captiveportal']['radiusvendor'] : null; $stop_time = (empty($stop_time)) ? time() : $stop_time; $session_time = $stop_time - $start_time; @@ -233,7 +233,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius // Default attributes $racct->putAttribute(RADIUS_SERVICE_TYPE, RADIUS_LOGIN); $racct->putAttribute(RADIUS_NAS_PORT_TYPE, RADIUS_ETHERNET); - $racct->putAttribute(RADIUS_NAS_PORT, $nas_port); + $racct->putAttribute(RADIUS_NAS_PORT, $nas_port, 'integer'); $racct->putAttribute(RADIUS_ACCT_SESSION_ID, $sessionid); // Extra data to identify the client and nas From fe2031ab18b967b31f95d865db07011a39ce6fcc Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 15 Jul 2011 13:10:40 +0000 Subject: [PATCH 316/329] Ticket #1052. Enforce certificates if they are present for authenticating to ldap. Allow to select a CA under ldap type authentication backend to be used for this. --- etc/inc/auth.inc | 48 +++++++++++++++++-- etc/inc/openvpn.auth-user.php | 7 +-- usr/local/www/system_authservers.php | 30 +++++++++++- ...stem_usermanager_settings_ldapacpicker.php | 1 + 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index e2849435aa..e93bf0251e 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -627,8 +627,10 @@ function ldap_test_connection($authcfg) { if(!$ldapserver) return false; + /* Setup CA environment if needed. */ + ldap_setup_caenv($authcfg); + /* connect and see if server is up */ - putenv('LDAPTLS_REQCERT=never'); $error = false; if (empty($ldapport)) { if (!($ldap = ldap_connect($ldapserver))) @@ -644,6 +646,34 @@ function ldap_test_connection($authcfg) { return true; } +function ldap_setup_caenv($authcfg) { + global $g; + + unset($caref); + if (empty($authcfg['ldap_cacert']) || !strstr($authcfg['ldap_urltype'], "SSL")) { + putenv('LDAPTLS_REQCERT=never'); + return; + } else { + $caref = lookup_ca($authcfg['ldap_cacert']); + if (!$caref) { + log_error(sprintf(gettext("LDAP: Could not lookup CA by reference for host %s."), $authcfg['ldap_cacert'])); + /* XXX: Prevent for credential leaking since we cannot setup the CA env. Better way? */ + putenv('LDAPTLS_REQCERT=hard'); + return; + } + if (!is_dir("{$g['varrun_path']}/certs")) + @mkdir("{$g['varrun_path']}/certs"); + if (file_exists("{$g['varrun_path']}/certs/{$authcfg['name']}.ca")) + @unlink("{$g['varrun_path']}/certs/{$authcfg['name']}.ca"); + file_put_contents("{$g['varrun_path']}/certs/{$authcfg['name']}.ca", base64_decode($caref['crt'])); + @chmod("{$g['varrun_path']}/certs/{$authcfg['name']}.ca", 0600); + putenv('LDAPTLS_REQCERT=hard'); + /* XXX: Probably even the hashed link should be created for this? */ + putenv("TLS_CACERTDIR={$g['varrun_path']}/certs"); + putenv("TLS_CACERT={$g['varrun_path']}/certs/{$authcfg['name']}.ca"); + } +} + function ldap_test_bind($authcfg) { global $debug, $config, $g; @@ -669,8 +699,10 @@ function ldap_test_bind($authcfg) { if(!$ldapserver) return false; + /* Setup CA environment if needed. */ + ldap_setup_caenv($authcfg); + /* connect and see if server is up */ - putenv('LDAPTLS_REQCERT=never'); $error = false; if (empty($ldapport)) { if (!($ldap = ldap_connect($ldapserver))) @@ -736,8 +768,10 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { return $ous; } + /* Setup CA environment if needed. */ + ldap_setup_caenv($authcfg); + /* connect and see if server is up */ - putenv('LDAPTLS_REQCERT=never'); $error = false; if (empty($ldapport)) { if (!($ldap = ldap_connect($ldapserver))) @@ -847,8 +881,10 @@ function ldap_get_groups($username, $authcfg) { $ldapgroupattribute = strtolower($ldapgroupattribute); $memberof = array(); + /* Setup CA environment if needed. */ + ldap_setup_caenv($authcfg); + /* connect and see if server is up */ - putenv('LDAPTLS_REQCERT=never'); $error = false; if (empty($ldapport)) { if (!($ldap = ldap_connect($ldapserver))) @@ -967,8 +1003,10 @@ function ldap_backed($username, $passwd, $authcfg) { ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, (int)$ldapver); + /* Setup CA environment if needed. */ + ldap_setup_caenv($authcfg); + /* Make sure we can connect to LDAP */ - putenv('LDAPTLS_REQCERT=never'); $error = false; if (empty($ldapport)) { if (!($ldap = ldap_connect($ldapserver))) diff --git a/etc/inc/openvpn.auth-user.php b/etc/inc/openvpn.auth-user.php index 35d79cd9cd..d36b5ff252 100755 --- a/etc/inc/openvpn.auth-user.php +++ b/etc/inc/openvpn.auth-user.php @@ -96,11 +96,6 @@ if (!$username || !$password) { /* Replaced by a sed with propper variables used below(ldap parameters). */ //
From 1f116988a9bf5ca043e1211ccd5473ae589c1680 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 15 Mar 2011 16:41:48 +0100 Subject: [PATCH 192/329] Enable the IPv6 allow toggle, otherwise the other IPv6 rules do not work. --- etc/inc/globals.inc | 2 +- etc/inc/upgrade_config.inc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index 4e150f82ef..da1a87fade 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.8", + "latest_config" => "7.9", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index df4ede83c0..0177461ffe 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2400,4 +2400,10 @@ function upgrade_077_to_078() { } } +function upgrade_078_to_079() { + global $config; + /* enable the allow IPv6 toggle */ + $config['system']['ipv6allow'] = true; +} + ?> From e2faab6d55975fd9af4167756406f848bcd910c9 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Tue, 15 Mar 2011 18:10:24 +0100 Subject: [PATCH 193/329] Unbreak firewall logs --- usr/local/www/diag_logs_filter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index 64de45830d..877d5bd75d 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -150,7 +150,7 @@ include("head.inc"); Date: Tue, 15 Mar 2011 21:43:51 +0100 Subject: [PATCH 194/329] Add more colors to themes --- usr/local/www/themes/code-red/rrdcolors.inc.php | 8 ++++---- usr/local/www/themes/metallic/rrdcolors.inc.php | 8 ++++---- usr/local/www/themes/nervecenter/rrdcolors.inc.php | 8 ++++---- usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php | 8 ++++---- usr/local/www/themes/pfsense/rrdcolors.inc.php | 8 ++++---- usr/local/www/themes/the_wall/rrdcolors.inc.php | 9 +++++---- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/usr/local/www/themes/code-red/rrdcolors.inc.php b/usr/local/www/themes/code-red/rrdcolors.inc.php index 869727f6af..529377b8fe 100755 --- a/usr/local/www/themes/code-red/rrdcolors.inc.php +++ b/usr/local/www/themes/code-red/rrdcolors.inc.php @@ -30,11 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colortraffic95 = array("660000", "FF0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/metallic/rrdcolors.inc.php b/usr/local/www/themes/metallic/rrdcolors.inc.php index 09956ccc94..1ed3027e20 100644 --- a/usr/local/www/themes/metallic/rrdcolors.inc.php +++ b/usr/local/www/themes/metallic/rrdcolors.inc.php @@ -30,11 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colortraffic95 = array("660000", "FF0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/nervecenter/rrdcolors.inc.php b/usr/local/www/themes/nervecenter/rrdcolors.inc.php index c681f78501..ca6a70fc08 100644 --- a/usr/local/www/themes/nervecenter/rrdcolors.inc.php +++ b/usr/local/www/themes/nervecenter/rrdcolors.inc.php @@ -30,11 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colortraffic95 = array("660000", "FF0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php b/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php index 09956ccc94..1ed3027e20 100644 --- a/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php @@ -30,11 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colortraffic95 = array("660000", "FF0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/pfsense/rrdcolors.inc.php b/usr/local/www/themes/pfsense/rrdcolors.inc.php index 09956ccc94..1ed3027e20 100644 --- a/usr/local/www/themes/pfsense/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense/rrdcolors.inc.php @@ -30,11 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("990000", "CC0000"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); $colortraffic95 = array("660000", "FF0000"); -$colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); diff --git a/usr/local/www/themes/the_wall/rrdcolors.inc.php b/usr/local/www/themes/the_wall/rrdcolors.inc.php index fc662539b4..1ed3027e20 100644 --- a/usr/local/www/themes/the_wall/rrdcolors.inc.php +++ b/usr/local/www/themes/the_wall/rrdcolors.inc.php @@ -30,10 +30,11 @@ /* This file is included by the RRD graphing page and sets the colors */ - $colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); - $colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); - $colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); - $colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); +$colortrafficup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colortrafficdown = array("990000", "CC0000", "b36666", "bd9090"); +$colorpacketsup = array("666666", "CCCCCC", "b36666", "bd9090"); +$colorpacketsdown = array("990000", "CC0000", "b36666", "bd9090"); +$colortraffic95 = array("660000", "FF0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); From 413a327e1ee4a8e3e0e8112bba8f8d8764fd4d8c Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 16 Mar 2011 11:37:02 +0100 Subject: [PATCH 195/329] Add v6 entries to the logs --- usr/local/www/diag_logs_ipsec.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php index 560cd1aa43..d196b30f27 100755 --- a/usr/local/www/diag_logs_ipsec.php +++ b/usr/local/www/diag_logs_ipsec.php @@ -56,13 +56,17 @@ 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); +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"; } From 80c1e99fb100bf79f74a22d66a04e6fec079c35f Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 16 Mar 2011 13:18:06 +0100 Subject: [PATCH 196/329] Correct ping hosts functionality for > 1 tunnel. Add v6 functionality --- etc/inc/vpn.inc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index ccddb80038..f6557b556c 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -137,6 +137,7 @@ function vpn_ipsec_configure($ipchg = false) if (is_array($a_phase1) && count($a_phase1)) { /* step through each phase1 entry */ + $ipsecpinghosts = ""; foreach ($a_phase1 as $ph1ent) { if (isset($ph1ent['disabled'])) continue; @@ -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']; @@ -182,19 +182,24 @@ function vpn_ipsec_configure($ipchg = false) if ($ikeid != $ph1ent['ikeid']) continue; + $ph2ent['localid']['mode'] = $ph2ent['mode']; /* add an ipsec pinghosts entry */ if ($ph2ent['pinghost']) { $iflist = get_configured_interface_list(); foreach ($iflist as $ifent => $ifname) { - if(is_ipaddrv6($ph1ent['src'])) { + if(is_ipaddrv6($ph2ent['pinghost'])) { $interface_ip = get_interface_ipv6($ifent); - $local_subnetv6 = ipsec_idinfo_to_cidr($ph2ent['localid'], true); - if (ip_in_subnetv6($interface_ip, $local_subnet)) { + if(!is_ipaddrv6($interface_ip)) + continue; + $local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); + if (ip_in_subnet($interface_ip, $local_subnet)) { $srcip = $interface_ip; break; } } else { $interface_ip = get_interface_ip($ifent); + if(!is_ipaddrv4($interface_ip)) + continue; $local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); if (ip_in_subnet($interface_ip, $local_subnet)) { $srcip = $interface_ip; @@ -203,20 +208,17 @@ function vpn_ipsec_configure($ipchg = false) } } $dstip = $ph2ent['pinghost']; - if(is_ipaddrv6($srcip)) { + if(is_ipaddrv6($dstip)) { $family = "inet6"; } else { $family = "inet"; } if (is_ipaddr($srcip)) - $ipsecpinghosts .= "{$srcip}|{$dstip}|3|{$family}\n"; + $ipsecpinghosts[] = "{$srcip}|{$dstip}|3|{$family}|\n"; + } } - $pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "w"); - if ($pfd) { - fwrite($pfd, $ipsecpinghosts); - fclose($pfd); - } + file_put_contents("{$g['vardb_path']}/ipsecpinghosts", $ipsecpinghosts); } } From 840d845fdac96ec4284a06ca3152e534b33bfc7e Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 16 Mar 2011 13:19:19 +0100 Subject: [PATCH 197/329] Add more helpful logging --- usr/local/www/diag_logs_ipsec.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php index d196b30f27..9ed65a5224 100755 --- a/usr/local/www/diag_logs_ipsec.php +++ b/usr/local/www/diag_logs_ipsec.php @@ -70,6 +70,15 @@ foreach($ip_address_list as $address) { $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; From e3e85044d1889a95c4d4a7245b09ca7b80512894 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 16 Mar 2011 13:26:46 +0100 Subject: [PATCH 198/329] Add field 8 for address family --- usr/local/bin/ping_hosts.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 97629c45de..19a6161905 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -13,6 +13,7 @@ # Field 5: Script to run once service is restored # Field 6: Ping time threshold # Field 7: Wan ping time threshold +# Field 8: Address family # Read in ipsec ping hosts and check the CARP status if [ -f /var/db/ipsecpinghosts ]; then @@ -66,9 +67,15 @@ for TOPING in $PINGHOSTS ; do SERVICERESTOREDSCRIPT=`echo $TOPING | cut -d"|" -f5` THRESHOLD=`echo $TOPING | cut -d"|" -f6` WANTHRESHOLD=`echo $TOPING | cut -d"|" -f7` + AF=`echo $TOPING | cut -d"|" -f8` + if [ "$AF" == "inet" ]; then + PINGCMD=ping + else + PINGCMD=ping6 + fi echo Processing $DSTIP # Look for a service being down - ping -c $COUNT -S $SRCIP $DSTIP + $PINGCMD -c $COUNT -S $SRCIP $DSTIP if [ $? -eq 0 ]; then # Host is up # Read in previous status @@ -97,7 +104,7 @@ for TOPING in $PINGHOSTS ; do fi echo "Checking ping time $DSTIP" # Look at ping values themselves - PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` + PINGTIME=`$PINGCMD -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` echo "Ping returned $?" echo $PINGTIME > /var/db/pingmsstatus/$DSTIP if [ "$THRESHOLD" != "" ]; then From aff70640bfe35f14176b6134359f05d565c83511 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Wed, 16 Mar 2011 13:28:39 +0100 Subject: [PATCH 199/329] Swap if statement, add fields into ipsecpinghosts file --- etc/inc/vpn.inc | 2 +- usr/local/bin/ping_hosts.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index f6557b556c..c40c472853 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -214,7 +214,7 @@ function vpn_ipsec_configure($ipchg = false) $family = "inet"; } if (is_ipaddr($srcip)) - $ipsecpinghosts[] = "{$srcip}|{$dstip}|3|{$family}|\n"; + $ipsecpinghosts[] = "{$srcip}|{$dstip}|3|||||{$family}|\n"; } } diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 19a6161905..c0de5a15fc 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -68,10 +68,10 @@ for TOPING in $PINGHOSTS ; do THRESHOLD=`echo $TOPING | cut -d"|" -f6` WANTHRESHOLD=`echo $TOPING | cut -d"|" -f7` AF=`echo $TOPING | cut -d"|" -f8` - if [ "$AF" == "inet" ]; then - PINGCMD=ping - else + if [ "$AF" == "inet6" ]; then PINGCMD=ping6 + else + PINGCMD=ping fi echo Processing $DSTIP # Look for a service being down From 8a3b09efccdced78db90eefba0ce208c0927bf36 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Thu, 17 Mar 2011 11:59:38 +0100 Subject: [PATCH 200/329] Comment out static mappings, this needs more research --- etc/inc/services.inc | 5 ++++- usr/local/www/services_dhcpv6.php | 30 +++++++++++++------------- usr/local/www/services_dhcpv6_edit.php | 6 +++--- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 3e22efb144..873b06f32c 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -668,6 +668,9 @@ EOD; EOD; /* add static mappings */ + /* Does not work for IPv6 + /* You can not use a hardware parameter for DHCPv6 hosts + /* Needs to be figured out if (is_array($dhcpv6ifconf['staticmap'])) { $i = 0; @@ -692,7 +695,7 @@ EOD; $i++; } } - + */ $realif = escapeshellcmd(get_real_interface($dhcpv6if)); $dhcpdv6ifs[] = $realif; diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 2c7f6bfaa6..7d00b0c761 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -577,8 +577,8 @@ include("head.inc");
- -    + +   
-
-
+
+
-
+
-
+
-
+
-
+
- +
- +
Netboot filename - +
Name of the file that should be loaded when this host boots off of the network, overrides setting on main page.
   + /
Range:   + - - +
- + /
- + diff --git a/usr/local/www/vpn_ipsec_phase1.php b/usr/local/www/vpn_ipsec_phase1.php index c537f9f28e..edfc36b336 100644 --- a/usr/local/www/vpn_ipsec_phase1.php +++ b/usr/local/www/vpn_ipsec_phase1.php @@ -556,7 +556,7 @@ function dpdchkbox_change() {
- +
   - + / :   - + /
- +
- "> + ">
  "> " onclick="history.back()"> - +

+ > +
+

+
" onclick="enable_change(true)"> From 649ea752ce83f7bf858c7d21ee9ba4b8efb0d57d Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Tue, 12 Jul 2011 16:08:22 +1200 Subject: [PATCH 301/329] Fix botched patch, add closing bracket --- usr/local/www/services_dnsmasq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php index a422fb0adb..a58e6f8ad1 100755 --- a/usr/local/www/services_dnsmasq.php +++ b/usr/local/www/services_dnsmasq.php @@ -160,7 +160,7 @@ function enable_change(enable_over) {

+ "affects the name given for a reverse lookup (PTR)."));?>