Module Name: src
Committed By: martin
Date: Sat Apr 9 21:00:53 UTC 2011
Modified Files:
src/sys/netinet: ip_output.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/ip_output.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.206 src/sys/netinet/ip_output.c:1.207
--- src/sys/netinet/ip_output.c:1.206 Sat Apr 9 20:34:36 2011
+++ src/sys/netinet/ip_output.c Sat Apr 9 21:00:53 2011
@@ -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;