Update of /project/movitz/cvsroot/movitz/losp/lib/net In directory common-lisp.net:/tmp/cvs-serv19491
Modified Files: ip4.lisp Log Message: Have checksum-ok accept any number of checksum terms, since typically there will be a frew terms from the pseudo-header and one term from the actual packet.
Date: Wed Nov 24 15:22:57 2004 Author: ffjeld
Index: movitz/losp/lib/net/ip4.lisp diff -u movitz/losp/lib/net/ip4.lisp:1.10 movitz/losp/lib/net/ip4.lisp:1.11 --- movitz/losp/lib/net/ip4.lisp:1.10 Wed Nov 24 14:12:26 2004 +++ movitz/losp/lib/net/ip4.lisp Wed Nov 24 15:22:57 2004 @@ -10,7 +10,7 @@ ;;;; Author: Frode Vatvedt Fjeld frodef@acm.org ;;;; Created at: Wed Apr 30 13:52:57 2003 ;;;; -;;;; $Id: ip4.lisp,v 1.10 2004/11/24 13:12:26 ffjeld Exp $ +;;;; $Id: ip4.lisp,v 1.11 2004/11/24 14:22:57 ffjeld Exp $ ;;;; ;;;;------------------------------------------------------------------
@@ -112,10 +112,12 @@ (setf (ip4-ref packet start 10 :unsigned-byte16) checksum))) packet)
-(defun checksum-ok (x) - (= #xffff - (+ (ldb (byte 16 0) x) - (ash x -16)))) +(defun checksum-ok (x &rest more-xes) + (declare (dynamic-extent more-xes)) + (let ((x (reduce #'add-u16-ones-complement more-xes :initial-value x))) + (= #xffff + (+ (ldb (byte 16 0) x) + (ash x -16)))))
(defun ip-input (stack packet start) (let ((header-size (* 4 (ip-header-length packet start))))