diff --git a/plist b/plist index 323c58c40..d84ebc777 100644 --- a/plist +++ b/plist @@ -1395,6 +1395,7 @@ /usr/local/opnsense/service/templates/OPNsense/Cron/user.cron /usr/local/opnsense/service/templates/OPNsense/Dnsmasq/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Dnsmasq/dnsmasq.conf +/usr/local/opnsense/service/templates/OPNsense/Dnsmasq/rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Filter/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Filter/filter_geoip.conf /usr/local/opnsense/service/templates/OPNsense/Filter/filter_tables.conf diff --git a/src/etc/inc/plugins.inc.d/dnsmasq.inc b/src/etc/inc/plugins.inc.d/dnsmasq.inc index 4bfa5567d..56def1751 100644 --- a/src/etc/inc/plugins.inc.d/dnsmasq.inc +++ b/src/etc/inc/plugins.inc.d/dnsmasq.inc @@ -49,7 +49,7 @@ function dnsmasq_services() { $services = []; - if (!dnsmasq_enabled() && !isvalidpid('/var/run/dnsmasq.pid')) { + if (!dnsmasq_enabled()) { return $services; } @@ -63,6 +63,7 @@ function dnsmasq_services() $pconfig['description'] = gettext('Dnsmasq DNS'); $pconfig['php']['restart'] = ['dnsmasq_configure_do']; $pconfig['php']['start'] = ['dnsmasq_configure_do']; + $pconfig['configd']['stop'] = ['dnsmasq stop']; $pconfig['pidfile'] = '/var/run/dnsmasq.pid'; $services[] = $pconfig; @@ -139,7 +140,7 @@ function dnsmasq_configure_do($verbose = false) global $config; killbypid('/var/run/dnsmasq_dhcpd.pid'); - killbypid('/var/run/dnsmasq.pid'); + mwexec('/usr/local/etc/rc.d/dnsmasq stop'); if (!dnsmasq_enabled()) { return; @@ -149,7 +150,7 @@ function dnsmasq_configure_do($verbose = false) _dnsmasq_add_host_entries(); - mwexec("/usr/local/sbin/dnsmasq"); + mwexec('/usr/local/etc/rc.d/dnsmasq start'); if (!empty($config['dnsmasq']['regdhcp'])) { /* XXX: deprecate when moving ISC to plugins ? */ diff --git a/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf b/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf index dfe075474..380ca9eba 100644 --- a/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf +++ b/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf @@ -4,7 +4,7 @@ type:script message:Starting Dnsmasq [stop] -command:/usr/local/sbin/pluginctl -s dnsmasq stop +command:/usr/local/etc/rc.d/dnsmasq stop type:script message:Stopping Dnsmasq @@ -15,7 +15,7 @@ message:Restarting Dnsmasq description:Restart Dnsmasq DNS service [status] -command:/usr/local/sbin/pluginctl -s dnsmasq status +command:/usr/local/etc/rc.d/dnsmasq status; exit 0 type:script_output message:Request Dnsmasq status diff --git a/src/opnsense/service/templates/OPNsense/Dnsmasq/+TARGETS b/src/opnsense/service/templates/OPNsense/Dnsmasq/+TARGETS index aec11b7ba..a679be076 100644 --- a/src/opnsense/service/templates/OPNsense/Dnsmasq/+TARGETS +++ b/src/opnsense/service/templates/OPNsense/Dnsmasq/+TARGETS @@ -1 +1,2 @@ dnsmasq.conf:/usr/local/etc/dnsmasq.conf +rc.conf.d:/etc/rc.conf.d/dnsmasq diff --git a/src/opnsense/service/templates/OPNsense/Dnsmasq/rc.conf.d b/src/opnsense/service/templates/OPNsense/Dnsmasq/rc.conf.d new file mode 100644 index 000000000..b4f7668f7 --- /dev/null +++ b/src/opnsense/service/templates/OPNsense/Dnsmasq/rc.conf.d @@ -0,0 +1,6 @@ +{% if not helpers.empty('dnsmasq.enable') %} +dnsmasq_enable="YES" +dnsmasq_skip="YES" +{% else %} +dnsmasq_enable="NO" +{% endif %}