diff options
-rw-r--r-- | sys/netinet/tcp_input.c | 18 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 11 | ||||
-rw-r--r-- | sys/netinet/tcp_timer.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 3 |
4 files changed, 22 insertions, 14 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 6e4ee27297d..5c3bb764f76 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.102 2002/01/14 20:09:42 provos Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.103 2002/01/15 19:18:01 provos Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2424,7 +2424,7 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen) continue; if (tp->snd_holes == NULL) { /* first hole */ tp->snd_holes = (struct sackhole *) - malloc(sizeof(struct sackhole), M_PCB, M_NOWAIT); + pool_get(&sackhl_pool, PR_NOWAIT); if (tp->snd_holes == NULL) { /* ENOBUFS, so ignore SACKed block for now*/ continue; @@ -2478,11 +2478,11 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen) /* Acks entire hole, so delete hole */ if (p != cur) { p->next = cur->next; - free(cur, M_PCB); + pool_put(&sackhl_pool, cur); cur = p->next; } else { cur = cur->next; - free(p, M_PCB); + pool_put(&sackhl_pool, p); p = cur; tp->snd_holes = p; } @@ -2520,8 +2520,8 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen) * ACKs some data in middle of a hole; need to * split current hole */ - temp = (struct sackhole *)malloc(sizeof(*temp), - M_PCB,M_NOWAIT); + temp = (struct sackhole *) + pool_get(&sackhl_pool, PR_NOWAIT); if (temp == NULL) continue; /* ENOBUFS */ #if defined(TCP_SACK) && defined(TCP_FACK) @@ -2557,8 +2557,8 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen) * Need to append new hole at end. * Last hole is p (and it's not NULL). */ - temp = (struct sackhole *) malloc(sizeof(*temp), - M_PCB, M_NOWAIT); + temp = (struct sackhole *) + pool_get(&sackhl_pool, PR_NOWAIT); if (temp == NULL) continue; /* ENOBUFS */ temp->start = tp->rcv_lastsack; @@ -2612,7 +2612,7 @@ tcp_del_sackholes(tp, th) if (SEQ_LEQ(cur->end, lastack)) { prev = cur; cur = cur->next; - free(prev, M_PCB); + pool_put(&sackhl_pool, prev); tp->snd_numholes--; } else if (SEQ_LT(cur->start, lastack)) { cur->start = lastack; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index e70f4406909..d32a1252028 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.54 2002/01/15 16:59:08 provos Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.55 2002/01/15 19:18:01 provos Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -144,6 +144,9 @@ extern int ip6_defhlim; #endif /* INET6 */ struct pool tcpcb_pool; +#ifdef TCP_SACK +struct pool sackhl_pool; +#endif struct tcpstat tcpstat; /* tcp statistics */ @@ -158,6 +161,10 @@ tcp_init() #endif /* TCP_COMPAT_42 */ pool_init(&tcpcb_pool, sizeof(struct tcpcb), 0, 0, 0, "tcpcbpl", 0, NULL, NULL, M_PCB); +#ifdef TCP_SACK + pool_init(&sackhl_pool, sizeof(struct sackhole), 0, 0, 0, "sackhlpl", + 0, NULL, NULL, M_PCB); +#endif /* TCP_SACK */ in_pcbinit(&tcbtable, tcbhashsize); tcp_now = arc4random() / 2; @@ -680,7 +687,7 @@ tcp_close(tp) q = p = tp->snd_holes; while (p != 0) { q = p->next; - free(p, M_PCB); + pool_put(&sackhl_pool, p); p = q; } #endif diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 695547cdbcf..763650405e1 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.c,v 1.25 2002/01/14 20:13:45 provos Exp $ */ +/* $OpenBSD: tcp_timer.c,v 1.26 2002/01/15 19:18:01 provos Exp $ */ /* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */ /* @@ -181,7 +181,7 @@ tcp_timers(tp, timer) while (q != NULL) { p = q; q = q->next; - free(p, M_PCB); + pool_put(&sackhl_pool, p); } tp->snd_holes = 0; #if defined(TCP_SACK) && defined(TCP_FACK) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index fd7a7e2c2d6..87d9f95b6a7 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.37 2001/06/23 06:03:13 angelos Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.38 2002/01/15 19:18:01 provos Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -326,6 +326,7 @@ extern int tcp_do_rfc1323; /* enabled/disabled? */ extern int tcp_mssdflt; /* default maximum segment size */ #ifdef TCP_SACK extern int tcp_do_sack; /* SACK enabled/disabled */ +extern struct pool sackhl_pool; #endif int tcp_attach __P((struct socket *)); |