summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>1999-06-01 23:43:43 +0000
committerHakan Olsson <ho@cvs.openbsd.org>1999-06-01 23:43:43 +0000
commit83226c98c22fe6057e7b537a7ff0b34d8e4670f1 (patch)
tree79126e401ee1c50dc834f58b3a0aa94b69220410 /sys/net
parent71f28fb5b9b69242cdb2409406fadb49fae0141e (diff)
Introduce M_PFKEY kmem type, and use it. (angelos@ ok)
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pfkey.c10
-rw-r--r--sys/net/pfkeyv2.c32
2 files changed, 21 insertions, 21 deletions
diff --git a/sys/net/pfkey.c b/sys/net/pfkey.c
index 46a0a4f33fa..ba820e40b6f 100644
--- a/sys/net/pfkey.c
+++ b/sys/net/pfkey.c
@@ -135,7 +135,7 @@ pfkey_output(struct mbuf *mbuf, struct socket *socket)
goto ret;
}
- if (!(message = malloc((unsigned long) mbuf->m_pkthdr.len, M_TEMP,
+ if (!(message = malloc((unsigned long) mbuf->m_pkthdr.len, M_PFKEY,
M_DONTWAIT))) {
error = ENOMEM;
goto ret;
@@ -270,7 +270,7 @@ pfkey_buildprotosw(void)
j++;
if (j) {
- if (!(protosw = malloc(j * sizeof(struct protosw), M_TEMP, M_DONTWAIT)))
+ if (!(protosw = malloc(j * sizeof(struct protosw), M_PFKEY, M_DONTWAIT)))
return ENOMEM;
for (i = 0, p = protosw; i <= PFKEY_PROTOCOL_MAX; i++)
@@ -281,18 +281,18 @@ pfkey_buildprotosw(void)
}
if (pfkey_domain.dom_protosw)
- free(pfkey_domain.dom_protosw, M_TEMP);
+ free(pfkey_domain.dom_protosw, M_PFKEY);
pfkey_domain.dom_protosw = protosw;
pfkey_domain.dom_protoswNPROTOSW = p;
} else {
- if (!(protosw = malloc(sizeof(struct protosw), M_TEMP, M_DONTWAIT)))
+ if (!(protosw = malloc(sizeof(struct protosw), M_PFKEY, M_DONTWAIT)))
return ENOMEM;
bcopy(&pfkey_protosw_template, protosw, sizeof(struct protosw));
if (pfkey_domain.dom_protosw)
- free(pfkey_domain.dom_protosw, M_TEMP);
+ free(pfkey_domain.dom_protosw, M_PFKEY);
pfkey_domain.dom_protosw = protosw;
pfkey_domain.dom_protoswNPROTOSW = protosw;
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 13cbc5f4e6b..f38c06d9ce4 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -118,7 +118,7 @@ pfkeyv2_create(struct socket *socket)
{
struct pfkeyv2_socket *pfkeyv2_socket;
- if (!(pfkeyv2_socket = malloc(sizeof(struct pfkeyv2_socket), M_TEMP,
+ if (!(pfkeyv2_socket = malloc(sizeof(struct pfkeyv2_socket), M_PFKEY,
M_DONTWAIT)))
return ENOMEM;
@@ -154,7 +154,7 @@ pfkeyv2_release(struct socket *socket)
if (pfkeyv2_socket->flags & PFKEYV2_SOCKETFLAGS_PROMISC)
npromisc--;
- free(pfkeyv2_socket, M_TEMP);
+ free(pfkeyv2_socket, M_PFKEY);
}
return 0;
@@ -460,7 +460,7 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *socket,
if (headers[i])
j += ((struct sadb_ext *)headers[i])->sadb_ext_len * sizeof(uint64_t);
- if (!(buffer = malloc(j + sizeof(struct sadb_msg), M_TEMP, M_DONTWAIT))) {
+ if (!(buffer = malloc(j + sizeof(struct sadb_msg), M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -550,7 +550,7 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *socket,
ret:
if (buffer != NULL) {
bzero(buffer, j + sizeof(struct sadb_msg));
- free(buffer, M_TEMP);
+ free(buffer, M_PFKEY);
}
return rval;
}
@@ -589,7 +589,7 @@ pfkeyv2_get(struct tdb *sa, void **headers, void **buffer)
if (sa->tdb_dstid_len)
i += PADUP(sa->tdb_dstid_len) + sizeof(struct sadb_ident);
- if (!(p = malloc(i, M_TEMP, M_DONTWAIT))) {
+ if (!(p = malloc(i, M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -664,7 +664,7 @@ pfkeyv2_dump_walker(struct tdb *sa, void *state)
return rval;
rval = pfkeyv2_sendmessage(headers, PFKEYV2_SENDMESSAGE_UNICAST,
dump_state->socket, 0, 0);
- free(buffer, M_TEMP);
+ free(buffer, M_PFKEY);
if (rval)
return rval;
}
@@ -699,7 +699,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
if (npromisc) {
struct mbuf *packet;
- if (!(freeme = malloc(sizeof(struct sadb_msg) + len, M_TEMP,
+ if (!(freeme = malloc(sizeof(struct sadb_msg) + len, M_PFKEY,
M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
@@ -726,7 +726,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
m_freem(packet);
bzero(freeme, sizeof(struct sadb_msg) + len);
- free(freeme, M_TEMP);
+ free(freeme, M_PFKEY);
freeme = NULL;
}
@@ -788,7 +788,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
if (sa.tdb_spi == 0)
goto ret;
- if (!(freeme = malloc(sizeof(struct sadb_sa), M_TEMP, M_DONTWAIT))) {
+ if (!(freeme = malloc(sizeof(struct sadb_sa), M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -1065,7 +1065,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
i = sizeof(struct sadb_supported) + sizeof(ealgs) + sizeof(aalgs);
- if (!(freeme = malloc(i, M_TEMP, M_DONTWAIT))) {
+ if (!(freeme = malloc(i, M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -1608,8 +1608,8 @@ ret:
realret:
if (freeme)
- free(freeme, M_TEMP);
- free(message, M_TEMP);
+ free(freeme, M_PFKEY);
+ free(message, M_PFKEY);
return rval;
@@ -1641,7 +1641,7 @@ pfkeyv2_acquire(void *os)
i += PADUP(os->rekeysa->srcident.bytes) +
PADUP(os->rekeysa->dstident.bytes);
- if (!(p = malloc(i, M_TEMP, M_DONTWAIT))) {
+ if (!(p = malloc(i, M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -1732,7 +1732,7 @@ pfkeyv2_acquire(void *os)
ret:
if (buffer != NULL) {
bzero(buffer, i);
- free(buffer, M_TEMP);
+ free(buffer, M_PFKEY);
}
return rval;
#endif
@@ -1767,7 +1767,7 @@ pfkeyv2_expire(struct tdb *sa, u_int16_t type)
sizeof(struct sadb_address) + PADUP(SA_LEN(&sa->tdb_src.sa)) +
sizeof(struct sadb_address) + PADUP(SA_LEN(&sa->tdb_dst.sa));
- if (!(p = malloc(i, M_TEMP, M_DONTWAIT))) {
+ if (!(p = malloc(i, M_PFKEY, M_DONTWAIT))) {
rval = ENOMEM;
goto ret;
}
@@ -1809,7 +1809,7 @@ pfkeyv2_expire(struct tdb *sa, u_int16_t type)
ret:
if (buffer != NULL) {
bzero(buffer, i);
- free(buffer, M_TEMP);
+ free(buffer, M_PFKEY);
}
return rval;
}