Let me update the diff

On Tue, 12 Jun 2018 13:39:51 +0900 (JST)
YASUOKA Masahiko <yasu...@openbsd.org> wrote:
> Currently t_template of tcpcb is a mbuf cluster.  This happened when
> max_linkhdr is increased from 16 to 64 (1.44 of
> sys/kern/uipc_domain.c).
> 
> I found this because I wonder why my company, IIJ's HTTP proxy servers
> started using a lot of mbuf clusters after a certain version.
> 
> 
> ok?
> 
> It doesn't seem to be necessary to have any extra space for the
> t_template of tcpcb.


> +             if (m->m_len + sizeof(struct tcphdr) >= MHLEN) {

is tweaked to

                if (m->m_len + sizeof(struct tcphdr) > MHLEN) {

ok?

Index: sys/netinet/tcp_subr.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.171
diff -u -p -r1.171 tcp_subr.c
--- sys/netinet/tcp_subr.c      8 May 2018 15:10:33 -0000       1.171
+++ sys/netinet/tcp_subr.c      12 Jun 2018 04:43:18 -0000
@@ -207,20 +207,15 @@ tcp_template(struct tcpcb *tp)
                        break;
 #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) {
+               if (m->m_len + sizeof(struct tcphdr) > MHLEN) {
                        MCLGET(m, M_DONTWAIT);
                        if ((m->m_flags & M_EXT) == 0) {
                                m_free(m);
                                return (0);
                        }
                }
+               m->m_len += sizeof(struct tcphdr);
        }
 
        switch(tp->pf) {

Reply via email to