summaryrefslogtreecommitdiffstats
path: root/etc/rc.bootup
blob: e1912d9e1d6900bb31dbfe326b143e9d6ac36f13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/local/bin/php -f
<?php
/* $Id$ */
/*
	rc.bootup
	part of pfSense by Scott Ullrich
	originally based on m0n0wall (http://m0n0.ch/wall)

	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
	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.
*/

	require_once("globals.inc");

	/* let the other functions know we're booting */
	$g['booting'] = TRUE;
	touch("{$g['varrun_path']}/booting");

	/* parse the configuration and include all functions used below */
	require_once("config.inc");
	require_once("functions.inc");

	$lan_if = $config['interfaces']['lan']['if'];
	$wan_if = get_real_wan_interface();

	$do_assign = 0;
	/* we need to ignore the vlan interface checks) */
	if(stristr($lan_if,"vlan") == false or stristr($wan_if,"vlan") == false) {
		if(does_interface_exist($lan_if) == false) {
			echo "\n\n\nLAN {$lan_if} interface mismatch.";
			$do_assign = 1;
		}
		if($config['interfaces']['wan']['ipaddr'] <> "pppoe" && $config['interfaces']['wan']['ipaddr'] <> "pptp" && $do_assign == 0) {
			if(does_interface_exist($wan_if) == false) {
				echo "\n\n\nWAN {$wan_if} interface mismatch.";
				$do_assign = 1;
			}
		}
		if($do_assign == 1) {
			$noreboot = true;
			echo " -- Running interface assignment option.\n";
			set_networking_interfaces_ports();
		}
	}

	/* convert configuration, if necessary */
	convert_config();

	/* read in /etc/sysctl.conf and set values if needed */
	system_setup_sysctl();

	/* run any early shell commands specified in config.xml */
	system_do_shell_commands(1);

	/* save dmesg output to file */
	system_dmesg_save();

	/* set up our timezone */
	system_timezone_configure();

	/* set up our hostname */
	system_hostname_configure();

	/* make hosts file */
	system_hosts_generate();

	/* generate resolv.conf */
	system_resolvconf_generate();

	/* start pccardd */
	if (!in_array($g['platform'], $g['nopccard_platforms']))
		system_pccard_start();

	/* configure loopback interface */
	interfaces_loopback_configure();

	/* set up VLAN virtual interfaces */
	interfaces_vlan_configure();

	/* set up LAN interface */
	interfaces_lan_configure();

	/* set up WAN interface */
	interfaces_wan_configure();

	/* set up Optional interfaces */
	interfaces_optional_configure();

	/* setup carp interfaces */
	interfaces_carp_configure();

	/* start pflog */
	filter_pflog_start();

	/* setup altq + pf */
	filter_configure();

	/* bring up carp interfaces */
	interfaces_carp_bringup();

	/* start OpenVPN server & clients */
	ovpn_configure();

	/* set up static routes */
	system_routing_configure();

	/* enable routing */
	system_routing_enable();

	/* start syslogd */
	system_syslogd_start();

	/* start web server */
	system_webgui_start();

	/* configure console menu */
	system_console_configure();

	/* start dnsmasq service */
	services_dnsmasq_configure();

	/* start dyndns service */
	services_dyndns_configure();

	/* start DHCP service */
	services_dhcpd_configure();

	/* start SNMP service */
	services_snmpd_configure();

	/* start proxy ARP service */
	services_proxyarp_configure();

	/* start the NTP client */
	system_ntp_configure();

	/* start pptpd */
	vpn_pptpd_configure();

	/* start the captive portal */
	captiveportal_configure();

	/* execute the rc scripts of extensions */
	system_do_extensions();

	/* run any shell commands specified in config.xml */
	system_do_shell_commands();

	/* start ftp proxy helpers if they are enabled */
	system_start_ftp_helpers();

	/* start IPsec tunnels */
	vpn_ipsec_configure();

	setup_microcode();

	/* done */
	unlink("{$g['varrun_path']}/booting");
	$g['booting'] = FALSE;

?>
OpenPOWER on IntegriCloud