From 16eace63e7cb2cc5ef21e0e6e956d4871ac4ff51 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 21 Feb 2021 23:51:20 +0000 Subject: [PATCH] Add dhcp-ignore handling --- includes/dhcp.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/dhcp.php b/includes/dhcp.php index 0ebf641b..14c0cf34 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -45,12 +45,15 @@ function DisplayDHCPConfig() } } getWifiInterface(); + $ap_iface = $_SESSION['ap_interface']; $serviceStatus = $dnsmasq_state ? "up" : "down"; exec('cat '. RASPI_DNSMASQ_PREFIX.'raspap.conf', $return); $conf = ParseConfig($return); + exec('cat '. RASPI_DNSMASQ_PREFIX.$ap_iface.'.conf', $return); + $conf = array_merge(ParseConfig($return)); + $hosts = (array)$conf['dhcp-host']; exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); exec('cat ' . RASPI_DNSMASQ_LEASES, $leases); - $ap_iface = $_SESSION['ap_interface']; echo renderTemplate( "dhcp", compact( @@ -59,7 +62,7 @@ function DisplayDHCPConfig() "dnsmasq_state", "ap_iface", "conf", - "dhcpHost", + "hosts", "interfaces", "leases" ) @@ -188,6 +191,9 @@ function updateDnsmasqConfig($iface,$status) } $config .= PHP_EOL; } + if ($_POST['dhcp-ignore'] == "1") { + $config .= 'dhcp-ignore=tag:!known'.PHP_EOL; + } file_put_contents("/tmp/dnsmasqdata", $config); $msg = file_exists(RASPI_DNSMASQ_PREFIX.$iface.'.conf') ? 'updated' : 'added'; system('sudo cp /tmp/dnsmasqdata '.RASPI_DNSMASQ_PREFIX.$iface.'.conf', $result);