diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-03-08 22:30:39 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-03-08 22:30:39 +0000 |
commit | 92c1ff9981daef2a2466f2d57464a575c4cfceec (patch) | |
tree | 231dd39ae4d011103eb32875be7250f76556b9c8 /sys/netinet | |
parent | 02da191fa3d6571b8ce2b47a78b0bdad3c4439b9 (diff) |
In IPsec policy replace integer refcount with atomic refcount.
OK tobhe@ mvs@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_ipsp.h | 4 | ||||
-rw-r--r-- | sys/netinet/ip_spd.c | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index 3b9c82691d5..4610727bf04 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.235 2022/03/02 20:16:43 bluhm Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.236 2022/03/08 22:30:38 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -281,7 +281,7 @@ struct ipsec_policy { u_int8_t ipo_sproto; /* ESP/AH; if zero, use system dflts */ u_int ipo_rdomain; - int ipo_ref_count; + struct refcnt ipo_refcnt; struct tdb *ipo_tdb; /* [p] Cached TDB entry */ diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index 4f5b4f24dcc..a3eddb19b5d 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.113 2022/03/06 15:24:50 bluhm Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.114 2022/03/08 22:30:38 bluhm Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -666,11 +666,10 @@ ipsec_delete_policy(struct ipsec_policy *ipo) struct ipsec_acquire *ipa; struct radix_node_head *rnh; struct radix_node *rn = (struct radix_node *)ipo; - int err = 0; NET_ASSERT_LOCKED(); - if (--ipo->ipo_ref_count > 0) + if (refcnt_rele(&ipo->ipo_refcnt) == 0) return 0; /* Delete from SPD. */ @@ -699,7 +698,7 @@ ipsec_delete_policy(struct ipsec_policy *ipo) pool_put(&ipsec_policy_pool, ipo); - return err; + return 0; } void |