Revision 6c07db48
Added by Phil Davis about 10 years ago
etc/ecl.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/*
|
|
2 |
/* |
|
3 | 3 |
external config loader |
4 | 4 |
Copyright (C) 2010 Scott Ullrich |
5 | 5 |
Copyright (C) 2013-2015 Electric Sheep Fencing, LP |
... | ... | |
25 | 25 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 | 26 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
27 | 27 |
POSSIBILITY OF SUCH DAMAGE. |
28 |
|
|
28 |
|
|
29 | 29 |
Currently supported file system types: MS-Dos, FreeBSD UFS |
30 | 30 |
|
31 | 31 |
*/ |
... | ... | |
53 | 53 |
$slices_array = array(); |
54 | 54 |
$slices = trim(exec("/bin/ls " . escapeshellarg("/dev/" . $disk . "s*") . " 2>/dev/null")); |
55 | 55 |
$slices = str_replace("/dev/", "", $slices); |
56 |
if($slices == "ls: No match.")
|
|
56 |
if ($slices == "ls: No match.") {
|
|
57 | 57 |
return; |
58 |
} |
|
58 | 59 |
$slices_array = explode(" ", $slices); |
59 | 60 |
return $slices_array; |
60 | 61 |
} |
... | ... | |
63 | 64 |
global $g, $debug; |
64 | 65 |
$disks_array = array(); |
65 | 66 |
$disks_s = explode(" ", get_single_sysctl("kern.disks")); |
66 |
foreach($disks_s as $disk)
|
|
67 |
if(trim($disk))
|
|
67 |
foreach ($disks_s as $disk) {
|
|
68 |
if (trim($disk)) {
|
|
68 | 69 |
$disks_array[] = $disk; |
70 |
} |
|
71 |
} |
|
69 | 72 |
return $disks_array; |
70 | 73 |
} |
71 | 74 |
|
72 | 75 |
function discover_config($mountpoint) { |
73 | 76 |
global $g, $debug; |
74 | 77 |
$locations_to_check = array("/", "/config"); |
75 |
foreach($locations_to_check as $ltc) { |
|
78 |
foreach ($locations_to_check as $ltc) {
|
|
76 | 79 |
$tocheck = "/tmp/mnt/cf{$ltc}config.xml"; |
77 |
if($debug) { |
|
80 |
if ($debug) {
|
|
78 | 81 |
echo "\nChecking for $tocheck"; |
79 |
if(file_exists($tocheck))
|
|
82 |
if (file_exists($tocheck)) {
|
|
80 | 83 |
echo " -> found!"; |
84 |
} |
|
81 | 85 |
} |
82 |
if(file_exists($tocheck))
|
|
86 |
if (file_exists($tocheck)) {
|
|
83 | 87 |
return $tocheck; |
88 |
} |
|
84 | 89 |
} |
85 | 90 |
return ""; |
86 | 91 |
} |
87 | 92 |
|
88 | 93 |
function test_config($file_location) { |
89 | 94 |
global $g, $debug; |
90 |
if(!$file_location)
|
|
95 |
if (!$file_location) {
|
|
91 | 96 |
return; |
97 |
} |
|
92 | 98 |
// config.xml was found. ensure it is sound. |
93 | 99 |
$root_obj = trim("<{$g['xml_rootobj']}>"); |
94 | 100 |
$xml_file_head = exec("/usr/bin/head -2 " . escapeshellarg($file_location) . " | /usr/bin/tail -n1"); |
95 |
if($debug) { |
|
101 |
if ($debug) {
|
|
96 | 102 |
echo "\nroot obj = $root_obj"; |
97 | 103 |
echo "\nfile head = $xml_file_head"; |
98 | 104 |
} |
99 |
if($xml_file_head == $root_obj) { |
|
105 |
if ($xml_file_head == $root_obj) {
|
|
100 | 106 |
// Now parse config to make sure |
101 | 107 |
$config_status = config_validate($file_location); |
102 |
if($config_status)
|
|
108 |
if ($config_status) {
|
|
103 | 109 |
return true; |
110 |
} |
|
104 | 111 |
} |
105 | 112 |
return false; |
106 | 113 |
} |
... | ... | |
110 | 117 |
global $g, $debug; |
111 | 118 |
$disks = get_disks(); |
112 | 119 |
// Safety check. |
113 |
if(!is_array($disks))
|
|
120 |
if (!is_array($disks)) {
|
|
114 | 121 |
return; |
122 |
} |
|
115 | 123 |
$boot_disk = get_boot_disk(); |
116 | 124 |
$swap_disks = get_swap_disks(); |
117 | 125 |
exec("/bin/mkdir -p /tmp/mnt/cf"); |
118 |
foreach($disks as $disk) { |
|
126 |
foreach ($disks as $disk) {
|
|
119 | 127 |
$slices = get_disk_slices($disk); |
120 |
if(is_array($slices)) { |
|
121 |
foreach($slices as $slice) { |
|
122 |
if($slice == "")
|
|
128 |
if (is_array($slices)) {
|
|
129 |
foreach ($slices as $slice) {
|
|
130 |
if ($slice == "") {
|
|
123 | 131 |
continue; |
124 |
if(stristr($slice, $boot_disk)) { |
|
125 |
if($debug) |
|
132 |
} |
|
133 |
if (stristr($slice, $boot_disk)) { |
|
134 |
if ($debug) { |
|
126 | 135 |
echo "\nSkipping boot device slice $slice"; |
136 |
} |
|
127 | 137 |
continue; |
128 | 138 |
} |
129 |
if(in_array($slice, $swap_disks)) { |
|
130 |
if($debug)
|
|
139 |
if (in_array($slice, $swap_disks)) {
|
|
140 |
if ($debug) {
|
|
131 | 141 |
echo "\nSkipping swap device slice $slice"; |
142 |
} |
|
132 | 143 |
continue; |
133 | 144 |
} |
134 | 145 |
echo " $slice"; |
135 | 146 |
// First try msdos fs |
136 |
if($debug)
|
|
147 |
if ($debug) {
|
|
137 | 148 |
echo "\n/sbin/mount -t msdosfs /dev/{$slice} /tmp/mnt/cf 2>/dev/null \n"; |
149 |
} |
|
138 | 150 |
$result = exec("/sbin/mount -t msdosfs /dev/{$slice} /tmp/mnt/cf 2>/dev/null"); |
139 | 151 |
// Next try regular fs (ufs) |
140 |
if(!$result) { |
|
141 |
if($debug)
|
|
152 |
if (!$result) {
|
|
153 |
if ($debug) {
|
|
142 | 154 |
echo "\n/sbin/mount /dev/{$slice} /tmp/mnt/cf 2>/dev/null \n"; |
155 |
} |
|
143 | 156 |
$result = exec("/sbin/mount /dev/{$slice} /tmp/mnt/cf 2>/dev/null"); |
144 | 157 |
} |
145 | 158 |
$mounted = trim(exec("/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep '/tmp/mnt/cf' | /usr/bin/wc -l")); |
146 |
if($debug)
|
|
159 |
if ($debug) {
|
|
147 | 160 |
echo "\nmounted: $mounted "; |
148 |
if(intval($mounted) > 0) { |
|
161 |
} |
|
162 |
if (intval($mounted) > 0) { |
|
149 | 163 |
// Item was mounted - look for config.xml file |
150 | 164 |
$config_location = discover_config($slice); |
151 |
if($config_location) { |
|
152 |
if(test_config($config_location)) { |
|
165 |
if ($config_location) {
|
|
166 |
if (test_config($config_location)) {
|
|
153 | 167 |
// We have a valid configuration. Install it. |
154 | 168 |
echo " -> found config.xml\n"; |
155 | 169 |
echo "Backing up old configuration...\n"; |
etc/inc/auth.inc | ||
---|---|---|
1214 | 1214 |
$ldac_splits = explode(";", $ldapauthcont); |
1215 | 1215 |
|
1216 | 1216 |
/* setup the usercount so we think we haven't found anyone yet */ |
1217 |
$usercount = 0;
|
|
1217 |
$usercount = 0; |
|
1218 | 1218 |
|
1219 | 1219 |
/*****************************************************************/ |
1220 | 1220 |
/* We First find the user based on username and filter */ |
... | ... | |
1242 | 1242 |
} |
1243 | 1243 |
/* Support legacy auth container specification. */ |
1244 | 1244 |
if (stristr($ldac_split, "DC=") || empty($ldapbasedn)) { |
1245 |
$search = @$ldapfunc($ldap,$ldac_split,$ldapfilter);
|
|
1245 |
$search = @$ldapfunc($ldap,$ldac_split,$ldapfilter); |
|
1246 | 1246 |
} else { |
1247 |
$search = @$ldapfunc($ldap,$ldapsearchbasedn,$ldapfilter);
|
|
1247 |
$search = @$ldapfunc($ldap,$ldapsearchbasedn,$ldapfilter); |
|
1248 | 1248 |
} |
1249 | 1249 |
if (!$search) { |
1250 | 1250 |
log_error(sprintf(gettext("Search resulted in error: %s"), ldap_error($ldap))); |
etc/inc/captiveportal.inc | ||
---|---|---|
1825 | 1825 |
$ourhostname .= ":" . $listenporthttps; |
1826 | 1826 |
} |
1827 | 1827 |
} else { |
1828 |
$listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : ($cpcfg['zoneid'] + 8000);
|
|
1828 |
$listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : ($cpcfg['zoneid'] + 8000);
|
|
1829 | 1829 |
$ifip = portal_ip_from_client_ip($cliip); |
1830 | 1830 |
if (!$ifip) { |
1831 | 1831 |
$ourhostname = "{$config['system']['hostname']}.{$config['system']['domain']}"; |
... | ... | |
1930 | 1930 |
unset($bw_up_pipeno, $bw_down_pipeno, $bw_up, $bw_down); |
1931 | 1931 |
} |
1932 | 1932 |
|
1933 |
function portal_allow($clientip, $clientmac, $username, $password = null, $attributes = null, $pipeno = null, $radiusctx = null) {
|
|
1933 |
function portal_allow($clientip, $clientmac, $username, $password = null, $attributes = null, $pipeno = null, $radiusctx = null) { |
|
1934 | 1934 |
global $redirurl, $g, $config, $type, $passthrumac, $_POST, $cpzone, $cpzoneid; |
1935 | 1935 |
|
1936 | 1936 |
// Ensure we create an array if we are missing attributes |
... | ... | |
2073 | 2073 |
} |
2074 | 2074 |
} |
2075 | 2075 |
if ($username == "unauthenticated") { |
2076 |
$mac['descr'] = "Auto-added";
|
|
2076 |
$mac['descr'] = "Auto-added"; |
|
2077 | 2077 |
} else { |
2078 |
$mac['descr'] = "Auto-added for user {$username}";
|
|
2078 |
$mac['descr'] = "Auto-added for user {$username}"; |
|
2079 | 2079 |
} |
2080 | 2080 |
if (!empty($bw_up)) { |
2081 | 2081 |
$mac['bw_up'] = $bw_up; |
... | ... | |
2149 | 2149 |
|
2150 | 2150 |
/* encode password in Base64 just in case it contains commas */ |
2151 | 2151 |
$bpassword = base64_encode($password); |
2152 |
$insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, radiusctx) ";
|
|
2152 |
$insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, radiusctx) "; |
|
2153 | 2153 |
$insertquery .= "VALUES ({$allow_time}, {$pipeno}, '{$clientip}', '{$clientmac}', '{$safe_username}', '{$sessionid}', '{$bpassword}', "; |
2154 | 2154 |
$insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval}, '{$radiusctx}')"; |
2155 | 2155 |
|
etc/inc/certs.inc | ||
---|---|---|
153 | 153 |
return ""; |
154 | 154 |
} |
155 | 155 |
|
156 |
function ca_import(& $ca, $str, $key="", $serial=0) {
|
|
156 |
function ca_import(& $ca, $str, $key = "", $serial = 0) {
|
|
157 | 157 |
global $config; |
158 | 158 |
|
159 | 159 |
$ca['crt'] = base64_encode($str); |
... | ... | |
306 | 306 |
return true; |
307 | 307 |
} |
308 | 308 |
|
309 |
function cert_create(& $cert, $caref, $keylen, $lifetime, $dn, $type="user", $digest_alg = "sha256") {
|
|
309 |
function cert_create(& $cert, $caref, $keylen, $lifetime, $dn, $type = "user", $digest_alg = "sha256") {
|
|
310 | 310 |
|
311 | 311 |
$cert['type'] = $type; |
312 | 312 |
|
... | ... | |
692 | 692 |
is_captiveportal_cert($certref)); |
693 | 693 |
} |
694 | 694 |
|
695 |
function crl_create(& $crl, $caref, $name, $serial=0, $lifetime=9999) {
|
|
695 |
function crl_create(& $crl, $caref, $name, $serial = 0, $lifetime = 9999) {
|
|
696 | 696 |
global $config; |
697 | 697 |
$ca =& lookup_ca($caref); |
698 | 698 |
if (!$ca) { |
... | ... | |
732 | 732 |
return $crl_res; |
733 | 733 |
} |
734 | 734 |
|
735 |
function cert_revoke($cert, & $crl, $reason=OCSP_REVOKED_STATUS_UNSPECIFIED) {
|
|
735 |
function cert_revoke($cert, & $crl, $reason = OCSP_REVOKED_STATUS_UNSPECIFIED) {
|
|
736 | 736 |
global $config; |
737 | 737 |
if (is_cert_revoked($cert, $crl['refid'])) { |
738 | 738 |
return true; |
etc/inc/config.console.inc | ||
---|---|---|
175 | 175 |
$config['system']['enablesshd'] = 'enabled'; |
176 | 176 |
$key = 'y'; |
177 | 177 |
|
178 |
} else { //Manually assign interfaces |
|
178 |
} else { |
|
179 |
//Manually assign interfaces |
|
179 | 180 |
if (in_array($key, array('y', 'Y'))) { |
180 | 181 |
vlan_setup(); |
181 | 182 |
} |
... | ... | |
515 | 516 |
if (!is_array($iflist)) { |
516 | 517 |
echo gettext("No interfaces found!") . "\n"; |
517 | 518 |
} else { |
518 |
$vlan_capable=0;
|
|
519 |
$vlan_capable = 0;
|
|
519 | 520 |
foreach ($iflist as $iface => $ifa) { |
520 | 521 |
if (is_jumbo_capable($iface)) { |
521 | 522 |
echo sprintf("% -8s%s%s\n", $iface, $ifa['mac'], |
etc/inc/config.lib.inc | ||
---|---|---|
898 | 898 |
|
899 | 899 |
function set_device_perms() { |
900 | 900 |
$devices = array( |
901 |
'pf' => array( 'user' => 'root', |
|
902 |
'group' => 'proxy', |
|
903 |
'mode' => 0660), |
|
901 |
'pf' => array( |
|
902 |
'user' => 'root', |
|
903 |
'group' => 'proxy', |
|
904 |
'mode' => 0660), |
|
904 | 905 |
); |
905 | 906 |
|
906 | 907 |
foreach ($devices as $name => $attr) { |
... | ... | |
975 | 976 |
$errorstr = "PHP ERROR: Type: {$error['type']}, File: {$error['file']}, Line: {$error['line']}, Message: {$error['message']}"; |
976 | 977 |
print($errorstr); |
977 | 978 |
log_error($errorstr); |
978 |
} else |
|
979 |
if ($error['type'] != E_NOTICE) { |
|
979 |
} else if ($error['type'] != E_NOTICE) { |
|
980 | 980 |
$errorstr = "PHP WARNING: Type: {$error['type']}, File: {$error['file']}, Line: {$error['line']}, Message: {$error['message']}"; |
981 | 981 |
// XXX: comment out for now, should re-enable post-2.2 |
982 | 982 |
//print($errorstr); |
etc/inc/dyndns.class | ||
---|---|---|
595 | 595 |
/* Setting Variables */ |
596 | 596 |
$hostname = "{$this->_dnsHost}."; |
597 | 597 |
$ZoneID = $this->_dnsZoneID; |
598 |
$AccessKeyId=$this->_dnsUser;
|
|
599 |
$SecretAccessKey=$this->_dnsPass;
|
|
600 |
$NewIP=$this->_dnsIP;
|
|
601 |
$NewTTL=$this->_dnsTTL;
|
|
598 |
$AccessKeyId = $this->_dnsUser;
|
|
599 |
$SecretAccessKey = $this->_dnsPass;
|
|
600 |
$NewIP = $this->_dnsIP;
|
|
601 |
$NewTTL = $this->_dnsTTL;
|
|
602 | 602 |
|
603 | 603 |
/* Include Route 53 Library Class */ |
604 | 604 |
require_once('/etc/inc/r53.class'); |
... | ... | |
623 | 623 |
|
624 | 624 |
/* Get IP for your hostname in Route 53 */ |
625 | 625 |
if (false !== ($a_result = SearchRecords($records['ResourceRecordSets'], "$hostname"))) { |
626 |
$OldTTL=$a_result[0][TTL];
|
|
627 |
$OldIP=$a_result[0][ResourceRecords][0];
|
|
626 |
$OldTTL = $a_result[0][TTL];
|
|
627 |
$OldIP = $a_result[0][ResourceRecords][0];
|
|
628 | 628 |
} else { |
629 |
$OldIP="";
|
|
629 |
$OldIP = "";
|
|
630 | 630 |
} |
631 | 631 |
|
632 | 632 |
/* Check if we need to update DNS Record */ |
... | ... | |
1231 | 1231 |
$lines = count($data)-1; |
1232 | 1232 |
|
1233 | 1233 |
// loop over the lines |
1234 |
for ($pos=0; ($successful_update || $pos == 0) && $pos < $lines; $pos++) {
|
|
1234 |
for ($pos = 0; ($successful_update || $pos == 0) && $pos < $lines; $pos++) {
|
|
1235 | 1235 |
$resp = $data[$pos]; |
1236 | 1236 |
if (preg_match('/UAUTH/i', $resp)) { |
1237 | 1237 |
$status = "DynDNS: The username specified is not authorized to update this hostname and domain."; |
etc/inc/filter.inc | ||
---|---|---|
3802 | 3802 |
$config['cron']['item'] = array(); |
3803 | 3803 |
} |
3804 | 3804 |
|
3805 |
$x=0;
|
|
3805 |
$x = 0;
|
|
3806 | 3806 |
$is_installed = false; |
3807 | 3807 |
foreach ($config['cron']['item'] as $item) { |
3808 | 3808 |
if (strstr($item['command'], "filter_configure_sync")) { |
etc/inc/filter_log.inc | ||
---|---|---|
156 | 156 |
$flent['anchor'] = $rule_data[$field++]; |
157 | 157 |
$flent['tracker'] = $rule_data[$field++]; |
158 | 158 |
$flent['realint'] = $rule_data[$field++]; |
159 |
$flent['interface'] = convert_real_interface_to_friendly_descr($flent['realint']);
|
|
159 |
$flent['interface'] = convert_real_interface_to_friendly_descr($flent['realint']); |
|
160 | 160 |
$flent['reason'] = $rule_data[$field++]; |
161 | 161 |
$flent['act'] = $rule_data[$field++]; |
162 | 162 |
$flent['direction'] = $rule_data[$field++]; |
etc/inc/functions.inc | ||
---|---|---|
81 | 81 |
global $g, $config; |
82 | 82 |
if (are_notices_pending()) { |
83 | 83 |
$notices = get_notices(); |
84 |
$requests=array();
|
|
84 |
$requests = array();
|
|
85 | 85 |
|
86 | 86 |
## Get Query Arguments from URL ### |
87 | 87 |
foreach ($_REQUEST as $key => $value) { |
etc/inc/gwlb.inc | ||
---|---|---|
267 | 267 |
$apingercfg .= " srcip \"{$gwifip}\"\n"; |
268 | 268 |
|
269 | 269 |
## How often the probe should be sent |
270 |
if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) {
|
|
270 |
if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) { |
|
271 | 271 |
$interval = intval($gateway['interval']); # Restrict to Integer |
272 |
if ($interval < 1) {
|
|
273 |
$interval = 1; # Minimum
|
|
272 |
if ($interval < 1) { |
|
273 |
$interval = 1; # Minimum |
|
274 | 274 |
} |
275 | 275 |
if ($interval != $apinger_default['interval']) { # If not default value |
276 | 276 |
$apingercfg .= " interval " . $interval . "s\n"; |
... | ... | |
281 | 281 |
## for controlling "delay" alarms |
282 | 282 |
if (!empty($gateway['avg_delay_samples']) && is_numeric($gateway['avg_delay_samples'])) { |
283 | 283 |
$avg_delay_samples = intval($gateway['avg_delay_samples']); # Restrict to Integer |
284 |
if ($avg_delay_samples < 1) {
|
|
285 |
$avg_delay_samples = 1; # Minimum
|
|
284 |
if ($avg_delay_samples < 1) { |
|
285 |
$avg_delay_samples = 1; # Minimum |
|
286 | 286 |
} |
287 | 287 |
if ($avg_delay_samples != $apinger_default['avg_delay_samples']) { # If not default value |
288 | 288 |
$apingercfg .= " avg_delay_samples " . $avg_delay_samples . "\n"; |
... | ... | |
629 | 629 |
break; |
630 | 630 |
default: |
631 | 631 |
$tunnelif = substr($ifcfg['if'], 0, 3); |
632 |
if (substr($ifcfg['if'], 0, 4) == "ovpn") {
|
|
632 |
if (substr($ifcfg['if'], 0, 4) == "ovpn") { |
|
633 | 633 |
// if current iface is an ovpn server endpoint then check its type, skip tap only |
634 | 634 |
if (substr($ifcfg['if'], 4, 1) == 's') { |
635 | 635 |
$ovpnid = substr($ifcfg['if'], 5); |
... | ... | |
725 | 725 |
break; |
726 | 726 |
default: |
727 | 727 |
$tunnelif = substr($ifcfg['if'], 0, 3); |
728 |
if (substr($ifcfg['if'], 0, 4) == "ovpn") {
|
|
728 |
if (substr($ifcfg['if'], 0, 4) == "ovpn") { |
|
729 | 729 |
// if current iface is an ovpn server endpoint then check its type, skip tap only |
730 | 730 |
if (substr($ifcfg['if'], 4, 1) == 's') { |
731 | 731 |
$ovpnid = substr($ifcfg['if'], 5); |
... | ... | |
762 | 762 |
$gateway['name'] = "{$friendly}{$ctype}"; |
763 | 763 |
$gateway['attribute'] = "system"; |
764 | 764 |
|
765 |
if (($gateway['dynamic'] === "default") && ($found_defaultv6 == 0)) {
|
|
765 |
if (($gateway['dynamic'] === "default") && ($found_defaultv6 == 0)) { |
|
766 | 766 |
$gateway['defaultgw'] = true; |
767 | 767 |
$gateway['dynamic'] = true; |
768 | 768 |
$found_defaultv6 = 1; |
... | ... | |
992 | 992 |
$gateway_groups_array[$group['name']]['ipprotocol'] = $gateway['ipprotocol']; |
993 | 993 |
if (is_ipaddr($gatewayip)) { |
994 | 994 |
$groupmember = array(); |
995 |
$groupmember['int'] = $int;
|
|
996 |
$groupmember['gwip'] = $gatewayip;
|
|
997 |
$groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1;
|
|
995 |
$groupmember['int'] = $int; |
|
996 |
$groupmember['gwip'] = $gatewayip; |
|
997 |
$groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; |
|
998 | 998 |
if (is_array($gwvip_arr[$group['name']])&& !empty($gwvip_arr[$group['name']][$member])) { |
999 | 999 |
$groupmember['vip'] = $gwvip_arr[$group['name']][$member]; |
1000 | 1000 |
} |
etc/inc/interfaces.inc | ||
---|---|---|
235 | 235 |
return; |
236 | 236 |
} |
237 | 237 |
$if = $vlan['if']; |
238 |
$vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif'];
|
|
238 |
$vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif']; |
|
239 | 239 |
$tag = $vlan['tag']; |
240 | 240 |
|
241 | 241 |
if (empty($if)) { |
... | ... | |
2020 | 2020 |
mwexec("/bin/ps auxww|grep \"{$interface}\" |grep \"[3]gstats\" | awk '{print $2}' |xargs kill"); |
2021 | 2021 |
foreach ($ports as $port) { |
2022 | 2022 |
if (preg_match("/huawei/i", implode("\n", $usbmodemoutput))) { |
2023 |
$mondev = substr(basename($port), 0, -1);
|
|
2023 |
$mondev = substr(basename($port), 0, -1); |
|
2024 | 2024 |
$devlist = glob("/dev/{$mondev}?"); |
2025 | 2025 |
$mondev = basename(end($devlist)); |
2026 | 2026 |
} |
2027 | 2027 |
if (preg_match("/zte/i", implode("\n", $usbmodemoutput))) { |
2028 |
$mondev = substr(basename($port), 0, -1) . "1";
|
|
2028 |
$mondev = substr(basename($port), 0, -1) . "1"; |
|
2029 | 2029 |
} |
2030 | 2030 |
if ($mondev != '') { |
2031 | 2031 |
log_error("Starting 3gstats.php on device '{$mondev}' for interface '{$interface}'"); |
... | ... | |
2169 | 2169 |
mwexec_bg("/usr/local/sbin/choparp " . $args); |
2170 | 2170 |
} |
2171 | 2171 |
} else if (count($paa) > 0) { |
2172 |
foreach ($paa as $paif => $paents) {
|
|
2172 |
foreach ($paa as $paif => $paents) { |
|
2173 | 2173 |
$paaifip = get_interface_ip($paif); |
2174 | 2174 |
if (!is_ipaddr($paaifip)) { |
2175 | 2175 |
continue; |
... | ... | |
3162 | 3162 |
if ($wancfg['spoofmac'] && ($wancfg['spoofmac'] != $mac)) { |
3163 | 3163 |
mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . |
3164 | 3164 |
" link " . escapeshellarg($wancfg['spoofmac'])); |
3165 |
} else {
|
|
3165 |
} else { |
|
3166 | 3166 |
|
3167 | 3167 |
if ($mac == "ff:ff:ff:ff:ff:ff") { |
3168 | 3168 |
/* this is not a valid mac address. generate a |
... | ... | |
3963 | 3963 |
$id_assoc_statement_address .= ";\n"; |
3964 | 3964 |
} |
3965 | 3965 |
|
3966 |
$id_assoc_statement_address .= "};\n";
|
|
3966 |
$id_assoc_statement_address .= "};\n"; |
|
3967 | 3967 |
} |
3968 | 3968 |
|
3969 | 3969 |
$id_assoc_statement_prefix = ""; |
... | ... | |
4005 | 4005 |
$id_assoc_statement_prefix .= "\n"; |
4006 | 4006 |
} |
4007 | 4007 |
|
4008 |
$id_assoc_statement_prefix .= "};\n";
|
|
4008 |
$id_assoc_statement_prefix .= "};\n"; |
|
4009 | 4009 |
} |
4010 | 4010 |
|
4011 | 4011 |
$authentication_statement = ""; |
... | ... | |
4135 | 4135 |
$subnetmask = gen_subnet_mask($wancfg['alias-subnet']); |
4136 | 4136 |
$dhclientconf .= <<<EOD |
4137 | 4137 |
alias { |
4138 |
interface "{$wanif}";
|
|
4138 |
interface "{$wanif}"; |
|
4139 | 4139 |
fixed-address {$wancfg['alias-address']}; |
4140 | 4140 |
option subnet-mask {$subnetmask}; |
4141 | 4141 |
} |
... | ... | |
4379 | 4379 |
|
4380 | 4380 |
if (stripos($interface, "_vip")) { |
4381 | 4381 |
foreach ($config['virtualip']['vip'] as $counter => $vip) { |
4382 |
if ($vip['mode'] == "carp") {
|
|
4382 |
if ($vip['mode'] == "carp") { |
|
4383 | 4383 |
if ($interface == "{$vip['interface']}_vip{$vip['vhid']}") { |
4384 | 4384 |
return $vip['interface']; |
4385 | 4385 |
} |
... | ... | |
4452 | 4452 |
} else if (substr($interface, 0, 4) == '_vip') { |
4453 | 4453 |
if (is_array($config['virtualip']['vip'])) { |
4454 | 4454 |
foreach ($config['virtualip']['vip'] as $counter => $vip) { |
4455 |
if ($vip['mode'] == "carp") {
|
|
4455 |
if ($vip['mode'] == "carp") { |
|
4456 | 4456 |
if ($interface == "{$vip['interface']}_vip{$vip['vhid']}") { |
4457 | 4457 |
return "{$vip['subnet']} - {$vip['descr']}"; |
4458 | 4458 |
} |
... | ... | |
5438 | 5438 |
$ints[$ifdescr] = $ifdescr; |
5439 | 5439 |
break; |
5440 | 5440 |
default: |
5441 |
if (substr($ifname['if'], 0, 4) == "ovpn" ||
|
|
5441 |
if (substr($ifname['if'], 0, 4) == "ovpn" || |
|
5442 | 5442 |
!empty($ifname['gateway'])) { |
5443 | 5443 |
$ints[$ifdescr] = $ifdescr; |
5444 | 5444 |
} |
... | ... | |
5463 | 5463 |
return true; |
5464 | 5464 |
break; |
5465 | 5465 |
default: |
5466 |
if (substr($ifname['if'], 0, 4) == "ovpn") {
|
|
5466 |
if (substr($ifname['if'], 0, 4) == "ovpn") { |
|
5467 | 5467 |
return true; |
5468 | 5468 |
} |
5469 | 5469 |
$tunnelif = substr($ifname['if'], 0, 3); |
... | ... | |
5494 | 5494 |
return true; |
5495 | 5495 |
break; |
5496 | 5496 |
default: |
5497 |
if (substr($ifname['if'], 0, 4) == "ovpn") {
|
|
5497 |
if (substr($ifname['if'], 0, 4) == "ovpn") { |
|
5498 | 5498 |
return true; |
5499 | 5499 |
} |
5500 | 5500 |
$tunnelif = substr($ifname['if'], 0, 3); |
... | ... | |
5671 | 5671 |
******/ |
5672 | 5672 |
function generate_random_mac_address() { |
5673 | 5673 |
$mac = "02"; |
5674 |
for ($x=0; $x<5; $x++) {
|
|
5674 |
for ($x = 0; $x < 5; $x++) {
|
|
5675 | 5675 |
$mac .= ":" . dechex(rand(16, 255)); |
5676 | 5676 |
} |
5677 | 5677 |
return $mac; |
etc/inc/ipsec.inc | ||
---|---|---|
220 | 220 |
$interfaceip = get_interface_ip($if); |
221 | 221 |
} |
222 | 222 |
} else { |
223 |
$interfaceip=$ph1ent['interface'];
|
|
223 |
$interfaceip = $ph1ent['interface'];
|
|
224 | 224 |
} |
225 | 225 |
} else { |
226 | 226 |
$if = "wan"; |
... | ... | |
511 | 511 |
$upperspec = explode("/", $linea[0]); |
512 | 512 |
$cursp['proto'] = $upperspec[0]; |
513 | 513 |
list($cursp['src'], $cursp['dst']) = explode("-", $upperspec[2]); |
514 |
$cursp['reqid'] = substr($upperspec[3], strpos($upperspec[3], "#")+1);
|
|
514 |
$cursp['reqid'] = substr($upperspec[3], strpos($upperspec[3], "#")+1); |
|
515 | 515 |
break; |
516 | 516 |
} |
517 | 517 |
} |
... | ... | |
619 | 619 |
global $config; |
620 | 620 |
$a_phase2 = $config['ipsec']['phase2']; |
621 | 621 |
|
622 |
$nbph2=0;
|
|
622 |
$nbph2 = 0;
|
|
623 | 623 |
|
624 | 624 |
if (is_array($a_phase2) && count($a_phase2)) { |
625 | 625 |
foreach ($a_phase2 as $ph2tmp) { |
etc/inc/led.inc | ||
---|---|---|
29 | 29 |
/* |
30 | 30 |
* Blink an LED at set speed from 1-9 (1=Very Fast, 9=Very Slow) |
31 | 31 |
*/ |
32 |
function led_blink($led, $speed=0) {
|
|
32 |
function led_blink($led, $speed = 0) {
|
|
33 | 33 |
switch ($speed) { |
34 | 34 |
case "reallyfast": |
35 | 35 |
case "veryfast": |
... | ... | |
60 | 60 |
* Letters A-J are on from 1/10s to 1s |
61 | 61 |
* Letters a-j are off from 1/10s to 1s |
62 | 62 |
*/ |
63 |
function led_pattern($led, $pattern, $repeat=true) {
|
|
63 |
function led_pattern($led, $pattern, $repeat = true) {
|
|
64 | 64 |
/* End with a . to stop after one iteration. */ |
65 | 65 |
$end = $repeat ? "" : "."; |
66 | 66 |
return led_ctl($led, "s{$pattern}{$end}"); |
etc/inc/meta.inc | ||
---|---|---|
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
$fname = $fpath; |
98 |
$slash = strrpos($fname,"/"); |
|
98 |
$slash = strrpos($fname, "/");
|
|
99 | 99 |
if ($slash) { |
100 |
$fname = substr($fname,$slash + 1); |
|
100 |
$fname = substr($fname, $slash + 1);
|
|
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
$fdata = @file_get_contents($fpath); |
... | ... | |
157 | 157 |
$offset = $tagend_trm + 1; |
158 | 158 |
|
159 | 159 |
if (is_array($taglist)) { |
160 |
if (!in_array($tagbeg,$taglist)) { |
|
160 |
if (!in_array($tagbeg, $taglist)) {
|
|
161 | 161 |
continue; |
162 | 162 |
} |
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
$vals = array(); |
166 | 166 |
|
167 |
$lines = explode("\n",$mdata); |
|
167 |
$lines = explode("\n", $mdata);
|
|
168 | 168 |
foreach ($lines as $line) { |
169 | 169 |
|
170 | 170 |
if (!strlen($line)) { |
etc/inc/notices.inc | ||
---|---|---|
346 | 346 |
$smtp->tls = (isset($config['notifications']['smtp']['tls'])) ? 1 : 0; |
347 | 347 |
$smtp->debug = 0; |
348 | 348 |
$smtp->html_debug = 0; |
349 |
$smtp->localhost=$config['system']['hostname'].".".$config['system']['domain'];
|
|
349 |
$smtp->localhost = $config['system']['hostname'] . "." . $config['system']['domain'];
|
|
350 | 350 |
|
351 | 351 |
if ($config['notifications']['smtp']['fromaddress']) { |
352 | 352 |
$from = $config['notifications']['smtp']['fromaddress']; |
... | ... | |
410 | 410 |
$growl_name = $config['notifications']['growl']['name']; |
411 | 411 |
$growl_notification = $config['notifications']['growl']['notification_name']; |
412 | 412 |
|
413 |
if(!empty($growl_ip) && (is_ipaddr($growl_ip) || dns_get_record($growl_ip, DNS_A) || dns_get_record($growl_ip, DNS_AAAA))) { |
|
413 |
if (!empty($growl_ip) && (is_ipaddr($growl_ip) || dns_get_record($growl_ip, DNS_A) || dns_get_record($growl_ip, DNS_AAAA))) {
|
|
414 | 414 |
$growl = new Growl($growl_ip, $growl_password, $growl_name); |
415 | 415 |
$growl->notify("{$growl_notification}", gettext(sprintf("%s (%s) - Notification", $g['product_name'], $hostname)), "{$message}"); |
416 | 416 |
} |
etc/inc/openvpn.inc | ||
---|---|---|
526 | 526 |
// Otherwise, if a specific interface is requested, use it |
527 | 527 |
// If "any" interface was selected, local directive will be omitted. |
528 | 528 |
if (is_ipaddrv4($ipaddr)) { |
529 |
$iface_ip=$ipaddr;
|
|
529 |
$iface_ip = $ipaddr;
|
|
530 | 530 |
} else { |
531 | 531 |
if ((!empty($interface)) && (strcmp($interface, "any"))) { |
532 | 532 |
$iface_ip=get_interface_ip($interface); |
533 | 533 |
} |
534 | 534 |
} |
535 | 535 |
if (is_ipaddrv6($ipaddr)) { |
536 |
$iface_ipv6=$ipaddr;
|
|
536 |
$iface_ipv6 = $ipaddr;
|
|
537 | 537 |
} else { |
538 | 538 |
if ((!empty($interface)) && (strcmp($interface, "any"))) { |
539 | 539 |
$iface_ipv6=get_interface_ipv6($interface); |
... | ... | |
1326 | 1326 |
$client['vpnid'] = $settings['vpnid']; |
1327 | 1327 |
$client['mgmt'] = "client{$client['vpnid']}"; |
1328 | 1328 |
$socket = "unix://{$g['varetc_path']}/openvpn/{$client['mgmt']}.sock"; |
1329 |
$client['status']="down";
|
|
1329 |
$client['status'] = "down";
|
|
1330 | 1330 |
|
1331 | 1331 |
$clients[] = openvpn_get_client_status($client, $socket); |
1332 | 1332 |
} |
... | ... | |
1355 | 1355 |
|
1356 | 1356 |
/* Get the client state */ |
1357 | 1357 |
if (strstr($line, "CONNECTED")) { |
1358 |
$client['status']="up";
|
|
1358 |
$client['status'] = "up";
|
|
1359 | 1359 |
$list = explode(",", $line); |
1360 | 1360 |
|
1361 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]);
|
|
1362 |
$client['virtual_addr'] = $list[3];
|
|
1361 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]); |
|
1362 |
$client['virtual_addr'] = $list[3]; |
|
1363 | 1363 |
$client['remote_host'] = $list[4]; |
1364 | 1364 |
} |
1365 | 1365 |
if (strstr($line, "CONNECTING")) { |
1366 |
$client['status']="connecting";
|
|
1366 |
$client['status'] = "connecting";
|
|
1367 | 1367 |
} |
1368 | 1368 |
if (strstr($line, "ASSIGN_IP")) { |
1369 |
$client['status']="waiting";
|
|
1369 |
$client['status'] = "waiting";
|
|
1370 | 1370 |
$list = explode(",", $line); |
1371 | 1371 |
|
1372 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]);
|
|
1373 |
$client['virtual_addr'] = $list[3];
|
|
1372 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]); |
|
1373 |
$client['virtual_addr'] = $list[3]; |
|
1374 | 1374 |
} |
1375 | 1375 |
if (strstr($line, "RECONNECTING")) { |
1376 |
$client['status']="reconnecting";
|
|
1376 |
$client['status'] = "reconnecting";
|
|
1377 | 1377 |
$list = explode(",", $line); |
1378 | 1378 |
|
1379 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]);
|
|
1379 |
$client['connect_time'] = date("D M j G:i:s Y", $list[0]); |
|
1380 | 1380 |
$client['status'] .= "; " . $list[2]; |
1381 | 1381 |
} |
1382 | 1382 |
/* parse end of output line */ |
etc/inc/pfsense-utils.inc | ||
---|---|---|
98 | 98 |
******/ |
99 | 99 |
function is_private_ip($iptocheck) { |
100 | 100 |
$isprivate = false; |
101 |
$ip_private_list=array(
|
|
101 |
$ip_private_list = array(
|
|
102 | 102 |
"10.0.0.0/8", |
103 | 103 |
"100.64.0.0/10", |
104 | 104 |
"172.16.0.0/12", |
... | ... | |
498 | 498 |
$addr_byte = explode(':', $mac); |
499 | 499 |
$hw_addr = ''; |
500 | 500 |
|
501 |
for ($a=0; $a < 6; $a++) {
|
|
501 |
for ($a = 0; $a < 6; $a++) {
|
|
502 | 502 |
$hw_addr .= chr(hexdec($addr_byte[$a])); |
503 | 503 |
} |
504 | 504 |
|
... | ... | |
515 | 515 |
log_error(sprintf(gettext("Error code is '%1\$s' - %2\$s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); |
516 | 516 |
} else { |
517 | 517 |
// setting a broadcast option to socket: |
518 |
$opt_ret = socket_set_option($s, 1, 6, TRUE);
|
|
518 |
$opt_ret = socket_set_option($s, 1, 6, TRUE); |
|
519 | 519 |
if ($opt_ret < 0) { |
520 | 520 |
log_error(sprintf(gettext("setsockopt() failed, error: %s"), strerror($opt_ret))); |
521 | 521 |
} |
... | ... | |
981 | 981 |
send_event("service restart webgui"); |
982 | 982 |
} |
983 | 983 |
|
984 |
function setup_serial_port($when="save", $path="") {
|
|
984 |
function setup_serial_port($when = "save", $path = "") {
|
|
985 | 985 |
global $g, $config; |
986 | 986 |
conf_mount_rw(); |
987 | 987 |
$ttys_file = "{$path}/etc/ttys"; |
... | ... | |
1260 | 1260 |
} |
1261 | 1261 |
|
1262 | 1262 |
function convert_seconds_to_hms($sec) { |
1263 |
$min=$hrs=0;
|
|
1263 |
$min = $hrs = 0;
|
|
1264 | 1264 |
if ($sec != 0) { |
1265 | 1265 |
$min = floor($sec/60); |
1266 | 1266 |
$sec %= 60; |
... | ... | |
1288 | 1288 |
if (file_exists("/conf/{$port}.log")) { |
1289 | 1289 |
$saved_time = file_get_contents("/conf/{$port}.log"); |
1290 | 1290 |
$uptime_data = explode("\n", $saved_time); |
1291 |
$sec=0;
|
|
1291 |
$sec = 0;
|
|
1292 | 1292 |
foreach ($uptime_data as $upt) { |
1293 | 1293 |
$sec += substr($upt, 1 + strpos($upt, " ")); |
1294 | 1294 |
} |
... | ... | |
1770 | 1770 |
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
1771 | 1771 |
curl_setopt($ch, CURLOPT_HEADER, false); |
1772 | 1772 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
1773 |
if (!isset($config['system']['host_uuid'])) |
|
1773 |
if (!isset($config['system']['host_uuid'])) {
|
|
1774 | 1774 |
curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); |
1775 |
else
|
|
1775 |
} else {
|
|
1776 | 1776 |
curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); |
1777 |
} |
|
1777 | 1778 |
|
1778 | 1779 |
if (!empty($config['system']['proxyurl'])) { |
1779 | 1780 |
curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); |
... | ... | |
1793 | 1794 |
return ($http_code == 200) ? true : $http_code; |
1794 | 1795 |
} |
1795 | 1796 |
|
1796 |
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout = 5, $timeout=0) {
|
|
1797 |
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout = 5, $timeout = 0) {
|
|
1797 | 1798 |
global $config, $g; |
1798 | 1799 |
global $ch, $fout, $file_size, $downloaded, $config, $first_progress_update; |
1799 |
$file_size = 1;
|
|
1800 |
$file_size = 1; |
|
1800 | 1801 |
$downloaded = 1; |
1801 | 1802 |
$first_progress_update = TRUE; |
1802 | 1803 |
/* open destination file */ |
... | ... | |
1815 | 1816 |
curl_setopt($ch, CURLOPT_NOPROGRESS, '1'); |
1816 | 1817 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout); |
1817 | 1818 |
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
1818 |
if (!isset($config['system']['host_uuid'])) |
|
1819 |
if (!isset($config['system']['host_uuid'])) {
|
|
1819 | 1820 |
curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); |
1820 |
else
|
|
1821 |
} else {
|
|
1821 | 1822 |
curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); |
1823 |
} |
|
1822 | 1824 |
|
1823 | 1825 |
if (!empty($config['system']['proxyurl'])) { |
1824 | 1826 |
curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); |
... | ... | |
2354 | 2356 |
} |
2355 | 2357 |
ob_implicit_flush(1); |
2356 | 2358 |
if (strstr($slice, "s2")) { |
2357 |
$ASLICE="2";
|
|
2358 |
$AOLDSLICE="1";
|
|
2359 |
$AGLABEL_SLICE="pfsense1";
|
|
2360 |
$AUFS_ID="1";
|
|
2361 |
$AOLD_UFS_ID="0";
|
|
2359 |
$ASLICE = "2";
|
|
2360 |
$AOLDSLICE = "1";
|
|
2361 |
$AGLABEL_SLICE = "pfsense1";
|
|
2362 |
$AUFS_ID = "1";
|
|
2363 |
$AOLD_UFS_ID = "0";
|
|
2362 | 2364 |
} else { |
2363 |
$ASLICE="1";
|
|
2364 |
$AOLDSLICE="2";
|
|
2365 |
$AGLABEL_SLICE="pfsense0";
|
|
2366 |
$AUFS_ID="0";
|
|
2367 |
$AOLD_UFS_ID="1";
|
|
2368 |
} |
|
2369 |
$ATOFLASH="{$BOOT_DRIVE}s{$ASLICE}";
|
|
2370 |
$ACOMPLETE_PATH="{$BOOT_DRIVE}s{$ASLICE}a";
|
|
2371 |
$ABOOTFLASH="{$BOOT_DRIVE}s{$AOLDSLICE}";
|
|
2365 |
$ASLICE = "1";
|
|
2366 |
$AOLDSLICE = "2";
|
|
2367 |
$AGLABEL_SLICE = "pfsense0";
|
|
2368 |
$AUFS_ID = "0";
|
|
2369 |
$AOLD_UFS_ID = "1";
|
|
2370 |
} |
|
2371 |
$ATOFLASH = "{$BOOT_DRIVE}s{$ASLICE}";
|
|
2372 |
$ACOMPLETE_PATH = "{$BOOT_DRIVE}s{$ASLICE}a";
|
|
2373 |
$ABOOTFLASH = "{$BOOT_DRIVE}s{$AOLDSLICE}";
|
|
2372 | 2374 |
conf_mount_rw(); |
2373 | 2375 |
set_single_sysctl("kern.geom.debugflags", "16"); |
2374 | 2376 |
exec("gpart set -a active -i {$ASLICE} {$BOOT_DRIVE}"); |
... | ... | |
2442 | 2444 |
|
2443 | 2445 |
// Detect which slice is active and set information. |
2444 | 2446 |
if (strstr($REAL_BOOT_DEVICE, "s1")) { |
2445 |
$SLICE="2";
|
|
2446 |
$OLDSLICE="1";
|
|
2447 |
$GLABEL_SLICE="pfsense1";
|
|
2448 |
$UFS_ID="1";
|
|
2449 |
$OLD_UFS_ID="0";
|
|
2447 |
$SLICE = "2";
|
|
2448 |
$OLDSLICE = "1";
|
|
2449 |
$GLABEL_SLICE = "pfsense1";
|
|
2450 |
$UFS_ID = "1";
|
|
2451 |
$OLD_UFS_ID = "0";
|
|
2450 | 2452 |
|
2451 | 2453 |
} else { |
2452 |
$SLICE="1";
|
|
2453 |
$OLDSLICE="2";
|
|
2454 |
$GLABEL_SLICE="pfsense0";
|
|
2455 |
$UFS_ID="0";
|
|
2456 |
$OLD_UFS_ID="1";
|
|
2454 |
$SLICE = "1";
|
|
2455 |
$OLDSLICE = "2";
|
|
2456 |
$GLABEL_SLICE = "pfsense0";
|
|
2457 |
$UFS_ID = "0";
|
|
2458 |
$OLD_UFS_ID = "1";
|
|
2457 | 2459 |
} |
2458 |
$TOFLASH="{$BOOT_DRIVE}s{$SLICE}";
|
|
2459 |
$COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a";
|
|
2460 |
$COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}";
|
|
2461 |
$BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}";
|
|
2460 |
$TOFLASH = "{$BOOT_DRIVE}s{$SLICE}";
|
|
2461 |
$COMPLETE_PATH = "{$BOOT_DRIVE}s{$SLICE}a";
|
|
2462 |
$COMPLETE_BOOT_PATH = "{$BOOT_DRIVE}s{$OLDSLICE}";
|
|
2463 |
$BOOTFLASH = "{$BOOT_DRIVE}s{$OLDSLICE}";
|
|
2462 | 2464 |
} |
2463 | 2465 |
|
2464 | 2466 |
function nanobsd_friendly_slice_name($slicename) { |
... | ... | |
2657 | 2659 |
$ipv6 = "fe80::"; |
2658 | 2660 |
foreach ($elements as $byte) { |
2659 | 2661 |
if ($i == 0) { |
2660 |
$hexadecimal = substr($byte, 1, 2);
|
|
2662 |
$hexadecimal = substr($byte, 1, 2); |
|
2661 | 2663 |
$bitmap = base_convert($hexadecimal, 16, 2); |
2662 | 2664 |
$bitmap = str_pad($bitmap, 4, "0", STR_PAD_LEFT); |
2663 | 2665 |
$bitmap = substr($bitmap, 0, 2) ."1". substr($bitmap, 3, 4); |
... | ... | |
2697 | 2699 |
foreach ($macs as $line) { |
2698 | 2700 |
if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)) { |
2699 | 2701 |
/* store values like this $mac_man['000C29']='VMware' */ |
2700 |
$mac_man["$matches[1]"]=$matches[2];
|
|
2702 |
$mac_man["$matches[1]"] = $matches[2];
|
|
2701 | 2703 |
} |
2702 | 2704 |
} |
2703 | 2705 |
return $mac_man; |
... | ... | |
2819 | 2821 |
$interface_list_vips = get_configured_vips_list(true); |
2820 | 2822 |
foreach ($interface_list_vips as $id => $vip) { |
2821 | 2823 |
/* Skip CARP interfaces here since they were already checked above */ |
2822 |
if ($id == $ignore_vip_id || (substr($ignore_if, 0, 4) == '_vip') && substr($ignore_vip_if, 5) == $vip['uniqdid']) {
|
|
2824 |
if ($id == $ignore_vip_id || (substr($ignore_if, 0, 4) == '_vip') && substr($ignore_vip_if, 5) == $vip['uniqdid']) { |
|
2823 | 2825 |
continue; |
2824 | 2826 |
} |
2825 | 2827 |
if (strcasecmp($ipaddr, $vip['ipaddr']) == 0) { |
etc/inc/priv.inc | ||
---|---|---|
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
/* compare exact or wildcard match */ |
136 |
$match = str_replace(array(".", "*", "?"), array("\.", ".*", "\?"), $match);
|
|
136 |
$match = str_replace(array(".", "*", "?"), array("\.", ".*", "\?"), $match); |
|
137 | 137 |
$result = preg_match("@^/{$match}$@", "/{$page}"); |
138 | 138 |
|
139 | 139 |
if ($result) { |
... | ... | |
328 | 328 |
$priority_privs = array("page-dashboard-all", "page-system-login/logout"); |
329 | 329 |
|
330 | 330 |
$fprivs = array_intersect($privs, $priority_privs); |
331 |
$sprivs = array_diff($privs, $priority_privs);
|
|
331 |
$sprivs = array_diff($privs, $priority_privs); |
|
332 | 332 |
|
333 | 333 |
return array_merge($fprivs, $sprivs); |
334 | 334 |
} |
etc/inc/rrd.inc | ||
---|---|---|
485 | 485 |
break; |
486 | 486 |
} |
487 | 487 |
$qbandwidth = $altq->GetBandwidth() * $factor; |
488 |
if ($qbandwidth <=0) { |
|
488 |
if ($qbandwidth <= 0) {
|
|
489 | 489 |
$qbandwidth = 100 * 1000 * 1000; /* 100Mbit */ |
490 | 490 |
} |
491 | 491 |
$qlist =& $altq->get_queue_list($notused); |
etc/inc/services.inc | ||
---|---|---|
410 | 410 |
fwrite($fd, "/bin/cp -n /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n"); |
411 | 411 |
fwrite($fd, "/bin/chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n"); |
412 | 412 |
|
413 |
$status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`;
|
|
413 |
$status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`;
|
|
414 | 414 |
if (!trim($status)) { |
415 | 415 |
fwrite($fd, "/sbin/mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n"); |
416 | 416 |
} |
... | ... | |
600 | 600 |
$my_port = "519"; |
601 | 601 |
$peer_port = "520"; |
602 | 602 |
$type = "primary"; |
603 |
$dhcpdconf_pri = "split 128;\n";
|
|
603 |
$dhcpdconf_pri = "split 128;\n"; |
|
604 | 604 |
$dhcpdconf_pri .= " mclt 600;\n"; |
605 | 605 |
} |
606 | 606 |
|
... | ... | |
1622 | 1622 |
if (!is_ipaddr($subnet)) { |
1623 | 1623 |
continue; |
1624 | 1624 |
} |
1625 |
$subnet .= "/" . get_interface_subnet($ifname);
|
|
1625 |
$subnet .= "/" . get_interface_subnet($ifname); |
|
1626 | 1626 |
if (ip_in_subnet($srvip, $subnet)) { |
1627 | 1627 |
$destif = get_real_interface($ifname); |
1628 | 1628 |
break; |
... | ... | |
1688 | 1688 |
return; /* XXX */ |
1689 | 1689 |
} |
1690 | 1690 |
|
1691 |
$cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs);
|
|
1691 |
$cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs); |
|
1692 | 1692 |
|
1693 | 1693 |
if (isset($dhcrelaycfg['agentoption'])) { |
1694 |
$cmd .= " -a -m replace";
|
|
1694 |
$cmd .= " -a -m replace"; |
|
1695 | 1695 |
} |
1696 | 1696 |
|
1697 | 1697 |
$cmd .= " " . implode(" ", $srvips); |
... | ... | |
1755 | 1755 |
if (!is_ipaddrv6($subnet)) { |
1756 | 1756 |
continue; |
1757 | 1757 |
} |
1758 |
$subnet .= "/" . get_interface_subnetv6($ifname);
|
|
1758 |
$subnet .= "/" . get_interface_subnetv6($ifname); |
|
1759 | 1759 |
if (ip_in_subnet($srvip, $subnet)) { |
1760 | 1760 |
$destif = get_real_interface($ifname); |
1761 | 1761 |
break; |
... | ... | |
1848 | 1848 |
$dnsPort = NULL, |
1849 | 1849 |
$dnsUpdateURL = "{$conf['updateurl']}", |
1850 | 1850 |
$forceUpdate = $conf['force'], |
1851 |
$dnsZoneID=$conf['zoneid'],
|
|
1852 |
$dnsTTL=$conf['ttl'],
|
|
1851 |
$dnsZoneID = $conf['zoneid'],
|
|
1852 |
$dnsTTL = $conf['ttl'],
|
|
1853 | 1853 |
$dnsResultMatch = "{$conf['resultmatch']}", |
1854 | 1854 |
$dnsRequestIf = "{$conf['requestif']}", |
1855 | 1855 |
$dnsID = "{$conf['id']}", |
... | ... | |
2621 | 2621 |
} |
2622 | 2622 |
} |
2623 | 2623 |
|
2624 |
function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") {
|
|
2624 |
function install_cron_job($command, $active = false, $minute = "0", $hour = "*", $monthday = "*", $month = "*", $weekday = "*", $who = "root") {
|
|
2625 | 2625 |
global $config, $g; |
2626 | 2626 |
|
2627 | 2627 |
$is_installed = false; |
... | ... | |
2634 | 2634 |
$config['cron']['item'] = array(); |
2635 | 2635 |
} |
2636 | 2636 |
|
2637 |
$x=0;
|
|
2637 |
$x = 0;
|
|
2638 | 2638 |
foreach ($config['cron']['item'] as $item) { |
2639 | 2639 |
if (strstr($item['command'], $command)) { |
2640 | 2640 |
$is_installed = true; |
etc/inc/shaper.inc | ||
---|---|---|
525 | 525 |
|
526 | 526 |
function &find_parentqueue($interface, $qname) { |
527 | 527 |
if ($qname == $interface) { |
528 |
$result = NULL;
|
|
528 |
$result = NULL; |
|
529 | 529 |
} else if ($this->queues[$qname]) { |
530 | 530 |
$result = $this; |
531 | 531 |
} else if ($this->GetScheduler() <> "PRIQ") { |
... | ... | |
545 | 545 |
$tree .= "\">" . $shaperIFlist[$this->GetInterface()] . "</a>"; |
546 | 546 |
if (is_array($this->queues)) { |
547 | 547 |
$tree .= "<ul>"; |
548 |
foreach ($this->queues as $q) {
|
|
548 |
foreach ($this->queues as $q) { |
|
549 | 549 |
$tree .= $q->build_tree(); |
550 | 550 |
} |
551 | 551 |
$tree .= "</ul>"; |
... | ... | |
707 | 707 |
$form .= "<br /></td><td class=\"vncellreq\">"; |
708 | 708 |
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\""; |
709 | 709 |
if ($this->GetEnabled() == "on") { |
710 |
$form .= " checked=\"checked\"";
|
|
710 |
$form .= " checked=\"checked\""; |
|
711 | 711 |
} |
712 | 712 |
$form .= " /><span class=\"vexpl\"> " . gettext("Enable/disable discipline and its children") . "</span>"; |
713 | 713 |
$form .= "</td></tr>"; |
... | ... | |
790 | 790 |
$form .= "\" />"; |
791 | 791 |
$form .= "<br /> <span class=\"vexpl\">"; |
792 | 792 |
$form .= gettext("Adjusts the size, in bytes, of the token bucket regulator. " |
793 |
. "If not specified, heuristics based on the interface "
|
|
794 |
. "bandwidth are used to determine the size.");
|
|
793 |
. "If not specified, heuristics based on the interface "
|
|
794 |
. "bandwidth are used to determine the size.");
|
|
795 | 795 |
$form .= "</span></td></tr>"; |
796 | 796 |
$form .= "<input type=\"hidden\" id=\"interface\" name=\"interface\""; |
797 | 797 |
$form .= " value=\"" . $this->GetInterface() . "\" />"; |
... | ... | |
1278 | 1278 |
$form .= "<br /></td><td class=\"vncellreq\">"; |
1279 | 1279 |
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\""; |
1280 | 1280 |
if ($this->GetEnabled() == "on") { |
1281 |
$form .= " checked=\"checked\"";
|
|
1281 |
$form .= " checked=\"checked\""; |
|
1282 | 1282 |
} |
1283 | 1283 |
$form .= " /><span class=\"vexpl\"> " . gettext("Enable/Disable queue and its children") . "</span>"; |
1284 | 1284 |
$form .= "</td></tr>"; |
... | ... | |
1322 | 1322 |
$form .= "<input type=\"checkbox\" id=\"red\" name=\"red\" value=\"red\" "; |
1323 | 1323 |
$tmpvalue = $this->GetRed(); |
1324 | 1324 |
if (!empty($tmpvalue)) { |
1325 |
$form .= " checked=\"checked\"";
|
|
1325 |
$form .= " checked=\"checked\""; |
|
1326 | 1326 |
} |
1327 | 1327 |
$form .= " /> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#red\">" . gettext("Random Early Detection") . "</a><br />"; |
1328 | 1328 |
$form .= "<input type=\"checkbox\" id=\"rio\" name=\"rio\" value=\"rio\""; |
1329 | 1329 |
$tmpvalue = $this->GetRio(); |
1330 | 1330 |
if (!empty($tmpvalue)) { |
1331 |
$form .= " checked=\"checked\"";
|
|
1331 |
$form .= " checked=\"checked\""; |
|
1332 | 1332 |
} |
1333 | 1333 |
$form .= " /> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#rio\">" . gettext("Random Early Detection In and Out") . "</a><br />"; |
1334 | 1334 |
$form .= "<input type=\"checkbox\" id=\"ecn\" name=\"ecn\" value=\"ecn\""; |
1335 | 1335 |
$tmpvalue = $this->GetEcn(); |
1336 | 1336 |
if (!empty($tmpvalue)) { |
1337 |
$form .= " checked=\"checked\"";
|
|
1337 |
$form .= " checked=\"checked\""; |
|
1338 | 1338 |
} |
1339 | 1339 |
$form .= " /> <a target=\"_new\" href=\"http://www.openbsd.org/faq/pf/queueing.html#ecn\">" . gettext("Explicit Congestion Notification") . "</a><br />"; |
1340 | 1340 |
$form .= "<input type=\"checkbox\" id=\"codel\" name=\"codel\" value=\"codel\""; |
1341 | 1341 |
$tmpvalue = $this->GetCodel(); |
1342 | 1342 |
if (!empty($tmpvalue)) { |
1343 |
$form .= " checked=\"checked\"";
|
|
1343 |
$form .= " checked=\"checked\""; |
|
1344 | 1344 |
} |
1345 | 1345 |
$form .= " /> <a target=\"_new\" href=\"http://www.bufferbloat.net/projects/codel/wiki\">" . gettext("Codel Active Queue") . "</a><br />"; |
1346 | 1346 |
$form .= "<span class=\"vexpl\"><br />" . gettext("Select options for this queue"); |
... | ... | |
1698 | 1698 |
unref_on_altq_queue_list($this->GetQname()); |
1699 | 1699 |
cleanup_queue_from_rules($this->GetQname()); |
1700 | 1700 |
$parent =& $this->GetParent(); |
1701 |
foreach ($this->subqueues as $q) {
|
|
1701 |
foreach ($this->subqueues as $q) { |
|
1702 | 1702 |
$this->SetAvailableBandwidth($this->GetAvailableBandwidth() + $q->GetAvailableBandwidth()); |
1703 | 1703 |
$q->delete_queue(); |
1704 | 1704 |
} |
... | ... | |
1772 | 1772 |
*/ |
1773 | 1773 |
} |
1774 | 1774 |
|
1775 |
if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") {
|
|
1775 |
if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") { |
|
1776 | 1776 |
$input_errors[] = gettext("upperlimit service curve defined but missing (d) value"); |
1777 | 1777 |
} |
1778 |
if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") {
|
|
1778 |
if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") { |
|
1779 | 1779 |
$input_errors[] = gettext("upperlimit service curve defined but missing initial bandwidth (m1) value"); |
1780 | 1780 |
} |
1781 | 1781 |
if ($data['upperlimit1'] <> "" && !is_valid_shaperbw($data['upperlimit1'])) { |
... | ... | |
1801 | 1801 |
} |
1802 | 1802 |
} |
1803 | 1803 |
*/ |
1804 |
if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") {
|
|
1804 |
if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") { |
|
1805 | 1805 |
$input_errors[] = gettext("linkshare service curve defined but missing (d) value"); |
1806 | 1806 |
} |
1807 |
if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") {
|
|
1807 |
if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") { |
|
1808 | 1808 |
$input_errors[] = gettext("linkshare service curve defined but missing initial bandwidth (m1) value"); |
1809 | 1809 |
} |
1810 | 1810 |
if ($data['linkshare1'] <> "" && !is_valid_shaperbw($data['linkshare1'])) { |
... | ... | |
1816 | 1816 |
if ($data['linkshare3'] <> "" && !is_valid_shaperbw($data['linkshare3'])) { |
1817 | 1817 |
$input_errors[] = gettext("linkshare m2 value needs to be Kb, Mb, Gb, or %"); |
1818 | 1818 |
} |
1819 |
if ($data['realtime1'] <> "" && $data['realtime2'] == "") {
|
|
1819 |
if ($data['realtime1'] <> "" && $data['realtime2'] == "") { |
|
1820 | 1820 |
$input_errors[] = gettext("realtime service curve defined but missing (d) value"); |
1821 | 1821 |
} |
1822 |
if ($data['realtime2'] <> "" && $data['realtime1'] == "") {
|
|
1822 |
if ($data['realtime2'] <> "" && $data['realtime1'] == "") { |
|
1823 | 1823 |
$input_errors[] = gettext("realtime service curve defined but missing initial bandwidth (m1) value"); |
1824 | 1824 |
} |
1825 | 1825 |
|
... | ... | |
1927 | 1927 |
$tree .= " >" . $this->GetQname() . "</a>"; |
1928 | 1928 |
if (is_array($this->subqueues)) { |
1929 | 1929 |
$tree .= "<ul>"; |
1930 |
foreach ($this->subqueues as $q) {
|
|
1930 |
foreach ($this->subqueues as $q) { |
|
1931 | 1931 |
$tree .= $q->build_tree(); |
1932 | 1932 |
} |
1933 | 1933 |
$tree .= "</ul>"; |
... | ... | |
1993 | 1993 |
$default = true; |
1994 | 1994 |
} |
1995 | 1995 |
|
1996 |
if ($this->GetRealtime() <> "") {
|
|
1996 |
if ($this->GetRealtime() <> "") { |
|
1997 | 1997 |
if ($comma) { |
1998 | 1998 |
$pfq_rule .= " , "; |
1999 | 1999 |
} |
2000 |
if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "") {
|
|
2000 |
if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "") { |
|
2001 | 2001 |
$pfq_rule .= " realtime (".$this->GetR_m1() . ", " . $this->GetR_d().", ". $this->GetR_m2() .") "; |
2002 |
} else if ($this->GetR_m2() <> "") {
|
|
2002 |
} else if ($this->GetR_m2() <> "") { |
|
2003 | 2003 |
$pfq_rule .= " realtime " . $this->GetR_m2(); |
2004 | 2004 |
} |
2005 | 2005 |
$comma = 1; |
... | ... | |
2136 | 2136 |
$form .= "<tr><td> </td><td><center>m1</center></td><td><center>d</center></td><td><center><b>m2</b></center></td></tr>"; |
2137 | 2137 |
$form .= "<tr><td><input type=\"checkbox\" id=\"upperlimit\" name=\"upperlimit\""; |
2138 | 2138 |
if ($this->GetUpperlimit()<> "") { |
2139 |
$form .= " checked=\"checked\" ";
|
|
2139 |
$form .= " checked=\"checked\" "; |
|
2140 | 2140 |
} |
2141 | 2141 |
$form .= "onchange=\"enable_upperlimit()\" /> " . gettext("Upperlimit:") . "</td><td><input size=\"6\" value=\""; |
2142 | 2142 |
$form .= htmlspecialchars($this->GetU_m1()); |
... | ... | |
2159 | 2159 |
$form .= " /></td><td>" . gettext("The maximum allowed bandwidth for the queue.") . "</td></tr>"; |
2160 | 2160 |
$form .= "<tr><td><input type=\"checkbox\" id=\"realtime\" name=\"realtime\""; |
2161 | 2161 |
if ($this->GetRealtime() <> "") { |
2162 |
$form .= " checked=\"checked\" ";
|
|
2162 |
$form .= " checked=\"checked\" "; |
|
2163 | 2163 |
} |
2164 | 2164 |
$form .= "onchange=\"enable_realtime()\" /> " . gettext("Real time:") . "</td><td><input size=\"6\" value=\""; |
2165 | 2165 |
$form .= htmlspecialchars($this->GetR_m1()); |
... | ... | |
2182 | 2182 |
$form .= " /></td><td>" . gettext("The minimum required bandwidth for the queue.") . "</td></tr>"; |
2183 | 2183 |
$form .= "<tr><td><input type=\"checkbox\" id=\"linkshare\" name=\"linkshare\""; |
2184 | 2184 |
if ($this->GetLinkshare() <> "") { |
2185 |
$form .= " checked=\"checked\" ";
|
|
2185 |
$form .= " checked=\"checked\" "; |
|
2186 | 2186 |
} |
2187 | 2187 |
$form .= "onchange=\"enable_linkshare()\" /> " . gettext("Link share:") . "</td><td><input size=\"6\" value=\""; |
2188 | 2188 |
$form .= htmlspecialchars($this->GetL_m1()); |
... | ... | |
2205 | 2205 |
$form .= " /></td><td>" . gettext("The bandwidth share of a backlogged queue - this overrides priority.") . "</td></tr>"; |
2206 | 2206 |
$form .= "</table><br />"; |
2207 | 2207 |
$form .= gettext("The format for service curve specifications is (m1, d, m2). m2 controls " |
2208 |
. "the bandwidth assigned to the queue. m1 and d are optional and can be "
|
|
2209 |
. "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value "
|
|
2210 |
. "given in m2.");
|
|
2208 |
. "the bandwidth assigned to the queue. m1 and d are optional and can be "
|
|
2209 |
. "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value "
|
|
2210 |
. "given in m2.");
|
|
2211 | 2211 |
$form .= "</td>"; |
2212 | 2212 |
$form .= "</tr>"; |
2213 | 2213 |
|
... | ... | |
2543 | 2543 |
$tree .= " >" . $this->GetQname() . "</a>"; |
2544 | 2544 |
if (is_array($this->subqueues)) { |
2545 | 2545 |
$tree .= "<ul>"; |
2546 |
foreach ($this->subqueues as $q) {
|
|
2546 |
foreach ($this->subqueues as $q) { |
|
2547 | 2547 |
$tree .= $q->build_tree(); |
2548 | 2548 |
} |
2549 | 2549 |
$tree .= "</ul>"; |
... | ... | |
2677 | 2677 |
$form .= "<tr><td class=\"vncellreq\">" . gettext("Scheduler specific options") . "</td>"; |
2678 | 2678 |
$form .= "<td class=\"vtable\"><input type=\"checkbox\" id=\"borrow\" name=\"borrow\""; |
2679 | 2679 |
if ($this->GetBorrow() == "on") { |
2680 |
$form .= " checked=\"checked\" ";
|
|
2680 |
$form .= " checked=\"checked\" "; |
|
2681 | 2681 |
} |
2682 | 2682 |
$form .= " /> " . gettext("Borrow from other queues when available") . "<br /></td></tr>"; |
2683 | 2683 |
|
... | ... | |
2989 | 2989 |
$form .= "<input id=\"buckets\" name=\"buckets\" value=\""; |
2990 | 2990 |
$tmpvalue = trim($this->GetBuckets()); |
2991 | 2991 |
if (!empty($tmpvalue)) { |
2992 |
$form .= $this->GetBuckets();
|
|
2992 |
$form .= $this->GetBuckets(); |
|
2993 | 2993 |
} |
2994 | 2994 |
$form .= "\" /> " . gettext("Number of buckets available.") . "<br /></td></tr>"; |
2995 | 2995 |
$form .= "<tr><td class=\"vtable\"><input id=\"hogs\" name=\"hogs\" value=\""; |
2996 | 2996 |
$tmpvalue = trim($this->GetHogs()); |
2997 | 2997 |
if (!empty($tmpvalue)) { |
2998 |
$form .= $this->GetHogs();
|
|
2998 |
$form .= $this->GetHogs(); |
|
2999 | 2999 |
} |
3000 | 3000 |
$form .= "\" /> " . gettext("Bandwidth limit for hosts to not saturate link.") . "<br /></td></tr>"; |
3001 | 3001 |
$form .= "</table></td></tr>"; |
... | ... | |
3481 | 3481 |
$tree .= $this->GetQname() . "</a>"; |
3482 | 3482 |
if (is_array($this->subqueues)) { |
3483 | 3483 |
$tree .= "<ul>"; |
3484 |
foreach ($this->subqueues as $q) {
|
|
3484 |
foreach ($this->subqueues as $q) { |
|
3485 | 3485 |
$tree .= $q->build_tree(); |
3486 | 3486 |
} |
3487 | 3487 |
$tree .= "</ul>"; |
... | ... | |
3655 | 3655 |
$form .= "</td><td class=\"vncellreq\">"; |
3656 | 3656 |
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\""; |
3657 | 3657 |
if ($this->GetEnabled() == "on") { |
3658 |
$form .= " checked=\"checked\"";
|
|
3658 |
$form .= " checked=\"checked\""; |
|
3659 | 3659 |
} |
3660 | 3660 |
$form .= " /><span class=\"vexpl\"> " . gettext("Enable limiter and its children") . "</span>"; |
3661 | 3661 |
$form .= "</td></tr>"; |
... | ... | |
3740 | 3740 |
$form .= "</select>"; |
3741 | 3741 |
$form .= " <br />"; |
3742 | 3742 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n" |
3743 |
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"
|
|
3744 |
. "be created for each source/destination IP address encountered, \n"
|
|
3745 |
. "respectively. This makes it possible to easily specify bandwidth \n"
|
|
3746 |
. "limits per host.") . "</span><br />";
|
|
3743 |
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"
|
|
3744 |
. "be created for each source/destination IP address encountered, \n"
|
|
3745 |
. "respectively. This makes it possible to easily specify bandwidth \n"
|
|
3746 |
. "limits per host.") . "</span><br />";
|
|
3747 | 3747 |
$form .= "255.255.255.255/ <input type=\"text\" class=\"formfld unknown\" size=\"2\" id=\"maskbits\" name=\"maskbits\" value=\""; |
3748 | 3748 |
if ($mask['type'] <> "none") { |
3749 | 3749 |
$form .= $mask['bits']; |
... | ... | |
3765 | 3765 |
$form .= " />"; |
3766 | 3766 |
$form .= " IPV6 mask bits (1-128)<br />"; |
3767 | 3767 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n" |
3768 |
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n"
|
|
3769 |
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n"
|
|
3770 |
. "per pipe.") . "</span>";
|
|
3768 |
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n"
|
|
3769 |
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n"
|
|
3770 |
. "per pipe.") . "</span>";
|
|
3771 | 3771 |
$form .= "</td></tr>"; |
3772 | 3772 |
$form .= "<tr><td valign=\"middle\" class=\"vncellreq\">" . gettext("Description") . "</td>"; |
3773 | 3773 |
$form .= "<td class=\"vncellreq\">"; |
... | ... | |
3790 | 3790 |
$form .= "<input name=\"delay\" type=\"text\" id=\"delay\" size=\"5\" value=\""; |
3791 | 3791 |
$form .= $this->GetDelay() . "\" />"; |
3792 | 3792 |
$form .= " ms<br /> <span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
3793 |
. "should specify 0 here (or leave the field empty)") . "</span><br />";
|
|
3793 |
. "should specify 0 here (or leave the field empty)") . "</span><br />";
|
|
3794 | 3794 |
$form .= "</td></tr>"; |
3795 | 3795 |
$form .= "<tr style=\"display:none\" id=\"sprtable1\">"; |
3796 | 3796 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Packet loss rate") . "</td>"; |
... | ... | |
3798 | 3798 |
$form .= "<input name=\"plr\" type=\"text\" id=\"plr\" size=\"5\" value=\""; |
3799 | 3799 |
$form .= $this->GetPlr() . "\" />"; |
3800 | 3800 |
$form .= " <br /> <span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
3801 |
. "should specify 0 here (or leave the field empty). "
|
|
3802 |
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>";
|
|
3801 |
. "should specify 0 here (or leave the field empty). "
|
|
3802 |
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>";
|
|
3803 | 3803 |
$form .= "</td></tr>"; |
3804 | 3804 |
$form .= "<tr style=\"display:none\" id=\"sprtable2\">"; |
3805 | 3805 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Queue Size") . "</td>"; |
... | ... | |
3808 | 3808 |
$form .= $this->GetQlimit() . "\" />"; |
3809 | 3809 |
$form .= " slots<br />"; |
3810 | 3810 |
$form .= "<span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
3811 |
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "
|
|
3812 |
. "then they are delayed by value specified in the Delay field, and then they "
|
|
3813 |
. "are delivered to their destination.") . "</span>";
|
|
3811 |
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "
|
|
3812 |
. "then they are delayed by value specified in the Delay field, and then they "
|
|
3813 |
. "are delivered to their destination.") . "</span>";
|
|
3814 | 3814 |
$form .= "</td></tr>"; |
3815 | 3815 |
$form .= "<tr style=\"display:none\" id=\"sprtable5\">"; |
3816 | 3816 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Bucket Size") . "</td>"; |
... | ... | |
3819 | 3819 |
$form .= $this->GetBuckets() . "\" />"; |
3820 | 3820 |
$form .= " slots<br />"; |
3821 | 3821 |
$form .= "<span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
3822 |
. "should leave the field empty. It increases the hash size set.");
|
|
3822 |
. "should leave the field empty. It increases the hash size set."); |
|
3823 | 3823 |
$form .= "</span></td></tr>"; |
3824 | 3824 |
|
3825 | 3825 |
return $form; |
... | ... | |
4011 | 4011 |
$form .= "</td><td class=\"vncellreq\">"; |
4012 | 4012 |
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\""; |
4013 | 4013 |
if ($this->GetEnabled() == "on") { |
4014 |
$form .= " checked=\"checked\"";
|
|
4014 |
$form .= " checked=\"checked\""; |
|
4015 | 4015 |
} |
4016 | 4016 |
$form .= " /><span class=\"vexpl\"> " . gettext("Enable/Disable queue") . "</span>"; |
4017 | 4017 |
$form .= "</td></tr>"; |
... | ... | |
4048 | 4048 |
$form .= "</select>"; |
4049 | 4049 |
$form .= " slots<br />"; |
4050 | 4050 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n" |
4051 |
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n"
|
|
4052 |
. "be created for each source/destination IP address encountered, \n"
|
|
4053 |
. "respectively. This makes it possible to easily specify bandwidth \n"
|
|
4054 |
. "limits per host.") . "</span><br />";
|
|
4051 |
. "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" |
|
4052 |
. "be created for each source/destination IP address encountered, \n" |
|
4053 |
. "respectively. This makes it possible to easily specify bandwidth \n" |
|
4054 |
. "limits per host.") . "</span><br />"; |
|
4055 | 4055 |
$form .= "255.255.255.255/ <input type=\"text\" class=\"formfld unknown\" size=\"2\" id=\"maskbits\" name=\"maskbits\" value=\""; |
4056 | 4056 |
if ($mask['type'] <> "none") { |
4057 | 4057 |
$form .= $mask['bits']; |
... | ... | |
4073 | 4073 |
$form .= " />"; |
4074 | 4074 |
$form .= " IPV6 mask bits (1-128)<br />"; |
4075 | 4075 |
$form .= "<span class=\"vexpl\">" . gettext("If 'source' or 'destination' slots is chosen, \n" |
4076 |
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n"
|
|
4077 |
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n"
|
|
4078 |
. "per queue.") . "</span>";
|
|
4076 |
. "leaving the mask bits blank will create one pipe per host. Otherwise specify \n" |
|
4077 |
. "the number of 'one' bits in the subnet mask used to group multiple hosts \n" |
|
4078 |
. "per queue.") . "</span>"; |
|
4079 | 4079 |
$form .= "</td></tr>"; |
4080 | 4080 |
$form .= "<tr><td valign=\"middle\" class=\"vncellreq\">" . gettext("Description") . "</td>"; |
4081 | 4081 |
$form .= "<td class=\"vncellreq\">"; |
... | ... | |
4097 | 4097 |
$form .= "<input name=\"weight\" type=\"text\" id=\"weight\" size=\"5\" value=\""; |
4098 | 4098 |
$form .= $this->GetWeight() . "\" />"; |
4099 | 4099 |
$form .= " <br /> <span class=\"vexpl\">" . gettext("Hint: For queues under the same parent " |
4100 |
. "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . "</span>";
|
|
4100 |
. "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . "</span>"; |
|
4101 | 4101 |
$form .= "</td></tr>"; |
4102 | 4102 |
$form .= "<tr style=\"display:none\" id=\"sprtable1\">"; |
4103 | 4103 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Packet loss rate") . "</td>"; |
... | ... | |
4105 | 4105 |
$form .= "<input name=\"plr\" type=\"text\" id=\"plr\" size=\"5\" value=\""; |
4106 | 4106 |
$form .= $this->GetPlr() . "\" />"; |
4107 | 4107 |
$form .= " <br /> <span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
4108 |
. "should specify 0 here (or leave the field empty). "
|
|
4109 |
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>";
|
|
4108 |
. "should specify 0 here (or leave the field empty). " |
|
4109 |
. "A value of 0.001 means one packet in 1000 gets dropped") . "</span>"; |
|
4110 | 4110 |
$form .= "</td></tr>"; |
4111 | 4111 |
$form .= "<tr style=\"display:none\" id=\"sprtable2\">"; |
4112 | 4112 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Queue Size") . "</td>"; |
... | ... | |
4115 | 4115 |
$form .= $this->GetQlimit() . "\" />"; |
4116 | 4116 |
$form .= " slots<br />"; |
4117 | 4117 |
$form .= "<span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
4118 |
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, "
|
|
4119 |
. "then they are delayed by value specified in the Delay field, and then they "
|
|
4120 |
. "are delivered to their destination.") . "</span>";
|
|
4118 |
. "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " |
|
4119 |
. "then they are delayed by value specified in the Delay field, and then they " |
|
4120 |
. "are delivered to their destination.") . "</span>"; |
|
4121 | 4121 |
$form .= "</td></tr>"; |
4122 | 4122 |
$form .= "<tr style=\"display:none\" id=\"sprtable5\">"; |
4123 | 4123 |
$form .= "<td valign=\"middle\" class=\"vncellreq\">" . gettext("Bucket Size") . "</td>"; |
... | ... | |
4126 | 4126 |
$form .= $this->GetBuckets() . "\" />"; |
4127 | 4127 |
$form .= " " . gettext("slots") . "<br />"; |
4128 | 4128 |
$form .= "<span class=\"vexpl\">" . gettext("Hint: in most cases, you " |
4129 |
. "should leave the field empty. It increases the hash size set.");
|
|
4129 |
. "should leave the field empty. It increases the hash size set."); |
|
4130 | 4130 |
$form .= "</span></td></tr>"; |
4131 | 4131 |
|
4132 | 4132 |
$form .= "<input type=\"hidden\" id=\"pipe\" name=\"pipe\""; |
... | ... | |
4268 | 4268 |
$form .= "</td><td class=\"vncellreq\">"; |
4269 | 4269 |
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\" "; |
Also available in: Unified diff
Code spacing
and other random stuff I noticed.
I think this finishes messing with code style. The codebase should match
the developer style guide closely enough that 99.9% of changes will not
feel the need to also massage the formatting.