diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-06-18 16:59:43 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-06-18 16:59:43 +0000 |
commit | a5d6f60bf42e07949ccf9d46a29d539c9d327205 (patch) | |
tree | 442ac33ec1d74c86187d3193f7c1607ee04109c3 /etc/inc/pfsense-utils.inc | |
parent | 6dc88d5352ea963d85708379405e238e0518e990 (diff) | |
download | pfsense-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/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 129 |
1 files changed, 20 insertions, 109 deletions
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) { |