function dhcpv6_apply_changes($dhcpdv6_enable_changed) { $retval = 0; $retvaldhcp = 0; $retvaldns = 0; /* Stop DHCPv6 so we can cleanup leases */ killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid"); // dhcp_clean_leases(); /* dnsmasq_configure calls dhcpd_configure */ /* no need to restart dhcpd twice */ if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) { $retvaldns = services_dnsmasq_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('hosts'); clear_subsystem_dirty('staticmaps'); } } else { if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) { $retvaldns = services_unbound_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('unbound'); clear_subsystem_dirty('staticmaps'); } } else { $retvaldhcp = services_dhcpd_configure(); if ($retvaldhcp == 0) { clear_subsystem_dirty('staticmaps'); } } } if ($dhcpdv6_enable_changed) { $retvalfc = filter_configure(); } if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) { $retval = 1; } return get_std_save_message($retval); }
break; case 'weekly': install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "*", "*", "0"); break; case 'monthly': // fall through // fall through default: install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "1", "*", "*"); } $config['system']['bogons']['interval'] = $_POST['bogonsinterval']; } write_config(); // Kill filterdns when value changes, filter_configure() will restart it if ($old_aliasesresolveinterval != $config['system']['aliasesresolveinterval'] && isvalidpid("{$g['varrun_path']}/filterdns.pid")) { killbypid("{$g['varrun_path']}/filterdns.pid"); } $retval = 0; $retval = filter_configure(); if (stristr($retval, "error") != true) { $savemsg = get_std_save_message($retval); $class = 'success'; } else { $savemsg = $retval; $class = 'warning'; } } } $pgtitle = array(gettext("System"), gettext("Advanced"), htmlspecialchars(gettext("Firewall & NAT"))); include "head.inc"; if ($input_errors) {
function service_control_restart($name, $extras) { switch ($name) { case 'radvd': services_radvd_configure(); break; case 'ntpd': system_ntp_configure(); break; case 'apinger': killbypid("/var/run/apinger.pid"); setup_gateways_monitor(); break; case 'bsnmpd': services_snmpd_configure(); break; case 'dhcrelay': services_dhcrelay_configure(); break; case 'dhcrelay6': services_dhcrelay6_configure(); break; case 'dnsmasq': services_dnsmasq_configure(); break; case 'unbound': services_unbound_configure(); break; case 'dhcpd': services_dhcpd_configure(); break; case 'igmpproxy': services_igmpproxy_configure(); break; case 'miniupnpd': upnp_action('restart'); break; case 'ipsec': vpn_ipsec_force_reload(); break; case 'sshd': configd_run("sshd restart"); break; case 'openvpn': $vpnmode = htmlspecialchars($extras['vpnmode']); if ($vpnmode == "server" || $vpnmode == "client") { $id = htmlspecialchars($extras['id']); $configfile = "/var/etc/openvpn/{$vpnmode}{$id}.conf"; if (file_exists($configfile)) { openvpn_restart_by_vpnid($vpnmode, $id); } } break; case 'relayd': relayd_configure(true); break; case 'squid': configd_run("proxy restart"); break; case 'suricata': configd_run("ids restart"); break; default: log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name)); break; } return sprintf(gettext("%s has been restarted."), htmlspecialchars($name)); }
break; } } } } @unlink('/tmp/.vpn_pppoe.apply'); } $retval = 0; $retval |= filter_configure(); $savemsg = get_std_save_message($retval); clear_subsystem_dirty('vpnpppoe'); } } if ($_GET['act'] == "del") { if ($a_pppoes[$_GET['id']]) { killbypid("/var/run/pppoe{$a_pppoes[$_GET['id']]['pppoeid']}-vpn.pid"); mwexecf('/bin/rm -r %s', "/var/etc/pppoe{$a_pppoes[$_GET['id']]['pppoeid']}"); unset($a_pppoes[$_GET['id']]); write_config(); header("Location: vpn_pppoe.php"); exit; } } $pgtitle = array(gettext("VPN"), gettext("PPPoE")); $shortcut_section = "pppoes"; include "head.inc"; $main_buttons = array(array('label' => gettext("add a new pppoe instance"), 'href' => 'vpn_pppoe_edit.php')); ?> <body> <?php
break; case 'weekly': install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "*", "*", "0"); break; case 'monthly': // fall through // fall through default: install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "1", "*", "*"); } $config['system']['bogons']['interval'] = $_POST['bogonsinterval']; } write_config(); // Kill filterdns when value changes, filter_configure() will restart it if ($old_aliasesresolveinterval != $config['system']['aliasesresolveinterval']) { killbypid('/var/run/filterdns.pid'); } $retval = 0; $retval = filter_configure(); if (stristr($retval, "error") != true) { $savemsg = get_std_save_message(); } else { $savemsg = $retval; } } } $pgtitle = array(gettext("System"), gettext("Settings"), gettext("Firewall and NAT")); include "head.inc"; ?> <body>
} } } } @unlink("{$g['tmp_path']}/.vpn_pppoe.apply"); } $retval = 0; $retval |= filter_configure(); $savemsg = get_std_save_message($retval); clear_subsystem_dirty('vpnpppoe'); } } if ($_GET['act'] == "del") { if ($a_pppoes[$_GET['id']]) { if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid") { killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid"); } if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) { mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']); } unset($a_pppoes[$_GET['id']]); write_config(); header("Location: services_pppoe.php"); exit; } } $pgtitle = array(gettext("Services"), gettext("PPPoE Server")); $shortcut_section = "pppoes"; include "head.inc"; if ($savemsg) { print_info_box($savemsg, 'success');
$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp']; $config['dhcpdv6'][$if]['ldap'] = $_POST['ldap']; $config['dhcpdv6'][$if]['netboot'] = $_POST['netboot'] ? true : false; $config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url']; $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime']; // Handle the custom options rowhelper if (isset($config['dhcpdv6'][$if]['numberoptions']['item'])) { unset($config['dhcpdv6'][$if]['numberoptions']['item']); } $config['dhcpdv6'][$if]['numberoptions'] = $numberoptions; write_config(); $retval = 0; $retvaldhcp = 0; $retvaldns = 0; /* Stop DHCPv6 so we can cleanup leases */ killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid"); // dhcp_clean_leases(); /* dnsmasq_configure calls dhcpd_configure */ /* no need to restart dhcpd twice */ if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) { $retvaldns = services_dnsmasq_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('hosts'); clear_subsystem_dirty('staticmaps'); } } else { if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) { $retvaldns = services_unbound_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('unbound'); clear_subsystem_dirty('staticmaps');
} $config['dhcpdv6'][$if]['tftp'] = $_POST['tftp']; $config['dhcpdv6'][$if]['ldap'] = $_POST['ldap']; $config['dhcpdv6'][$if]['netboot'] = $_POST['netboot'] ? true : false; $config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url']; $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime']; // Handle the custom options rowhelper if (isset($config['dhcpdv6'][$if]['numberoptions']['item'])) { unset($config['dhcpdv6'][$if]['numberoptions']['item']); } $config['dhcpdv6'][$if]['numberoptions'] = $numberoptions; write_config(); } if (!$input_errors || $_POST['apply'] == 'Apply changes') { /* Stop DHCPv6 so we can cleanup leases */ killbypid("{$g['dhcpd_chroot_path']}/var/run/dhcpdv6.pid"); // dhcp_clean_leases(); /* dnsmasq_configure calls dhcpd_configure */ /* no need to restart dhcpd twice */ if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) { $retvaldns = services_dnsmasq_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('hosts'); clear_subsystem_dirty('staticmaps'); } } else { if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) { $retvaldns = services_unbound_configure(); if ($retvaldns == 0) { clear_subsystem_dirty('unbound'); }
killbyname("ntpd"); break; case 'bsnmpd': killbypid("{$g['varrun_path']}/snmpd.pid"); break; case 'choparp': killbyname("choparp"); break; case 'dhcpd': killbyname("dhcpd"); break; case 'dhcrelay': killbypid("{$g['varrun_path']}/dhcrelay.pid"); break; case 'dnsmasq': killbypid("{$g['varrun_path']}/dnsmasq.pid"); break; case 'miniupnpd': upnp_action('stop'); break; case 'openntpd': killbyname("openntpd"); break; case 'sshd': killbyname("sshd"); break; case 'racoon': exec("killall -9 racoon"); default: stop_service($_GET['service']); break;
break; case 'miniupnpd': upnp_action('stop'); break; case 'sshd': killbyname("sshd"); break; case 'racoon': exec("killall -9 racoon"); break; case 'openvpn': $vpnmode = $_GET['vpnmode']; if ($vpnmode == "server" or $vpnmode == "client") { $id = $_GET['id']; $pidfile = "{$g['varrun_path']}/openvpn_{$vpnmode}{$id}.pid"; killbypid($pidfile); } break; case 'relayd': mwexec('pkill relayd'); break; default: stop_service($_GET['service']); break; } $savemsg = sprintf(gettext("%s has been stopped."), htmlspecialchars($_GET['service'])); sleep(5); } /* batch mode, allow other scripts to call this script */ if ($_GET['batch']) { exit;