diff options
author | Erich Eckner <git@eckner.net> | 2020-03-11 14:13:44 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-03-11 14:13:44 +0100 |
commit | 18f0b70cdfcf5bc20a0d74ea08f5605c132082e2 (patch) | |
tree | 82b7fc7bf97518b73a765461a6420f57817e304b | |
parent | 26cf23ece38f7ab52f35557ff39477d12e00fd83 (diff) | |
download | ddns-18f0b70cdfcf5bc20a0d74ea08f5605c132082e2.tar.xz |
ddns.php: update aliases per ip-version separately
-rw-r--r-- | ddns.php | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -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"; } } |