svn commit: r216857 - head/sys/netinet
Bjoern A. Zeeb
bz at FreeBSD.org
Fri Dec 31 21:47:12 UTC 2010
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;
/*
More information about the svn-src-head
mailing list