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
774fa9f4
Commit
774fa9f4
authored
Mar 25, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: fix dhcpd startup on install media
Submitted by: Ad
parent
f62c0223
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
services.inc
src/etc/inc/services.inc
+12
-11
No files found.
src/etc/inc/services.inc
View file @
774fa9f4
...
@@ -281,7 +281,8 @@ function services_radvd_configure($blacklist = array())
...
@@ -281,7 +281,8 @@ function services_radvd_configure($blacklist = array())
return
0
;
return
0
;
}
}
function
services_dhcpd_configure
(
$family
=
"all"
,
$blacklist
=
array
())
{
function
services_dhcpd_configure
(
$family
=
"all"
,
$blacklist
=
array
())
{
global
$config
,
$g
;
global
$config
,
$g
;
/* configure DHCPD chroot once */
/* configure DHCPD chroot once */
...
@@ -295,19 +296,19 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) {
...
@@ -295,19 +296,19 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) {
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/usr
\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'
]
}
/lib
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/run
\n
"
);
fwrite
(
$fd
,
"/bin/mkdir -p
{
$g
[
'dhcpd_chroot_path'
]
}
/run
\n
"
);
fwrite
(
$fd
,
"/usr/sbin/chown -R dhcpd:_dhcp
{
$g
[
'dhcpd_chroot_path'
]
}
/*
\n
"
);
$status
=
`/sbin/mount -t devfs | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`
;
fwrite
(
$fd
,
"/bin/cp -n /lib/libc.so.*
{
$g
[
'dhcpd_chroot_path'
]
}
/lib/
\n
"
);
if
(
!
trim
(
$status
))
{
fwrite
(
$fd
,
"/bin/cp -n /usr/local/sbin/dhcpd
{
$g
[
'dhcpd_chroot_path'
]
}
/usr/local/sbin/
\n
"
);
fwrite
(
$fd
,
"/bin/chmod a+rx
{
$g
[
'dhcpd_chroot_path'
]
}
/usr/local/sbin/dhcpd
\n
"
);
$status
=
`/sbin/mount | /usr/bin/grep -v grep | /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
,
"/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
);
fclose
(
$fd
);
mwexec
(
'/bin/sh /tmp/dhcpd.sh'
);
mwexec
(
'/bin/sh /tmp/dhcpd.sh'
);
if
(
$family
==
"all"
||
$family
==
"inet"
)
if
(
$family
==
"all"
||
$family
==
"inet"
)
{
services_dhcpdv4_configure
();
services_dhcpdv4_configure
();
}
if
(
$family
==
"all"
||
$family
==
"inet6"
)
{
if
(
$family
==
"all"
||
$family
==
"inet6"
)
{
services_dhcpdv6_configure
(
$blacklist
);
services_dhcpdv6_configure
(
$blacklist
);
services_radvd_configure
(
$blacklist
);
services_radvd_configure
(
$blacklist
);
...
@@ -860,7 +861,7 @@ EOD;
...
@@ -860,7 +861,7 @@ EOD;
/* fire up dhcpd in a chroot */
/* fire up dhcpd in a chroot */
if
(
count
(
$dhcpdifs
)
>
0
)
{
if
(
count
(
$dhcpdifs
)
>
0
)
{
mwexec
(
"/usr/local/sbin/dhcpd -user dhcpd -group
_dhcp
-chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpd.conf -pf
{
$g
[
'varrun_path'
]
}
/dhcpd.pid "
.
mwexec
(
"/usr/local/sbin/dhcpd -user dhcpd -group
dhcpd
-chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpd.conf -pf
{
$g
[
'varrun_path'
]
}
/dhcpd.pid "
.
join
(
" "
,
$dhcpdifs
));
join
(
" "
,
$dhcpdifs
));
}
}
...
@@ -1265,7 +1266,7 @@ EOD;
...
@@ -1265,7 +1266,7 @@ EOD;
/* fire up dhcpd in a chroot */
/* fire up dhcpd in a chroot */
if
(
count
(
$dhcpdv6ifs
)
>
0
)
{
if
(
count
(
$dhcpdv6ifs
)
>
0
)
{
mwexec
(
"/usr/local/sbin/dhcpd -6 -user dhcpd -group
_dhcp
-chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpdv6.conf -pf
{
$g
[
'varrun_path'
]
}
/dhcpdv6.pid "
.
mwexec
(
"/usr/local/sbin/dhcpd -6 -user dhcpd -group
dhcpd
-chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpdv6.conf -pf
{
$g
[
'varrun_path'
]
}
/dhcpdv6.pid "
.
join
(
" "
,
$dhcpdv6ifs
));
join
(
" "
,
$dhcpdv6ifs
));
mwexec
(
"/usr/local/sbin/dhcpleases6 -c
\"
/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh
\"
-l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
);
mwexec
(
"/usr/local/sbin/dhcpleases6 -c
\"
/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh
\"
-l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
);
}
}
...
...
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