From owner-svn-src-all@FreeBSD.ORG Fri Dec 31 21:47:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD6C41065675; Fri, 31 Dec 2010 21:47:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD4E58FC15; Fri, 31 Dec 2010 21:47:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBVLlB2Q089665; Fri, 31 Dec 2010 21:47:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBVLlBHO089663; Fri, 31 Dec 2010 21:47:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201012312147.oBVLlBHO089663@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 31 Dec 2010 21:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216857 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 31 Dec 2010 21:47:12 -0000 Author: bz Date: Fri Dec 31 21:47:11 2010 New Revision: 216857 URL: http://svn.freebsd.org/changeset/base/216857 Log: Try to catch a possible divide-by-zero as early as possible if "mtu" is 0 (also test for negative MTUs if checking it anyway). An MTU of 0 is arguably a bug elsewhere, but this at least gives us some more debugging hints. Sponsored by: ISPsystem (Early 2010) MFC after: 1 week Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Dec 31 21:20:32 2010 (r216856) +++ head/sys/netinet/ip_output.c Fri Dec 31 21:47:11 2010 (r216857) @@ -323,6 +323,9 @@ again: } else { mtu = ifp->if_mtu; } + /* Catch a possible divide by zero later. */ + KASSERT(mtu > 0, ("%s: mtu %d <= 0, rte=%p (rt_flags=0x%08x) ifp=%p", + __func__, mtu, rte, (rte != NULL) ? rte->rt_flags : 0, ifp)); if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { m->m_flags |= M_MCAST; /*