Index: trunk/gen-rDNS.pl
===================================================================
--- trunk/gen-rDNS.pl	(revision 778)
+++ trunk/gen-rDNS.pl	(revision 778)
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+# Most of the file rDNS.html should be copied exactly from DNSAdmin.  This
+# script creates rDNS.html from the source file in SVN at
+# https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html
+
+use strict;
+use warnings;
+
+use LWP;
+
+my $ua = LWP::UserAgent->new;
+$ua->agent("ipdb-gen-rDNS");
+my $req = HTTP::Request->new(GET => "https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html");
+my $res = $ua->request($req);
+die "Failed to retrieve source file from SVN: ".$res->status_line."\n" if !$res->is_success;
+
+my $srcfile = $res->content;
+
+open LRDNS, ">rDNS.html.new";
+print LRDNS << 'EOH'
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+        <title>IP Database Reverse DNS Help</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+        <link rel="stylesheet" type="text/css" href="ipdb.css">
+        <link rel="stylesheet" type="text/css" href="local.css">
+</head>
+<body>
+
+<!--
+  This file is generated, and should not be edited directly.  Edit gen-rDNS.pl to edit the header below, and 
+  see https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html for the tables.
+-->
+
+<p>The IP Database can pass reverse DNS information back and forth to a DNS management backend to simplify
+maintenance of the reverse DNS records associated with the IPs being managed.</p>
+
+<p>Several shortcuts can be used when specifying a pattern for an IPv4 netblock, which will be expanded to
+actual DNS records by the DNS management system.</p>
+
+<p>Entries should generally only be present in the "Per-IP reverse entries" section if they are different from
+the block pattern.</p>
+
+<p>Template patterns are not supported for IPv6 allocations due to the size of the address space and typical
+size of allocations.</p>
+
+<p>"(cached)" or "[local]" indicates the rDNS information shown came from IPDB records,
+and not the DNS management utility.  It may be out of date, or DNS
+management integration may be missing or incomplete for this block.</p>
+
+EOH
+;
+
+my @l = split "\n", $srcfile;
+my $flag = 0;
+foreach my $line(@l) {
+  $flag = 1 if $line eq '<!-- rdns pattern table -->';
+  $flag = 0 if $line eq '<!-- done rdns pattern table -->';
+  next unless $flag;
+  print LRDNS "$line\n";
+}
+print LRDNS "<!-- done rdns pattern table -->\n\n</body>\n</html>\n";
+close LRDNS;
+
+# now that we have a supposedly good copy, move the .new to the canonical file.
+
+rename "rDNS.html.new", "rDNS.html";
Index: trunk/rDNS.html
===================================================================
--- trunk/rDNS.html	(revision 777)
+++ trunk/rDNS.html	(revision 778)
@@ -2,46 +2,162 @@
 <html>
 <head>
-	<title>IP Database Reverse DNS Help</title>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<link rel="stylesheet" type="text/css" href="ipdb.css">
-	<link rel="stylesheet" type="text/css" href="local.css">
+        <title>IP Database Reverse DNS Help</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+        <link rel="stylesheet" type="text/css" href="ipdb.css">
+        <link rel="stylesheet" type="text/css" href="local.css">
 </head>
 <body>
 
-<p>The IP Database can pass reverse DNS information back and forth to a DNS management backend to simplify 
+<!--
+  This file is generated, and should not be edited directly.  Edit gen-rDNS.pl to edit the header below, and 
+  see https://secure.deepnet.cx/svn/dnsadmin/trunk/reverse-patterns.html for the tables.
+-->
+
+<p>The IP Database can pass reverse DNS information back and forth to a DNS management backend to simplify
 maintenance of the reverse DNS records associated with the IPs being managed.</p>
 
-<p>Several shortcuts can be used when specifying a pattern for an IPv4 netblock, which will be expanded to 
-actual DNS records by the DNS management system.  %blank% may be used to skip template expansion on a 
-subblock or IP.</p>
+<p>Several shortcuts can be used when specifying a pattern for an IPv4 netblock, which will be expanded to
+actual DNS records by the DNS management system.</p>
 
-<p>Entries should generally only be present in the "Per-IP reverse entries" section if they are different from 
+<p>Entries should generally only be present in the "Per-IP reverse entries" section if they are different from
 the block pattern.</p>
 
-<p>Template patterns are not supported for IPv6 allocations due to the size of the address space and typical 
+<p>Template patterns are not supported for IPv6 allocations due to the size of the address space and typical
 size of allocations.</p>
 
-<table class="regular" cellspacing="1" cellpadding="1" bgcolor="#000000">
-<tr class="header"><td></td><td>Substitution pattern</td><td>Example expansion using 192.168.23.45</td></tr>
+<p>"(cached)" or "[local]" indicates the rDNS information shown came from IPDB records,
+and not the DNS management utility.  It may be out of date, or DNS
+management integration may be missing or incomplete for this block.</p>
 
-<tr class="header"><td colspan="3">Whole-IP patterns</td></tr>
-<tr class="row0"><td>Dashed IP</td><td>%i</td><td>192-168-23-45</td></tr>
-<tr class="row1"><td>Reverse dashed IP</td><td>%r</td><td>45-23-168-192</td></tr>
-<tr class="row0"><td>Hex-coded IP</td><td>%h</td><td>c0a8172d</td></tr>
-<tr class="row1"><td>Decimal IP</td><td>%d</td><td>323241453</td></tr>
+<!-- rdns pattern table -->
+      <table class="container" cellpadding="2" cellspacing="2" style="max-width:850px;">
+        <tbody>
+          <tr class="tableheader">
+            <td colspan="3">Whole-IP patterns</td>
+          </tr>
+          <tr class="tableheader">
+            <td></td>
+            <td>Substitution pattern</td>
+            <td>Example expansion using 192.168.23.45</td>
+          </tr>
+          <tr class="row0">
+            <td>Dashed IP</td>
+            <td>%i</td>
+            <td>192-168-23-45</td>
+          </tr>
+          <tr class="row1">
+            <td>Reverse dashed IP</td>
+            <td>%r</td>
+            <td>45-23-168-192</td>
+          </tr>
+          <tr class="row0">
+            <td>Hex-coded IP</td>
+            <td>%h</td>
+            <td>c0a8172d</td>
+          </tr>
+          <tr class="row1">
+            <td>Decimal IP</td>
+            <td>%d</td>
+            <td>323241453</td>
+          </tr>
+          <tr class="row0">
+            <td colspan="3">
+              %i and %r also allow explicitly defining the separator; eg %.i or %_r.  Dot/period (.), dash (-),
+              and underscore (_) are the only characters supported since DNS names may not contain most
+              other non-alphanumerics.
+            </td>
+          </tr>
+          <tr class="row0">
+            <td colspan="3">
+              %blank% may be used to specifically prevent template expansion on a segment of a block if
+              desired;  eg, if 192.168.23.0/24 has "unused-%i.example.com" set, adding an A+PTR template
+              for 192.168.23.48/30 of "%blank%" will leave 192.168.23.48 through .51 without PTR records
+              unless specific entries exist for those IPs.
+            </td>
+          </tr>
+          <tr class="tableheader">
+            <td colspan="3">Per-octet patterns (1, 2, 3, or 4 specify
+              the octet; d, h or 0 specify decimal, hexidecimal, or
+              0-padded decimal)</td>
+          </tr>
+          <tr class="row0">
+            <td>First octet, decimal</td>
+            <td>%1d</td>
+            <td>192</td>
+          </tr>
+          <tr class="row1">
+            <td>Third octet, 0-padded</td>
+            <td>%30</td>
+            <td>023</td>
+          </tr>
+          <tr class="row0">
+            <td>Fourth octet, hexidecimal</td>
+            <td>%4h</td>
+            <td>2d</td>
+          </tr>
+          <tr class="row1">
+            <td>All octets, different expansions</td>
+            <td>%1h-%2d-%30-%4h</td>
+            <td>c0-168-023-2d</td>
+          </tr>
 
-<tr class="header"><td colspan="3">Per-octet patterns (1, 2, 3, or 4 specify the octet;  d, h or 0
- specify decimal, hexidecimal, or 0-padded decimal)</td></tr>
-<tr class="row0"><td>First octet, decimal</td><td>%1d</td><td>192</td></tr>
-<tr class="row1"><td>Third octet, 0-padded</td><td>%30</td><td>023</td></tr>
-<tr class="row0"><td>Fourth octet, hexidecimal</td><td>%4h</td><td>2d</td></tr>
-<tr class="row1"><td>All octets, different expansions</td><td>%1h-%2d-%30-%4h</td><td>c0-168-023-2d</td></tr>
+          <tr><td colspan="3">&nbsp;</td></tr>
 
-</table>
+          <tr class="tableheader">
+            <td colspan="3">Extensions</td>
+          </tr>
+          <tr class="tableheader">
+            <td></td>
+            <td>Substitution pattern</td>
+            <td>Example expansion using 192.168.23.40/29</td>
+          </tr>
+          <tr class="row0">
+            <td>Network/<br />gateway/<br />broadcast</td>
+            <td>%ngb%</td>
+            <td>
+              customer-%i%ngb%.example.com<br />
+              192.168.23.40 -> customer-net.example.com<br />
+              192.168.23.41 -> customer-gw.example.com<br />
+              192.168.23.42 -> customer-192-168-23-42.example.com<br />
+              192.168.23.43 -> customer-192-168-23-43.example.com<br />
+              192.168.23.44 -> customer-192-168-23-44.example.com<br />
+              192.168.23.45 -> customer-192-168-23-45.example.com<br />
+              192.168.23.46 -> customer-192-168-23-46.example.com<br />
+              192.168.23.47 -> customer-bcast.example.com
+            </td>
+          </tr>
+          <tr class="row1">
+            <td colspan="3">
+              Any IP pattern component is blanked on the network, gateway, and broadcast IPs when this is
+              used.<br />
+              Each of n, g, or b can be prefixed with a dash, eg %-ng-b% or %n-g-b%, which will
+              blank that entire entry instead of substituting <tt>net</tt>, <tt>gw</tt>, or <tt>bcast</tt>.
+            </td>
+          </tr>
+          <tr class="row0">
+            <td>n'th usable IP</td>
+            <td>%c</td>
+            <td>
+              customer-%3d-%c.example.com<br />
+              192.168.23.40 -> customer-23.example.com<br />
+              192.168.23.41 -> customer-23.example.com<br />
+              192.168.23.42 -> customer-23-1.example.com<br />
+              192.168.23.43 -> customer-23-2.example.com<br />
+              192.168.23.44 -> customer-23-3.example.com<br />
+              192.168.23.45 -> customer-23-4.example.com<br />
+              192.168.23.46 -> customer-23-5.example.com<br />
+              192.168.23.47 -> customer-23.example.com
+            </td>
+          </tr>
+          <tr class="row1">
+            <td colspan="3">
+              c can be prefixed with a dash (%-c), which starts the numbering from the conventional gateway IP
+              instead.  (.41 above would be 1, .42 2, etc, finishing with 6 at .46).
+            </td>
+          </tr>
+        </tbody>
+      </table>
+<!-- done rdns pattern table -->
 
-<p> %i and %r also allow explicitly defining the separator; eg %.i
-or %_r. '.', '-', and '_' are the only characters<br>
-supported since DNS names may not contain most other
-non-alphanumerics.</p>
-
-</body></html>
+</body>
+</html>
