Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2015 19:41:29 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r281866 - stable/10/sys/netinet6
Message-ID:  <201504221941.t3MJfTvS066089@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Apr 22 19:41:29 2015
New Revision: 281866
URL: https://svnweb.freebsd.org/changeset/base/281866

Log:
  MFC r281309:
    Fix the check for maximum mbuf's size needed to send ND6 NA and NS.
    It is acceptable that the size can be equal to MCLBYTES. In the later
    KAME's code this check has been moved under DIAGNOSTIC ifdef, because
    the size of NA and NS is much smaller than MCLBYTES. So, it is safe to
    replace the check with KASSERT.
  
    PR:		199304

Modified:
  stable/10/sys/netinet6/nd6_nbr.c
Directory Properties:
  stable/10/   (props changed)
  stable/10/sys/gnu/dts/   (props changed)

Modified: stable/10/sys/netinet6/nd6_nbr.c
==============================================================================
--- stable/10/sys/netinet6/nd6_nbr.c	Wed Apr 22 18:54:51 2015	(r281865)
+++ stable/10/sys/netinet6/nd6_nbr.c	Wed Apr 22 19:41:29 2015	(r281866)
@@ -400,13 +400,9 @@ nd6_ns_output(struct ifnet *ifp, const s
 	/* estimate the size of message */
 	maxlen = sizeof(*ip6) + sizeof(*nd_ns);
 	maxlen += (sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7;
-	if (max_linkhdr + maxlen >= MCLBYTES) {
-#ifdef DIAGNOSTIC
-		printf("nd6_ns_output: max_linkhdr + maxlen >= MCLBYTES "
-		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
-#endif
-		return;
-	}
+	KASSERT(max_linkhdr + maxlen <= MCLBYTES, (
+	    "%s: max_linkhdr + maxlen > MCLBYTES (%d + %d > %d)",
+	    __func__, max_linkhdr, maxlen, MCLBYTES));
 
 	if (max_linkhdr + maxlen > MHLEN)
 		m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
@@ -973,13 +969,9 @@ nd6_na_output_fib(struct ifnet *ifp, con
 	/* estimate the size of message */
 	maxlen = sizeof(*ip6) + sizeof(*nd_na);
 	maxlen += (sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7;
-	if (max_linkhdr + maxlen >= MCLBYTES) {
-#ifdef DIAGNOSTIC
-		printf("nd6_na_output: max_linkhdr + maxlen >= MCLBYTES "
-		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
-#endif
-		return;
-	}
+	KASSERT(max_linkhdr + maxlen <= MCLBYTES, (
+	    "%s: max_linkhdr + maxlen > MCLBYTES (%d + %d > %d)",
+	    __func__, max_linkhdr, maxlen, MCLBYTES));
 
 	if (max_linkhdr + maxlen > MHLEN)
 		m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504221941.t3MJfTvS066089>