]> gitweb.michael.orlitzky.com - djbdns-logparse.git/commitdiff
bin/djbdns-logparse.py: fiddle with the convert_ip() comments.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 15 Sep 2022 03:10:17 +0000 (23:10 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 15 Sep 2022 03:10:17 +0000 (23:10 -0400)
bin/djbdns-logparse.py

index bfb29135d0fcd6d7a0a769b31f9f4f2f5bd4b02b..3a25a5a52bf4dceb4e5376c4644abf12a361918d 100755 (executable)
@@ -68,12 +68,10 @@ def convert_ip(ip : str):
 
     """
     if len(ip) == 8:
-        # IPv4, eg. "7f000001" -> "127.0.0.1"
+        # IPv4, eg. "7f000001" -> "7f 00 00 01" -> "127.0.0.1"
         return "%d.%d.%d.%d" % tuple(pack(">L", int(ip, 16)))
     elif len(ip) == 32:
-        # IPv6 is actually simpler -- it's just a string-slicing operation,
-        # eg. "00000000000000000000ffff7f000001" ->
-        # "0000:0000:0000:0000:0000:ffff:7f00:0001"
+        # IPv6 is actually simpler -- it's just a string-slicing operation.
         return ":".join([ip[(4*i) : (4*i+4)] for i in range(8)])