Tcl Library Source Code

Artifact [11039d62ac]
Login

Artifact 11039d62ac4c75621d02780c1e8fa901ac09c274cf8ca5f967ab3b391a9d379a:

Attachment "reverse_ipv6_lookups.patch" to ticket [8168daf796] added by buzzdeee 2019-06-13 11:24:07. (unpublished)
--- dns.tcl.orig	Thu Jun 13 12:34:10 2019
+++ dns.tcl	Thu Jun 13 12:38:02 2019
@@ -286,10 +286,17 @@
         }
     }
 
-    # Check for reverse lookups
+    # Check for reverse lookups, IPv4 first, then IPv6
     if {[regexp {^(?:\d{0,3}\.){3}\d{0,3}$} $state(query)]} {
         set addr [lreverse [split $state(query) .]]
         lappend addr in-addr arpa
+        set state(query) [join $addr .]
+        set state(-type) PTR
+    } elseif {[string match {*:*} $state(query)]} {
+        set addr [ip::normalize $state(query)]
+        set addr [split [string reverse $addr] :]
+        set addr [join [split [join $addr ""] {}] .]
+        lappend addr ip6 arpa
         set state(query) [join $addr .]
         set state(-type) PTR
     }