summaryrefslogtreecommitdiffhomepage
path: root/src/peer.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-09-22 03:51:39 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-09-24 23:10:15 +0200
commit18e49c76cfe5efe9c10a5ed2f59f694c98c30390 (patch)
treebc5813d1f9d3d16853b5491980ce960737ba747f /src/peer.c
parent7895086b4f2497cb8a2e75d24d4a40b6d0b018b5 (diff)
timers: convert to use netif_running
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/peer.c b/src/peer.c
index cebda70..01b12fa 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -25,6 +25,7 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
peer = kzalloc(sizeof(struct wireguard_peer), GFP_KERNEL);
if (!peer)
return NULL;
+ peer->device = wg;
if (dst_cache_init(&peer->endpoint_cache, GFP_KERNEL)) {
kfree(peer);
@@ -33,7 +34,6 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
peer->internal_id = atomic64_inc_return(&peer_counter);
peer->serial_work_cpu = nr_cpumask_bits;
- peer->device = wg;
cookie_init(&peer->latest_cookie);
if (!noise_handshake_init(&peer->handshake, &wg->static_identity, public_key, preshared_key, peer)) {
kfree(peer);
@@ -49,6 +49,7 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
packet_queue_init(&peer->tx_queue, packet_tx_worker, false);
packet_queue_init(&peer->rx_queue, packet_rx_worker, false);
skb_queue_head_init(&peer->staged_packet_queue);
+ timers_init(peer);
pr_debug("%s: Peer %Lu created\n", wg->dev->name, peer->internal_id);
return peer;
}
@@ -80,7 +81,7 @@ void peer_remove(struct wireguard_peer *peer)
noise_handshake_clear(&peer->handshake);
noise_keypairs_clear(&peer->keypairs);
list_del(&peer->peer_list);
- timers_uninit_peer(peer);
+ timers_stop(peer);
routing_table_remove_by_peer(&peer->device->peer_routing_table, peer);
pubkey_hashtable_remove(&peer->device->peer_hashtable, peer);
skb_queue_purge(&peer->staged_packet_queue);