summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/xform_ah.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-09-01 05:35:55 +0000
committersam <sam@FreeBSD.org>2003-09-01 05:35:55 +0000
commit7a8c89dde15c19a8c1e8eb2976dc9936d9b7329c (patch)
treec44de6fcda02feb74d7dccf3bde0ea476169307f /sys/netipsec/xform_ah.c
parent591fec46c46db5741955ea71f2571001a039f4d0 (diff)
downloadFreeBSD-src-7a8c89dde15c19a8c1e8eb2976dc9936d9b7329c.zip
FreeBSD-src-7a8c89dde15c19a8c1e8eb2976dc9936d9b7329c.tar.gz
Locking and misc cleanups; most of which I've been running for >4 months:
o add locking o strip irrelevant spl's o split malloc types to better account for memory use o remove unused IPSEC_NONBLOCK_ACQUIRE code o remove dead code Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/netipsec/xform_ah.c')
-rw-r--r--sys/netipsec/xform_ah.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/netipsec/xform_ah.c b/sys/netipsec/xform_ah.c
index 1d67703..795701b 100644
--- a/sys/netipsec/xform_ah.c
+++ b/sys/netipsec/xform_ah.c
@@ -738,7 +738,7 @@ ah_input_cb(struct cryptop *crp)
struct secasindex *saidx;
u_int8_t nxt;
caddr_t ptr;
- int s, authsize;
+ int authsize;
crd = crp->crp_desc;
@@ -750,8 +750,6 @@ ah_input_cb(struct cryptop *crp)
mtag = (struct m_tag *) tc->tc_ptr;
m = (struct mbuf *) crp->crp_buf;
- s = splnet();
-
sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
if (sav == NULL) {
ahstat.ahs_notdb++;
@@ -866,12 +864,11 @@ ah_input_cb(struct cryptop *crp)
IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag);
KEY_FREESAV(&sav);
- splx(s);
+
return error;
bad:
if (sav)
KEY_FREESAV(&sav);
- splx(s);
if (m != NULL)
m_freem(m);
if (tc != NULL)
@@ -1123,7 +1120,7 @@ ah_output_cb(struct cryptop *crp)
struct secasvar *sav;
struct mbuf *m;
caddr_t ptr;
- int s, err;
+ int err;
tc = (struct tdb_crypto *) crp->crp_opaque;
KASSERT(tc != NULL, ("ah_output_cb: null opaque data area!"));
@@ -1132,9 +1129,8 @@ ah_output_cb(struct cryptop *crp)
ptr = (caddr_t) (tc + 1);
m = (struct mbuf *) crp->crp_buf;
- s = splnet();
-
isr = tc->tc_isr;
+ mtx_lock(&isr->lock);
sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
if (sav == NULL) {
ahstat.ahs_notdb++;
@@ -1151,7 +1147,7 @@ ah_output_cb(struct cryptop *crp)
if (crp->crp_etype == EAGAIN) {
KEY_FREESAV(&sav);
- splx(s);
+ mtx_unlock(&isr->lock);
return crypto_dispatch(crp);
}
@@ -1183,12 +1179,13 @@ ah_output_cb(struct cryptop *crp)
/* NB: m is reclaimed by ipsec_process_done. */
err = ipsec_process_done(m, isr);
KEY_FREESAV(&sav);
- splx(s);
+ mtx_unlock(&isr->lock);
+
return err;
bad:
if (sav)
KEY_FREESAV(&sav);
- splx(s);
+ mtx_unlock(&isr->lock);
if (m)
m_freem(m);
free(tc, M_XDATA);
OpenPOWER on IntegriCloud