summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-03-11 14:13:44 +0100
committerErich Eckner <git@eckner.net>2020-03-11 14:13:44 +0100
commit18f0b70cdfcf5bc20a0d74ea08f5605c132082e2 (patch)
tree82b7fc7bf97518b73a765461a6420f57817e304b
parent26cf23ece38f7ab52f35557ff39477d12e00fd83 (diff)
downloadddns-18f0b70cdfcf5bc20a0d74ea08f5605c132082e2.tar.xz
ddns.php: update aliases per ip-version separately
-rw-r--r--ddns.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/ddns.php b/ddns.php
index afa1bfc..7437a9f 100644
--- a/ddns.php
+++ b/ddns.php
@@ -203,24 +203,27 @@
$zone_file .= fread($pin, 1024);
$zone_file = explode("\n", trim($zone_file));
pclose($pin);
+ $updateCommand .=
+ "zone ddns.eckner.net.\n";
foreach($aliasess as $aliases) {
$aliases = explode(' ', trim($aliases));
$alias = array_shift($aliases);
- $updateCommand .=
- "zone ddns.eckner.net.\n" .
- "prereq yxrrset " . $alias . ".ddns.eckner.net.\n" .
- "update delete " . $alias . ".ddns.eckner.net.\n" .
- "send\n";
- foreach($aliases as $representative) {
- foreach($zone_file as $zone_file_entry) {
- if (preg_match('/^'.$representative.' ([0-9]+) (AAAA|A) (\S+)$/', $zone_file_entry, $match)) {
- $updateCommand .=
- "update add " . $alias . ".ddns.eckner.net. " . $match[1] . " IN " . $match[2] . " " . $match[3] . "\n";
+ foreach ($hasRrType as $rrType => $dummy) {
+ $updateCommand .=
+ "prereq yxrrset " . $alias . ".ddns.eckner.net. IN " . $rrType . "\n" .
+ "update delete " . $alias . ".ddns.eckner.net. IN " . $rrType . "\n" .
+ "send\n";
+ foreach($aliases as $representative) {
+ foreach($zone_file as $zone_file_entry) {
+ if (preg_match('/^'.$representative.' ([0-9]+) (' . $rrType . ') (\S+)$/', $zone_file_entry, $match)) {
+ $updateCommand .=
+ "update add " . $alias . ".ddns.eckner.net. " . $match[1] . " IN " . $match[2] . " " . $match[3] . "\n";
+ }
}
}
+ $updateCommand .=
+ "send\n";
}
- $updateCommand .=
- "send\n";
}
}