class PTRRecordValidator implements DnsRecordValidatorInterface (View source)

Validator for PTR (Pointer) DNS records

Validates PTR records according to:

  • RFC 1035: Domain Names - Implementation and Specification
  • RFC 2181: Clarifications to the DNS Specification
  • RFC 1912: Common DNS Operational and Configuration Errors
  • RFC 2317: Classless IN-ADDR.ARPA delegation

PTR records are used for reverse DNS lookups, mapping IP addresses to hostnames. These records are the inverse of A/AAAA records and are stored in special reverse delegation domains: in-addr.arpa for IPv4 and ip6.arpa for IPv6.

Format:

Example: host.example.com

Where:

  • hostname: A domain name which points to the canonical name for the record's name (which should be an IP address in reverse notation)

IPv4 example:

  • Record name: 1.0.168.192.in-addr.arpa (for IP 192.168.0.1)
  • Record content: host.example.com

IPv6 example:

  • Record name: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa (for IP 2001:db8::1)
  • Record content: host.example.com

RFC 2317 Classless Reverse Delegation (for subnets smaller than /24):

Poweradmin supports RFC 2317 classless reverse delegation, allowing reverse DNS for subnet blocks smaller than /24 (e.g., /25, /26, /27, /28, /29, /30, /31).

RFC 2317 zone name format (slash notation):

  • /26 subnet: 0/26.1.0.192.in-addr.arpa (covers 192.0.1.0-192.0.1.63)
  • /27 subnet: 32/27.1.0.192.in-addr.arpa (covers 192.0.1.32-192.0.1.63)
  • /28 subnet: 16/28.1.0.192.in-addr.arpa (covers 192.0.1.16-192.0.1.31)
  • /29 subnet: 0/29.1.0.192.in-addr.arpa (covers 192.0.1.0-192.0.1.7)
  • /30 subnet: 0/30.1.0.192.in-addr.arpa (covers 192.0.1.0-192.0.1.3)
  • /31 subnet: 0/31.1.0.192.in-addr.arpa (covers 192.0.1.0-192.0.1.1)

RFC 2317 PTR record examples for zone 0/26.1.0.192.in-addr.arpa:

  • Record name: 1.0/26.1.0.192.in-addr.arpa
  • Record content: host1.example.com
  • Full notation includes the subnet/prefix in the record name

Alternative range notation (less common):

  • Zone: 0-63.1.0.192.in-addr.arpa
  • Record: 1.0-63.1.0.192.in-addr.arpa

RFC 2317 validation:

  • Subnet number must be 0-255 and aligned with prefix boundary
  • Prefix length for IPv4: /24 to /32 (typical classless delegation: /25-/31)
  • Prefix length for IPv6: /0 to /128
  • Examples of valid subnets: 0/26, 64/26, 128/26, 192/26
  • Examples of invalid subnets: 1/26, 65/26 (not aligned to /26 boundary)

Important notes:

  • Type code: 12 (defined in RFC 1035)
  • PTR records should have corresponding forward (A/AAAA) records to avoid problems
  • Many services (especially email) require properly configured reverse DNS
  • PTR records don't imply any special processing like CNAME records
  • No additional section processing is required for PTR records
  • RFC 2317 zones require proper delegation from parent /24 zone
  • PowerDNS natively supports RFC 2317 zone names with forward slashes

Methods

__construct(ConfigurationManager $config)

Constructor

validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validate PTR record

Details

__construct(ConfigurationManager $config)

Constructor

Parameters

ConfigurationManager $config

ValidationResult validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validate PTR record

Parameters

string $content

The content part of the record

string $name

The name part of the record

mixed $prio

The priority value (if applicable)

int|string|null $ttl

The TTL value

int $defaultTTL

The default TTL to use if not specified

mixed ...$args

Additional validator-specific parameters

Return Value

ValidationResult

ValidationResult containing validated data or error messages