aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinydns
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-06-09 11:48:06 -0400
committerjim-p <jimp@pfsense.org>2011-06-09 11:48:06 -0400
commitec12bb379d697bc3f47e8f58141af1c7631f18eb (patch)
treee2d960f75e023362bb16af979abd4cc1912024d2 /config/tinydns
parent7de56f6a89ffe80e0a314b1b9f3617fd143454c4 (diff)
downloadpfsense-packages-ec12bb379d697bc3f47e8f58141af1c7631f18eb.tar.gz
pfsense-packages-ec12bb379d697bc3f47e8f58141af1c7631f18eb.tar.bz2
pfsense-packages-ec12bb379d697bc3f47e8f58141af1c7631f18eb.zip
For at least this case, generate a proper ipv6 arpa format reverse IP.
Diffstat (limited to 'config/tinydns')
-rw-r--r--config/tinydns/tinydns.inc18
1 files changed, 17 insertions, 1 deletions
diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc
index a95d7489..84cacd60 100644
--- a/config/tinydns/tinydns.inc
+++ b/config/tinydns/tinydns.inc
@@ -539,7 +539,10 @@ function tinydns_create_zone_file() {
if($record_data) {
fwrite($fd, $record_data . "\n");
if ($domain['rdns'] || ($domain['recordtype'] == 'PTR')) {
- $rip = tinydns_get_ip_subnet_arpa($ipaddress, 32);
+ if (is_ipaddr($ipaddress))
+ $rip = tinydns_get_ip_subnet_arpa($ipaddress, 32);
+ elseif (intval($config['version']) >= 6)
+ $rip = tinydns_get_ip6_subnet_arpa($ipaddress, 128);
if($rip)
fwrite($fd, ".{$rip[1]}::{$config['system']['hostname']}.{$config['system']['domain']}\n");
}
@@ -863,6 +866,19 @@ function tinydns_get_ip_subnet_arpa($ip, $ipmask) {
return array($subnet,$arpaip);
}
+/* in-add.arpa IP calculated from D.C.B.A and Mask to A.B.C.D.in-addr.arpa */
+/* subnet IP calculated from A.B.C.D and Mask */
+function tinydns_get_ip6_subnet_arpa($ip, $ipmask=128) {
+ require_once("IPv6.inc");
+ $fullip = explode(":", Net_IPv6::uncompress($ip));
+ foreach ($fullip as & $q) {
+ $q = sprintf("%04s", $q);
+ }
+ $subnet = Net_IPv6::compress(implode(":", $fullip));
+ $arpaip = implode(".", array_reverse(str_split(implode("", $fullip)))) . ".ip6.arpa";
+ return array($subnet, $arpaip);
+}
+
/* Create a Forward and a Reverse DNS (SOA, A, PTR) records for Fully Qualififed Domain Name*/
function tinydns_complete_soa_record($fd, $ip, $ipmask, $nsname, $domain) {
$fqdn = "{$nsname}.{$domain}";