wip2
This commit is contained in:
29
load-conf.php
Normal file
29
load-conf.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$conf_paths = [
|
||||
"/etc/dnsmasq.d/ipam.conf",
|
||||
__DIR__ . "/ipam.conf"
|
||||
];
|
||||
|
||||
$default = [
|
||||
"dhcp-optsfile" => "/var/lib/misc/dhcp.options",
|
||||
"dhcp-hostsfile" => "/var/lib/misc/dhcp.hosts",
|
||||
"dhcp-leasefile" => "/var/lib/misc/dnsmasq.leases",
|
||||
"conf-file" => "/var/lib/misc/dhcp.ranges",
|
||||
];
|
||||
|
||||
foreach($conf_paths as $path) {
|
||||
if (file_exists($path)) {
|
||||
$conf = array_merge($default, parse_ini_file($path, true, INI_SCANNER_TYPED));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$namePtn = "[a-zA-Z_][\w-]*";
|
||||
$ipPtn = "\d+\.\d+\.\d+\.\d+";
|
||||
$macPtn = "[\da-f]{2}(?:[:-][\da-f]{2}){5}";
|
||||
$domainPtn = "[\w-]+(\.[\w-]+)*";
|
||||
$ifacePtn = "[\w,]+";
|
||||
$modesPtn = "static|proxya-only|slaac|ra-names|ra-stateless|ra-advrouter|off-link";
|
||||
$timePtn = "\d+[mhds]";
|
||||
$commentPtn = "[ \t]*(?:# ?(?<comment>.*))?";
|
||||
Reference in New Issue
Block a user