summaryrefslogtreecommitdiff
path: root/ddns.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-26 08:19:26 +0100
committerErich Eckner <git@eckner.net>2020-02-26 08:19:26 +0100
commit453088811146e223ea3a5589a2e9f53a89d4b3bc (patch)
treedc3e27a5321bdb2785dd902258f841223d5e1f8e /ddns.php
parent496c8b518367d63a5a86044e8305ec710ced91dc (diff)
downloadddns-453088811146e223ea3a5589a2e9f53a89d4b3bc.tar.xz
ddns.php: only issue updates for zones that really exist
Diffstat (limited to 'ddns.php')
-rw-r--r--ddns.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/ddns.php b/ddns.php
index c3694b9..f3becb4 100644
--- a/ddns.php
+++ b/ddns.php
@@ -15,8 +15,15 @@
function reverse_entry($addr) {
$addrTeile = explode('.', $addr);
+ $lp = array_pop($addrTeile);
+ $subNet = implode('.', $addrTeile);
+ array_push($addrTeile, $lp);
array_reverse($addrTeile);
- return implode('.',$addrTeile).'.in-addr.arpa.';
+ if (($subNet == '10.0.2') ||
+ ($subNet == '192.168.0') ||
+ ($subNet == '192.168.1'))
+ return implode('.',$addrTeile).'.in-addr.arpa.';
+ return NULL;
};
function reverse_zone($addr) {
@@ -125,6 +132,8 @@
foreach ($ips as $i => $ip) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$reverse_entry = reverse_entry($ip);
+ if (!$reverse_entry)
+ continue;
$updateCommand .=
"zone ".reverse_zone($ip)."\n";
// delete old record if existing