diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-06-08 13:58:10 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-06-08 13:58:10 +0000 |
commit | e6bbff8e72d3823f576dc11b78661638f576114e (patch) | |
tree | 34c080b5026b438e4cf92b657cbc05ae36277837 | |
parent | d177b1d3680c458f6fe4c70d0f20089ab8965c46 (diff) |
alloc ipq's for fragment reassembly from a pool instead of using
malloc();
ok henning@ some time ago
-rw-r--r-- | sys/netinet/ip_input.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 93007462da2..9033860ebbd 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.159 2008/05/09 02:44:54 markus Exp $ */ +/* $OpenBSD: ip_input.c,v 1.160 2008/06/08 13:58:09 thib Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -138,6 +138,7 @@ struct in_ifaddrhead in_ifaddr; struct ifqueue ipintrq; struct pool ipqent_pool; +struct pool ipq_pool; struct ipstat ipstat; @@ -186,6 +187,8 @@ ip_init() pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl", NULL); + pool_init(&ipq_pool, sizeof(struct ipq), 0, 0, 0, "ipqpl", + NULL); pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == 0) @@ -726,8 +729,8 @@ ip_reass(ipqe, fp) /* * If first fragment to arrive, create a reassembly queue. */ - if (fp == 0) { - fp = malloc(sizeof (struct ipq), M_FTABLE, M_NOWAIT); + if (fp == NULL) { + fp = pool_get(&ipq_pool, PR_NOWAIT); if (fp == NULL) goto dropfrag; LIST_INSERT_HEAD(&ipq, fp, ipq_q); @@ -864,7 +867,7 @@ insert: ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; LIST_REMOVE(fp, ipq_q); - free(fp, M_FTABLE); + pool_put(&ipq_pool, fp); m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); /* some debugging cruft by sklower, below, will go away soon */ @@ -903,7 +906,7 @@ ip_freef(fp) ip_frags--; } LIST_REMOVE(fp, ipq_q); - free(fp, M_FTABLE); + pool_put(&ipq_pool, fp); } /* |