summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2010-12-31 21:47:11 +0000
committerbz <bz@FreeBSD.org>2010-12-31 21:47:11 +0000
commit969f8f9046a3a302dba8bdcd2c6d1c8d8785881b (patch)
treeaa19e49a2900d611041b3a5d33a25981187e4c85 /sys/netinet
parent2a04b52e8a1dac2486826b340198915f0318482d (diff)
downloadFreeBSD-src-969f8f9046a3a302dba8bdcd2c6d1c8d8785881b.zip
FreeBSD-src-969f8f9046a3a302dba8bdcd2c6d1c8d8785881b.tar.gz
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
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_output.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index e292b60..3e592c5 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -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;
/*
OpenPOWER on IntegriCloud