summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-06-18 16:59:43 +0000
committerErmal Luçi <eri@pfsense.org>2009-06-18 16:59:43 +0000
commita5d6f60bf42e07949ccf9d46a29d539c9d327205 (patch)
tree442ac33ec1d74c86187d3193f7c1607ee04109c3 /etc/inc
parent6dc88d5352ea963d85708379405e238e0518e990 (diff)
downloadpfsense-a5d6f60bf42e07949ccf9d46a29d539c9d327205.zip
pfsense-a5d6f60bf42e07949ccf9d46a29d539c9d327205.tar.gz
* Fix the pppoe reset script.
* Do not reload recursevly services while configuring interfaces * Clean up the resync_all and reload_interfaces to not call services recursievly * Fix interfaces.php to not try to save the config after you click the apply button. * Put interfaces_loopback_configure on interfaces_configure its an interface after all.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/interfaces.inc64
-rw-r--r--etc/inc/pfsense-utils.inc129
2 files changed, 54 insertions, 139 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 55f352b..e6c3198 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -668,6 +668,9 @@ function interface_gif_configure(&$gif) {
function interfaces_configure() {
global $config, $g;
+ /* Set up our loopback interface */
+ interfaces_loopback_configure();
+
/* set up LAGG virtual interfaces */
interfaces_lagg_configure();
@@ -698,9 +701,9 @@ function interfaces_configure() {
else {
if ($g['booting'])
echo "Configuring {$ifname} interface...";
- if($g['debug'])
+ if($g['debug'])
log_error("Configuring {$ifname}");
- interface_configure($if);
+ interface_configure($if, true);
if ($g['booting'])
echo "done.\n";
}
@@ -715,10 +718,10 @@ function interfaces_configure() {
foreach ($delayed_list as $if => $ifname) {
if ($g['booting'])
echo "Configuring {$ifname} interface...";
- if($g['debug'])
- log_error("Configuring {$ifname}");
+ if ($g['debug'])
+ log_error("Configuring {$ifname}");
- interface_configure($if);
+ interface_configure($if, true);
if ($g['booting'])
echo "done.\n";
@@ -733,7 +736,7 @@ function interfaces_configure() {
if($g['debug'])
log_error("Configuring {$ifname}");
- interface_configure($if);
+ interface_configure($if, true);
if ($g['booting'])
echo "done.\n";
@@ -1437,7 +1440,7 @@ function find_dhclient_process($interface) {
return $pid;
}
-function interface_configure($interface = "wan") {
+function interface_configure($interface = "wan", $reloadall = false) {
global $config, $g;
global $interface_sn_arr_cache, $interface_ip_arr_cache;
@@ -1545,32 +1548,34 @@ function interface_configure($interface = "wan") {
interface_bridge_configure($bridge);
}
- /* XXX: Shouldn't the caller do this?! */
- /* XXX */
- if ($interface = "lan")
+ /* XXX: Shouldn't the caller do all this reconfiguring?! */
+ if ($interface == "lan")
/* make new hosts file */
- system_hosts_generate();
+ system_hosts_generate();
- /* reconfigure static routes (kernel may have deleted them) */
- system_routing_configure();
+ if ($reloadall == true) {
- /* set the reload filter dity flag */
- filter_configure();
+ /* reconfigure static routes (kernel may have deleted them) */
+ system_routing_configure();
- /* reload ipsec tunnels */
- vpn_ipsec_configure();
+ /* reload ipsec tunnels */
+ vpn_ipsec_configure();
- /* update dyndns */
- services_dyndns_configure();
+ /* update dyndns */
+ services_dyndns_configure();
- /* force DNS update */
- services_dnsupdate_process();
+ /* force DNS update */
+ services_dnsupdate_process();
- /* restart dnsmasq */
- services_dnsmasq_configure();
+ /* restart dnsmasq */
+ services_dnsmasq_configure();
- /* reload captive portal */
- captiveportal_configure();
+ /* reload captive portal */
+ captiveportal_configure();
+
+ /* set the reload filter dity flag */
+ filter_configure();
+ }
}
@@ -2496,15 +2501,14 @@ function is_jumbo_capable($int) {
function setup_pppoe_reset_file($interface, $status) {
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$interface}restart");
- define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interface_reconfigure({$interface}); services_dyndns_reset({$interface}); filter_configure(); ?>' | /usr/local/bin/php -q");
- if($status == true) {
- if(!file_exists(CRON_PPPOE_CMD_FILE)) {
+ define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"config.inc\"); require(\"interfaces.inc\"); interface_reconfigure({$interface}); ?>' | /usr/local/bin/php -q");
+ if ($status == true) {
+ if (!file_exists(CRON_PPPOE_CMD_FILE)) {
file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
chmod(CRON_PPPOE_CMD_FILE, 0700);
}
- } else {
+ } else
unlink_if_exists(CRON_PPPOE_CMD_FILE);
- }
}
?>
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 9c62180..8038a63 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1054,77 +1054,36 @@ function strncpy(&$dst, $src, $length) {
function reload_interfaces_sync() {
global $config, $g;
- $shutdown_webgui_needed = false;
-
+ /* XXX: Use locks?! */
+ if (file_exists("{$g['tmp_path']}/reloading_all")) {
+ log_error("WARNING: Recursive call to interfaces sync!");
+ return;
+ }
touch("{$g['tmp_path']}/reloading_all");
if($g['debug'])
log_error("reload_interfaces_sync() is starting.");
- if(file_exists("{$g['tmp_path']}/config.cache"))
- unlink("{$g['tmp_path']}/config.cache");
-
/* parse config.xml again */
$config = parse_config(true);
- $wan_if = $config['interfaces']['wan']['if'];
- if (isset($config['interfaces']['lan']))
- $lan_if = $config['interfaces']['lan']['if'];
- else
- $lan_if = "";
+ /* enable routing */
+ system_routing_enable();
+ if($g['debug'])
+ log_error("Enabling system routing");
if($g['debug'])
log_error("Cleaning up Interfaces");
- /* if list */
- $iflist = get_configured_interface_list(true);
-
- foreach ($iflist as $ifent => $ifname) {
- $ifname_real = convert_friendly_interface_to_real_interface_name($ifname);
-
- if(stristr($ifname, "lo0") == true)
- continue;
- /* do not process wan interface, its mandatory */
- if(stristr($ifname, "$wan_if") == true)
- continue;
- /* do not process lan interface, its mandatory */
- if(stristr($ifname, "$lan_if") == true)
- continue;
- if($g['debug'])
- log_error("Downing and deleting $ifname_real - $ifname");
- mwexec("/sbin/ifconfig {$ifname_real} down");
- mwexec("/sbin/ifconfig {$ifname_real} delete");
- }
-
/* set up interfaces */
interfaces_configure();
- /* set up static routes */
- if($g['debug'])
- log_error("Configuring system Routing");
- system_routing_configure();
-
- /* enable routing */
- if($g['debug'])
- log_error("Enabling system routing");
- system_routing_enable();
-
- /* setup captive portal if needed */
+ /* remove reloading_all trigger */
if($g['debug'])
- log_error("Configuring Captive portal");
- captiveportal_configure();
-
- /* restart webConfigurator if needed */
- if($shutdown_webgui_needed == true)
- touch("/tmp/restart_webgui");
+ log_error("Removing {$g['tmp_path']}/reloading_all");
/* start devd back up */
mwexec("/bin/rm /tmp/reload*");
-
- /* remove reloading_all trigger */
- if($g['debug'])
- log_error("Removing {$g['tmp_path']}/reloading_all");
- unlink_if_exists("{$g['tmp_path']}/reloading_all");
}
/****f* pfsense-utils/reload_all
@@ -1164,13 +1123,13 @@ function reload_all_sync() {
$g['booting'] = false;
+ /* XXX: Use locks?! */
+ if (file_exists("{$g['tmp_path']}/reloading_all")) {
+ log_error("WARNING: Recursive call to reload all sync!");
+ return;
+ }
touch("{$g['tmp_path']}/reloading_all");
- $shutdown_webgui_needed = false;
-
- if(file_exists("{$g['tmp_path']}/config.cache"))
- unlink("{$g['tmp_path']}/config.cache");
-
/* parse config.xml again */
$config = parse_config(true);
@@ -1186,81 +1145,33 @@ function reload_all_sync() {
/* generate resolv.conf */
system_resolvconf_generate();
- /* Set up our loopback interface */
- interfaces_loopback_configure();
-
- $wan_if = $config['interfaces']['wan']['if'];
- if (isset($config['interfaces']['lan']))
- $lan_if = $config['interfaces']['lan']['if'];
- else
- $lan_if = "";
-
- /* if list */
- $iflist = get_configured_interface_list();
-
- foreach ($iflist as $ifent => $ifname) {
- $ifname_real = convert_friendly_interface_to_real_interface_name($ifname);
- if(stristr($ifname, "lo0") == true)
- continue;
- /* do not process wan interface, its mandatory */
- if($wan_if == $ifname_real)
- continue;
- /* do not process lan interface, its mandatory */
- if($lan_if == $ifname_real)
- continue;
- mwexec("/sbin/ifconfig {$ifname_real} down");
- mwexec("/sbin/ifconfig {$ifname_real} delete");
- }
-
- /* set up interfaces */
- interfaces_configure();
-
- /* set up static routes */
- system_routing_configure();
-
/* enable routing */
system_routing_enable();
- /* ensure passwords are sync'd */
-// system_password_configure();
-
- /* start dnsmasq service */
- services_dnsmasq_configure();
+ /* set up interfaces */
+ interfaces_configure();
/* start dyndns service */
services_dyndns_configure();
- /* start DHCP service */
- services_dhcpd_configure();
-
/* configure cron service */
configure_cron();
/* start the NTP client */
system_ntp_configure();
- /* start the captive portal */
- captiveportal_configure();
-
- /* reload the filter */
- filter_configure_sync();
-
/* sync pw database */
conf_mount_rw();
mwexec("/usr/sbin/pwd_mkdb -d /etc/ /etc/master.passwd");
conf_mount_ro();
/* restart sshd */
- touch("/tmp/start_sshd");
+ @touch("/tmp/start_sshd");
/* restart webConfigurator if needed */
- if($shutdown_webgui_needed == true)
- touch("/tmp/restart_webgui");
+ touch("/tmp/restart_webgui");
mwexec("/bin/rm /tmp/reload*");
-
- unlink_if_exists("{$g['tmp_path']}/reloading_all");
-
}
function auto_login($status) {
OpenPOWER on IntegriCloud