mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Handle dhcp log options w/ 090_raspap.conf
This commit is contained in:
parent
3db9717b27
commit
910122838d
@ -46,6 +46,8 @@ function DisplayDHCPConfig()
|
|||||||
}
|
}
|
||||||
getWifiInterface();
|
getWifiInterface();
|
||||||
$serviceStatus = $dnsmasq_state ? "up" : "down";
|
$serviceStatus = $dnsmasq_state ? "up" : "down";
|
||||||
|
exec('cat '. RASPI_DNSMASQ_PREFIX.'raspap.conf', $return);
|
||||||
|
$conf = ParseConfig($return);
|
||||||
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
|
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
|
||||||
exec('cat ' . RASPI_DNSMASQ_LEASES, $leases);
|
exec('cat ' . RASPI_DNSMASQ_LEASES, $leases);
|
||||||
$ap_iface = $_SESSION['ap_interface'];
|
$ap_iface = $_SESSION['ap_interface'];
|
||||||
@ -56,6 +58,7 @@ function DisplayDHCPConfig()
|
|||||||
"serviceStatus",
|
"serviceStatus",
|
||||||
"dnsmasq_state",
|
"dnsmasq_state",
|
||||||
"ap_iface",
|
"ap_iface",
|
||||||
|
"conf",
|
||||||
"dhcpHost",
|
"dhcpHost",
|
||||||
"interfaces",
|
"interfaces",
|
||||||
"leases"
|
"leases"
|
||||||
@ -178,12 +181,6 @@ function updateDnsmasqConfig($iface,$status)
|
|||||||
foreach ($_POST['server'] as $server) {
|
foreach ($_POST['server'] as $server) {
|
||||||
$config .= "server=$server".PHP_EOL;
|
$config .= "server=$server".PHP_EOL;
|
||||||
}
|
}
|
||||||
if ($_POST['log-dhcp'] == "1") {
|
|
||||||
$config .= "log-dhcp".PHP_EOL;
|
|
||||||
}
|
|
||||||
if ($_POST['log-queries'] == "1") {
|
|
||||||
$config .= "log-queries".PHP_EOL;
|
|
||||||
}
|
|
||||||
if ($_POST['DNS1']) {
|
if ($_POST['DNS1']) {
|
||||||
$config .= "dhcp-option=6," . $_POST['DNS1'];
|
$config .= "dhcp-option=6," . $_POST['DNS1'];
|
||||||
if ($_POST['DNS2']) {
|
if ($_POST['DNS2']) {
|
||||||
@ -197,6 +194,22 @@ function updateDnsmasqConfig($iface,$status)
|
|||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
$status->addMessage('Dnsmasq configuration for '.$iface.' '.$msg.'.', 'success');
|
$status->addMessage('Dnsmasq configuration for '.$iface.' '.$msg.'.', 'success');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write default 090_raspap.conf
|
||||||
|
$config = '# RaspAP default config'.PHP_EOL;
|
||||||
|
$config .='log-facility=/tmp/dnsmasq.log'.PHP_EOL;
|
||||||
|
$config .='conf-dir=/etc/dnsmasq.d'.PHP_EOL;
|
||||||
|
// handle log option
|
||||||
|
if ($_POST['log-dhcp'] == "1") {
|
||||||
|
$config .= "log-dhcp".PHP_EOL;
|
||||||
|
}
|
||||||
|
if ($_POST['log-queries'] == "1") {
|
||||||
|
$config .= "log-queries".PHP_EOL;
|
||||||
|
}
|
||||||
|
$config .= PHP_EOL;
|
||||||
|
file_put_contents("/tmp/dnsmasqdata", $config);
|
||||||
|
system('sudo cp /tmp/dnsmasqdata '.RASPI_DNSMASQ_PREFIX.'raspap.conf', $result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user