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;
                /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to