aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorGnus developers2014-03-23 23:14:52 +0000
committerKatsumi Yamaoka2014-03-23 23:14:52 +0000
commit7a31038fd91fec168aa6ff5d09ce9bfc819d25d5 (patch)
treec76aab1953e66c6e1e39bcdbb0ed8afe9ce3c61e /lisp/net
parent4d2226bff09b794fe2f5db3b2ae3b5b48188d4a7 (diff)
downloademacs-7a31038fd91fec168aa6ff5d09ce9bfc819d25d5.tar.gz
emacs-7a31038fd91fec168aa6ff5d09ce9bfc819d25d5.zip
Merge from Gnus git master
2014-02-04 Lars Ingebrigtsen <larsi@gnus.org> * calendar/parse-time.el (parse-time-iso8601-regexp) (parse-iso8601-time-string): Copied from `url-dav' so that we can use it more generally. 2014-02-01 Lars Ingebrigtsen <larsi@gnus.org> * net/dns.el (network-interface-list): Define for XEmacs. 2014-01-31 Magnus Henoch <magnus.henoch@gmail.com> * net/dns.el (dns-servers-up-to-date-p): New function to see whether the network interfaces changed. (dns-query): Use it to flush the data.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/dns.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index e52ead1fb72..ea1c805c6b9 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -31,6 +31,12 @@
31 "List of DNS servers to query. 31 "List of DNS servers to query.
32If nil, /etc/resolv.conf and nslookup will be consulted.") 32If nil, /etc/resolv.conf and nslookup will be consulted.")
33 33
34(defvar dns-servers-valid-for-interfaces nil
35 "The return value of `network-interface-list' when `dns-servers' was set.
36If the set of network interfaces and/or their IP addresses
37change, then presumably the list of DNS servers needs to be
38updated. Set this variable to t to disable the check.")
39
34;;; Internal code: 40;;; Internal code:
35 41
36(defvar dns-query-types 42(defvar dns-query-types
@@ -297,6 +303,17 @@ If TCP-P, the first two bytes of the package with be the length field."
297 (t string))) 303 (t string)))
298 (goto-char point)))) 304 (goto-char point))))
299 305
306(declare-function network-interface-list "process.c")
307
308(defun dns-servers-up-to-date-p ()
309 "Return false if we need to recheck the list of DNS servers."
310 (and dns-servers
311 (or (eq dns-servers-valid-for-interfaces t)
312 ;; `network-interface-list' was introduced in Emacs 22.1.
313 (not (fboundp 'network-interface-list))
314 (equal dns-servers-valid-for-interfaces
315 (network-interface-list)))))
316
300(defun dns-set-servers () 317(defun dns-set-servers ()
301 "Set `dns-servers' to a list of DNS servers or nil if none are found. 318 "Set `dns-servers' to a list of DNS servers or nil if none are found.
302Parses \"/etc/resolv.conf\" or calls \"nslookup\"." 319Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
@@ -314,7 +331,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
314 (goto-char (point-min)) 331 (goto-char (point-min))
315 (re-search-forward 332 (re-search-forward
316 "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t) 333 "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t)
317 (setq dns-servers (list (match-string 1))))))) 334 (setq dns-servers (list (match-string 1))))))
335 (when (fboundp 'network-interface-list)
336 (setq dns-servers-valid-for-interfaces (network-interface-list))))
318 337
319(defun dns-read-txt (string) 338(defun dns-read-txt (string)
320 (if (> (length string) 1) 339 (if (> (length string) 1)
@@ -378,7 +397,7 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
378If FULLP, return the entire record returned. 397If FULLP, return the entire record returned.
379If REVERSEP, look up an IP address." 398If REVERSEP, look up an IP address."
380 (setq type (or type 'A)) 399 (setq type (or type 'A))
381 (unless dns-servers 400 (unless (dns-servers-up-to-date-p)
382 (dns-set-servers)) 401 (dns-set-servers))
383 402
384 (when reversep 403 (when reversep