aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/peer.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-05-24 19:18:04 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-05-30 18:07:28 +0200
commit6e6986e17d0dc99903c5134c7c0c8e78fbec7831 (patch)
treef1a571f1c04e021113abb3572dc31b44401a7634 /src/peer.c
parentnoise: precompute static-static ECDH operation (diff)
downloadwireguard-monolithic-historical-6e6986e17d0dc99903c5134c7c0c8e78fbec7831.tar.xz
wireguard-monolithic-historical-6e6986e17d0dc99903c5134c7c0c8e78fbec7831.zip
peer: use iterator macro instead of callback
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/peer.c b/src/peer.c
index 411a82e..fc7ee0a 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -108,33 +108,6 @@ void peer_put(struct wireguard_peer *peer)
kref_put(&peer->refcount, kref_release);
}
-int peer_for_each_unlocked(struct wireguard_device *wg, int (*fn)(struct wireguard_peer *peer, void *ctx), void *data)
-{
- struct wireguard_peer *peer, *temp;
- int ret = 0;
-
- lockdep_assert_held(&wg->device_update_lock);
- list_for_each_entry_safe(peer, temp, &wg->peer_list, peer_list) {
- peer = peer_rcu_get(peer);
- if (unlikely(!peer))
- continue;
- ret = fn(peer, data);
- peer_put(peer);
- if (ret < 0)
- break;
- }
- return ret;
-}
-
-int peer_for_each(struct wireguard_device *wg, int (*fn)(struct wireguard_peer *peer, void *ctx), void *data)
-{
- int ret;
- mutex_lock(&wg->device_update_lock);
- ret = peer_for_each_unlocked(wg, fn, data);
- mutex_unlock(&wg->device_update_lock);
- return ret;
-}
-
void peer_remove_all(struct wireguard_device *wg)
{
struct wireguard_peer *peer, *temp;