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
74fdb93e
Commit
74fdb93e
authored
Feb 25, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dhcpd: directly execute the chroot setup
(cherry picked from commit
aceea376
)
parent
f65877a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
services.inc
src/etc/inc/services.inc
+16
-24
No files found.
src/etc/inc/services.inc
View file @
74fdb93e
...
...
@@ -386,35 +386,27 @@ function services_dhcpdv6_leasesfile()
return
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
;
}
function
services_dhcpd_configure
(
$family
=
"all"
,
$blacklist
=
array
())
function
services_dhcpd_configure
(
$family
=
'all'
,
$blacklist
=
array
())
{
global
$config
,
$g
;
global
$g
;
$dirs
=
array
(
'/dev'
,
'/etc'
,
'/lib'
,
'/run'
,
'/usr'
,
'/usr/local/sbin'
,
'/var/db'
,
'/var/run'
);
foreach
(
$dirs
as
$dir
)
{
mwexecf
(
'/bin/mkdir -p %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}{
$dir
}
"
);
}
if
(
mwexecf
(
'/sbin/mount -uw %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}
/dev"
,
true
))
{
mwexecf
(
'/sbin/mount -t devfs devfs %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}
/dev"
);
}
mwexecf
(
'/usr/sbin/chown -R dhcpd:dhcpd %s'
,
$g
[
'dhcpd_chroot_path'
]);
/* configure DHCPD chroot once */
$fd
=
fopen
(
'/tmp/dhcpd.sh'
,
'w'
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/dev
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/etc
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/usr/local/sbin
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/usr
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/lib
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/run
\n
"
);
$status
=
`/sbin/mount -t devfs | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`
;
if
(
!
trim
(
$status
))
{
fwrite
(
$fd
,
"/sbin/mount -t devfs devfs
{
$g
[
'dhcpd_chroot_path'
]
}
/dev
\n
"
);
}
fwrite
(
$fd
,
"/usr/sbin/chown -R dhcpd:dhcpd
{
$g
[
'dhcpd_chroot_path'
]
}
\n
"
);
fclose
(
$fd
);
mwexec
(
'/bin/sh /tmp/dhcpd.sh'
);
if
(
$family
==
"all"
||
$family
==
"inet"
)
{
if
(
$family
==
'all'
||
$family
==
'inet'
)
{
services_dhcpdv4_configure
();
}
if
(
$family
==
"all"
||
$family
==
"inet6"
)
{
if
(
$family
==
'all'
||
$family
==
'inet6'
)
{
services_dhcpdv6_configure
(
$blacklist
);
services_radvd_configure
(
$blacklist
);
}
...
...
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