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
5fa2d2dc
Commit
5fa2d2dc
authored
Jul 12, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: dns servers restart alignment
So that DHCP isn't restarted up to three times...
parent
d090ccc3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
58 deletions
+43
-58
interfaces.inc
src/etc/inc/interfaces.inc
+16
-18
services.inc
src/etc/inc/services.inc
+17
-23
services_dhcpv6.php
src/www/services_dhcpv6.php
+10
-17
No files found.
src/etc/inc/interfaces.inc
View file @
5fa2d2dc
...
@@ -95,8 +95,8 @@ function convert_128bit_to_ipv6($ip6bin)
...
@@ -95,8 +95,8 @@ function convert_128bit_to_ipv6($ip6bin)
function
match_wireless_interface
(
$int
)
function
match_wireless_interface
(
$int
)
{
{
$wireless_regex
=
'/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/'
;
$wireless_regex
=
'/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/'
;
return
preg_match
(
$wireless_regex
,
$int
);
return
preg_match
(
$wireless_regex
,
$int
);
}
}
function
interfaces_bring_up
(
$interface
)
function
interfaces_bring_up
(
$interface
)
...
@@ -153,9 +153,9 @@ function interface_netgraph_needed($interface)
...
@@ -153,9 +153,9 @@ function interface_netgraph_needed($interface)
case
'pppoe'
:
case
'pppoe'
:
case
'l2tp'
:
case
'l2tp'
:
case
'pptp'
:
case
'pptp'
:
return
true
;
return
true
;
default
:
default
:
break
;
break
;
}
}
}
}
...
@@ -1138,15 +1138,12 @@ function interfaces_configure()
...
@@ -1138,15 +1138,12 @@ function interfaces_configure()
/* reload IPsec tunnels */
/* reload IPsec tunnels */
ipsec_configure
();
ipsec_configure
();
/* restart dns servers (defering dhcp restart) */
services_dnsmasq_configure
(
false
);
services_unbound_configure
(
false
);
/* reload dhcpd (interface enabled/disabled status may have changed) */
/* reload dhcpd (interface enabled/disabled status may have changed) */
services_dhcpd_configure
();
services_dhcpd_configure
();
/* restart dnsmasq or unbound */
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
]))
{
services_dnsmasq_configure
();
}
elseif
(
isset
(
$config
[
'unbound'
][
'enable'
]))
{
services_unbound_configure
();
}
}
}
return
0
;
return
0
;
...
@@ -2952,7 +2949,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -2952,7 +2949,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
array_walk
(
$grouptmp
,
'interface_group_add_member'
);
array_walk
(
$grouptmp
,
'interface_group_add_member'
);
}
}
if
(
$interface
==
"lan"
)
{
if
(
$interface
==
'lan'
)
{
/* make new hosts file */
/* make new hosts file */
system_hosts_generate
();
system_hosts_generate
();
}
}
...
@@ -2964,12 +2961,12 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -2964,12 +2961,12 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
/* reload ipsec tunnels */
/* reload ipsec tunnels */
ipsec_configure
();
ipsec_configure
();
/* restart dns
masq or unbound
*/
/* restart dns
servers (defering dhcp restart)
*/
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
]))
{
services_dnsmasq_configure
(
false
);
services_dnsmasq_configure
(
);
services_unbound_configure
(
false
);
}
elseif
(
isset
(
$config
[
'unbound'
][
'enable'
]))
{
services_unbound_configure
();
/* reload dhcpd (interface enabled/disabled status may have changed) */
}
services_dhcpd_configure
();
/* update dyndns */
/* update dyndns */
configd_run
(
"dyndns reload
{
$interface
}
"
);
configd_run
(
"dyndns reload
{
$interface
}
"
);
...
@@ -2977,6 +2974,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -2977,6 +2974,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
}
}
interfaces_staticarp_configure
(
$interface
);
interfaces_staticarp_configure
(
$interface
);
return
0
;
return
0
;
}
}
...
...
src/etc/inc/services.inc
View file @
5fa2d2dc
...
@@ -1829,7 +1829,7 @@ function dyndnsCheckIP($int)
...
@@ -1829,7 +1829,7 @@ function dyndnsCheckIP($int)
return
$ip_address
;
return
$ip_address
;
}
}
function
services_dnsmasq_configure
()
function
services_dnsmasq_configure
(
$dhcp_reload
=
true
)
{
{
global
$config
;
global
$config
;
...
@@ -1840,14 +1840,11 @@ function services_dnsmasq_configure()
...
@@ -1840,14 +1840,11 @@ function services_dnsmasq_configure()
"local-ttl"
=>
"--local-ttl=1"
"local-ttl"
=>
"--local-ttl=1"
);
);
/* kill any running dnsmasq */
killbypid
(
'/var/run/dnsmasq.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/dnsmasq.pid'
);
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
]))
{
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
]))
{
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"Starting DNS forwarder..."
);
echo
gettext
(
"Starting DNS forwarder..."
);
}
else
{
sleep
(
1
);
}
}
$args
=
""
;
$args
=
""
;
...
@@ -1977,44 +1974,41 @@ function services_dnsmasq_configure()
...
@@ -1977,44 +1974,41 @@ function services_dnsmasq_configure()
}
}
}
}
if
(
!
file_exists
(
"/var/run/booting"
))
{
/*
if
(
services_dhcpd_configure
()
!=
0
)
{
* XXX this is overly convoluted, potentiall
return
1
;
* restarting all of dhcp up to three times ;)
}
*/
if
(
!
file_exists
(
"/var/run/booting"
)
&&
$dhcp_reload
)
{
services_dhcpd_configure
();
}
}
return
0
;
}
}
function
services_unbound_configure
()
function
services_unbound_configure
(
$dhcp_reload
=
true
)
{
{
global
$config
;
global
$config
;
$return
=
0
;
// kill any running Unbound instance
killbypid
(
'/var/run/unbound.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/unbound.pid'
);
if
(
isset
(
$config
[
'unbound'
][
'enable'
]))
{
if
(
isset
(
$config
[
'unbound'
][
'enable'
]))
{
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"Starting DNS Resolver..."
);
echo
gettext
(
"Starting DNS Resolver..."
);
}
else
{
sleep
(
1
);
}
}
sync_unbound_service
();
sync_unbound_service
();
system_dhcpleases_configure
();
system_dhcpleases_configure
();
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"done."
)
.
"
\n
"
;
echo
gettext
(
"done."
)
.
"
\n
"
;
}
}
}
}
if
(
!
file_exists
(
"/var/run/booting"
))
{
/*
if
(
services_dhcpd_configure
()
!=
0
)
{
* XXX this is overly convoluted, potentially
$return
=
1
;
* restarting all of dhcp up to three times ;)
}
*/
if
(
!
file_exists
(
"/var/run/booting"
)
&&
$dhcp_reload
)
{
services_dhcpd_configure
();
}
}
return
$return
;
}
}
function
services_snmpd_configure
()
function
services_snmpd_configure
()
...
...
src/www/services_dhcpv6.php
View file @
5fa2d2dc
...
@@ -42,25 +42,18 @@ require_once("services.inc");
...
@@ -42,25 +42,18 @@ require_once("services.inc");
*/
*/
function
reconfigure_dhcpd
()
function
reconfigure_dhcpd
()
{
{
/* services_dnsmasq_configure calls services_dhcpd_configure */
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
$retvaldns
=
services_dnsmasq_configure
();
services_dnsmasq_configure
(
false
);
if
(
$retvaldns
==
0
)
{
clear_subsystem_dirty
(
'hosts'
);
clear_subsystem_dirty
(
'hosts'
);
clear_subsystem_dirty
(
'staticmaps'
);
}
/* services_unbound_configure calls services_dhcpd_configure */
}
elseif
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
$retvaldns
=
services_unbound_configure
();
if
(
$retvaldns
==
0
)
{
clear_subsystem_dirty
(
'unbound'
);
}
}
else
{
$retvaldhcp
=
services_dhcpd_configure
();
if
(
$retvaldhcp
==
0
)
{
clear_subsystem_dirty
(
'staticmaps'
);
}
}
}
if
(
isset
(
$config
[
'unbound'
][
'enable'
])
&&
isset
(
$config
[
'unbound'
][
'regdhcpstatic'
]))
{
services_unbound_configure
(
false
);
clear_subsystem_dirty
(
'unbound'
);
}
services_dhcpd_configure
();
clear_subsystem_dirty
(
'staticmaps'
);
}
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
...
...
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