summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>1999-07-06 20:54:04 +0000
committerHakan Olsson <ho@cvs.openbsd.org>1999-07-06 20:54:04 +0000
commit8c93bc428d72da261b13290f026abffa704aacb9 (patch)
treeeb48fef1984a75b4cc2623e30f40fe8cb006524c
parent6295f799ea030d5bb47e477aaa1f3fe949e46c65 (diff)
ipsec_in_use could get out of sync. (Also niklas@. angelos@ ok)
-rw-r--r--sys/net/pfkeyv2.c7
-rw-r--r--sys/netinet/ip_ipsp.c7
2 files changed, 3 insertions, 11 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 46b84dc1b5e..acf9af33e1a 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1294,7 +1294,6 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
0, (struct rtentry **) 0);
delete_flow(flow, flow->flow_sa);
- ipsec_in_use--;
}
else if (!replace)
{
@@ -1312,7 +1311,6 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
goto splxret;
}
- ipsec_in_use++;
sa2->tdb_cur_allocations++;
}
else
@@ -1334,7 +1332,6 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
delete_flow(flow2, sa2);
goto splxret;
}
- ipsec_in_use++;
}
else if (rt_setgate(rt, rt_key(rt), (struct sockaddr *) &encapgw))
{
@@ -1362,7 +1359,6 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
(struct rtentry **) 0);
delete_flow(flow2, flow2->flow_sa);
- ipsec_in_use--;
}
else if (!replace)
{
@@ -1385,11 +1381,9 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
delete_flow(flow, sa2);
delete_flow(flow2, sa2);
- ipsec_in_use--;
goto splxret;
}
- ipsec_in_use++;
sa2->tdb_cur_allocations++;
}
else
@@ -1418,7 +1412,6 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
delete_flow(flow2, sa2);
goto splxret;
}
- ipsec_in_use++;
}
else if (rt_setgate(rt, rt_key(rt),
(struct sockaddr *) &encapgw))
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 749c747c347..54d22e3d5f6 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.47 1999/07/06 20:17:52 cmetz Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.48 1999/07/06 20:54:03 ho Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -449,6 +449,7 @@ get_flow(void)
MALLOC(flow, struct flow *, sizeof(struct flow), M_TDB, M_WAITOK);
bzero(flow, sizeof(struct flow));
+ ipsec_in_use++;
return flow;
}
@@ -834,6 +835,7 @@ delete_flow(struct flow *flow, struct tdb *tdb)
}
}
+ ipsec_in_use--;
FREE(flow, M_TDB);
}
@@ -890,10 +892,7 @@ tdb_delete(struct tdb *tdbp, int delchain, int expflags)
(*(tdbp->tdb_xform->xf_zeroize))(tdbp);
while (tdbp->tdb_flow)
- {
delete_flow(tdbp->tdb_flow, tdbp);
- ipsec_in_use--;
- }
/* Cleanup SA-Bindings */
for (tdbpp = TAILQ_FIRST(&tdbp->tdb_bind_in); tdbpp;