Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha Don't compute psuedo header checksum if...



details:   https://anonhg.NetBSD.org/src/rev/cff671ebb354
branches:  trunk
changeset: 510092:cff671ebb354
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 19 00:30:35 2001 +0000

description:
Don't compute psuedo header checksum if nxt == 0.

diffstat:

 sys/arch/alpha/alpha/in_cksum.c |  28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diffs (52 lines):

diff -r 35c08f784e60 -r cff671ebb354 sys/arch/alpha/alpha/in_cksum.c
--- a/sys/arch/alpha/alpha/in_cksum.c   Sat May 19 00:13:53 2001 +0000
+++ b/sys/arch/alpha/alpha/in_cksum.c   Sat May 19 00:30:35 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_cksum.c,v 1.9 2001/04/29 05:54:29 thorpej Exp $ */
+/* $NetBSD: in_cksum.c,v 1.10 2001/05/19 00:30:35 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988, 1992, 1993
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.9 2001/04/29 05:54:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.10 2001/05/19 00:30:35 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -211,20 +211,22 @@
        union l_util l_util; 
        struct ipovly ipov;
 
-       /* pseudo header */
-       if (off < sizeof(struct ipovly))
-               panic("in4_cksum: offset too short");
-       if (m->m_len < sizeof(struct ip))
-               panic("in4_cksum: bad mbuf chain");
+       if (nxt == 0) {
+               /* pseudo header */
+               if (off < sizeof(struct ipovly))
+                       panic("in4_cksum: offset too short");
+               if (m->m_len < sizeof(struct ip))
+                       panic("in4_cksum: bad mbuf chain");
 
-       memset(&ipov, 0, sizeof(ipov));
+               memset(&ipov, 0, sizeof(ipov));
 
-       ipov.ih_len = htons(len);
-       ipov.ih_pr = nxt;
-       ipov.ih_src = mtod(m, struct ip *)->ip_src;
-       ipov.ih_dst = mtod(m, struct ip *)->ip_dst;
+               ipov.ih_len = htons(len);
+               ipov.ih_pr = nxt;
+               ipov.ih_src = mtod(m, struct ip *)->ip_src;
+               ipov.ih_dst = mtod(m, struct ip *)->ip_dst;
 
-       sum += in_cksumdata((caddr_t) &ipov, sizeof(ipov));
+               sum += in_cksumdata((caddr_t) &ipov, sizeof(ipov));
+       }
 
        /* skip over unnecessary part */
        while (m != NULL && off > 0) {



Home | Main Index | Thread Index | Old Index