Date: Fri, 31 Dec 2010 21:47:11 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r216857 - head/sys/netinet Message-ID: <201012312147.oBVLlBHO089663@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012312147.oBVLlBHO089663>