Project

General

Profile

Download (6.41 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    globals.inc
5
    part of pfSense (www.pfsense.com)
6
    Copyright (C) 2004-2006 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 = `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 = `ifconfig -m $iface | grep "capabilities=.*{$CAPABILITIES}"`;
50
		if($capable) {
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
	"factory_shipped_username" => "admin",
62
	"factory_shipped_password" => "pfsense",
63
	"upload_path" => "/root",
64
	"dhcpd_chroot_path" => "/var/dhcpd",
65
	"varrun_path" => "/var/run",
66
	"varetc_path" => "/var/etc",
67
	"vardb_path" => "/var/db",
68
	"varlog_path" => "/var/log",
69
	"etc_path" => "/etc",
70
	"tmp_path" => "/tmp",
71
	"conf_path" => "/conf",
72
	"ftmp_path" => "/ftmp",
73
	"conf_default_path" => "/conf.default",
74
	"cf_path" => "/cf",
75
	"cf_conf_path" => "/cf/conf",
76
	"www_path" => "/usr/local/www",
77
	"xml_rootobj" => "pfsense",
78
	"admin_group" => "admins",
79
	"product_name" => "pfSense",
80
	"product_copyright" => "BSD Perimeter LLC",
81
	"product_copyright_url" => "http://www.bsdperimeter.com",
82
	"product_copyright_years" => "2004 - 2009",
83
	"product_website" => "www.pfsense.org",
84
	"product_website_footer" => "http://www.pfsense.org/?gui20",
85
	"product_email" => "coreteam@pfsense.org",
86
	"hideplatform" => false,
87
	"disablethemeselection" => false,
88
	"disablehelpmenu" => false,
89
	"debug" => false,
90
	"latest_config" => "6.0",
91
	"nopkg_platforms" => array("cdrom"),
92
	"minimum_ram_warning" => "105",
93
	"minimum_ram_warning_text" => "128 MB",
94
	"minimum_nic_count" => "1",
95
	"minimum_nic_count_text" => "*AT LEAST* 1",	
96
	"wan_interface_name" => "wan", 
97
	"nopccard_platforms" => array("wrap", "net48xx"),
98
	"xmlrpcbaseurl" => "www.pfsense.com",
99
	"captiveportal_path" => "/usr/local/captiveportal",
100
	"captiveportal_element_path" => "/var/db/cpelements",
101
	"captiveportal_element_sizelimit" => 262144,
102
	"xmlrpcpath" => "/pfSense/xmlrpc.php",
103
	"embeddedbootupslice" => "/dev/ad0a",
104
	"services_dhcp_server_enable" => true,
105
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|wai|iwi|awi|wlan|rum|zyd)/",
106
	"help_base_url" => "/help.php"
107
);
108

    
109
// Loop through and set vlan_native_supp (native vlan tagging)
110
$vlan_native_supp = get_nics_with_capabilities("HWTAGGING");
111
if(count($vlan_native_supp) > 0)
112
	$g['vlan_native_supp'] = $vlan_native_supp;
113
else 
114
	$g['vlan_native_supp'] = array("bce", "bge", "bfe", "cxgb", "dc", "em", "fxp", "gem", "hme", "ixgb", "msk", "nge", "re", "rl", "sis", "ste", "stge", "ti", "tl", "tx", "txp", "vge", "vr", "xl", "lagg");
115

    
116
// Loop through and set vlan_long_frame VLAN_MTU
117
$vlan_native_supp = get_nics_with_capabilities("VLAN_MTU");
118
if(count($vlan_native_supp) > 0)
119
	$g['vlan_long_frame'] = $vlan_native_supp;
120
else 
121
	$g['vlan_long_frame'] = array("vge", "bfe",  "bge",  "dc",  "em",  "fxp",  "gem",  "hme",  "ixgb",  "le",  "nge",  "re",  "rl",  "sis",  "sk",  "ste",  "ti",  "tl",  "tx",  "txp",  "vr", "xl", "lagg");
122

    
123
/* IP TOS flags */
124
$iptos = array("lowdelay", "throughput", "reliability");
125

    
126
/* TCP flags */
127
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg");
128

    
129
if(file_exists("/etc/platform")) {
130
	$arch = trim(`uname -m`);
131
	$g['platform'] = trim(file_get_contents("/etc/platform"));
132
	if($g['platform'] == "nanobsd") {
133
		$g['update_url']="http://snapshots.pfsense.org/FreeBSD_RELENG_8_0/{$arch}/pfSense_HEAD/.updaters/";
134
		$g['update_manifest']="http://updates.pfSense.com/nanobsd/manifest";
135
		$g['firmware_update_text']="pfSense-*.img.gz";
136

    
137
	} else {
138
		$g['update_url']="http://snapshots.pfsense.org/FreeBSD_RELENG_8_0/{$arch}/pfSense_HEAD/.updaters/";
139
		$g['update_manifest']="http://updates.pfSense.com/manifest";
140
		$g['firmware_update_text']="pfSense-*.tgz";
141
	}
142
}
143

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

    
173
?>
(18-18/50)