From unknown Sun Aug 17 01:51:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Resent-From: peder@klingenberg.no (Peder O. Klingenberg) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 18:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 26820@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149418310019020 (code B ref -1); Sun, 07 May 2017 18:52:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2017 18:51:40 +0000 Received: from localhost ([127.0.0.1]:60683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RHQ-0004wi-El for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38697) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RHO-0004wW-SV for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7RHI-0006q4-SZ for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d7RHI-0006px-Ow for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7RHH-0000di-Fn for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7RHE-0006ov-ER for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:31 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:44213) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7RHE-0006ma-7T for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:28 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1d7RGx-0007Xh-4g for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 20:51:17 +0200 Received: by modesty.local (Postfix, from userid 502) id 49D7717F6469; Sun, 7 May 2017 20:51:03 +0200 (CEST) From: peder@klingenberg.no (Peder O. Klingenberg) Date: Sun, 07 May 2017 20:51:03 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Last week I was trying to set up reverse delegations for some newly assigned IPv6 address space. It was... painful. IPv6 addresses are ugly enough in their normal format, but when used in a reverse zone, they need to be converted to individual nibbles separated by dots, reversed, and have .ip6.arpa. appended. The result is less than human friendly. So I've written a new feature for dns-mode.el that allows me to mostly relate to the normal IPv6 format, and convert automatically to the nibble format. I can for instance do this in a (part of a) zone file, where I'm only interested in defining hosts in the last 16 bits of the address: $ORIGIN 2a0a:3dc0:10::/112 ::1/-112 IN PTR www.example.com. And then, by pressing C-c C-e on each of the IPv6 addresses, end up with the necessary $ORIGIN 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.c.d.3.a.0.a.2.ip6.arpa. 1.0.0.0 IN PTR www.example.com. Assuming I'm doing this as I type, I can then yank the last standard-format address, do a minimal edit, C-c C-e again, and continue typing to define the next PTR record. I'm hoping this sounds useful to other people as well. I'll pass along the patch as soon as I get a bug# to attach to it. :) From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 14:52:37 2017 Received: (at control) by debbugs.gnu.org; 7 May 2017 18:52:38 +0000 Received: from localhost ([127.0.0.1]:60688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RIL-0004ys-QR for submit@debbugs.gnu.org; Sun, 07 May 2017 14:52:37 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:43167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RIK-0004yk-34 for control@debbugs.gnu.org; Sun, 07 May 2017 14:52:36 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1d7RID-0007Xz-8s for control@debbugs.gnu.org; Sun, 07 May 2017 20:52:34 +0200 Received: by modesty.local (Postfix, from userid 502) id 6FD8017F6494; Sun, 7 May 2017 20:52:22 +0200 (CEST) To: control@debbugs.gnu.org From: peder@klingenberg.no (Peder O. Klingenberg) Subject: control message for bug #26820 Message-Id: <20170507185223.6FD8017F6494@modesty.local> Date: Sun, 7 May 2017 20:52:22 +0200 (CEST) X-Spam-Score: -2.9 (--) X-SRS: Sender address rewritten from to by tarrant.klingenberg.no. X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) severity 26820 wishlist From unknown Sun Aug 17 01:51:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Resent-From: peder@klingenberg.no (Peder O. Klingenberg) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 19:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 26820@debbugs.gnu.org Received: via spool by 26820-submit@debbugs.gnu.org id=B26820.149418355719851 (code B ref 26820); Sun, 07 May 2017 19:00:02 +0000 Received: (at 26820) by debbugs.gnu.org; 7 May 2017 18:59:17 +0000 Received: from localhost ([127.0.0.1]:60704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7ROn-0005A7-2d for submit@debbugs.gnu.org; Sun, 07 May 2017 14:59:17 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:43191) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7ROk-00059z-VZ for 26820@debbugs.gnu.org; Sun, 07 May 2017 14:59:15 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1d7ROc-0007fT-ET for 26820@debbugs.gnu.org; Sun, 07 May 2017 20:59:14 +0200 Received: by modesty.local (Postfix, from userid 502) id 2979117F651B; Sun, 7 May 2017 20:58:59 +0200 (CEST) From: peder@klingenberg.no (Peder O. Klingenberg) References: Date: Sun, 07 May 2017 20:58:59 +0200 In-Reply-To: (Peder O. Klingenberg's message of "Sun, 07 May 2017 20:51:03 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.9 (--) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain peder@klingenberg.no (Peder O. Klingenberg) writes: > I'll pass along the patch as soon as I get a bug# to attach to it. :) As promised, here's the patch. I even wrote tests, which is a first for me. I couldn't find dns-mode documented in any manual, so I haven't written any info docs, but the docstrings should hopefully give enough information to use the feature. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Command-to-convert-IPv6-addresses-in-zone-files.patch >From 8fe87aafd6aa77f5d4c1ac126e2d2e7e69ce236c Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Sun, 7 May 2017 17:58:41 +0200 Subject: [PATCH] Command to convert IPv6 addresses in zone files * lisp/textmodes/dns-mode.el (dns-mode-ipv6-to-nibbles): New command to convert IPv6 addresses to a format suitable for reverse lookup zone files. (dns-mode-reverse-and-expand-ipv6): The algorithm central to the command above. (dns-mode-map, dns-mode-menu): Key and menu item for the new command. * test/lisp/textmodes/dns-mode-tests.el (dns-mode-ipv6-conversion) (dns-mode-ipv6-text-replacement): Tests for new functionality in dns-mode.el (bug#26820) --- etc/NEWS | 8 +++ lisp/textmodes/dns-mode.el | 102 +++++++++++++++++++++++++++++++++- test/lisp/textmodes/dns-mode-tests.el | 58 +++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 test/lisp/textmodes/dns-mode-tests.el diff --git a/etc/NEWS b/etc/NEWS index 4599efd7da..293ef4f960 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -784,6 +784,14 @@ file. *** Emacs does no longer prompt the user before killing Flymake processes on exit. +** DNS mode + ++++ +*** DNS mode has a tool to convert IPv6 addresses +Reverse zones for IPv6 needs IPv6 addresses spelled out in a +cumbersome format. A new command 'dns-mode-ipv6-to-nibbles' helps +with the conversion. + * New Modes and Packages in Emacs 26.1 diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 01f509d913..6f2f40cd2c 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -113,6 +113,7 @@ dns-mode-syntax-table (defvar dns-mode-map (let ((map (make-sparse-keymap))) (define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial) + (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles) map) "Keymap for DNS master file mode.") @@ -124,7 +125,8 @@ dns-mode-menu (easy-menu-define dns-mode-menu dns-mode-map "DNS Menu." '("DNS" - ["Increment SOA serial" dns-mode-soa-increment-serial t])) + ["Increment SOA serial" dns-mode-soa-increment-serial t] + ["Convert IPv6 address to nibbles" dns-mode-ipv6-to-nibbles t])) ;; Mode. @@ -220,6 +222,104 @@ dns-mode-soa-maybe-increment-serial ;; We return nil in case this is used in write-contents-functions. nil))) +;;;###autoload +(defun dns-mode-ipv6-to-nibbles (negate-prefix-p) + "Replace an IPv6 address around or preceeding point by its +ip6.arpa-representation for use in reverse zone files. The +replaced address is placed in the kill ring. + +The address can be a complete address (no prefix designator), can +have a normal prefix designator (e.g. /48), in which case only +the required number of nibbles are output, or can have a negative +prefix designator (e.g. /-112), in which case only the parts of +the address *not* covered by the absolute value of the prefix +length is output, as a relative address (without .ip6.arpa. at +the end). This is useful when $ORIGIN is specified in the zone +file. + +If called with a prefix argument (C-u), the value of the detected +prefix length is negated. + +Examples: + +2001:db8::12 => +2.1.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. + +2001:db8::12/32 => +8.b.d.0.1.0.0.2.ip6.arpa. + +2001:db8::12/-32 => +2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 + +::42/112 (with C-u prefix) => +2.4.0.0" + (interactive "P") + (skip-syntax-backward " ") + (skip-syntax-backward "w_.") + (re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?") + (kill-new (match-string 0)) + (let ((address (match-string 1)) + (prefix-length (match-string 2))) + (if prefix-length + (progn + (setq prefix-length (string-to-number (substring prefix-length 1))) + (if negate-prefix-p + (setq prefix-length (* -1 prefix-length))))) + (replace-match (save-match-data + (dns-mode-reverse-and-expand-ipv6 address prefix-length))))) + +(defun dns-mode-reverse-and-expand-ipv6 (address &optional prefix-length) + "Convert an IPv6 address to (parts of) an ip6.arpa nibble format. + +ADDRESS must be an IPv6 address in the usual colon-separaated +format, without a prefix designator at the end. PREFIX-LENGTH, +if given, must be a number whose absolute value is the length in +bits of the network part of the address. + +If PREFIX-LENGTH is `nil', an absolute address is returned +representing the full IPv6 address. + +If PREFIX-LENGTH is positive, an absolute address is returned +representing the network prefix indicated. + +If PREFIX-LENGTH is negative, a relative address is returned +representing the host parts of the address with respect to the +indicated network prefix. + +See `dns-mode-ipv6-to-nibbles' for examples." + (let* ((chunks (split-string address ":")) + (prefix-length-nibbles (if prefix-length + (ceiling (abs prefix-length) 4) + 32)) + (filler-chunks (- 8 (length (remove "" chunks)))) + (expanded-address (apply #'concat + (loop with filler-done = nil + for chunk in chunks + if (and (not filler-done) + (string= "" chunk)) + append (prog1 + (loop repeat filler-chunks + collect "0000") + (setq filler-done t)) + else + if (not (string= "" chunk)) + collect (format "%04x" (string-to-number chunk 16))))) + (rev-address-nibbles (nreverse (if (and prefix-length + (minusp prefix-length)) + (substring expanded-address prefix-length-nibbles) + (substring expanded-address 0 prefix-length-nibbles))))) + (with-temp-buffer + (loop for char across rev-address-nibbles + do + (insert char) + (insert ".")) + (if (and prefix-length + (minusp prefix-length)) + (delete-char -1) + (insert "ip6.arpa.")) + (insert " ") + (buffer-string)))) + (provide 'dns-mode) ;;; dns-mode.el ends here diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el new file mode 100644 index 0000000000..34e86201d8 --- /dev/null +++ b/test/lisp/textmodes/dns-mode-tests.el @@ -0,0 +1,58 @@ +;;; dns-mode-tests.el --- Test suite for dns-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Peder O. Klingenberg +;; Keywords: dns zone + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'dns-mode) + +;;; IPv6 reverse zones +(ert-deftest dns-mode-ipv6-conversion () + (let ((address "2001:db8::42")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address) + "2.4.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. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address 32) + "8.b.d.0.1.0.0.2.ip6.arpa. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address -112) + "2.4.0.0 ")))) + +(ert-deftest dns-mode-ipv6-text-replacement () + (let ((address "2001:db8::42/32")) + (with-temp-buffer + ;; Conversion with point directly after address + (insert address) + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. ")) + ;; Kill ring contains the expected + (erase-buffer) + (yank) + (should (equal (buffer-string) address)) + ;; Point at beginning of address (and prefix arg to command) + (goto-char (point-min)) + (dns-mode-ipv6-to-nibbles t) + (should (equal (buffer-string) "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 ")) + ;; Point separated from address by whitespace + (erase-buffer) + (insert address) + (insert " ") + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))))) -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 14:59:23 2017 Received: (at control) by debbugs.gnu.org; 7 May 2017 18:59:23 +0000 Received: from localhost ([127.0.0.1]:60707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7ROt-0005AR-Jx for submit@debbugs.gnu.org; Sun, 07 May 2017 14:59:23 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:43201) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7ROr-0005AJ-UT for control@debbugs.gnu.org; Sun, 07 May 2017 14:59:22 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1d7ROl-0007fW-MM for control@debbugs.gnu.org; Sun, 07 May 2017 20:59:21 +0200 Received: by modesty.local (Postfix, from userid 502) id 5A85117F651F; Sun, 7 May 2017 20:59:10 +0200 (CEST) To: control@debbugs.gnu.org From: peder@klingenberg.no (Peder O. Klingenberg) Subject: control message for bug #26820 Message-Id: <20170507185910.5A85117F651F@modesty.local> Date: Sun, 7 May 2017 20:59:10 +0200 (CEST) X-Spam-Score: -2.9 (--) X-SRS: Sender address rewritten from to by tarrant.klingenberg.no. X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) tags 26820 patch From unknown Sun Aug 17 01:51:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 May 2017 00:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: peder@klingenberg.no (Peder O. Klingenberg) Cc: 26820@debbugs.gnu.org Received: via spool by 26820-submit@debbugs.gnu.org id=B26820.14953262064010 (code B ref 26820); Sun, 21 May 2017 00:24:02 +0000 Received: (at 26820) by debbugs.gnu.org; 21 May 2017 00:23:26 +0000 Received: from localhost ([127.0.0.1]:57524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCEec-00012c-D6 for submit@debbugs.gnu.org; Sat, 20 May 2017 20:23:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCEea-00012Q-Ks for 26820@debbugs.gnu.org; Sat, 20 May 2017 20:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCEeU-00023u-Kt for 26820@debbugs.gnu.org; Sat, 20 May 2017 20:23:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCEeB-0001yz-Si; Sat, 20 May 2017 20:22:59 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dCEeB-0002TH-Go; Sat, 20 May 2017 20:22:59 -0400 From: Glenn Morris References: X-Spook: csystems WMATA Etacs MP5K-SD Watch Tony Blair Agro David X-Ran: $q"'7^yC>~|HUq2XOFcq@)>fkuRTRfUgxAT+GO'(glli*mcggJUAm~nUwTAw)w]M.;; (Peder O. Klingenberg's message of "Sun, 07 May 2017 20:58:59 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Thanks, but: =20=20=20=20 In dns-mode-reverse-and-expand-ipv6: ~/dns-mode.el:330:41:Warning: reference to free variable =E2=80=98with= =E2=80=99 ~/dns-mode.el:330:46:Warning: reference to free variable =E2=80=98fille= r-done=E2=80=99 ~/dns-mode.el:330:58:Warning: reference to free variable =E2=80=98=3D= =E2=80=99 ~/dns-mode.el:331:41:Warning: reference to free variable =E2=80=98for= =E2=80=99 ~/dns-mode.el:331:45:Warning: reference to free variable =E2=80=98chunk= =E2=80=99 ~/dns-mode.el:331:51:Warning: reference to free variable =E2=80=98in=E2= =80=99 ~/dns-mode.el:332:41:Warning: reference to free variable =E2=80=98if=E2= =80=99 ~/dns-mode.el:334:41:Warning: reference to free variable =E2=80=98appen= d=E2=80=99 ~/dns-mode.el:335:58:Warning: reference to free variable =E2=80=98repea= t=E2=80=99 ~/dns-mode.el:336:58:Warning: reference to free variable =E2=80=98colle= ct=E2=80=99 ~/dns-mode.el:337:56:Warning: assignment to free variable =E2=80=98fill= er-done=E2=80=99 ~/dns-mode.el:338:41:Warning: reference to free variable =E2=80=98else= =E2=80=99 ~/dns-mode.el:346:17:Warning: reference to free variable =E2=80=98char= =E2=80=99 ~/dns-mode.el:346:22:Warning: reference to free variable =E2=80=98acros= s=E2=80=99 ~/dns-mode.el:347:13:Warning: reference to free variable =E2=80=98do=E2= =80=99 =20=20=20=20 In end of data: ~/dns-mode.el:360:1:Warning: the following functions are not known to be defined: loop, minusp which is due to using stuff from cl.el without requiring it. And in any case, the cl-lib versions should be used instead these days. Please could you revise that? TIA. From unknown Sun Aug 17 01:51:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Resent-From: peder@klingenberg.no (Peder O. Klingenberg) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 May 2017 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Glenn Morris Cc: 26820@debbugs.gnu.org Received: via spool by 26820-submit@debbugs.gnu.org id=B26820.14953966139110 (code B ref 26820); Sun, 21 May 2017 19:57:02 +0000 Received: (at 26820) by debbugs.gnu.org; 21 May 2017 19:56:53 +0000 Received: from localhost ([127.0.0.1]:59619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCWyD-0002Ms-5h for submit@debbugs.gnu.org; Sun, 21 May 2017 15:56:53 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:50162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCWyB-0002Mk-PG for 26820@debbugs.gnu.org; Sun, 21 May 2017 15:56:52 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1dCWxy-0005HS-LD; Sun, 21 May 2017 21:56:46 +0200 Received: by modesty.local (Postfix, from userid 502) id 3D8BC18170E4; Sun, 21 May 2017 21:56:32 +0200 (CEST) From: peder@klingenberg.no (Peder O. Klingenberg) References: Date: Sun, 21 May 2017 21:56:32 +0200 In-Reply-To: (Glenn Morris's message of "Sat, 20 May 2017 20:22:59 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.9 (--) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Glenn Morris writes: > And in any case, the cl-lib versions should be used instead these days. > Please could you revise that? TIA. Revised patch attached, using the cl-lib versions. dns-mode.el now compiles without warnings in emacs -Q. Thank you for taking an interest. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Command-to-convert-IPv6-addresses-in-zone-files.patch >From 784308bc7b85c9012f89294fec478f43b0f1f210 Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Sun, 7 May 2017 17:58:41 +0200 Subject: [PATCH] Command to convert IPv6 addresses in zone files * lisp/textmodes/dns-mode.el (dns-mode-ipv6-to-nibbles): New command to convert IPv6 addresses to a format suitable for reverse lookup zone files. (dns-mode-reverse-and-expand-ipv6): The algorithm central to the command above. (dns-mode-map, dns-mode-menu): Key and menu item for the new command. * test/lisp/textmodes/dns-mode-tests.el (dns-mode-ipv6-conversion) (dns-mode-ipv6-text-replacement): Tests for new functionality in dns-mode.el (bug#26820) --- etc/NEWS | 8 +++ lisp/textmodes/dns-mode.el | 102 +++++++++++++++++++++++++++++++++- test/lisp/textmodes/dns-mode-tests.el | 58 +++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 test/lisp/textmodes/dns-mode-tests.el diff --git a/etc/NEWS b/etc/NEWS index 4599efd7da..293ef4f960 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -784,6 +784,14 @@ file. *** Emacs does no longer prompt the user before killing Flymake processes on exit. +** DNS mode + ++++ +*** DNS mode has a tool to convert IPv6 addresses +Reverse zones for IPv6 needs IPv6 addresses spelled out in a +cumbersome format. A new command 'dns-mode-ipv6-to-nibbles' helps +with the conversion. + * New Modes and Packages in Emacs 26.1 diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 01f509d913..88d9c6bee6 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -113,6 +113,7 @@ dns-mode-syntax-table (defvar dns-mode-map (let ((map (make-sparse-keymap))) (define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial) + (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles) map) "Keymap for DNS master file mode.") @@ -124,7 +125,8 @@ dns-mode-menu (easy-menu-define dns-mode-menu dns-mode-map "DNS Menu." '("DNS" - ["Increment SOA serial" dns-mode-soa-increment-serial t])) + ["Increment SOA serial" dns-mode-soa-increment-serial t] + ["Convert IPv6 address to nibbles" dns-mode-ipv6-to-nibbles t])) ;; Mode. @@ -220,6 +222,104 @@ dns-mode-soa-maybe-increment-serial ;; We return nil in case this is used in write-contents-functions. nil))) +;;;###autoload +(defun dns-mode-ipv6-to-nibbles (negate-prefix-p) + "Replace an IPv6 address around or preceeding point by its +ip6.arpa-representation for use in reverse zone files. The +replaced address is placed in the kill ring. + +The address can be a complete address (no prefix designator), can +have a normal prefix designator (e.g. /48), in which case only +the required number of nibbles are output, or can have a negative +prefix designator (e.g. /-112), in which case only the parts of +the address *not* covered by the absolute value of the prefix +length is output, as a relative address (without .ip6.arpa. at +the end). This is useful when $ORIGIN is specified in the zone +file. + +If called with a prefix argument (C-u), the value of the detected +prefix length is negated. + +Examples: + +2001:db8::12 => +2.1.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. + +2001:db8::12/32 => +8.b.d.0.1.0.0.2.ip6.arpa. + +2001:db8::12/-32 => +2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 + +::42/112 (with C-u prefix) => +2.4.0.0" + (interactive "P") + (skip-syntax-backward " ") + (skip-syntax-backward "w_.") + (re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?") + (kill-new (match-string 0)) + (let ((address (match-string 1)) + (prefix-length (match-string 2))) + (if prefix-length + (progn + (setq prefix-length (string-to-number (substring prefix-length 1))) + (if negate-prefix-p + (setq prefix-length (* -1 prefix-length))))) + (replace-match (save-match-data + (dns-mode-reverse-and-expand-ipv6 address prefix-length))))) + +(defun dns-mode-reverse-and-expand-ipv6 (address &optional prefix-length) + "Convert an IPv6 address to (parts of) an ip6.arpa nibble format. + +ADDRESS must be an IPv6 address in the usual colon-separaated +format, without a prefix designator at the end. PREFIX-LENGTH, +if given, must be a number whose absolute value is the length in +bits of the network part of the address. + +If PREFIX-LENGTH is `nil', an absolute address is returned +representing the full IPv6 address. + +If PREFIX-LENGTH is positive, an absolute address is returned +representing the network prefix indicated. + +If PREFIX-LENGTH is negative, a relative address is returned +representing the host parts of the address with respect to the +indicated network prefix. + +See `dns-mode-ipv6-to-nibbles' for examples." + (let* ((chunks (split-string address ":")) + (prefix-length-nibbles (if prefix-length + (ceiling (abs prefix-length) 4) + 32)) + (filler-chunks (- 8 (length (remove "" chunks)))) + (expanded-address (apply #'concat + (cl-loop with filler-done = nil + for chunk in chunks + if (and (not filler-done) + (string= "" chunk)) + append (prog1 + (cl-loop repeat filler-chunks + collect "0000") + (setq filler-done t)) + else + if (not (string= "" chunk)) + collect (format "%04x" (string-to-number chunk 16))))) + (rev-address-nibbles (nreverse (if (and prefix-length + (cl-minusp prefix-length)) + (substring expanded-address prefix-length-nibbles) + (substring expanded-address 0 prefix-length-nibbles))))) + (with-temp-buffer + (cl-loop for char across rev-address-nibbles + do + (insert char) + (insert ".")) + (if (and prefix-length + (cl-minusp prefix-length)) + (delete-char -1) + (insert "ip6.arpa.")) + (insert " ") + (buffer-string)))) + (provide 'dns-mode) ;;; dns-mode.el ends here diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el new file mode 100644 index 0000000000..34e86201d8 --- /dev/null +++ b/test/lisp/textmodes/dns-mode-tests.el @@ -0,0 +1,58 @@ +;;; dns-mode-tests.el --- Test suite for dns-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Peder O. Klingenberg +;; Keywords: dns zone + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'dns-mode) + +;;; IPv6 reverse zones +(ert-deftest dns-mode-ipv6-conversion () + (let ((address "2001:db8::42")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address) + "2.4.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. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address 32) + "8.b.d.0.1.0.0.2.ip6.arpa. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address -112) + "2.4.0.0 ")))) + +(ert-deftest dns-mode-ipv6-text-replacement () + (let ((address "2001:db8::42/32")) + (with-temp-buffer + ;; Conversion with point directly after address + (insert address) + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. ")) + ;; Kill ring contains the expected + (erase-buffer) + (yank) + (should (equal (buffer-string) address)) + ;; Point at beginning of address (and prefix arg to command) + (goto-char (point-min)) + (dns-mode-ipv6-to-nibbles t) + (should (equal (buffer-string) "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 ")) + ;; Point separated from address by whitespace + (erase-buffer) + (insert address) + (insert " ") + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))))) -- 2.11.0 --=-=-=-- From unknown Sun Aug 17 01:51:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: peder@klingenberg.no (Peder O. Klingenberg) Subject: bug#26820: closed (Re: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones) Message-ID: References: X-Gnu-PR-Message: they-closed 26820 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 26820@debbugs.gnu.org Date: Wed, 24 May 2017 00:37:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1495586222-16205-1" This is a multi-part message in MIME format... ------------=_1495586222-16205-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #26820: 26.0.50; DNS mode and IPv6 reverse zones which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 26820@debbugs.gnu.org. --=20 26820: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D26820 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1495586222-16205-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 26820-done) by debbugs.gnu.org; 24 May 2017 00:36:13 +0000 Received: from localhost ([127.0.0.1]:35261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDKHc-0004CI-O6 for submit@debbugs.gnu.org; Tue, 23 May 2017 20:36:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDKHb-0004C4-C4 for 26820-done@debbugs.gnu.org; Tue, 23 May 2017 20:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDKHV-00067r-59 for 26820-done@debbugs.gnu.org; Tue, 23 May 2017 20:36:05 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDKHV-00067l-0J for 26820-done@debbugs.gnu.org; Tue, 23 May 2017 20:36:05 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dDKHU-0007ye-Hm; Tue, 23 May 2017 20:36:04 -0400 From: Glenn Morris To: 26820-done@debbugs.gnu.org Subject: Re: bug#26820: 26.0.50; DNS mode and IPv6 reverse zones References: X-Spook: Serbian Legion of Doom Drug cartel Aladdin pink noise X-Ran: I#7lYZm{%eIr2IRB3~E)zg%w6Y+u`4k3M9}-CqRI&$Elw%r;n4]S=0UF7fI^%zqowuN|A{ X-Hue: magenta X-Debbugs-No-Ack: yes X-Attribution: GM Date: Tue, 23 May 2017 20:36:04 -0400 In-Reply-To: (Peder O. Klingenberg's message of "Sun, 21 May 2017 21:56:32 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26820-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Version: 26.1 Thanks; tweaked and applied as 8f6550b. ------------=_1495586222-16205-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 May 2017 18:51:40 +0000 Received: from localhost ([127.0.0.1]:60683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RHQ-0004wi-El for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38697) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7RHO-0004wW-SV for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7RHI-0006q4-SZ for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d7RHI-0006px-Ow for submit@debbugs.gnu.org; Sun, 07 May 2017 14:51:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7RHH-0000di-Fn for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7RHE-0006ov-ER for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:31 -0400 Received: from tarrant.klingenberg.no ([80.91.231.253]:44213) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7RHE-0006ma-7T for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 14:51:28 -0400 Received: from 179.51-175-138.customer.lyse.net ([51.175.138.179] helo=modesty.local) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1d7RGx-0007Xh-4g for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 20:51:17 +0200 Received: by modesty.local (Postfix, from userid 502) id 49D7717F6469; Sun, 7 May 2017 20:51:03 +0200 (CEST) From: peder@klingenberg.no (Peder O. Klingenberg) To: bug-gnu-emacs@gnu.org Subject: 26.0.50; DNS mode and IPv6 reverse zones Date: Sun, 07 May 2017 20:51:03 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Last week I was trying to set up reverse delegations for some newly assigned IPv6 address space. It was... painful. IPv6 addresses are ugly enough in their normal format, but when used in a reverse zone, they need to be converted to individual nibbles separated by dots, reversed, and have .ip6.arpa. appended. The result is less than human friendly. So I've written a new feature for dns-mode.el that allows me to mostly relate to the normal IPv6 format, and convert automatically to the nibble format. I can for instance do this in a (part of a) zone file, where I'm only interested in defining hosts in the last 16 bits of the address: $ORIGIN 2a0a:3dc0:10::/112 ::1/-112 IN PTR www.example.com. And then, by pressing C-c C-e on each of the IPv6 addresses, end up with the necessary $ORIGIN 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.c.d.3.a.0.a.2.ip6.arpa. 1.0.0.0 IN PTR www.example.com. Assuming I'm doing this as I type, I can then yank the last standard-format address, do a minimal edit, C-c C-e again, and continue typing to define the next PTR record. I'm hoping this sounds useful to other people as well. I'll pass along the patch as soon as I get a bug# to attach to it. :) ------------=_1495586222-16205-1--