Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/netinet pullup 1.92 -> 1.93 (requested by thorpej)



details:   https://anonhg.NetBSD.org/src/rev/a777707417db
branches:  netbsd-1-5
changeset: 489486:a777707417db
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Sep 19 21:02:55 2000 +0000

description:
pullup 1.92 -> 1.93 (requested by thorpej)

for t_template, allocate mbuf cluster only if really necessary.
this avoids too aggressive memory usage on heavy load web server, for example.
From: Kevin Lahey <kml%dotrocket.com@localhost>

release and reallocate t_template, if t_template->m_len changes.
(this happens if we connect to IPv4 mapped destination and then IPv6
destination, on a single AF_INET6 socket)

KAME 1.26 -> 1.28

diffstat:

 sys/netinet/tcp_subr.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r ce1c13d1bfb3 -r a777707417db sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Tue Sep 19 20:32:08 2000 +0000
+++ b/sys/netinet/tcp_subr.c    Tue Sep 19 21:02:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.91.4.1 2000/07/23 05:25:08 itojun Exp $ */
+/*     $NetBSD: tcp_subr.c,v 1.91.4.2 2000/09/19 21:02:55 itojun Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -258,9 +258,19 @@
                hlen = 0;       /*pacify gcc*/
                return NULL;    /*EAFNOSUPPORT*/
        }
-       if ((m = tp->t_template) == 0) {
+#ifdef DIAGNOSTIC
+       if (hlen + sizeof(struct tcphdr) > MCLBYTES)
+               panic("mclbytes too small for t_template");
+#endif
+       m = tp->t_template;
+       if (m && m->m_len == hlen + sizeof(struct tcphdr))
+               ;
+       else {
+               if (m)
+                       m_freem(m);
+               m = tp->t_template = NULL;
                MGETHDR(m, M_DONTWAIT, MT_HEADER);
-               if (m) {
+               if (m && hlen + sizeof(struct tcphdr) > MHLEN) {
                        MCLGET(m, M_DONTWAIT);
                        if ((m->m_flags & M_EXT) == 0) {
                                m_free(m);



Home | Main Index | Thread Index | Old Index