bug fixes and last chksum
[unix-history] / usr / src / sys / netinet / tcp_input.c
index 00e0fd5..0e06a63 100644 (file)
@@ -1,9 +1,10 @@
-/* tcp_input.c 1.15 81/10/31 */
+/* tcp_input.c 1.16 81/10/31 */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
+#include "../inet/cksum.h"
 #include "../inet/inet.h"
 #include "../inet/inet_systm.h"
 #include "../inet/imp.h"
 #include "../inet/inet.h"
 #include "../inet/inet_systm.h"
 #include "../inet/imp.h"
@@ -18,7 +19,7 @@ tcp_input(mp)
        register struct mbuf *mp;
 {
        register struct th *n;          /* known to be r10 */
        register struct mbuf *mp;
 {
        register struct th *n;          /* known to be r10 */
-       register int j;                 /* known to be r9 */
+       register int j;
        register struct tcb *tp;
        int nstate;
        struct mbuf *m;
        register struct tcb *tp;
        int nstate;
        struct mbuf *m;
@@ -50,19 +51,8 @@ COUNT(TCP_INPUT);
                /*
                 * Checksum extended header and data
                 */
                /*
                 * Checksum extended header and data
                 */
-               j = n->t_sum; n->t_sum = 0;
-#ifdef vax
-               if (tlen == 20) {
-                       asm("addl3 $8,r10,r0; movl (r0)+,r1; addl2 (r0)+,r1");
-                       asm("adwc (r0)+,r1; adwc (r0)+,r1; adwc (r0)+,r1");
-                       asm("adwc (r0)+,r1; adwc (r0)+,r1; adwc (r0)+,r1");
-                       asm("adwc $0,r1; ashl $-16,r1,r0; addw2 r0,r1");
-                       asm("adwc $0,r1");              /* ### */
-                       asm("mcoml r1,r1; movzwl r1,r1; subl2 r1,r9");
-               } else
-#endif
-                       j -= cksum(mp, sizeof (struct ip) + tlen);
-               if (j != 0) {
+               CKSUM_TCPGET(mp, n, r10, sizeof (struct ip) + tlen);
+               if (n->t_cksum != 0) {
                        netstat.t_badsum++;
                        m_freem(mp);
                        return;
                        netstat.t_badsum++;
                        m_freem(mp);
                        return;