diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 03:54:28 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 04:07:05 +0200 |
commit | c9e14e27b99db66ba4c410e19e5067e9b7fcadb4 (patch) | |
tree | 2a0307d62c323733d67626db83903150677916d2 | |
parent | global: rename struct wireguard_ to struct wg_ (diff) | |
download | wireguard-monolithic-historical-c9e14e27b99db66ba4c410e19e5067e9b7fcadb4.tar.xz wireguard-monolithic-historical-c9e14e27b99db66ba4c410e19e5067e9b7fcadb4.zip |
global: more nits
-rw-r--r-- | src/noise.c | 4 | ||||
-rw-r--r-- | src/noise.h | 3 | ||||
-rw-r--r-- | src/peer.c | 2 | ||||
-rw-r--r-- | src/queueing.h | 3 | ||||
-rw-r--r-- | src/selftest/allowedips.c | 3 |
5 files changed, 12 insertions, 3 deletions
diff --git a/src/noise.c b/src/noise.c index 00310c2..ce1abba 100644 --- a/src/noise.c +++ b/src/noise.c @@ -206,8 +206,8 @@ static void add_new_keypair(struct noise_keypairs *keypairs, next_keypair); wg_noise_keypair_put(current_keypair, true); } else /* If there wasn't an existing next keypair, we replace - * the previous with the current one. - */ + * the previous with the current one. + */ rcu_assign_pointer(keypairs->previous_keypair, current_keypair); /* At this point we can get rid of the old previous keypair, and diff --git a/src/noise.h b/src/noise.h index a67fd3f..48fb3fc 100644 --- a/src/noise.h +++ b/src/noise.h @@ -87,7 +87,8 @@ struct noise_handshake { __le32 remote_index; /* Protects all members except the immutable (after noise_handshake_ - * init): remote_static, precomputed_static_static, static_identity. */ + * init): remote_static, precomputed_static_static, static_identity. + */ struct rw_semaphore lock; }; @@ -149,6 +149,7 @@ void wg_peer_remove(struct wg_peer *peer) static void rcu_release(struct rcu_head *rcu) { struct wg_peer *peer = container_of(rcu, struct wg_peer, rcu); + dst_cache_destroy(&peer->endpoint_cache); wg_packet_queue_free(&peer->rx_queue, false); wg_packet_queue_free(&peer->tx_queue, false); @@ -158,6 +159,7 @@ static void rcu_release(struct rcu_head *rcu) static void kref_release(struct kref *refcount) { struct wg_peer *peer = container_of(refcount, struct wg_peer, refcount); + pr_debug("%s: Peer %llu (%pISpfsc) destroyed\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr); diff --git a/src/queueing.h b/src/queueing.h index 281d325..36fa08d 100644 --- a/src/queueing.h +++ b/src/queueing.h @@ -83,6 +83,7 @@ static inline __be16 wg_skb_examine_untrusted_ip_hdr(struct sk_buff *skb) static inline void wg_reset_packet(struct sk_buff *skb) { const int pfmemalloc = skb->pfmemalloc; + skb_scrub_packet(skb, true); memset(&skb->headers_start, 0, offsetof(struct sk_buff, headers_end) - @@ -166,6 +167,7 @@ static inline void wg_queue_enqueue_per_peer(struct crypt_queue *queue, * peer can be freed from below us. */ struct wg_peer *peer = wg_peer_get(PACKET_PEER(skb)); + atomic_set_release(&PACKET_CB(skb)->state, state); queue_work_on(wg_cpumask_choose_online(&peer->serial_work_cpu, peer->internal_id), @@ -181,6 +183,7 @@ static inline void wg_queue_enqueue_per_peer_napi(struct crypt_queue *queue, * peer can be freed from below us. */ struct wg_peer *peer = wg_peer_get(PACKET_PEER(skb)); + atomic_set_release(&PACKET_CB(skb)->state, state); napi_schedule(&peer->napi); wg_peer_put(peer); diff --git a/src/selftest/allowedips.c b/src/selftest/allowedips.c index 6c98486..d15a0a0 100644 --- a/src/selftest/allowedips.c +++ b/src/selftest/allowedips.c @@ -48,6 +48,7 @@ static __init void print_node(struct allowedips_node *node, u8 bits) } if (node->peer) { hsiphash_key_t key = { 0 }; + memcpy(&key, &node->peer, sizeof(node->peer)); color = hsiphash_1u32(0xdeadbeef, &key) % 200 << 16 | hsiphash_1u32(0xbabecafe, &key) % 200 << 8 | @@ -427,6 +428,7 @@ free: static __init inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) { static struct in_addr ip; + u8 *split = (u8 *)&ip; split[0] = a; split[1] = b; @@ -438,6 +440,7 @@ static __init inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) static __init inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d) { static struct in6_addr ip; + __be32 *split = (__be32 *)&ip; split[0] = cpu_to_be32(a); split[1] = cpu_to_be32(b); |