aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/nsm.el26
1 files changed, 15 insertions, 11 deletions
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el
index c47ef55a6f4..205b7974883 100644
--- a/lisp/net/nsm.el
+++ b/lisp/net/nsm.el
@@ -204,17 +204,21 @@ LOCAL-IP, MASK, and IP are specified as vectors of integers, and
204are expected to have the same length. Works for both IPv4 and 204are expected to have the same length. Works for both IPv4 and
205IPv6 addresses." 205IPv6 addresses."
206 (let ((matches t) 206 (let ((matches t)
207 (length (length local-ip))) 207 (ip-length (length ip))
208 (unless (memq length '(4 5 8 9)) 208 (local-length (length local-ip)))
209 (unless (and (memq ip-length '(4 5 8 9))
210 (memq local-length '(4 5 8 9)))
209 (error "Unexpected length of IP address %S" local-ip)) 211 (error "Unexpected length of IP address %S" local-ip))
210 (dotimes (i length) 212 (if (/= ip-length local-length)
211 (setq matches (and matches 213 nil
212 (= 214 (dotimes (i local-length)
213 (logand (aref local-ip i) 215 (setq matches (and matches
214 (aref mask i)) 216 (=
215 (logand (aref ip i) 217 (logand (aref local-ip i)
216 (aref mask i)))))) 218 (aref mask i))
217 matches)) 219 (logand (aref ip i)
220 (aref mask i))))))
221 matches)))
218 222
219(defun nsm-should-check (host) 223(defun nsm-should-check (host)
220 "Determine whether NSM should check for TLS problems for HOST. 224 "Determine whether NSM should check for TLS problems for HOST.
@@ -238,7 +242,7 @@ otherwise."
238 (when 242 (when
239 (nsm-network-same-subnet (substring (car info) 0 -1) 243 (nsm-network-same-subnet (substring (car info) 0 -1)
240 (substring (car (cddr info)) 0 -1) 244 (substring (car (cddr info)) 0 -1)
241 address) 245 (substring address 0 -1))
242 (setq off-net nil)))) 246 (setq off-net nil))))
243 network-interface-list)) 247 network-interface-list))
244 addresses)) 248 addresses))