diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-11-01 22:53:35 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-11-01 22:53:35 +0000 |
commit | bf112579d3d7f5196a96df884e99f1755ce8a4d2 (patch) | |
tree | fa719dc9920b237c4db099e7e1259ec279c1a427 /sys/netinet6 | |
parent | 1a8a70b888e42a68de1b5d0ec07f8fba2f660dc3 (diff) |
Replace the nd6 llinfo malloc(9) with pool_get(9) like arp does.
OK mpi@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/nd6.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 2e8b59e7a8e..7edf8861ce7 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.168 2015/11/01 17:02:44 bluhm Exp $ */ +/* $OpenBSD: nd6.c,v 1.169 2015/11/01 22:53:34 bluhm Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -39,6 +39,7 @@ #include <sys/sockio.h> #include <sys/time.h> #include <sys/kernel.h> +#include <sys/pool.h> #include <sys/protosw.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -82,6 +83,7 @@ int nd6_debug = 1; int nd6_debug = 0; #endif +struct pool nd6_pool; /* pool for llinfo_nd6 structures */ static int nd6_inuse, nd6_allocated; struct llinfo_nd6 llinfo_nd6 = {&llinfo_nd6, &llinfo_nd6}; @@ -123,6 +125,8 @@ nd6_init(void) return; } + pool_init(&nd6_pool, sizeof(struct llinfo_nd6), 0, 0, 0, "nd6", NULL); + /* initialization of the default router list */ TAILQ_INIT(&nd_defrouter); @@ -996,10 +1000,10 @@ nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) * Case 2: This route may come from cloning, or a manual route * add with a LL address. */ - ln = malloc(sizeof(*ln), M_RTABLE, M_NOWAIT | M_ZERO); + ln = pool_get(&nd6_pool, PR_NOWAIT | PR_ZERO); rt->rt_llinfo = (caddr_t)ln; if (ln == NULL) { - log(LOG_DEBUG, "%s: malloc failed\n", __func__); + log(LOG_DEBUG, "%s: pool get failed\n", __func__); break; } nd6_inuse++; @@ -1126,7 +1130,7 @@ nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) rt->rt_llinfo = NULL; rt->rt_flags &= ~RTF_LLINFO; m_freem(ln->ln_hold); - free(ln, M_RTABLE, 0); + pool_put(&nd6_pool, ln); } } |