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
f65877a5
Commit
f65877a5
authored
Feb 25, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dhcpd: try to contain usage of global dhcpd_chroot_path
(cherry picked from commit
5a091c26
)
parent
efad363c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
10 deletions
+26
-10
services.inc
src/etc/inc/services.inc
+14
-0
services_dhcp.php
src/www/services_dhcp.php
+8
-4
services_dhcpv6.php
src/www/services_dhcpv6.php
+2
-3
status_dhcp_leases.php
src/www/status_dhcp_leases.php
+1
-1
status_dhcpv6_leases.php
src/www/status_dhcpv6_leases.php
+1
-2
No files found.
src/etc/inc/services.inc
View file @
f65877a5
...
...
@@ -372,6 +372,20 @@ function services_radvd_configure($blacklist = array())
return
0
;
}
function
services_dhcpd_leasesfile
()
{
global
$g
;
return
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
;
}
function
services_dhcpdv6_leasesfile
()
{
global
$g
;
return
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
;
}
function
services_dhcpd_configure
(
$family
=
"all"
,
$blacklist
=
array
())
{
global
$config
,
$g
;
...
...
src/www/services_dhcp.php
View file @
f65877a5
...
...
@@ -35,16 +35,20 @@ require_once("unbound.inc");
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
/* This function will remove entries from dhcpd.leases that would otherwise
/*
* This function will remove entries from dhcpd.leases that would otherwise
* overlap with static DHCP reservations. If we don't clean these out,
* then DHCP will print a warning in the logs about a duplicate lease
*/
function
dhcp_clean_leases
()
{
global
$g
,
$config
;
$leasesfile
=
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
;
function
dhcp_clean_leases
()
{
global
$config
;
$leasesfile
=
services_dhcpd_leasesfile
();
if
(
!
file_exists
(
$leasesfile
))
{
return
;
}
/* Build list of static MACs */
$staticmacs
=
array
();
foreach
(
$config
[
'interfaces'
]
as
$ifname
=>
$ifarr
)
{
...
...
src/www/services_dhcpv6.php
View file @
f65877a5
...
...
@@ -42,15 +42,14 @@ require_once("services.inc");
*/
function
reconfigure_dhcpd
()
{
killbypid
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpdv6.pid"
);
/* dnsmasq_configure calls dhcpd_configure */
/* no need to restart dhcpd twice */
/* services_dnsmasq_configure calls services_dhcpd_configure */
if
(
isset
(
$config
[
'dnsmasq'
][
'enable'
])
&&
isset
(
$config
[
'dnsmasq'
][
'regdhcpstatic'
]))
{
$retvaldns
=
services_dnsmasq_configure
();
if
(
$retvaldns
==
0
)
{
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
)
{
...
...
src/www/status_dhcp_leases.php
View file @
f65877a5
...
...
@@ -75,7 +75,7 @@ function remove_duplicate($array, $field)
return
$new
;
}
$leasesfile
=
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
;
$leasesfile
=
services_dhcpd_leasesfile
()
;
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
$awk
=
"/usr/bin/awk"
;
...
...
src/www/status_dhcpv6_leases.php
View file @
f65877a5
...
...
@@ -98,8 +98,7 @@ function parse_duid($duid_string) {
return
array
(
$iaid
,
$duid
);
}
$leasesfile
=
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
;
$leasesfile
=
services_dhcpdv6_leasesfile
();
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
$awk
=
"/usr/bin/awk"
;
...
...
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