Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet PR kern/43664:



details:   https://anonhg.NetBSD.org/src/rev/08b9ded1d04f
branches:  trunk
changeset: 763986:08b9ded1d04f
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Apr 09 21:00:53 2011 +0000

description:
PR kern/43664:
mlelstv pointed out that we sometimes may use checksums on loopback
interfaces. Make the test consistent with the code path selecting
the checksum operation before invoking fragmentation.

diffstat:

 sys/netinet/ip_output.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 4387465a460c -r 08b9ded1d04f sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Sat Apr 09 20:53:39 2011 +0000
+++ b/sys/netinet/ip_output.c   Sat Apr 09 21:00:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $   */
+/*     $NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_inet.h"
@@ -1027,9 +1027,10 @@
        ip->ip_off |= htons(IP_MF);
        ip->ip_sum = 0;
        /*
-        * We do not do checksums on loopback interfaces
+        * We may not use checksums on loopback interfaces
         */
-       if (__predict_true(ifp == NULL || !(ifp->if_flags & IFF_LOOPBACK)))  {
+       if (__predict_false(ifp == NULL) ||
+           IN_NEED_CHECKSUM(ifp, M_CSUM_IPv4)) {
                if (sw_csum & M_CSUM_IPv4) {
                        ip->ip_sum = in_cksum(m, hlen);
                        m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;



Home | Main Index | Thread Index | Old Index