mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dhcp: second half of @marjohn56's changes; closes #2077
This commit is contained in:
parent
d03799b312
commit
018bea397a
@ -1324,7 +1324,8 @@ EOD;
|
||||
/* fire up dhcpd in a chroot */
|
||||
if (count($dhcpdv6ifs) > 0) {
|
||||
mwexec('/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot /var/dhcpd -cf /etc/dhcpdv6.conf -pf /var/run/dhcpdv6.pid ' . join(' ', $dhcpdv6ifs));
|
||||
mwexec('/usr/local/sbin/dhcpleases6 -c "/usr/local/sbin/prefixes.php|/bin/sh" -l /var/dhcpd/var/db/dhcpd6.leases');
|
||||
/* XXX prefixes.php is a backend script we must priv-sep! */
|
||||
mwexec('/usr/local/sbin/dhcpleases6 -c /usr/local/opnsense/scripts/dhcp/prefixes.php -l /var/dhcpd/var/db/dhcpd6.leases');
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
require_once 'util.inc';
|
||||
|
||||
$leases_file = "/var/dhcpd/var/db/dhcpd6.leases";
|
||||
if (!file_exists($leases_file)) {
|
||||
exit(1);
|
||||
@ -8,7 +10,6 @@ if (!file_exists($leases_file)) {
|
||||
|
||||
$duid_arr = array();
|
||||
foreach (file($leases_file) as $line) {
|
||||
// echo "$line";
|
||||
if (preg_match("/^(ia-[np][ad])[ ]+\"(.*?)\"/i ", $line, $duidmatch)) {
|
||||
$type = $duidmatch[1];
|
||||
$duid = $duidmatch[2];
|
||||
@ -58,11 +59,10 @@ foreach ($duid_arr as $entry) {
|
||||
array_shift($duid_arr);
|
||||
}
|
||||
|
||||
// echo "add routes\n";
|
||||
if (count($routes) > 0) {
|
||||
foreach ($routes as $address => $prefix) {
|
||||
echo "/sbin/route delete -inet6 {$prefix} {$address}\n";
|
||||
echo "/sbin/route add -inet6 {$prefix} {$address}\n";
|
||||
mwexecf('/sbin/route delete -inet6 %s %s', array($prefix, $address));
|
||||
mwexecf('/sbin/route add -inet6 %s %s', array($prefix, $address));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +88,10 @@ foreach ($clog as $line) {
|
||||
array_shift($clog);
|
||||
}
|
||||
|
||||
// echo "remove routes\n";
|
||||
if (count($expires) > 0) {
|
||||
foreach ($expires as $prefix) {
|
||||
if (isset($prefix['prefix'])) {
|
||||
echo "/sbin/route delete -inet6 {$prefix['prefix']}\n";
|
||||
mwexecf('/sbin/route delete -inet6 %s', array($prefix['prefix']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user