aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorYoshinobu Inoue <shin@FreeBSD.org>2000-02-09 00:34:40 +0000
committerYoshinobu Inoue <shin@FreeBSD.org>2000-02-09 00:34:40 +0000
commita683a7dd4f600574a9e62a1c8b11d6e03e612906 (patch)
treedeed6856329885e6240edb635949a0cb62af515e /sys/netinet/tcp_output.c
parentd98d74772fefc1efcdf18d459e9e7a25ac9d5559 (diff)
downloadsrc-a683a7dd4f600574a9e62a1c8b11d6e03e612906.tar.gz
src-a683a7dd4f600574a9e62a1c8b11d6e03e612906.zip
Avoid kernel panic when tcp rfc1323 and rfc1644 options are enabled
at the same time. When rfc1323 and rfc1644 option are enabled by sysctl, and tcp over IPv6 is tried, kernel panic happens by the following check in tcp_output(), because now hdrlen is bigger in such case than before. /*#ifdef DIAGNOSTIC*/ if (max_linkhdr + hdrlen > MHLEN) panic("tcphdr too big"); /*#endif*/ So change the above check to compare with MCLBYTES in #ifdef INET6 case. Also, allocate a mbuf cluster for the header mbuf, in that case. Bug reported at KAME environment. Approved by: jkh Reviewed by: sumikawa Obtained from: KAME project
Notes
Notes: svn path=/head/; revision=57068
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index bbae03fdc494..ae85e84ef327 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -530,8 +530,13 @@ send:
}
/*#ifdef DIAGNOSTIC*/
+#ifdef INET6
+ if (max_linkhdr + hdrlen > MCLBYTES)
+ panic("tcphdr too big");
+#else
if (max_linkhdr + hdrlen > MHLEN)
panic("tcphdr too big");
+#endif
/*#endif*/
/*
@@ -567,10 +572,14 @@ send:
goto out;
}
#ifdef INET6
- if (isipv6 && (MHLEN < hdrlen + max_linkhdr) &&
- MHLEN >= hdrlen) {
- MH_ALIGN(m, hdrlen);
- } else
+ if (MHLEN < hdrlen + max_linkhdr) {
+ MCLGET(m, M_DONTWAIT);
+ if ((m->m_flags & M_EXT) == 0) {
+ m_freem(m);
+ error = ENOBUFS;
+ goto out;
+ }
+ }
#endif
m->m_data += max_linkhdr;
m->m_len = hdrlen;