Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
4a7ff245
Commit
4a7ff245
authored
Nov 21, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unbound: simply reload on /etc/hosts change
parent
c8236eec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
71 deletions
+15
-71
unbound.inc
src/etc/inc/plugins.inc.d/unbound.inc
+10
-38
services_dhcp.php
src/www/services_dhcp.php
+2
-13
services_dhcp_edit.php
src/www/services_dhcp_edit.php
+1
-4
services_dhcpv6.php
src/www/services_dhcpv6.php
+1
-10
services_dhcpv6_edit.php
src/www/services_dhcpv6_edit.php
+1
-6
No files found.
src/etc/inc/plugins.inc.d/unbound.inc
View file @
4a7ff245
...
...
@@ -416,9 +416,7 @@ EOF;
file_put_contents
(
"
{
$g
[
'unbound_chroot_path'
]
}
/remotecontrol.conf"
,
$remotcfg
);
// Generate our keys
unbound_execute
(
"unbound-control-setup"
);
unbound_execute
(
'unbound-control-setup'
);
}
}
...
...
@@ -426,7 +424,7 @@ function unbound_configure_do($verbose = false)
{
global
$config
;
killbypid
(
'/var/run/unbound.pid'
,
'TERM'
,
true
);
unbound_execute
(
'stop'
);
if
(
!
isset
(
$config
[
'unbound'
][
'enable'
]))
{
return
;
...
...
@@ -448,7 +446,6 @@ function unbound_configure_do($verbose = false)
}
}
// Execute commands as the user unbound
function
unbound_execute
(
$cmd
)
{
global
$g
,
$config
;
...
...
@@ -456,16 +453,19 @@ function unbound_execute($cmd)
switch
(
$cmd
)
{
case
'start'
:
$local_domain
=
!
empty
(
$config
[
'system'
][
'domain'
])
?
$config
[
'system'
][
'domain'
]
:
"local"
;
killbypid
(
'/var/run/unbound_dhcpd.pid'
);
killbypid
(
'/var/run/unbound_dhcpd.pid'
,
'TERM'
,
true
);
if
(
isset
(
$config
[
'unbound'
][
'regdhcp'
]))
{
mwexec
(
'/usr/local/opnsense/scripts/dns/unbound_dhcpd.py /domain "'
.
$local_domain
.
'"'
);
}
mwexec
(
"/usr/local/sbin/unbound -c
{
$g
[
'unbound_chroot_path'
]
}
/unbound.conf"
);
break
;
case
'stop'
:
killbypid
(
'/var/run/unbound_dhcpd.pid'
);
killbypid
(
'/var/run/unbound_dhcpd.pid'
,
'TERM'
,
true
);
mwexec
(
"chroot -u unbound -g unbound / /usr/local/sbin/unbound-control stop"
,
true
);
break
;
case
'reload'
:
killbypid
(
'/var/run/unbound.pid'
,
'HUP'
);
break
;
case
'unbound-anchor'
:
mwexec
(
"chroot -u unbound -g unbound / /usr/local/sbin/unbound-anchor -a
{
$g
[
'unbound_chroot_path'
]
}
/root.key"
,
true
);
break
;
...
...
@@ -648,36 +648,9 @@ function unbound_add_host_entries()
file_put_contents
(
"
{
$g
[
'unbound_chroot_path'
]
}
/host_entries.conf"
,
$unbound_entries
);
}
function
unbound_control
(
$action
)
{
global
$config
,
$g
;
switch
(
$action
)
{
case
"start"
:
// Start Unbound
if
(
$config
[
'unbound'
][
'enable'
]
==
"on"
)
{
if
(
!
is_process_running
(
"unbound"
))
{
unbound_execute
(
"start"
);
}
}
break
;
case
"stop"
:
if
(
$config
[
'unbound'
][
'enable'
]
==
"on"
)
{
unbound_execute
(
"stop"
);
}
break
;
case
"reload"
:
if
(
$config
[
'unbound'
][
'enable'
]
==
"on"
)
{
unbound_execute
(
"reload"
);
}
break
;
default
:
break
;
}
}
// Generation of Unbound statistics
function
unbound_statistics
()
{
function
unbound_statistics
()
{
global
$config
;
if
(
$config
[
'stats'
]
==
"on"
)
{
...
...
@@ -765,6 +738,5 @@ function unbound_hosts_generate()
}
unbound_add_host_entries
();
/* XXX this doesn't exist! */
unbound_control
(
"reload"
);
unbound_execute
(
'reload'
);
}
src/www/services_dhcp.php
View file @
4a7ff245
...
...
@@ -111,13 +111,6 @@ function reconfigure_dhcpd()
system_hosts_generate
();
clear_subsystem_dirty
(
'hosts'
);
services_dhcpleases_configure
();
if
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
/* XXX we're calling unbound for regdhcpstatic, but restart the whole thing? */
unbound_configure_do
();
clear_subsystem_dirty
(
'unbound'
);
}
services_dhcpd_configure
();
clear_subsystem_dirty
(
'staticmaps'
);
}
...
...
@@ -516,13 +509,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if
(
!
empty
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
][
$_POST
[
'id'
]]))
{
unset
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
][
$_POST
[
'id'
]]);
write_config
();
if
(
isset
(
$config
[
'dhcpd'
][
$if
][
'enable'
]))
{
if
(
isset
(
$config
[
'dhcpd'
][
$if
][
'enable'
]))
{
mark_subsystem_dirty
(
'staticmaps'
);
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
mark_subsystem_dirty
(
'hosts'
);
}
elseif
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
mark_subsystem_dirty
(
'unbound'
);
}
mark_subsystem_dirty
(
'hosts'
);
}
}
header
(
url_safe
(
'Location: /services_dhcp.php?if=%s'
,
array
(
$if
)));
...
...
src/www/services_dhcp_edit.php
View file @
4a7ff245
...
...
@@ -287,11 +287,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config
();
if
(
isset
(
$config
[
'dhcpd'
][
$if
][
'enable'
]))
{
mark_subsystem_dirty
(
'staticmaps'
);
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
mark_subsystem_dirty
(
'staticmaps'
);
mark_subsystem_dirty
(
'hosts'
);
if
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
mark_subsystem_dirty
(
'unbound'
);
}
header
(
url_safe
(
'Location: /services_dhcp.php?if=%s'
,
array
(
$if
)));
...
...
src/www/services_dhcpv6.php
View file @
4a7ff245
...
...
@@ -41,13 +41,6 @@ function reconfigure_dhcpd()
{
system_hosts_generate
();
clear_subsystem_dirty
(
'hosts'
);
if
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
/* XXX we're calling unbound for regdhcpstatic, but restart the whole thing? */
unbound_configure_do
();
clear_subsystem_dirty
(
'unbound'
);
}
services_dhcpd_configure
();
clear_subsystem_dirty
(
'staticmaps'
);
}
...
...
@@ -327,9 +320,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config
();
if
(
isset
(
$config
[
'dhcpdv6'
][
$if
][
'enable'
]))
{
mark_subsystem_dirty
(
'staticmapsv6'
);
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
mark_subsystem_dirty
(
'hosts'
);
}
mark_subsystem_dirty
(
'hosts'
);
}
}
exit
;
...
...
src/www/services_dhcpv6_edit.php
View file @
4a7ff245
...
...
@@ -136,12 +136,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if
(
isset
(
$config
[
'dhcpdv6'
][
$if
][
'enable'
]))
{
mark_subsystem_dirty
(
'staticmaps'
);
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
mark_subsystem_dirty
(
'hosts'
);
}
if
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
mark_subsystem_dirty
(
'unbound'
);
}
mark_subsystem_dirty
(
'hosts'
);
}
header
(
url_safe
(
'Location: /services_dhcpv6.php?if=%s'
,
array
(
$if
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment