diff --git a/src/etc/devd/carp.conf b/src/etc/devd/carp.conf index d5376cd60..9451eaee0 100644 --- a/src/etc/devd/carp.conf +++ b/src/etc/devd/carp.conf @@ -6,11 +6,11 @@ notify 100 { match "system" "CARP"; match "type" "MASTER"; - action "/usr/local/sbin/pfSctl -c 'interface carpmaster $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface carpmaster $subsystem'"; }; notify 100 { match "system" "CARP"; match "type" "BACKUP"; - action "/usr/local/sbin/pfSctl -c 'interface carpbackup $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface carpbackup $subsystem'"; }; diff --git a/src/etc/devd/ifnet.conf b/src/etc/devd/ifnet.conf index 911d7e5de..9c77c6bc9 100644 --- a/src/etc/devd/ifnet.conf +++ b/src/etc/devd/ifnet.conf @@ -1,5 +1,5 @@ # -# Override the system defaults of devd so that pfSctl receives +# Override the system defaults of devd so that configd receives # both LINK_UP and LINK_DOWN events on wired and wireless devices. # @@ -7,26 +7,26 @@ notify 101 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "ethernet"; - action "/usr/local/sbin/pfSctl -c 'interface linkup start $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup start $subsystem'"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_DOWN"; media-type "ethernet"; - action "/usr/local/sbin/pfSctl -c 'interface linkup stop $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup stop $subsystem'"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "802.11"; - action "/usr/local/sbin/pfSctl -c 'interface linkup start $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup start $subsystem'"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_DOWN"; media-type "802.11"; - action "/usr/local/sbin/pfSctl -c 'interface linkup stop $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup stop $subsystem'"; }; diff --git a/src/etc/inc/captiveportal.inc b/src/etc/inc/captiveportal.inc index 15441a440..f5cb16055 100644 --- a/src/etc/inc/captiveportal.inc +++ b/src/etc/inc/captiveportal.inc @@ -423,7 +423,7 @@ function captiveportal_configure_zone($cpcfg) { if (isset($cpcfg['enable'])) { - if ($g['booting']) { + if (file_exists("/var/run/booting")) { echo "Starting captive portal({$cpcfg['zone']})... "; /* remove old information */ @@ -565,7 +565,7 @@ EOD; unlink_if_exists("{$g['vardb_path']}/captiveportal_radius_{$cpzone}.db"); captiveportal_init_radius_servers(); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { /* send Accounting-On to server */ captiveportal_send_server_accounting(); echo "done\n"; @@ -582,7 +582,7 @@ EOD; captiveportal_radius_stop_all(); /* send Accounting-Off to server */ - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { captiveportal_send_server_accounting(true); } diff --git a/src/etc/inc/config.console.inc b/src/etc/inc/config.console.inc index dbee1d5e0..2a272946a 100644 --- a/src/etc/inc/config.console.inc +++ b/src/etc/inc/config.console.inc @@ -300,7 +300,7 @@ EOD; $config['interfaces']['lan'] = array(); $config['interfaces']['lan']['if'] = $lanif; $config['interfaces']['lan']['enable'] = true; - } elseif (!$g['booting'] && !$auto_assign) { + } elseif (!file_exists("/var/run/booting") && !$auto_assign) { echo <<") == true) { - if($g['booting']) echo "."; /* user has just upgraded to m0n0wall, replace root xml tags */ log_error(gettext("Upgrading m0n0wall configuration to pfSense... ")); $config_contents = str_replace("m0n0wall","pfsense", $config_contents); @@ -91,14 +82,11 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) { } /* if our config file exists bail out, we're already set. */ -else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) { - if($g['booting']) echo "."; +else if (file_exists("/var/run/booting") && !file_exists('/cf/conf/config.xml')) { /* find the device where config.xml resides and write out an fstab */ unset($cfgdevice); - if($g['booting']) echo "."; /* check if there's already an fstab (NFS booting?) */ if (!file_exists('/etc/fstab')) { - if($g['booting']) echo "."; if (strstr($g['platform'], "cdrom")) { /* config is on floppy disk for CD-ROM version */ $cfgdevice = $cfgpartition = "fd0"; @@ -116,7 +104,6 @@ else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) { echo " " . gettext("CFG:") . " {$cfgpartition}\n"; echo " " . gettext("TYPE:") . " {$cfgfstype}\n"; } else { - if($g['booting']) echo "."; /* probe kernel known disks until we find one with config.xml */ $disks = explode(" ", get_single_sysctl("kern.disks")); foreach ($disks as $mountdisk) { @@ -138,7 +125,6 @@ else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) { break; } if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) { - if($g['booting']) echo "."; if (file_exists('/cf/conf/config.xml')) { /* found it */ $cfgdevice = $mountdisk; @@ -154,7 +140,6 @@ else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) { } } } - if($g['booting']) echo "."; if (!$cfgdevice) { $last_backup = discover_last_backup(); if($last_backup) { @@ -181,12 +166,10 @@ else if ($g['booting'] && !file_exists('/cf/conf/config.xml')) { fwrite($fd, $fstab); fclose($fd); } - if($g['booting']) echo "."; /* mount all filesystems */ mwexec("/sbin/mount -a"); } -if($g['booting']) echo "."; $config = parse_config(); /* set timezone */ diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index b70fb20fb..9badb5968 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -42,7 +42,7 @@ function encrypted_configxml() { if (!file_exists($g['conf_path'] . "/config.xml")) return; - if (!$g['booting']) + if (!file_exists("/var/run/booting")) return; $configtxt = file_get_contents($g['conf_path'] . "/config.xml"); @@ -96,8 +96,6 @@ function parse_config($parse = false) { } } - if($g['booting']) - echo "."; // Check for encrypted config.xml encrypted_configxml(); @@ -112,8 +110,6 @@ function parse_config($parse = false) { } if ($parse == true) { if(!file_exists($g['conf_path'] . "/config.xml")) { - if($g['booting']) - echo "."; log_error("No config.xml found, attempting last known config restore."); file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); $last_backup = discover_last_backup(); @@ -139,8 +135,6 @@ function parse_config($parse = false) { generate_config_cache($config); } - if($g['booting']) - echo "."; $config_parsed = true; unlock($lockkey); @@ -211,12 +205,9 @@ function restore_backup($file) { function parse_config_bootup() { global $config, $g; - if($g['booting']) - echo "."; - $lockkey = lock('config'); if (!file_exists("{$g['conf_path']}/config.xml")) { - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if (strstr($g['platform'], "cdrom")) { /* try copying the default config. to the floppy */ echo gettext("Resetting factory defaults...") . "\n"; @@ -304,7 +295,7 @@ function conf_mount_rw() { $status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}"); if($status <> 0) { - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Disk is dirty. Running fsck -y") . "\n"; mwexec("/sbin/fsck -y {$g['cf_path']}"); $status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}"); @@ -345,7 +336,7 @@ function conf_mount_ro() { if(isset($config['system']['nanobsd_force_rw'])) return; - if($g['booting']) + if(file_exists("/var/run/booting")) return; clear_subsystem_dirty('mount'); @@ -523,7 +514,7 @@ function write_config($desc = 'Unknown', $backup = true) if ($last_backup) { restore_backup("/cf/conf/backup/{$last_backup}"); $config = parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { echo "\n\n ************** WARNING **************"; echo "\n\n Configuration could not be validated. A previous configuration was restored. \n"; echo "\n The failed configuration file has been saved as {$g['conf_path']}/config.xml.bad \n\n"; @@ -628,7 +619,7 @@ function config_install($conffile) { if (!config_validate("{$conffile}")) return 1; - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo gettext("Installing configuration...") . "\n"; else log_error(gettext("Installing configuration ....")); @@ -733,8 +724,6 @@ function cleanup_backupcache($lock = false) { $tocheck = array_shift(explode('.', array_pop(explode('-', $backup)))); if(!in_array($tocheck, $baktimes)) { $i = true; - if($g['booting']) - echo "."; $newxml = parse_xml_config($backup, array($g['xml_rootobj'], 'pfsense')); if($newxml == "-1") { log_error(sprintf(gettext("The backup cache file %s is corrupted. Unlinking."), $backup)); @@ -754,7 +743,7 @@ function cleanup_backupcache($lock = false) { $newbaks[] = $checkbak; } else { $i = true; - if($g['booting']) print " " . $tocheck . "r"; + if(file_exists("/var/run/booting")) print " " . $tocheck . "r"; } } foreach($newbaks as $todo) $tocache[$todo['time']] = array('description' => $todo['description'], 'version' => $todo['version'], 'filesize' => $todo['filesize']); @@ -765,7 +754,6 @@ function cleanup_backupcache($lock = false) { foreach($tocache as $version => $versioninfo) { if(!in_array($version, array_keys($newcache))) { unlink_if_exists($g['conf_path'] . '/backup/config-' . $version . '.xml'); - //if($g['booting']) print " " . $tocheck . "d"; } } $tocache = $newcache; diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index 5f1612ab9..fbe6ead75 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -119,7 +119,7 @@ function filter_configure() * NOTE: Check here for bootup status since this should not be triggered during bootup. * The reason is that rc.bootup calls filter_configure_sync directly which does this too. */ - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { send_event('filter reload'); } } @@ -171,16 +171,16 @@ function filter_configure_sync($delete_states_if_needed = true) /* Get interface list to work with. */ filter_generate_optcfg_array(); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo gettext("Configuring firewall"); /* generate aliases */ - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; update_filter_reload_status(gettext("Creating aliases")); $aliases = filter_generate_aliases(); $gateways = filter_generate_gateways(); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; update_filter_reload_status(gettext("Generating Limiter rules")); $dummynet_rules = filter_generate_dummynet_rules(); @@ -188,19 +188,19 @@ function filter_configure_sync($delete_states_if_needed = true) update_filter_reload_status(gettext("Generating NAT rules")); /* generate nat rules */ $natrules = filter_nat_rules_generate(); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; update_filter_reload_status(gettext("Generating filter rules")); /* generate pfctl rules */ $pfrules = filter_rules_generate(); /* generate altq, limiter */ - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; update_filter_reload_status(gettext("Generating ALTQ queues")); $altq_queues = filter_generate_altq_queues(); update_filter_reload_status(gettext("Generating Layer7 rules")); generate_layer7_files(); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; update_filter_reload_status(gettext("Loading filter rules")); /* enable pf if we need to, otherwise disable */ @@ -210,7 +210,7 @@ function filter_configure_sync($delete_states_if_needed = true) mwexec("/sbin/pfctl -d", true); unlink_if_exists("{$g['tmp_path']}/filter_loading"); update_filter_reload_status(gettext("Filter is disabled. Not loading rules.")); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; unlock($filterlck); return; @@ -368,7 +368,7 @@ function filter_configure_sync($delete_states_if_needed = true) else filter_tdr_install_cron(false); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo "."; if($delete_states_if_needed) { @@ -386,7 +386,7 @@ function filter_configure_sync($delete_states_if_needed = true) } update_filter_reload_status(gettext("Done")); - if($g['booting'] == true) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; unlock($filterlck); @@ -3236,7 +3236,7 @@ function tdr_install_cron($should_install) { function filter_tdr_install_cron($should_install) { global $config, $g; - if($g['booting']==true) + if(file_exists("/var/run/booting")) return; if (!is_array($config['cron'])) diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index a22e6444a..438c836f4 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -100,8 +100,8 @@ rrd interval 60s; ## These parameters can be overridden in a specific alarm configuration alarm default { - command on "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' " - command off "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' " + command on "/usr/local/opnsense/service/configd_ctl.py 'service reload dyndns %T' 'service reload ipsecdns' 'service reload openvpn %T' 'filter reload' " + command off "/usr/local/opnsense/service/configd_ctl.py 'service reload dyndns %T' 'service reload ipsecdns' 'service reload openvpn %T' 'filter reload' " combine 10s } @@ -854,7 +854,7 @@ function return_gateway_groups_array() { $tiers_count = count($tiers); if ($tiers_count == 0) { /* Oh dear, we have no members! Engage Plan B */ - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { $msg = gettext("Gateways status could not be determined, considering all as up/active. (Group: {$group['name']})"); log_error($msg); notify_via_growl($msg); diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 3d4d929a5..af9ed6b6c 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -191,14 +191,14 @@ function interfaces_loopback_configure() { global $g; - if($g['booting']) { + if(file_exists("/var/run/booting")) { echo gettext("Configuring loopback interface..."); } pfSense_interface_setaddress("lo0", "127.0.0.1"); interfaces_bring_up("lo0"); - if($g['booting']) { + if(file_exists("/var/run/booting")) { echo gettext("done.") . "\n"; } @@ -207,7 +207,7 @@ function interfaces_loopback_configure() function interfaces_vlan_configure($realif = "") { global $config, $g; - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Configuring VLAN interfaces..."); if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { @@ -220,7 +220,7 @@ function interfaces_vlan_configure($realif = "") { interface_vlan_configure($vlan); } } - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -344,7 +344,7 @@ function interface_qinq_configure(&$vlan, $fd = NULL) { function interfaces_qinq_configure() { global $config, $g; - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Configuring QinQ interfaces..."); if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) { foreach ($config['qinqs']['qinqentry'] as $qinq) { @@ -352,7 +352,7 @@ function interfaces_qinq_configure() { interface_qinq_configure($qinq); } } - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext( "done.") . "\n"; } @@ -388,7 +388,7 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr) { function interfaces_create_wireless_clones() { global $config, $g; - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Creating wireless clone interfaces..."); $iflist = get_configured_interface_list(); @@ -409,7 +409,7 @@ function interfaces_create_wireless_clones() { interface_wireless_clone($clone['cloneif'], $clone); } } - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -526,7 +526,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0) { else $flags_on |= IFCAP_LRO; - if ($g['booting'] || !empty($bridge['bridgeif'])) { + if (file_exists("/var/run/booting") || !empty($bridge['bridgeif'])) { pfSense_interface_destroy($bridge['bridgeif']); pfSense_interface_create($bridge['bridgeif']); $bridgeif = escapeshellarg($bridge['bridgeif']); @@ -704,7 +704,7 @@ function interface_bridge_add_member($bridgeif, $interface) { function interfaces_lagg_configure($realif = "") { global $config, $g; - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Configuring LAGG interfaces..."); $i = 0; if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) { @@ -718,7 +718,7 @@ function interfaces_lagg_configure($realif = "") { $i++; } } - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -732,7 +732,7 @@ function interface_lagg_configure(&$lagg) { if (!count($members)) return -1; - if ($g['booting'] || !(empty($lagg['laggif']))) { + if (file_exists("/var/run/booting") || !(empty($lagg['laggif']))) { pfSense_interface_destroy($lagg['laggif']); pfSense_interface_create($lagg['laggif']); $laggif = $lagg['laggif']; @@ -848,7 +848,7 @@ function interface_gre_configure(&$gre, $grekey = "") { /* make sure the parent interface is up */ interfaces_bring_up($realif); - if ($g['booting'] || !(empty($gre['greif']))) { + if (file_exists("/var/run/booting") || !(empty($gre['greif']))) { pfSense_interface_destroy($gre['greif']); pfSense_interface_create($gre['greif']); $greif = $gre['greif']; @@ -945,7 +945,7 @@ function interface_gif_configure(&$gif, $gifkey = "") { else log_error(gettext("could not bring realif up -- variable not defined -- interface_gif_configure()")); - if ($g['booting'] || !(empty($gif['gifif']))) { + if (file_exists("/var/run/booting") || !(empty($gif['gifif']))) { pfSense_interface_destroy($gif['gifif']); pfSense_interface_create($gif['gifif']); $gifif = $gif['gifif']; @@ -1029,7 +1029,7 @@ function interfaces_configure() /* This is needed to speedup interfaces on bootup. */ $reload = false; - if (!$g['booting']) + if (!file_exists("/var/run/booting")) $reload = true; foreach($iflist as $if => $ifname) { @@ -1046,13 +1046,13 @@ function interfaces_configure() } else if (!empty($config['interfaces'][$if]['ipaddrv6']) && $config['interfaces'][$if]['ipaddrv6'] == "track6") { $track6_list[$if] = $ifname; } else { - if ($g['booting']) + if (file_exists("/var/run/booting")) printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext( "done.") . "\n"; } } @@ -1073,14 +1073,14 @@ function interfaces_configure() interfaces_bridge_configure(1); foreach ($track6_list as $if => $ifname) { - if ($g['booting']) + if (file_exists("/var/run/booting")) printf(gettext("Configuring %s interface..."), $ifname); if ($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -1094,14 +1094,14 @@ function interfaces_configure() interfaces_gif_configure(2); foreach ($delayed_list as $if => $ifname) { - if ($g['booting']) + if (file_exists("/var/run/booting")) printf(gettext("Configuring %s interface..."), $ifname); if ($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -1109,21 +1109,21 @@ function interfaces_configure() interfaces_bridge_configure(2); foreach ($bridge_list as $if => $ifname) { - if ($g['booting']) + if (file_exists("/var/run/booting")) printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } /* configure interface groups */ interfaces_group_setup(); - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { /* reconfigure static routes (kernel may have deleted them) */ system_routing_configure(); @@ -1514,7 +1514,7 @@ function interface_ppps_configure($interface) { $type = $ppp['type']; $upper_type = strtoupper($ppp['type']); - if($g['booting']) { + if(file_exists("/var/run/booting")) { $descr = isset($ifcfg['descr']) ? $ifcfg['descr'] : strtoupper($interface); echo "starting {$pppif} link..."; // Do not re-configure the interface if we are booting and it's already been started @@ -1921,7 +1921,7 @@ function interfaces_carp_setup() { global $g, $config; - if ($g['booting']) { + if (file_exists("/var/run/booting")) { echo gettext("Configuring CARP settings..."); mute_kernel_msgs(); } @@ -1977,7 +1977,7 @@ function interfaces_carp_setup() else set_single_sysctl("net.inet.carp.allow", "0"); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { unmute_kernel_msgs(); echo gettext("done.") . "\n"; } @@ -2903,7 +2903,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling $realhwif = $realhwif_array[0]; - if (!$g['booting'] && !(substr($realif, 0, 4) == "ovpn")) { + if (!file_exists("/var/run/booting") && !(substr($realif, 0, 4) == "ovpn")) { /* remove all IPv4 and IPv6 addresses */ $tmpifaces = pfSense_getall_interface_addresses($realif); if (is_array($tmpifaces)) { @@ -3119,7 +3119,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven interface_netgraph_needed($interface); - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { link_interface_to_vips($interface, "update"); unset($gre); @@ -3229,7 +3229,7 @@ function interface_track6_configure($interface = "lan", $wancfg, $linkupevent = break; } - if (!$g['booting'] && $linkupevent == false) { + if (!file_exists("/var/run/booting") && $linkupevent == false) { if (!function_exists('services_dhcpd_configure')) require_once("services.inc"); @@ -3430,7 +3430,7 @@ function interface_6rd_configure($interface = "wan", $wancfg) { mwexec("/sbin/route add -host " . escapeshellarg($wancfg['gateway-6rd']) . " {$ip4gateway}"); } /* configure dependent interfaces */ - if (!$g['booting']) + if (!file_exists("/var/run/booting")) link_interface_to_track6($interface, "update"); return 0; @@ -3528,7 +3528,7 @@ function interface_6to4_configure($interface = "wan", $wancfg){ mwexec("/sbin/route add -host 192.88.99.1 {$ip4gateway}"); } - if (!$g['booting']) + if (!file_exists("/var/run/booting")) link_interface_to_track6($interface, "update"); return 0; @@ -5202,7 +5202,7 @@ function interface_setup_pppoe_reset_file($pppif, $iface="") { if(!empty($iface) && !empty($pppif)){ $cron_cmd = << $instservice) { if($instservice['name'] == $service['name']) { - if($g['booting'] != true) + if(!file_exists("/var/run/booting")) stop_service($service['name']); if($service['rcfile']) { $prefix = RCFILEPREFIX; diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc index 113793c46..f72ab9ad2 100644 --- a/src/etc/inc/rrd.inc +++ b/src/etc/inc/rrd.inc @@ -196,7 +196,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { function enable_rrd_graphing() { global $config, $g, $altq_list_queues; - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("Generating RRD graphs..."); $rrddbpath = "/var/db/rrd/"; @@ -278,7 +278,7 @@ function enable_rrd_graphing() { } chown($rrddbpath, "nobody"); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { restore_rrd(); } @@ -334,7 +334,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$traffic N:U:U:U:U:U:U:U:U"); } @@ -367,7 +367,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$packets N:U:U:U:U:U:U:U:U"); } @@ -396,7 +396,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$wireless N:U:U:U"); } @@ -421,7 +421,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$vpnusers N:U"); } @@ -503,7 +503,7 @@ function enable_rrd_graphing() { unset($rrdcreate); } - if($g['booting']) { + if(file_exists("/var/run/booting")) { $rrdqcommand = "-t "; $rrducommand = "N"; $qi = 0; @@ -571,7 +571,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$cellular N:U:U:U"); } @@ -605,7 +605,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$states N:U:U:U:U:U"); } @@ -640,7 +640,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$proc N:U:U:U:U:U"); } @@ -678,7 +678,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$mem N:U:U:U:U:U"); } @@ -715,7 +715,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ifname$mbuf N:U:U:U:U"); } @@ -792,7 +792,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $concurrent_filename N:U"); } @@ -828,7 +828,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $loggedin_filename N:U"); } @@ -871,7 +871,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrddbpath$ntpd N:U:U:U:U:U:U"); } @@ -918,7 +918,7 @@ function enable_rrd_graphing() { chown($database, "nobody"); } - if($g['booting']) + if(file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -945,7 +945,7 @@ function create_gateway_quality_rrd($rrd_file) { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(file_exists("/var/run/booting")) { mwexec("$rrdtool update $rrd_file N:U:U"); } unset($rrdtool, $rrdinterval, $valid, $rrd_file); diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index a80f1a114..39bf0ac58 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -264,7 +264,7 @@ function services_radvd_configure($blacklist = array()) /* write radvd.conf */ if (!@file_put_contents("{$g['varetc_path']}/radvd.conf", $radvdconf)) { log_error("Error: cannot open radvd.conf in services_radvd_configure().\n"); - if ($g['booting']) + if (file_exists("/var/run/booting")) printf("Error: cannot open radvd.conf in services_radvd_configure().\n"); } unset($radvdconf); @@ -347,7 +347,7 @@ function services_dhcpdv4_configure() break; } - if ($g['booting']) { + if (file_exists("/var/run/booting")) { /* restore the leases, if we have them */ if (file_exists('/cf/conf/dhcpleases.tgz')) { $dhcprestore = ''; @@ -380,7 +380,7 @@ function services_dhcpdv4_configure() } } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DHCP service..."); else sleep(1); @@ -887,7 +887,7 @@ EOD; join(" ", $dhcpdifs)); } - if ($g['booting']) + if (file_exists("/var/run/booting")) print "done.\n"; return 0; @@ -974,7 +974,7 @@ function services_dhcpdv6_configure($blacklist = array()) if (!is_dhcpv6_server_enabled()) return 0; - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if ($g['platform'] != "pfSense") { /* restore the leases, if we have them */ if (file_exists('/cf/conf/dhcp6leases.tgz')) { @@ -1002,7 +1002,7 @@ function services_dhcpdv6_configure($blacklist = array()) $Iflist = array_merge($Iflist, get_configured_pppoe_server_interfaces()); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Starting DHCPv6 service..."; else sleep(1); @@ -1279,7 +1279,7 @@ EOD; /* write dhcpdv6.conf */ if (!@file_put_contents("{$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf", $dhcpdv6conf)) { log_error("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n"); - if ($g['booting']) + if (file_exists("/var/run/booting")) printf("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n"); unset($dhcpdv6conf); return 1; @@ -1300,7 +1300,7 @@ EOD; join(" ", $dhcpdv6ifs)); mwexec("/usr/local/sbin/dhcpleases6 -c \"/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh\" -l {$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases"); } - if ($g['booting']) + if (file_exists("/var/run/booting")) print gettext("done.") . "\n"; return 0; @@ -1377,7 +1377,7 @@ function services_dhcrelay_configure() if (!isset($dhcrelaycfg['enable'])) return 0; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DHCP relay service..."); else sleep(1); @@ -1494,7 +1494,7 @@ function services_dhcrelay6_configure() if (!isset($dhcrelaycfg['enable'])) return 0; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DHCPv6 relay service..."); else sleep(1); @@ -1632,7 +1632,7 @@ function services_dyndns_configure($int = '') $dyndnscfg = $config['dyndnses']['dyndns']; $gwgroups = return_gateway_groups_array(); if (is_array($dyndnscfg)) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DynDNS clients..."); foreach ($dyndnscfg as $dyndns) { @@ -1645,7 +1645,7 @@ function services_dyndns_configure($int = '') } } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -1696,7 +1696,7 @@ function services_dnsmasq_configure() if (isset($config['dnsmasq']['enable'])) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DNS forwarder..."); else sleep(1); @@ -1814,11 +1814,11 @@ function services_dnsmasq_configure() mwexec_bg($cmd); unset($args); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { if(services_dhcpd_configure()!=0) $return = 1; } @@ -1835,18 +1835,18 @@ function services_unbound_configure() { sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM"); if (isset($config['unbound']['enable'])) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting DNS Resolver..."); else sleep(1); require_once('unbound.inc'); sync_unbound_service(); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { if (services_dhcpd_configure()!=0) $return = 1; } @@ -1866,7 +1866,7 @@ function services_snmpd_configure() if (isset($config['snmpd']['enable'])) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting SNMP daemon... "); /* generate snmpd.conf */ @@ -2048,7 +2048,7 @@ EOD; mwexec("/usr/sbin/bsnmpd -c {$g['varetc_path']}/snmpd.conf" . "{$bindlan} -p {$g['varrun_path']}/snmpd.pid"); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index e3e7f6f34..0e5d89220 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -138,7 +138,7 @@ function system_resolvconf_generate($dynupdate = false) fclose($fd); chmod("{$g['varetc_path']}/resolv.conf", 0644); - if (!$g['booting']) { + if (!file_exists("/var/run/booting")) { /* restart dhcpd (nameservers may have changed) */ if (!$dynupdate) services_dhcpd_configure(); @@ -558,7 +558,7 @@ function system_staticroutes_configure($interface = "", $update_dns = false) { $hostnames = ""; array_unique($filterdns_list); foreach ($filterdns_list as $hostname) - $hostnames .= "cmd {$hostname} '/usr/local/sbin/pfSctl -c \"service reload routedns\"'\n"; + $hostnames .= "cmd {$hostname} '/usr/local/opnsense/service/configd_ctl.py \"service reload routedns\"'\n"; file_put_contents("{$g['varetc_path']}/filterdns-route.hosts", $hostnames); unset($hostnames); @@ -617,7 +617,7 @@ function system_syslogd_start() $syslogcfg = $config['syslog']; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Starting syslog..."); if (is_process_running("fifolog_writer")) @@ -797,7 +797,7 @@ EOD; else $retval = mwexec_bg("/usr/local/sbin/syslogd -s -c -c -l {$g['dhcpd_chroot_path']}/var/run/log -P {$g['varrun_path']}/syslog.pid {$syslogd_extra}"); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; return $retval; @@ -818,7 +818,7 @@ function system_webgui_start() log_error(_('Could not find an OpenSSL implementation on your system.')); } - if ($g['booting']) { + if (file_exists("/var/run/booting")) { /* XXX no no no no no no no no */ echo gettext("Starting webConfigurator..."); } @@ -891,7 +891,7 @@ function system_webgui_start() /* attempt to start lighthttpd */ $res = mwexec("/usr/local/sbin/lighttpd -f {$g['varetc_path']}/lighty-webConfigurator.conf"); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if ($res == 0) echo gettext("done.") . "\n"; else @@ -1273,7 +1273,7 @@ function system_timezone_configure() $syscfg = $config['system']; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Setting timezone..."); /* extract appropriate timezone file */ @@ -1295,7 +1295,7 @@ function system_timezone_configure() mwexec("sync"); conf_mount_ro(); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -1648,7 +1648,7 @@ function system_ntp_configure($start_ntpd = true) function sync_system_time() { global $config, $g; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Syncing system time before startup..."); /* foreach through servers and write out to ntpd.conf */ @@ -1656,7 +1656,7 @@ function sync_system_time() { mwexec("/usr/local/sbin/ntpdate -s $ts"); } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done.") . "\n"; } @@ -1741,7 +1741,7 @@ function system_set_harddisk_standby() global $g, $config; if (isset($config['system']['harddiskstandby'])) { - if ($g['booting']) { + if (file_exists("/var/run/booting")) { echo gettext('Setting hard disk standby... '); } @@ -1753,13 +1753,13 @@ function system_set_harddisk_standby() if (set_single_sysctl('hw.ata.standby', (int)$standby)) { // Reinitialize ATA-drives mwexec('/usr/local/sbin/atareinit'); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { echo gettext("done.") . "\n"; } - } else if ($g['booting']) { + } else if (file_exists("/var/run/booting")) { echo gettext("failed!") . "\n"; } - } else if ($g['booting']) { + } else if (file_exists("/var/run/booting")) { echo gettext("failed!") . "\n"; } } diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index e7ddc4122..906a9dce5 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -1943,7 +1943,7 @@ function upgrade_054_to_055() { $xmldump = "{$database}.old.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Migrate RRD database {$database} to new format for IPv6 \n"; mwexec("$rrdtool tune {$rrddbpath}{$database} -r roundtrip:delay 2>&1"); @@ -1979,7 +1979,7 @@ function upgrade_054_to_055() { $xmldumptmp = "{$database}.tmp.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Migrate RRD database {$database} to new format \n"; /* rename DS source */ mwexec("$rrdtool tune {$rrddbpath}/{$database} -r in:inpass 2>&1"); @@ -2033,7 +2033,7 @@ function upgrade_054_to_055() { /* The function will restore the rrd.tgz so we will save it after */ exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd"); unlink_if_exists("{$g['vardb_path']}/rrd/*.xml"); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Updating configuration..."; } @@ -2594,7 +2594,7 @@ function upgrade_080_to_081() { $xmldump = "{$database}.old.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Migrate RRD database {$database} to new format for IPv6.\n"; /* dump contents to xml and move database out of the way */ @@ -2714,7 +2714,7 @@ function upgrade_080_to_081() { /* Let's save the RRD graphs after we run enable RRD graphing */ /* The function will restore the rrd.tgz so we will save it after */ exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='/cf/conf' /usr/local/etc/rc.backup_rrd"); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Updating configuration..."; foreach($config['filter']['rule'] as & $rule) { if (isset($rule['protocol']) && !empty($rule['protocol'])) @@ -3034,7 +3034,7 @@ function upgrade_095_to_096() { $databases = return_dir_as_array($rrddbpath, '/-(traffic|packets)\.rrd$/'); rsort($databases); foreach($databases as $database) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "Update RRD database {$database}.\n"; $cmd = "{$rrdtool} tune {$rrddbpath}/{$database}"; diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index a612d8093..fd2051971 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -157,7 +157,9 @@ function unlock_force($lock) { function send_event($cmd) { - return mwexec("/usr/local/sbin/pfSctl -c '{$cmd}'"); + require_once("script/load_phalcon.php"); + $backend = new OPNsense\Core\Backend(); + return $backend->sendEvent("{$cmd}"); } function refcount_init($reference) { diff --git a/src/etc/inc/voucher.inc b/src/etc/inc/voucher.inc index 3c501c4df..78ab717a6 100644 --- a/src/etc/inc/voucher.inc +++ b/src/etc/inc/voucher.inc @@ -458,11 +458,11 @@ function voucher_configure($sync = false) { if (is_array($config['voucher'])) { foreach ($config['voucher'] as $voucherzone => $vcfg) { - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Enabling voucher support... "); $cpzone = $voucherzone; $error = voucher_configure_zone($sync); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if ($error) echo "error\n"; else @@ -507,7 +507,7 @@ function voucher_configure_zone($sync = false) { @chmod("{$g['varetc_path']}/voucher_{$cpzone}.cfg", 0600); unlock($voucherlck); - if (($g['booting'] || $sync == true) && is_array($config['voucher'][$cpzone]['roll'])) { + if ((file_exists("/var/run/booting") || $sync == true) && is_array($config['voucher'][$cpzone]['roll'])) { $voucherlck = lock("voucher{$cpzone}", LOCK_EX); diff --git a/src/etc/inc/vpn.inc b/src/etc/inc/vpn.inc index 74b138c54..1b9785119 100644 --- a/src/etc/inc/vpn.inc +++ b/src/etc/inc/vpn.inc @@ -152,7 +152,7 @@ function vpn_ipsec_configure($ipchg = false) mkdir("/usr/local/etc/ipsec.d/reqs"); - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("Configuring IPsec VPN... "); /* fastforwarding is not compatible with ipsec tunnels */ @@ -193,7 +193,7 @@ function vpn_ipsec_configure($ipchg = false) if (!is_ipaddr($rg)) { $filterdns_list[] = "{$rg}"; add_hostname_to_watch($rg); - if(! $g['booting']) + if(! file_exists("/var/run/booting")) $rg = resolve_retry($rg); if (!is_ipaddr($rg)) continue; @@ -842,7 +842,7 @@ EOD; $hostnames = ""; array_unique($filterdns_list); foreach ($filterdns_list as $hostname) - $hostnames .= "cmd {$hostname} '/usr/local/sbin/pfSctl -c \"service reload ipsecdns\"'\n"; + $hostnames .= "cmd {$hostname} '/usr/local/opnsense/service/configd_ctl.py \"service reload ipsecdns\"'\n"; file_put_contents("/usr/local/etc/filterdns-ipsec.hosts", $hostnames); unset($hostnames); @@ -856,7 +856,7 @@ EOD; @unlink("{$g['varrun_path']}/filterdns-ipsec.pid"); } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "done\n"; return count($filterdns_list); @@ -926,7 +926,7 @@ function vpn_pptpd_configure() { $syscfg = $config['system']; $pptpdcfg = $config['pptpd']; - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if (!$pptpdcfg['mode'] || ($pptpdcfg['mode'] == "off")) return 0; @@ -1137,7 +1137,7 @@ EOD; break; } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "done\n"; return 0; @@ -1161,7 +1161,7 @@ function vpn_pppoe_configure(&$pppoecfg) { if (!is_dir("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn")) mkdir("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn"); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off")) return 0; @@ -1357,7 +1357,7 @@ EOD; break; } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo gettext("done") . "\n"; return 0; @@ -1373,7 +1373,7 @@ function vpn_l2tp_configure() { if (!is_dir("{$g['varetc_path']}/l2tp-vpn")) mkdir("{$g['varetc_path']}/l2tp-vpn"); - if ($g['booting']) { + if (file_exists("/var/run/booting")) { if (!$l2tpcfg['mode'] || ($l2tpcfg['mode'] == "off")) return 0; @@ -1554,7 +1554,7 @@ EOD; break; } - if ($g['booting']) + if (file_exists("/var/run/booting")) echo "done\n"; return 0; diff --git a/src/etc/phpshellsessions/gitsync b/src/etc/phpshellsessions/gitsync index 8834b648f..d2e3dbeb3 100644 --- a/src/etc/phpshellsessions/gitsync +++ b/src/etc/phpshellsessions/gitsync @@ -393,7 +393,7 @@ function post_cvssync_commands() { $fd = fopen("/tmp/restart_lighty", "w"); fwrite($fd, "#!/bin/sh\n"); fwrite($fd, "sleep 5\n"); - fwrite($fd, "/usr/local/sbin/pfSctl -c 'service restart webgui'\n"); + fwrite($fd, "/usr/local/opnsense/service/configd_ctl.py 'service restart webgui'\n"); if(file_exists("/var/etc/lighty-CaptivePortal.conf")) fwrite($fd, "/usr/local/sbin/lighttpd -f /var/etc/lighty-CaptivePortal.conf\n"); fclose($fd); diff --git a/src/etc/rc b/src/etc/rc index 072913b0f..2b3d987c7 100755 --- a/src/etc/rc +++ b/src/etc/rc @@ -359,7 +359,7 @@ echo -n "Launching the init system..." /usr/bin/touch /var/run/booting /usr/local/etc/rc.bootup -# rc.bootup unset $g['booting'], remove file right now to be consistent +# end of boot process, remove status file /bin/rm /var/run/booting # If a shell was selected from recovery diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup index 7cd4f8497..89cd15f19 100755 --- a/src/etc/rc.bootup +++ b/src/etc/rc.bootup @@ -89,7 +89,6 @@ if (led_count() >= 3) { /* let the other functions know we're booting */ $pkg_interface = 'console'; -$g['booting'] = true; /* parse the configuration and include all functions used below */ require_once("config.inc"); @@ -393,8 +392,6 @@ if(file_exists('/conf/needs_package_sync')) { fail to route syslog messages properly on both IPv4 and IPv6 */ system_syslogd_start(); -/* done */ -unset($g['booting']); /* If there are ipsec dynamic hosts try again to reload the tunnels as rc.newipsecdns does */ if ($ipsec_dynamic_hosts) { diff --git a/src/etc/rc.filter_synchronize b/src/etc/rc.filter_synchronize index c7a468d88..cfd0261ab 100755 --- a/src/etc/rc.filter_synchronize +++ b/src/etc/rc.filter_synchronize @@ -90,8 +90,9 @@ function remove_special_characters($string) { function carp_check_version($url, $username, $password, $port = 80, $method = 'pfsense.host_firmware_version') { global $config, $g; - if(file_exists("{$g['varrun_path']}/booting") || $g['booting']) - return; + if(file_exists("/var/run/booting") { + return; + } $params = array( XML_RPC_encode($password) @@ -140,8 +141,9 @@ function carp_check_version($url, $username, $password, $port = 80, $method = 'p function carp_sync_xml($url, $username, $password, $sections, $port = 80, $method = 'pfsense.restore_config_section') { global $config, $g; - if(file_exists("{$g['varrun_path']}/booting") || $g['booting']) - return; + if(file_exists("/var/run/booting") { + return; + } update_filter_reload_status("Syncing CARP data to {$url}"); @@ -272,8 +274,10 @@ function carp_sync_xml($url, $username, $password, $sections, $port = 80, $metho } global $g; -if (file_exists("{$g['varrun_path']}/booting") || $g['booting']) - return; +if(file_exists("/var/run/booting") { + return; +} + if (is_array($config['hasync'])) { update_filter_reload_status("Building high availability sync information"); diff --git a/src/etc/rc.initial.firmware_update b/src/etc/rc.initial.firmware_update index 447bb32ab..06ee42737 100755 --- a/src/etc/rc.initial.firmware_update +++ b/src/etc/rc.initial.firmware_update @@ -9,15 +9,11 @@ require("globals.inc"); require("config.inc"); require("functions.inc"); -$g['booting'] = true; - echo "Starting the {$g['product_name']} console firmware update system"; require("functions.inc"); echo "."; -$g['booting'] = false; - if(isset($config['system']['firmware']['alturl']['enable'])) $updater_url = "{$config['system']['firmware']['alturl']['firmwareurl']}"; else diff --git a/src/etc/rc.kill_states b/src/etc/rc.kill_states index aa55d4cef..ca0df4861 100755 --- a/src/etc/rc.kill_states +++ b/src/etc/rc.kill_states @@ -34,7 +34,7 @@ require_once("interfaces.inc"); require_once("util.inc"); // Do not process while booting -if($g['booting']) +if(file_exists("/var/run/booting")) exit; /* Interface address to cleanup states */ diff --git a/src/etc/rc.linkup b/src/etc/rc.linkup index 055dea763..776b81a6e 100755 --- a/src/etc/rc.linkup +++ b/src/etc/rc.linkup @@ -84,14 +84,14 @@ function handle_argument_group($iface, $argument2) { } global $g; -if (!file_exists("{$g['varrun_path']}/booting") && empty($g['booting'])) { -if (isset($_GET)) { - if (!empty($_GET['interface'])) - handle_argument_group($_GET['interface'], $_GET['action']); -} else { - if ($argc < 3) { - log_error("HOTPLUG event: The number of required parameters not passed!"); - exit; +if (!file_exists("/var/run/booting")) { + if (isset($_GET)) { + if (!empty($_GET['interface'])) + handle_argument_group($_GET['interface'], $_GET['action']); + } else { + if ($argc < 3) { + log_error("HOTPLUG event: The number of required parameters not passed!"); + exit; } $action = $argv[1]; switch($action) { diff --git a/src/etc/rc.newipsecdns b/src/etc/rc.newipsecdns index 8a9ef14b1..19a434529 100755 --- a/src/etc/rc.newipsecdns +++ b/src/etc/rc.newipsecdns @@ -41,8 +41,9 @@ require_once("ipsec.inc"); require_once("vpn.inc"); /* make sure to wait until the boot scripts have finished */ -if (file_exists("{$g['varrun_path']}/booting")) - return; +if(file_exists("/var/run/booting") { + return; +} if (isset($config['ipsec']['enable'])) { sleep(15); diff --git a/src/etc/rc.newroutedns b/src/etc/rc.newroutedns index 9e5139eff..eae397653 100755 --- a/src/etc/rc.newroutedns +++ b/src/etc/rc.newroutedns @@ -33,8 +33,9 @@ require_once("functions.inc"); require_once("system.inc"); /* make sure to wait until the boot scripts have finished */ -if (file_exists("{$g['varrun_path']}/booting")) - return; +if(file_exists("/var/run/booting") { + return; +} $staticroutes = get_staticroutes(); diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip index 3e36cabbe..41e025a5b 100755 --- a/src/etc/rc.newwanip +++ b/src/etc/rc.newwanip @@ -44,8 +44,9 @@ require_once("IPv6.inc"); require_once("rrd.inc"); // Do not process while booting -if($g['booting']) +if(file_exists("/var/run/booting") { return; +} function restart_packages() { global $oldip, $curwanip, $g; diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6 index 4def04166..f76febfd3 100755 --- a/src/etc/rc.newwanipv6 +++ b/src/etc/rc.newwanipv6 @@ -78,7 +78,7 @@ if (empty($interface)) { } //Do not process while booting -if ($g['booting'] && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6") +if (file_exists("/var/run/booting") && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6") return; /* diff --git a/src/etc/rc.openvpn b/src/etc/rc.openvpn index d8717a1f9..e5cc56c35 100755 --- a/src/etc/rc.openvpn +++ b/src/etc/rc.openvpn @@ -67,8 +67,9 @@ function openvpn_resync_if_needed ($mode, $ovpn_settings, $interface) { } /* make sure to wait until the boot scripts have finished */ -if (file_exists("{$g['varrun_path']}/booting")) - return; +if(file_exists("/var/run/booting") { + return; +} /* Input argument is a comma-separated list of gateway names, blank or "all". */ if (isset($_GET)) diff --git a/src/opnsense/service/configd_ctl.py b/src/opnsense/service/configd_ctl.py index be6c4d664..6a6eebfa3 100755 --- a/src/opnsense/service/configd_ctl.py +++ b/src/opnsense/service/configd_ctl.py @@ -38,7 +38,7 @@ import sys __author__ = 'Ad Schellevis' -configd_socket_name = 'testing/configd.socket' +configd_socket_name = '/var/run/configd.socket' diff --git a/src/sbin/dhclient-script.ext b/src/sbin/dhclient-script.ext index ca0260319..61c9deea5 100755 --- a/src/sbin/dhclient-script.ext +++ b/src/sbin/dhclient-script.ext @@ -283,7 +283,7 @@ add_new_resolv_conf() { # Notify rc.newwanip of changes to an interface notify_rc_newwanip() { - /usr/local/sbin/pfSctl -c "interface newip $interface" + /usr/local/etc/rc.newwanip $interface } # diff --git a/src/sbin/ovpn-linkdown b/src/sbin/ovpn-linkdown index 708d5077f..bf11c5b6c 100755 --- a/src/sbin/ovpn-linkdown +++ b/src/sbin/ovpn-linkdown @@ -4,4 +4,4 @@ /bin/rm -f /var/etc/nameserver_$1 /bin/rm -f /tmp/$1_router /bin/rm -f /tmp/$1up -/usr/local/sbin/pfSctl -c 'filter reload' +/usr/local/opnsense/service/configd_ctl.py 'filter reload' diff --git a/src/sbin/ovpn-linkup b/src/sbin/ovpn-linkup index b4027c2b7..53cbf2cf1 100755 --- a/src/sbin/ovpn-linkup +++ b/src/sbin/ovpn-linkup @@ -1,7 +1,7 @@ #!/bin/sh # let the configuration system know that the ip has changed. -#/usr/local/sbin/pfSctl -c "interface newip $interface" +# /usr/local/opnsense/service/configd_ctl.py "interface newip $interface" if [ "${dev_type}" = "tun" ]; then if [ "" != "$route_vpn_gateway" ]; then @@ -13,5 +13,5 @@ fi /usr/bin/touch /tmp/$1up # reload filter -/usr/local/sbin/pfSctl -c "interface newip $1" +/usr/local/opnsense/service/configd_ctl.py "interface newip $1" exit 0 diff --git a/src/sbin/pfSsh.php b/src/sbin/pfSsh.php index 749071cb1..0548ea094 100755 --- a/src/sbin/pfSsh.php +++ b/src/sbin/pfSsh.php @@ -3,14 +3,12 @@ require_once("globals.inc"); echo "Starting the {$g['product_name']} shell system"; -$g['booting'] = true; require_once("functions.inc"); echo "."; require_once("config.inc"); echo "."; require_once("util.inc"); echo "."; -$g['booting'] = false; $shell_cmds = array("alias", "alloc", "bg", "bind", "bindkey", "break", "breaksw", "builtins", "case", "cd", "chdir", "command", "complete", "continue", "default", diff --git a/src/sbin/ppp-linkdown b/src/sbin/ppp-linkdown index b85a10561..119987ea9 100755 --- a/src/sbin/ppp-linkdown +++ b/src/sbin/ppp-linkdown @@ -28,4 +28,4 @@ fi /bin/rm -f /tmp/${IF}_router /bin/rm -f /tmp/${IF}up /bin/rm -f /tmp/${IF}_ip -/usr/local/sbin/pfSctl -c 'service reload dns' +/usr/local/opnsense/service/configd_ctl.py 'service reload dns' diff --git a/src/sbin/ppp-linkup b/src/sbin/ppp-linkup index 2d1eb33c5..e387100c1 100755 --- a/src/sbin/ppp-linkup +++ b/src/sbin/ppp-linkup @@ -29,10 +29,10 @@ if [ "${2}" == "inet" ]; then echo "${DNS2}" >> /var/etc/nameserver_${1} route change "${DNS2}" ${4} fi - pfSctl -c 'service reload dns' + /usr/local/opnsense/service/configd_ctl.py 'service reload dns' sleep 1 fi - pfSctl -c "interface newip ${1}" + /usr/local/opnsense/service/configd_ctl.py "interface newip ${1}" elif [ "${2}" == "inet6" ]; then # let the configuration system know that the ipv6 has changed. @@ -53,10 +53,10 @@ elif [ "${2}" == "inet6" ]; then echo "${DNS2}" >> /var/etc/nameserver_v6${1} route change -inet6 "${DNS2}" ${4} fi - pfSctl -c 'service reload dns' + /usr/local/opnsense/service/configd_ctl.py 'service reload dns' sleep 1 fi - pfSctl -c "interface newipv6 ${1}" + /usr/local/opnsense/service/configd_ctl.py "interface newipv6 ${1}" fi exit 0