diff options
| author | Gnus developers <ding@gnus.org.noreply> | 2014-03-23 23:14:52 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2014-03-23 23:14:52 +0000 |
| commit | 7a31038fd91fec168aa6ff5d09ce9bfc819d25d5 (patch) | |
| tree | c76aab1953e66c6e1e39bcdbb0ed8afe9ce3c61e /lisp/net | |
| parent | 4d2226bff09b794fe2f5db3b2ae3b5b48188d4a7 (diff) | |
| download | emacs-7a31038fd91fec168aa6ff5d09ce9bfc819d25d5.tar.gz | |
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.el | 23 |
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 @@ "List of DNS servers to query. If nil, /etc/resolv.conf and nslookup will be consulted.") +(defvar dns-servers-valid-for-interfaces nil + "The return value of `network-interface-list' when `dns-servers' was set. +If the set of network interfaces and/or their IP addresses +change, then presumably the list of DNS servers needs to be +updated. Set this variable to t to disable the check.") + ;;; Internal code: (defvar dns-query-types @@ -297,6 +303,17 @@ If TCP-P, the first two bytes of the package with be the length field." (t string))) (goto-char point)))) +(declare-function network-interface-list "process.c") + +(defun dns-servers-up-to-date-p () + "Return false if we need to recheck the list of DNS servers." + (and dns-servers + (or (eq dns-servers-valid-for-interfaces t) + ;; `network-interface-list' was introduced in Emacs 22.1. + (not (fboundp 'network-interface-list)) + (equal dns-servers-valid-for-interfaces + (network-interface-list))))) + (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\"." @@ -314,7 +331,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"." (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))))))) + (setq dns-servers (list (match-string 1)))))) + (when (fboundp 'network-interface-list) + (setq dns-servers-valid-for-interfaces (network-interface-list)))) (defun dns-read-txt (string) (if (> (length string) 1) @@ -378,7 +397,7 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"." If FULLP, return the entire record returned. If REVERSEP, look up an IP address." (setq type (or type 'A)) - (unless dns-servers + (unless (dns-servers-up-to-date-p) (dns-set-servers)) (when reversep |
