diff options
author | 2018-06-14 01:24:08 +0000 | |
---|---|---|
committer | 2018-06-14 01:24:08 +0000 | |
commit | d4c0cfb1134debf28ef6c6a4fb0975446fde9a91 (patch) | |
tree | 477f34acf6857c48584c2acb51f53503bd20df92 | |
parent | In dounlinkat() only perform the check for a mounted directory when (diff) | |
download | wireguard-openbsd-d4c0cfb1134debf28ef6c6a4fb0975446fde9a91.tar.xz wireguard-openbsd-d4c0cfb1134debf28ef6c6a4fb0975446fde9a91.zip |
Use mbuf (not cluster) always for t_template of tcpcb.
ok bluhm
-rw-r--r-- | sys/netinet/tcp_subr.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index b8eac110e91..99bf6bebc78 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.171 2018/05/08 15:10:33 bluhm Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.172 2018/06/14 01:24:08 yasuoka Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -191,6 +191,9 @@ tcp_template(struct tcpcb *tp) struct mbuf *m; struct tcphdr *th; + CTASSERT(sizeof(struct ip) + sizeof(struct tcphdr) <= MHLEN); + CTASSERT(sizeof(struct ip6_hdr) + sizeof(struct tcphdr) <= MHLEN); + if ((m = tp->t_template) == 0) { m = m_get(M_DONTWAIT, MT_HEADER); if (m == NULL) @@ -208,19 +211,6 @@ tcp_template(struct tcpcb *tp) #endif /* INET6 */ } m->m_len += sizeof (struct tcphdr); - - /* - * The link header, network header, TCP header, and TCP options - * all must fit in this mbuf. For now, assume the worst case of - * TCP options size. Eventually, compute this from tp flags. - */ - if (m->m_len + MAX_TCPOPTLEN + max_linkhdr >= MHLEN) { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - return (0); - } - } } switch(tp->pf) { |