diff options
author | 2017-08-11 21:24:19 +0000 | |
---|---|---|
committer | 2017-08-11 21:24:19 +0000 | |
commit | aa28b9a6d024fc39940a8bf6e59c28dbaafc6950 (patch) | |
tree | ad38cdfb637269384ad7ff4acea0c6e8e71932a7 /sys/netinet | |
parent | Be consistent with goto labels, failure flag and use of FAIL macro. (diff) | |
download | wireguard-openbsd-aa28b9a6d024fc39940a8bf6e59c28dbaafc6950.tar.xz wireguard-openbsd-aa28b9a6d024fc39940a8bf6e59c28dbaafc6950.zip |
Remove NET_LOCK()'s argument.
Tested by Hrvoje Popovski, ok bluhm@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/if_ether.c | 7 | ||||
-rw-r--r-- | sys/netinet/ip_ah.c | 23 | ||||
-rw-r--r-- | sys/netinet/ip_carp.c | 19 | ||||
-rw-r--r-- | sys/netinet/ip_esp.c | 27 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 7 | ||||
-rw-r--r-- | sys/netinet/ip_ipcomp.c | 24 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.c | 27 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 9 | ||||
-rw-r--r-- | sys/netinet/tcp_timer.c | 29 |
9 files changed, 76 insertions, 96 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 9625c1fbb52..f1de465e4d3 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.230 2017/07/30 18:16:14 florian Exp $ */ +/* $OpenBSD: if_ether.c,v 1.231 2017/08/11 21:24:19 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -111,9 +111,8 @@ arptimer(void *arg) { struct timeout *to = (struct timeout *)arg; struct llinfo_arp *la, *nla; - int s; - NET_LOCK(s); + NET_LOCK(); timeout_add_sec(to, arpt_prune); LIST_FOREACH_SAFE(la, &arp_list, la_list, nla) { struct rtentry *rt = la->la_rt; @@ -121,7 +120,7 @@ arptimer(void *arg) if (rt->rt_expire && rt->rt_expire <= time_uptime) arptfree(rt); /* timer has expired; clear */ } - NET_UNLOCK(s); + NET_UNLOCK(); } void diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index fa7db0497d4..96c7a74cf04 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.130 2017/05/30 16:07:22 deraadt Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.131 2017/08/11 21:24:19 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -700,7 +700,7 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) void ah_input_cb(struct cryptop *crp) { - int s, roff, rplen, skip, protoff; + int roff, rplen, skip, protoff; unsigned char calc[AH_ALEN_MAX]; struct mbuf *m1, *m0, *m; struct auth_hash *ahx; @@ -727,7 +727,7 @@ ah_input_cb(struct cryptop *crp) return; } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -745,7 +745,7 @@ ah_input_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -830,7 +830,7 @@ ah_input_cb(struct cryptop *crp) m1 = m_getptr(m, skip, &roff); if (m1 == NULL) { ahstat.ahs_hdrops++; - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); DPRINTF(("ah_input(): bad mbuf chain for packet in SA " @@ -898,11 +898,11 @@ ah_input_cb(struct cryptop *crp) } ipsec_common_input_cb(m, tdb, skip, protoff); - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); @@ -1193,7 +1193,6 @@ ah_output_cb(struct cryptop *crp) struct tdb *tdb; struct mbuf *m; caddr_t ptr; - int s; tc = (struct tdb_crypto *) crp->crp_opaque; skip = tc->tc_skip; @@ -1210,7 +1209,7 @@ ah_output_cb(struct cryptop *crp) return; } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -1226,7 +1225,7 @@ ah_output_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -1249,11 +1248,11 @@ ah_output_cb(struct cryptop *crp) if (ipsp_process_done(m, tdb)) ahstat.ahs_outfail++; - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 5e3a0c26faf..a18d778f2e9 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.314 2017/06/22 11:34:51 tom Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.315 2017/08/11 21:24:19 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -870,11 +870,10 @@ int carp_clone_destroy(struct ifnet *ifp) { struct carp_softc *sc = ifp->if_softc; - int s; - NET_LOCK(s); + NET_LOCK(); carpdetach(sc); - NET_UNLOCK(s); + NET_UNLOCK(); ether_ifdetach(ifp); if_detach(ifp); @@ -1036,11 +1035,9 @@ carp_vhe_send_ad_all(struct carp_softc *sc) void carp_timer_ad(void *v) { - int s; - - NET_LOCK(s); + NET_LOCK(); carp_send_ad(v); - NET_UNLOCK(s); + NET_UNLOCK(); } void @@ -1548,11 +1545,9 @@ done: void carp_timer_down(void *v) { - int s; - - NET_LOCK(s); + NET_LOCK(); carp_master_down(v); - NET_UNLOCK(s); + NET_UNLOCK(); } void diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index f118e4e4583..c4a79f2f54d 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.149 2017/05/30 16:07:22 deraadt Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.150 2017/08/11 21:24:20 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -531,7 +531,7 @@ void esp_input_cb(struct cryptop *crp) { u_int8_t lastthree[3], aalg[AH_HMAC_MAX_HASHLEN]; - int s, hlen, roff, skip, protoff; + int hlen, roff, skip, protoff; struct mbuf *m1, *mo, *m; struct auth_hash *esph; struct tdb_crypto *tc; @@ -556,7 +556,7 @@ esp_input_cb(struct cryptop *crp) return; } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -574,7 +574,7 @@ esp_input_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -662,7 +662,7 @@ esp_input_cb(struct cryptop *crp) m1 = m_getptr(m, skip, &roff); if (m1 == NULL) { espstat.esps_hdrops++; - NET_UNLOCK(s); + NET_UNLOCK(); DPRINTF(("esp_input_cb(): bad mbuf chain, SA %s/%08x\n", ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)), ntohl(tdb->tdb_spi))); @@ -720,7 +720,7 @@ esp_input_cb(struct cryptop *crp) /* Verify pad length */ if (lastthree[1] + 2 > m->m_pkthdr.len - skip) { espstat.esps_badilen++; - NET_UNLOCK(s); + NET_UNLOCK(); DPRINTF(("esp_input_cb(): invalid padding length %d for " "packet in SA %s/%08x\n", lastthree[1], ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)), @@ -732,7 +732,7 @@ esp_input_cb(struct cryptop *crp) /* Verify correct decryption by checking the last padding bytes */ if ((lastthree[1] != lastthree[0]) && (lastthree[1] != 0)) { espstat.esps_badenc++; - NET_UNLOCK(s); + NET_UNLOCK(); DPRINTF(("esp_input(): decryption failed for packet in " "SA %s/%08x\n", ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)), ntohl(tdb->tdb_spi))); @@ -748,11 +748,11 @@ esp_input_cb(struct cryptop *crp) /* Back to generic IPsec input processing */ ipsec_common_input_cb(m, tdb, skip, protoff); - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); @@ -1041,7 +1041,6 @@ esp_output_cb(struct cryptop *crp) struct tdb_crypto *tc; struct tdb *tdb; struct mbuf *m; - int s; tc = (struct tdb_crypto *) crp->crp_opaque; @@ -1057,7 +1056,7 @@ esp_output_cb(struct cryptop *crp) } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -1073,7 +1072,7 @@ esp_output_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -1091,11 +1090,11 @@ esp_output_cb(struct cryptop *crp) /* Call the IPsec input callback. */ if (ipsp_process_done(m, tdb)) espstat.esps_outfail++; - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index e1f7483f409..67f2f27d749 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.317 2017/08/08 12:23:56 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.318 2017/08/11 21:24:20 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1794,7 +1794,6 @@ ip_send_dispatch(void *xmq) struct mbuf_queue *mq = xmq; struct mbuf *m; struct mbuf_list ml; - int s; #ifdef IPSEC int locked = 0; #endif /* IPSEC */ @@ -1816,11 +1815,11 @@ ip_send_dispatch(void *xmq) } #endif /* IPSEC */ - NET_LOCK(s); + NET_LOCK(); while ((m = ml_dequeue(&ml)) != NULL) { ip_output(m, NULL, NULL, 0, NULL, NULL, 0); } - NET_UNLOCK(s); + NET_UNLOCK(); #ifdef IPSEC if (locked) diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 163f4d00002..b251af9ae6b 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.56 2017/04/05 22:27:03 dhill Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.57 2017/08/11 21:24:20 mpi Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -192,7 +192,7 @@ ipcomp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) void ipcomp_input_cb(struct cryptop *crp) { - int s, skip, protoff, roff, hlen = IPCOMP_HLENGTH, clen; + int skip, protoff, roff, hlen = IPCOMP_HLENGTH, clen; u_int8_t nproto; struct mbuf *m, *m1, *mo; struct tdb_crypto *tc; @@ -217,7 +217,7 @@ ipcomp_input_cb(struct cryptop *crp) return; } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -252,7 +252,7 @@ ipcomp_input_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -332,11 +332,11 @@ ipcomp_input_cb(struct cryptop *crp) /* Back to generic IPsec input processing */ ipsec_common_input_cb(m, tdb, skip, protoff); - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); @@ -523,7 +523,7 @@ ipcomp_output_cb(struct cryptop *crp) struct tdb_crypto *tc; struct tdb *tdb; struct mbuf *m, *mo; - int s, skip, rlen, roff; + int skip, rlen, roff; u_int16_t cpi; struct ip *ip; #ifdef INET6 @@ -549,7 +549,7 @@ ipcomp_output_cb(struct cryptop *crp) return; } - NET_LOCK(s); + NET_LOCK(); tdb = gettdb(tc->tc_rdomain, tc->tc_spi, &tc->tc_dst, tc->tc_proto); if (tdb == NULL) { @@ -565,7 +565,7 @@ ipcomp_output_cb(struct cryptop *crp) /* Reset the session ID */ if (tdb->tdb_cryptoid != 0) tdb->tdb_cryptoid = crp->crp_sid; - NET_UNLOCK(s); + NET_UNLOCK(); crypto_dispatch(crp); return; } @@ -583,7 +583,7 @@ ipcomp_output_cb(struct cryptop *crp) crypto_freereq(crp); if (ipsp_process_done(m, tdb)) ipcompstat.ipcomps_outfail++; - NET_UNLOCK(s); + NET_UNLOCK(); return; } @@ -632,11 +632,11 @@ ipcomp_output_cb(struct cryptop *crp) if (ipsp_process_done(m, tdb)) ipcompstat.ipcomps_outfail++; - NET_UNLOCK(s); + NET_UNLOCK(); return; baddone: - NET_UNLOCK(s); + NET_UNLOCK(); m_freem(m); diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index 085557cf2bd..185df6f3728 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.225 2017/06/26 09:08:00 patrick Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.226 2017/08/11 21:24:20 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -536,67 +536,63 @@ void tdb_timeout(void *v) { struct tdb *tdb = v; - int s; if (!(tdb->tdb_flags & TDBF_TIMER)) return; - NET_LOCK(s); + NET_LOCK(); /* If it's an "invalid" TDB do a silent expiration. */ if (!(tdb->tdb_flags & TDBF_INVALID)) pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_HARD); tdb_delete(tdb); - NET_UNLOCK(s); + NET_UNLOCK(); } void tdb_firstuse(void *v) { struct tdb *tdb = v; - int s; if (!(tdb->tdb_flags & TDBF_SOFT_FIRSTUSE)) return; - NET_LOCK(s); + NET_LOCK(); /* If the TDB hasn't been used, don't renew it. */ if (tdb->tdb_first_use != 0) pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_HARD); tdb_delete(tdb); - NET_UNLOCK(s); + NET_UNLOCK(); } void tdb_soft_timeout(void *v) { struct tdb *tdb = v; - int s; if (!(tdb->tdb_flags & TDBF_SOFT_TIMER)) return; - NET_LOCK(s); + NET_LOCK(); /* Soft expirations. */ pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_SOFT); tdb->tdb_flags &= ~TDBF_SOFT_TIMER; - NET_UNLOCK(s); + NET_UNLOCK(); } void tdb_soft_firstuse(void *v) { struct tdb *tdb = v; - int s; if (!(tdb->tdb_flags & TDBF_SOFT_FIRSTUSE)) return; - NET_LOCK(s); + NET_LOCK(); /* If the TDB hasn't been used, don't renew it. */ if (tdb->tdb_first_use != 0) pfkeyv2_expire(tdb, SADB_EXT_LIFETIME_SOFT); tdb->tdb_flags &= ~TDBF_SOFT_FIRSTUSE; - NET_UNLOCK(s); + NET_UNLOCK(); } void @@ -993,18 +989,17 @@ void ipsp_ids_timeout(void *arg) { struct ipsec_ids *ids = arg; - int s; DPRINTF(("%s: ids %p count %d\n", __func__, ids, ids->id_refcount)); KASSERT(ids->id_refcount == 0); - NET_LOCK(s); + NET_LOCK(); RBT_REMOVE(ipsec_ids_tree, &ipsec_ids_tree, ids); RBT_REMOVE(ipsec_ids_flows, &ipsec_ids_flows, ids); free(ids->id_local, M_CREDENTIALS, 0); free(ids->id_remote, M_CREDENTIALS, 0); free(ids, M_CREDENTIALS, 0); - NET_UNLOCK(s); + NET_UNLOCK(); } /* decrements refcount, actual free happens in timeout */ diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index c847ceec16d..52c206f0bf5 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.346 2017/06/26 09:32:32 mpi Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.347 2017/08/11 21:24:20 mpi Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -3455,9 +3455,8 @@ void syn_cache_timer(void *arg) { struct syn_cache *sc = arg; - int s; - NET_LOCK(s); + NET_LOCK(); if (sc->sc_flags & SCF_DEAD) goto out; @@ -3483,14 +3482,14 @@ syn_cache_timer(void *arg) SYN_CACHE_TIMER_ARM(sc); out: - NET_UNLOCK(s); + NET_UNLOCK(); return; dropit: tcpstat_inc(tcps_sc_timed_out); syn_cache_rm(sc); syn_cache_put(sc); - NET_UNLOCK(s); + NET_UNLOCK(); } void diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 3d4bc5d0600..3f063ed9936 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.c,v 1.56 2017/05/16 12:24:02 mpi Exp $ */ +/* $OpenBSD: tcp_timer.c,v 1.57 2017/08/11 21:24:20 mpi Exp $ */ /* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */ /* @@ -105,20 +105,19 @@ void tcp_delack(void *arg) { struct tcpcb *tp = arg; - int s; /* * If tcp_output() wasn't able to transmit the ACK * for whatever reason, it will restart the delayed * ACK callout. */ - NET_LOCK(s); + NET_LOCK(); if (tp->t_flags & TF_DEAD) goto out; tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); out: - NET_UNLOCK(s); + NET_UNLOCK(); } /* @@ -187,9 +186,8 @@ tcp_timer_rexmt(void *arg) { struct tcpcb *tp = arg; uint32_t rto; - int s; - NET_LOCK(s); + NET_LOCK(); if (tp->t_flags & TF_DEAD) goto out; @@ -369,7 +367,7 @@ tcp_timer_rexmt(void *arg) (void) tcp_output(tp); out: - NET_UNLOCK(s); + NET_UNLOCK(); } void @@ -377,9 +375,8 @@ tcp_timer_persist(void *arg) { struct tcpcb *tp = arg; uint32_t rto; - int s; - NET_LOCK(s); + NET_LOCK(); if ((tp->t_flags & TF_DEAD) || TCP_TIMER_ISARMED(tp, TCPT_REXMT)) { goto out; @@ -407,16 +404,15 @@ tcp_timer_persist(void *arg) (void) tcp_output(tp); tp->t_force = 0; out: - NET_UNLOCK(s); + NET_UNLOCK(); } void tcp_timer_keep(void *arg) { struct tcpcb *tp = arg; - int s; - NET_LOCK(s); + NET_LOCK(); if (tp->t_flags & TF_DEAD) goto out; @@ -448,22 +444,21 @@ tcp_timer_keep(void *arg) } else TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); out: - NET_UNLOCK(s); + NET_UNLOCK(); return; dropit: tcpstat_inc(tcps_keepdrops); tp = tcp_drop(tp, ETIMEDOUT); - NET_UNLOCK(s); + NET_UNLOCK(); } void tcp_timer_2msl(void *arg) { struct tcpcb *tp = arg; - int s; - NET_LOCK(s); + NET_LOCK(); if (tp->t_flags & TF_DEAD) goto out; @@ -478,5 +473,5 @@ tcp_timer_2msl(void *arg) tp = tcp_close(tp); out: - NET_UNLOCK(s); + NET_UNLOCK(); } |