From: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
To: Robert Pluim <rpluim@gmail.com>
Cc: 40343@debbugs.gnu.org
Subject: bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows
Date: Fri, 03 Apr 2020 23:08:10 +0900 [thread overview]
Message-ID: <86v9mgbr1x.wl--xmue@d1.dion.ne.jp> (raw)
In-Reply-To: <m2blo9yn7z.fsf@gmail.com>
> Thanks for that. This should fix all those cases:
Thank you for the patch. It works well on Cygwin environment. But I
noticed different problems in dns-query when TCP is used.
1. dns-write function needs to be called with TCP-P option.
2. First 2 bytes of received data (length field) should be truncated
for dns-read function. Or dns-read function should accept TCP-P
option like dns-wrote function.
> diff --git a/lisp/net/dns.el b/lisp/net/dns.el
> index 78d4827162..177df4e332 100644
> --- a/lisp/net/dns.el
> +++ b/lisp/net/dns.el
> @@ -315,8 +315,8 @@ dns-servers-up-to-date-p
> (defun dns-set-servers ()
> "Set `dns-servers' to a list of DNS servers or nil if none are found.
> Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
> + (setq dns-servers nil)
> (or (when (file-exists-p "/etc/resolv.conf")
> - (setq dns-servers nil)
> (with-temp-buffer
> (insert-file-contents "/etc/resolv.conf")
> (goto-char (point-min))
> @@ -327,9 +327,9 @@ dns-set-servers
> (with-temp-buffer
> (call-process "nslookup" nil t nil "localhost")
> (goto-char (point-min))
> - (re-search-forward
> - "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t)
> - (setq dns-servers (list (match-string 1))))))
> + (when (re-search-forward
> + "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\|[[:xdigit:]:]*\\)" nil t)
> + (setq dns-servers (list (match-string 1)))))))
> (when (fboundp 'network-interface-list)
> (setq dns-servers-valid-for-interfaces (network-interface-list))))
>
> @@ -357,7 +357,9 @@ dns-make-network-process
> `(let ((server ,server)
> (coding-system-for-read 'binary)
> (coding-system-for-write 'binary))
> - (if (fboundp 'make-network-process)
> + (if (and
> + (fboundp 'make-network-process)
> + (featurep 'make-network-process '(:type datagram)))
> (make-network-process
> :name "dns"
> :coding 'binary
> @@ -365,9 +367,9 @@ dns-make-network-process
> :host server
> :service "domain"
> :type 'datagram)
> - ;; Older versions of Emacs doesn't have
> - ;; `make-network-process', so we fall back on opening a TCP
> - ;; connection to the DNS server.
> + ;; Older versions of Emacs do not have `make-network-process',
> + ;; and on MS-Windows datagram sockets are not supported, so we
> + ;; fall back on opening a TCP connection to the DNS server.
> (open-network-stream "dns" (current-buffer) server "domain"))))
>
> (defvar dns-cache (make-vector 4096 0))
> @@ -400,7 +402,9 @@ dns-query
> type 'PTR))
>
> (if (not dns-servers)
> - (message "No DNS server configuration found")
> + (progn
> + (message "No DNS server configuration found")
> + nil)
> (with-temp-buffer
> (set-buffer-multibyte nil)
> (let ((process (condition-case ()
--
Kazuhiro Ito
next prev parent reply other threads:[~2020-04-03 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 8:46 bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows Kazuhiro Ito
2020-03-31 9:50 ` Robert Pluim
2020-03-31 11:06 ` Kazuhiro Ito
2020-03-31 13:01 ` Robert Pluim
2020-03-31 14:22 ` Kazuhiro Ito
2020-03-31 14:28 ` Robert Pluim
2020-04-01 13:43 ` Kazuhiro Ito
2020-04-01 13:57 ` Robert Pluim
2020-04-01 14:55 ` Kazuhiro Ito
2020-04-03 8:42 ` Robert Pluim
2020-04-03 14:08 ` Kazuhiro Ito [this message]
2020-04-03 15:19 ` Robert Pluim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v9mgbr1x.wl--xmue@d1.dion.ne.jp \
--to=kzhr@d1.dion.ne.jp \
--cc=40343@debbugs.gnu.org \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.