From owner-svn-src-all@FreeBSD.ORG Thu May 8 17:27:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D94D994C; Thu, 8 May 2014 17:27:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6EDCC08; Thu, 8 May 2014 17:27:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s48HRkla056079; Thu, 8 May 2014 17:27:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48HRkiT056077; Thu, 8 May 2014 17:27:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201405081727.s48HRkiT056077@svn.freebsd.org> From: Michael Tuexen Date: Thu, 8 May 2014 17:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265691 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2014 17:27:46 -0000 Author: tuexen Date: Thu May 8 17:27:46 2014 New Revision: 265691 URL: http://svnweb.freebsd.org/changeset/base/265691 Log: For some UDP packets (for example with 200 byte payload) and IP options, the IP header and the UDP header are not in the same mbuf. Add code to in_delayed_cksum() to deal with this case. MFC after: 3 days Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu May 8 17:20:45 2014 (r265690) +++ head/sys/netinet/ip_output.c Thu May 8 17:27:46 2014 (r265691) @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m) csum = 0xffff; offset += m->m_pkthdr.csum_data; /* checksum offset */ + /* find the mbuf in the chain where the checksum starts*/ + while ((m != NULL) && (offset >= m->m_len)) { + offset -= m->m_len; + m = m->m_next; + } + if (m == NULL) { + /* This should not happen. */ + printf("in_delayed_cksum(): checksum outside mbuf chain.\n"); + return; + } if (offset + sizeof(u_short) > m->m_len) { - printf("delayed m_pullup, m->len: %d off: %d p: %d\n", - m->m_len, offset, ip->ip_p); /* * XXX - * this shouldn't happen, but if it does, the - * correct behavior may be to insert the checksum - * in the appropriate next mbuf in the chain. + * This should not happen, but if it does, it might make more + * sense to fix the caller than to add code to split it here. */ + printf("in_delayed_cksum(): checksum split between mbufs.\n"); return; } *(u_short *)(m->m_data + offset) = csum;