svn commit: r281309 - head/sys/netinet6
Andrey V. Elsukov
ae at FreeBSD.org
Thu Apr 9 12:57:59 UTC 2015
Author: ae
Date: Thu Apr 9 12:57:58 2015
New Revision: 281309
URL: https://svnweb.freebsd.org/changeset/base/281309
Log:
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
Discussed with: glebius
MFC after: 1 week
Modified:
head/sys/netinet6/nd6_nbr.c
Modified: head/sys/netinet6/nd6_nbr.c
==============================================================================
--- head/sys/netinet6/nd6_nbr.c Thu Apr 9 10:28:05 2015 (r281308)
+++ head/sys/netinet6/nd6_nbr.c Thu Apr 9 12:57:58 2015 (r281309)
@@ -417,14 +417,9 @@ nd6_ns_output_fib(struct ifnet *ifp, con
/* 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("%s: max_linkhdr + maxlen >= MCLBYTES "
- "(%d + %d > %d)\n", __func__, 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);
@@ -992,13 +987,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);
More information about the svn-src-all
mailing list