Project

General

Profile

Download (6.23 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    globals.inc
5
    part of pfSense (www.pfsense.com)
6
    Copyright (C) 2004-2010 Scott Ullrich
7

    
8
    Originally Part of m0n0wall
9
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
    All rights reserved.
11

    
12
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14

    
15
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17

    
18
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21

    
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32

    
33
	pfSense_MODULE:	utils
34

    
35
*/
36

    
37
function remove_numbers($string) {
38
	$nums = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ");
39
	$string = str_replace($nums, '', $string);
40
	return $string;
41
}
42

    
43
function get_nics_with_capabilities($CAPABILITIES) {
44
	$ifs = `/sbin/ifconfig -l`;
45
	$if_list = split(" ", $ifs);
46
	$vlan_native_supp = array();
47
	foreach($if_list as $if => $iface) {
48
		$iface = trim($iface);
49
		$capable = pfSense_get_interface_addresses($iface);
50
		if(isset($capable['caps'][$CAPABILITIES])) {
51
			$interfacenonum = remove_numbers($iface);
52
			if(!in_array($interfacenonum, $vlan_native_supp))
53
				$vlan_native_supp[] = $interfacenonum;
54
		}
55
	}
56
	return $vlan_native_supp;
57
}
58

    
59
$g = array(
60
	"base_packages" => "siproxd", 
61
	"event_address" => "unix:///var/run/check_reload_status",
62
	"factory_shipped_username" => "admin",
63
	"factory_shipped_password" => "pfsense",
64
	"upload_path" => "/root",
65
	"dhcpd_chroot_path" => "/var/dhcpd",
66
	"unbound_chroot_path" => "/var/unbound",
67
	"varrun_path" => "/var/run",
68
	"varetc_path" => "/var/etc",
69
	"vardb_path" => "/var/db",
70
	"varlog_path" => "/var/log",
71
	"etc_path" => "/etc",
72
	"tmp_path" => "/tmp",
73
	"conf_path" => "/conf",
74
	"ftmp_path" => "/ftmp",
75
	"conf_default_path" => "/conf.default",
76
	"cf_path" => "/cf",
77
	"cf_conf_path" => "/cf/conf",
78
	"www_path" => "/usr/local/www",
79
	"xml_rootobj" => "pfsense",
80
	"admin_group" => "admins",
81
	"product_name" => "pfSense",
82
	"product_copyright" => "BSD Perimeter LLC",
83
	"product_copyright_url" => "http://www.bsdperimeter.com",
84
	"product_copyright_years" => "2004 - 2011",
85
	"product_website" => "www.pfsense.org",
86
	"product_website_footer" => "http://www.pfsense.org/?gui20",
87
	"product_email" => "coreteam@pfsense.org",
88
	"hideplatform" => false,
89
	"hidedownloadbackup" => false,
90
	"disablethemeselection" => false,
91
	"disablehelpmenu" => false,
92
	"disablehelpicon" => false,
93
	"disablecrashreporter" => false,
94
	"crashreporterurl" => "http://crashreporter.pfsense.org/crash_reporter.php",
95
	"debug" => false,
96
	"latest_config" => "8.3",
97
	"nopkg_platforms" => array("cdrom"),
98
	"minimum_ram_warning" => "101",
99
	"minimum_ram_warning_text" => "128 MB",
100
	"minimum_nic_count" => "1",
101
	"minimum_nic_count_text" => "*AT LEAST* 1",	
102
	"wan_interface_name" => "wan", 
103
	"nopccard_platforms" => array("wrap", "net48xx"),
104
	"xmlrpcbaseurl" => "www.pfsense.com",
105
	"captiveportal_path" => "/usr/local/captiveportal",
106
	"captiveportal_element_path" => "/var/db/cpelements",
107
	"captiveportal_element_sizelimit" => 1048576,
108
	"xmlrpcpath" => "/pfSense/xmlrpc.php",
109
	"embeddedbootupslice" => "/dev/ad0a",
110
	"services_dhcp_server_enable" => true,
111
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
112
	"help_base_url" => "/help.php"
113
);
114

    
115
// Loop through and set vlan_long_frame VLAN_MTU
116
$vlan_native_supp = get_nics_with_capabilities("vlanmtu");
117
$g['vlan_long_frame'] = array_merge(array("vge", "bfe",  "bge",  "dc",  "em",  "fxp",  "gem",  "hme",  "ixgb",  "le", "lem", "nge",  "re",  "rl",  "sis",  "sk",  "ste",  "ti",  "tl",  "tx",  "txp",  "vr", "xl", "lagg"), (array)$vlan_native_supp);
118

    
119
/* IP TOS flags */
120
$iptos = array("lowdelay", "throughput", "reliability");
121

    
122
/* TCP flags */
123
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg");
124

    
125
if(file_exists("/etc/platform")) {
126
	$arch = php_uname("m");
127
	$g['platform'] = trim(file_get_contents("/etc/platform"));
128
	if($g['platform'] == "nanobsd") {
129
		$g['update_url']="http://snapshots.pfsense.org/FreeBSD_RELENG_8_1/{$arch}/pfSense_HEAD/.updaters/";
130
		$g['update_manifest']="http://updates.pfSense.com/nanobsd/manifest";
131
		$g['firmware_update_text']="pfSense-*.img.gz";
132

    
133
	} else {
134
		$g['update_url']="http://snapshots.pfsense.org/FreeBSD_RELENG_8_1/{$arch}/pfSense_HEAD/.updaters/";
135
		$g['update_manifest']="http://updates.pfSense.com/manifest";
136
		$g['firmware_update_text']="pfSense-*.tgz";
137
	}
138
}
139

    
140
/* Default sysctls */
141
$sysctls = array("net.inet.ip.portrange.first" => "1024", 
142
	"net.inet.tcp.blackhole" => "2", 
143
	"net.inet.udp.blackhole" => "1", 
144
	"net.inet.ip.random_id" => "1", 
145
	"net.inet.tcp.drop_synfin" => "1", 
146
	"net.inet.ip.redirect" => "1", 
147
	"net.inet6.ip6.redirect" => "1", 
148
	"net.inet.tcp.syncookies" => "1", 
149
	"net.inet.tcp.recvspace" => "65228", 
150
	"net.inet.tcp.sendspace" => "65228", 
151
	"net.inet.ip.fastforwarding" => "0", 
152
	"net.inet.tcp.delayed_ack" => "0", 
153
	"net.inet.udp.maxdgram" => "57344", 
154
	"net.link.bridge.pfil_onlyip" => "0", 
155
	"net.link.bridge.pfil_member" => "1", 
156
	"net.link.bridge.pfil_bridge" => "0", 
157
	"net.link.tap.user_open" => "1", 
158
	"kern.randompid" => "347", 
159
	"net.inet.ip.intr_queue_maxlen" => "1000", 
160
	"hw.syscons.kbd_reboot" => "0", 
161
	"net.inet.tcp.inflight.enable" => "1", 
162
	"net.inet.tcp.log_debug" => "0", 
163
	"net.inet.tcp.tso" => "1", 
164
	"net.inet.icmp.icmplim" => "0",
165
	"vfs.read_max" => "32",
166
	"kern.ipc.maxsockbuf" => "4262144",
167
	"debug.pfftpproxy" => "0"
168
);
169

    
170
$config_parsed = false;
171

    
172
?>
(22-22/62)