pvl.hosts-dns: do not enumerate the entire prefix space unless using --unknown-host
authorTero Marttila <terom@paivola.fi>
Mon, 16 Dec 2013 20:21:30 +0200
changeset 278 2db1a5323f92
parent 277 5f0b67ba454f
child 279 1b72f1e0cdbe
pvl.hosts-dns: do not enumerate the entire prefix space unless using --unknown-host
bin/pvl.hosts-dns
--- a/bin/pvl.hosts-dns	Mon Dec 16 20:21:09 2013 +0200
+++ b/bin/pvl.hosts-dns	Mon Dec 16 20:21:30 2013 +0200
@@ -66,7 +66,13 @@
         else :
             by_ip[ip] = fqdn
 
-    for ip in prefix.iterhosts() :
+    if options.unknown_host :
+        # enumerate all of them
+        iter_ips = prefix.iterhosts()
+    else :
+        iter_ips = sorted(by_ip)
+
+    for ip in iter_ips :
         if ip in by_ip :
             fqdn = by_ip[ip]
         elif options.unknown_host :