summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/compat/compat.h7
-rw-r--r--src/config.c11
-rw-r--r--src/cookie.c4
-rw-r--r--src/data.c2
-rw-r--r--src/device.c1
-rw-r--r--src/device.h1
-rw-r--r--src/noise.c4
-rw-r--r--src/peer.c4
-rw-r--r--src/receive.c30
-rw-r--r--src/send.c10
-rw-r--r--src/socket.c16
-rw-r--r--src/timers.c8
12 files changed, 46 insertions, 52 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 524fe6f..a1a5061 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -378,13 +378,6 @@ static inline void new_icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32
#define icmpv6_send(a,b,c,d) new_icmpv6_send(a,b,c,d)
#endif
-/* https://lkml.org/lkml/2015/6/12/415 */
-#include <linux/netdevice.h>
-static inline struct net_device *netdev_pub(void *dev)
-{
- return (struct net_device *)((char *)dev - ALIGN(sizeof(struct net_device), NETDEV_ALIGN));
-}
-
/* PaX compatibility */
#ifdef CONSTIFY_PLUGIN
#include <linux/cache.h>
diff --git a/src/config.c b/src/config.c
index d3b6611..7ffc529 100644
--- a/src/config.c
+++ b/src/config.c
@@ -14,7 +14,7 @@ static int set_device_port(struct wireguard_device *wg, u16 port)
struct wireguard_peer *peer, *temp;
socket_uninit(wg);
wg->incoming_port = port;
- if (!(netdev_pub(wg)->flags & IFF_UP))
+ if (!(wg->dev->flags & IFF_UP))
return 0;
peer_for_each (wg, peer, temp, false)
socket_clear_peer_endpoint_src(peer);
@@ -72,7 +72,7 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t
peer = peer_rcu_get(peer_create(wg, in_peer.public_key, in_peer.preshared_key));
if (!peer)
return -ENOMEM;
- if (netdev_pub(wg)->flags & IFF_UP)
+ if (wg->dev->flags & IFF_UP)
timers_init_peer(peer);
}
@@ -107,13 +107,13 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t
}
if (in_peer.persistent_keepalive_interval != (u16)-1) {
- const bool send_keepalive = !peer->persistent_keepalive_interval && in_peer.persistent_keepalive_interval && netdev_pub(wg)->flags & IFF_UP;
+ const bool send_keepalive = !peer->persistent_keepalive_interval && in_peer.persistent_keepalive_interval && wg->dev->flags & IFF_UP;
peer->persistent_keepalive_interval = (unsigned long)in_peer.persistent_keepalive_interval * HZ;
if (send_keepalive)
packet_send_keepalive(peer);
}
- if (netdev_pub(wg)->flags & IFF_UP)
+ if (wg->dev->flags & IFF_UP)
packet_send_queue(peer);
peer_put(peer);
@@ -289,7 +289,6 @@ int config_get_device(struct wireguard_device *wg, void __user *user_device)
{
int ret;
struct wireguard_peer *peer, *temp;
- struct net_device *dev = netdev_pub(wg);
struct data_remaining peer_data = { NULL };
struct wgdevice out_device;
struct wgdevice in_device;
@@ -318,7 +317,7 @@ int config_get_device(struct wireguard_device *wg, void __user *user_device)
out_device.version_magic = WG_API_VERSION_MAGIC;
out_device.port = wg->incoming_port;
out_device.fwmark = wg->fwmark;
- memcpy(out_device.interface, dev->name, IFNAMSIZ);
+ memcpy(out_device.interface, wg->dev->name, IFNAMSIZ);
down_read(&wg->static_identity.lock);
if (wg->static_identity.has_identity) {
diff --git a/src/cookie.c b/src/cookie.c
index 33beea8..ec58903 100644
--- a/src/cookie.c
+++ b/src/cookie.c
@@ -119,7 +119,7 @@ enum cookie_mac_state cookie_validate_packet(struct cookie_checker *checker, str
goto out;
ret = VALID_MAC_WITH_COOKIE_BUT_RATELIMITED;
- if (!ratelimiter_allow(skb, dev_net(netdev_pub(checker->device))))
+ if (!ratelimiter_allow(skb, dev_net(checker->device->dev)))
goto out;
ret = VALID_MAC_WITH_COOKIE;
@@ -185,7 +185,7 @@ void cookie_message_consume(struct message_handshake_cookie *src, struct wiregua
entry->peer->latest_cookie.have_sent_mac1 = false;
up_write(&entry->peer->latest_cookie.lock);
} else
- net_dbg_ratelimited("%s: Could not decrypt invalid cookie response\n", netdev_pub(wg)->name);
+ net_dbg_ratelimited("%s: Could not decrypt invalid cookie response\n", wg->dev->name);
out:
peer_put(entry->peer);
diff --git a/src/data.c b/src/data.c
index be6bf7f..cab99ef 100644
--- a/src/data.c
+++ b/src/data.c
@@ -351,7 +351,7 @@ static void finish_decrypt_packet(struct decryption_ctx *ctx)
return;
if (unlikely(!counter_validate(&ctx->keypair->receiving.counter, PACKET_CB(ctx->skb)->nonce))) {
- net_dbg_ratelimited("%s: Packet has invalid nonce %Lu (max %Lu)\n", netdev_pub(ctx->keypair->entry.peer->device)->name, PACKET_CB(ctx->skb)->nonce, ctx->keypair->receiving.counter.receive.counter);
+ net_dbg_ratelimited("%s: Packet has invalid nonce %Lu (max %Lu)\n", ctx->keypair->entry.peer->device->dev->name, PACKET_CB(ctx->skb)->nonce, ctx->keypair->receiving.counter.receive.counter);
peer_put(ctx->keypair->entry.peer);
noise_keypair_put(ctx->keypair);
dev_kfree_skb(ctx->skb);
diff --git a/src/device.c b/src/device.c
index 8ac433d..cb5517e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -270,6 +270,7 @@ static void setup(struct net_device *dev)
netif_keep_dst(dev);
memset(wg, 0, sizeof(struct wireguard_device));
+ wg->dev = dev;
}
static int newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[], struct netlink_ext_ack *extack)
diff --git a/src/device.h b/src/device.h
index 5ba2c5d..77f1b2e 100644
--- a/src/device.h
+++ b/src/device.h
@@ -22,6 +22,7 @@ struct handshake_worker {
};
struct wireguard_device {
+ struct net_device *dev;
struct list_head device_list;
struct sock __rcu *sock4, *sock6;
u16 incoming_port;
diff --git a/src/noise.c b/src/noise.c
index 9bad788..4ffe549 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -93,7 +93,7 @@ static struct noise_keypair *keypair_create(struct wireguard_peer *peer)
static void keypair_free_rcu(struct rcu_head *rcu)
{
struct noise_keypair *keypair = container_of(rcu, struct noise_keypair, rcu);
- net_dbg_ratelimited("%s: Keypair %Lu destroyed for peer %Lu\n", netdev_pub(keypair->entry.peer->device)->name, keypair->internal_id, keypair->entry.peer->internal_id);
+ net_dbg_ratelimited("%s: Keypair %Lu destroyed for peer %Lu\n", keypair->entry.peer->device->dev->name, keypair->internal_id, keypair->entry.peer->internal_id);
kzfree(keypair);
}
@@ -600,7 +600,7 @@ bool noise_handshake_begin_session(struct noise_handshake *handshake, struct noi
handshake_zero(handshake);
add_new_keypair(keypairs, new_keypair);
- net_dbg_ratelimited("%s: Keypair %Lu created for peer %Lu\n", netdev_pub(new_keypair->entry.peer->device)->name, new_keypair->internal_id, new_keypair->entry.peer->internal_id);
+ net_dbg_ratelimited("%s: Keypair %Lu created for peer %Lu\n", new_keypair->entry.peer->device->dev->name, new_keypair->internal_id, new_keypair->entry.peer->internal_id);
WARN_ON(!index_hashtable_replace(&handshake->entry.peer->device->index_hashtable, &handshake->entry, &new_keypair->entry));
up_write(&handshake->lock);
diff --git a/src/peer.c b/src/peer.c
index ad2cb25..f539d99 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -49,7 +49,7 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
#ifdef CONFIG_WIREGUARD_PARALLEL
atomic_set(&peer->parallel_encryption_inflight, 0);
#endif
- pr_debug("%s: Peer %Lu created\n", netdev_pub(wg)->name, peer->internal_id);
+ pr_debug("%s: Peer %Lu created\n", wg->dev->name, peer->internal_id);
return peer;
}
@@ -92,7 +92,7 @@ void peer_remove(struct wireguard_peer *peer)
static void rcu_release(struct rcu_head *rcu)
{
struct wireguard_peer *peer = container_of(rcu, struct wireguard_peer, rcu);
- pr_debug("%s: Peer %Lu (%pISpfsc) destroyed\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ pr_debug("%s: Peer %Lu (%pISpfsc) destroyed\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
skb_queue_purge(&peer->tx_packet_queue);
dst_cache_destroy(&peer->endpoint_cache);
kzfree(peer);
diff --git a/src/receive.c b/src/receive.c
index e46bafa..3d7a330 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -14,7 +14,7 @@
static inline void rx_stats(struct wireguard_peer *peer, size_t len)
{
- struct pcpu_sw_netstats *tstats = get_cpu_ptr(netdev_pub(peer->device)->tstats);
+ struct pcpu_sw_netstats *tstats = get_cpu_ptr(peer->device->dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->rx_bytes += len;
++tstats->rx_packets;
@@ -71,7 +71,7 @@ static void receive_handshake_packet(struct wireguard_device *wg, struct sk_buff
message_type = message_determine_type(skb);
if (message_type == MESSAGE_HANDSHAKE_COOKIE) {
- net_dbg_skb_ratelimited("%s: Receiving cookie response from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Receiving cookie response from %pISpfsc\n", wg->dev->name, skb);
cookie_message_consume((struct message_handshake_cookie *)skb->data, wg);
return;
}
@@ -87,7 +87,7 @@ static void receive_handshake_packet(struct wireguard_device *wg, struct sk_buff
else if (under_load && mac_state == VALID_MAC_BUT_NO_COOKIE)
packet_needs_cookie = true;
else {
- net_dbg_skb_ratelimited("%s: Invalid MAC of handshake, dropping packet from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Invalid MAC of handshake, dropping packet from %pISpfsc\n", wg->dev->name, skb);
return;
}
@@ -100,11 +100,11 @@ static void receive_handshake_packet(struct wireguard_device *wg, struct sk_buff
}
peer = noise_handshake_consume_initiation(message, wg);
if (unlikely(!peer)) {
- net_dbg_skb_ratelimited("%s: Invalid handshake initiation from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Invalid handshake initiation from %pISpfsc\n", wg->dev->name, skb);
return;
}
update_latest_addr(peer, skb);
- net_dbg_ratelimited("%s: Receiving handshake initiation from peer %Lu (%pISpfsc)\n", netdev_pub(wg)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Receiving handshake initiation from peer %Lu (%pISpfsc)\n", wg->dev->name, peer->internal_id, &peer->endpoint.addr);
packet_send_handshake_response(peer);
break;
}
@@ -116,11 +116,11 @@ static void receive_handshake_packet(struct wireguard_device *wg, struct sk_buff
}
peer = noise_handshake_consume_response(message, wg);
if (unlikely(!peer)) {
- net_dbg_skb_ratelimited("%s: Invalid handshake response from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Invalid handshake response from %pISpfsc\n", wg->dev->name, skb);
return;
}
update_latest_addr(peer, skb);
- net_dbg_ratelimited("%s: Receiving handshake response from peer %Lu (%pISpfsc)\n", netdev_pub(wg)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Receiving handshake response from peer %Lu (%pISpfsc)\n", wg->dev->name, peer->internal_id, &peer->endpoint.addr);
if (noise_handshake_begin_session(&peer->handshake, &peer->keypairs, true)) {
timers_ephemeral_key_created(peer);
timers_handshake_complete(peer);
@@ -188,7 +188,7 @@ void packet_consume_data_done(struct sk_buff *skb, struct wireguard_peer *peer,
socket_set_peer_endpoint(peer, endpoint);
wg = peer->device;
- dev = netdev_pub(wg);
+ dev = wg->dev;
if (unlikely(used_new_key)) {
peer->sent_lastminute_handshake = false;
@@ -200,7 +200,7 @@ void packet_consume_data_done(struct sk_buff *skb, struct wireguard_peer *peer,
/* A packet with length 0 is a keepalive packet */
if (unlikely(!skb->len)) {
- net_dbg_ratelimited("%s: Receiving keepalive packet from peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Receiving keepalive packet from peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
goto packet_processed;
}
@@ -245,22 +245,22 @@ void packet_consume_data_done(struct sk_buff *skb, struct wireguard_peer *peer,
rx_stats(peer, len);
else {
++dev->stats.rx_dropped;
- net_dbg_ratelimited("%s: Failed to give packet to userspace from peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Failed to give packet to userspace from peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
}
goto continue_processing;
dishonest_packet_peer:
- net_dbg_skb_ratelimited("%s: Packet has unallowed src IP (%pISc) from peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, skb, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_skb_ratelimited("%s: Packet has unallowed src IP (%pISc) from peer %Lu (%pISpfsc)\n", peer->device->dev->name, skb, peer->internal_id, &peer->endpoint.addr);
++dev->stats.rx_errors;
++dev->stats.rx_frame_errors;
goto packet_processed;
dishonest_packet_type:
- net_dbg_ratelimited("%s: Packet is neither ipv4 nor ipv6 from peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Packet is neither ipv4 nor ipv6 from peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
++dev->stats.rx_errors;
++dev->stats.rx_frame_errors;
goto packet_processed;
dishonest_packet_size:
- net_dbg_ratelimited("%s: Packet has incorrect size from peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Packet has incorrect size from peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
++dev->stats.rx_errors;
++dev->stats.rx_length_errors;
goto packet_processed;
@@ -283,7 +283,7 @@ void packet_receive(struct wireguard_device *wg, struct sk_buff *skb)
case MESSAGE_HANDSHAKE_COOKIE: {
int cpu_index, cpu, target_cpu;
if (skb_queue_len(&wg->incoming_handshakes) > MAX_QUEUED_INCOMING_HANDSHAKES) {
- net_dbg_skb_ratelimited("%s: Too many handshakes queued, dropping packet from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Too many handshakes queued, dropping packet from %pISpfsc\n", wg->dev->name, skb);
goto err;
}
skb_queue_tail(&wg->incoming_handshakes, skb);
@@ -301,7 +301,7 @@ void packet_receive(struct wireguard_device *wg, struct sk_buff *skb)
packet_consume_data(skb, wg);
break;
default:
- net_dbg_skb_ratelimited("%s: Invalid packet from %pISpfsc\n", netdev_pub(wg)->name, skb);
+ net_dbg_skb_ratelimited("%s: Invalid packet from %pISpfsc\n", wg->dev->name, skb);
goto err;
}
return;
diff --git a/src/send.c b/src/send.c
index 4086739..5bc2dd6 100644
--- a/src/send.c
+++ b/src/send.c
@@ -27,7 +27,7 @@ static void packet_send_handshake_initiation(struct wireguard_peer *peer)
peer->last_sent_handshake = get_jiffies_64();
up_write(&peer->handshake.lock);
- net_dbg_ratelimited("%s: Sending handshake initiation to peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Sending handshake initiation to peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
if (noise_handshake_create_initiation(&packet, &peer->handshake)) {
cookie_add_mac_to_packet(&packet, sizeof(packet), peer);
@@ -67,7 +67,7 @@ void packet_send_handshake_response(struct wireguard_peer *peer)
{
struct message_handshake_response packet;
- net_dbg_ratelimited("%s: Sending handshake response to peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Sending handshake response to peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
peer->last_sent_handshake = get_jiffies_64();
if (noise_handshake_create_response(&packet, &peer->handshake)) {
@@ -84,7 +84,7 @@ void packet_send_handshake_cookie(struct wireguard_device *wg, struct sk_buff *i
{
struct message_handshake_cookie packet;
- net_dbg_skb_ratelimited("%s: Sending cookie response for denied handshake message for %pISpfsc\n", netdev_pub(wg)->name, initiating_skb);
+ net_dbg_skb_ratelimited("%s: Sending cookie response for denied handshake message for %pISpfsc\n", wg->dev->name, initiating_skb);
cookie_message_create(&packet, initiating_skb, sender_index, &wg->cookie_checker);
socket_send_buffer_as_reply_to_skb(wg, initiating_skb, &packet, sizeof(packet));
}
@@ -114,9 +114,9 @@ void packet_send_keepalive(struct wireguard_peer *peer)
if (unlikely(!skb))
return;
skb_reserve(skb, DATA_PACKET_HEAD_ROOM);
- skb->dev = netdev_pub(peer->device);
+ skb->dev = peer->device->dev;
skb_queue_tail(&peer->tx_packet_queue, skb);
- net_dbg_ratelimited("%s: Sending keepalive packet to peer %Lu (%pISpfsc)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr);
+ net_dbg_ratelimited("%s: Sending keepalive packet to peer %Lu (%pISpfsc)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr);
}
packet_send_queue(peer);
}
diff --git a/src/socket.c b/src/socket.c
index a90811a..cdb0f47 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -29,7 +29,7 @@ static inline int send4(struct wireguard_device *wg, struct sk_buff *skb, struct
int ret = 0;
skb->next = skb->prev = NULL;
- skb->dev = netdev_pub(wg);
+ skb->dev = wg->dev;
rcu_read_lock_bh();
sock = rcu_dereference_bh(wg->sock4);
@@ -55,12 +55,12 @@ static inline int send4(struct wireguard_device *wg, struct sk_buff *skb, struct
}
if (unlikely(IS_ERR(rt))) {
ret = PTR_ERR(rt);
- net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n", netdev_pub(wg)->name, &endpoint->addr, ret);
+ net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n", wg->dev->name, &endpoint->addr, ret);
goto err;
} else if (unlikely(rt->dst.dev == skb->dev)) {
ip_rt_put(rt);
ret = -ELOOP;
- net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n", netdev_pub(wg)->name, &endpoint->addr);
+ net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n", wg->dev->name, &endpoint->addr);
goto err;
}
if (cache)
@@ -94,7 +94,7 @@ static inline int send6(struct wireguard_device *wg, struct sk_buff *skb, struct
int ret = 0;
skb->next = skb->prev = NULL;
- skb->dev = netdev_pub(wg);
+ skb->dev = wg->dev;
rcu_read_lock_bh();
sock = rcu_dereference_bh(wg->sock6);
@@ -116,12 +116,12 @@ static inline int send6(struct wireguard_device *wg, struct sk_buff *skb, struct
}
ret = ipv6_stub->ipv6_dst_lookup(sock_net(sock), sock, &dst, &fl);
if (unlikely(ret)) {
- net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n", netdev_pub(wg)->name, &endpoint->addr, ret);
+ net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n", wg->dev->name, &endpoint->addr, ret);
goto err;
} else if (unlikely(dst->dev == skb->dev)) {
dst_release(dst);
ret = -ELOOP;
- net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n", netdev_pub(wg)->name, &endpoint->addr);
+ net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n", wg->dev->name, &endpoint->addr);
goto err;
}
if (cache)
@@ -329,7 +329,7 @@ retry:
ret = udp_sock_create(wg->creating_net, &port4, &new4);
if (ret < 0) {
- pr_err("%s: Could not create IPv4 socket\n", netdev_pub(wg)->name);
+ pr_err("%s: Could not create IPv4 socket\n", wg->dev->name);
goto out;
}
wg->incoming_port = ntohs(inet_sk(new4->sk)->inet_sport);
@@ -349,7 +349,7 @@ retry:
goto retry;
if (!port4.local_udp_port)
wg->incoming_port = 0;
- pr_err("%s: Could not create IPv6 socket\n", netdev_pub(wg)->name);
+ pr_err("%s: Could not create IPv6 socket\n", wg->dev->name);
goto out;
}
set_sock_opts(new6);
diff --git a/src/timers.c b/src/timers.c
index c1ef7f0..9a7b593 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -28,7 +28,7 @@ static void expired_retransmit_handshake(unsigned long ptr)
{
peer_get_from_ptr(ptr);
if (peer->timer_handshake_attempts > MAX_TIMER_HANDSHAKES) {
- pr_debug("%s: Handshake for peer %Lu (%pISpfsc) did not complete after %d attempts, giving up\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr, MAX_TIMER_HANDSHAKES + 2);
+ pr_debug("%s: Handshake for peer %Lu (%pISpfsc) did not complete after %d attempts, giving up\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr, MAX_TIMER_HANDSHAKES + 2);
del_timer(&peer->timer_send_keepalive);
/* We remove all existing packets and don't try again,
@@ -40,7 +40,7 @@ static void expired_retransmit_handshake(unsigned long ptr)
mod_timer(&peer->timer_kill_ephemerals, jiffies + (REJECT_AFTER_TIME * 3));
} else {
++peer->timer_handshake_attempts;
- pr_debug("%s: Handshake for peer %Lu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr, REKEY_TIMEOUT / HZ, peer->timer_handshake_attempts + 1);
+ pr_debug("%s: Handshake for peer %Lu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr, REKEY_TIMEOUT / HZ, peer->timer_handshake_attempts + 1);
/* We clear the endpoint address src address, in case this is the cause of trouble. */
socket_clear_peer_endpoint_src(peer);
@@ -65,7 +65,7 @@ static void expired_send_keepalive(unsigned long ptr)
static void expired_new_handshake(unsigned long ptr)
{
peer_get_from_ptr(ptr);
- pr_debug("%s: Retrying handshake with peer %Lu (%pISpfsc) because we stopped hearing back after %d seconds\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr, (KEEPALIVE_TIMEOUT + REKEY_TIMEOUT) / HZ);
+ pr_debug("%s: Retrying handshake with peer %Lu (%pISpfsc) because we stopped hearing back after %d seconds\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr, (KEEPALIVE_TIMEOUT + REKEY_TIMEOUT) / HZ);
/* We clear the endpoint address src address, in case this is the cause of trouble. */
socket_clear_peer_endpoint_src(peer);
packet_queue_handshake_initiation(peer, false);
@@ -81,7 +81,7 @@ static void expired_kill_ephemerals(unsigned long ptr)
static void queued_expired_kill_ephemerals(struct work_struct *work)
{
struct wireguard_peer *peer = container_of(work, struct wireguard_peer, clear_peer_work);
- pr_debug("%s: Zeroing out all keys for peer %Lu (%pISpfsc), since we haven't received a new one in %d seconds\n", netdev_pub(peer->device)->name, peer->internal_id, &peer->endpoint.addr, (REJECT_AFTER_TIME * 3) / HZ);
+ pr_debug("%s: Zeroing out all keys for peer %Lu (%pISpfsc), since we haven't received a new one in %d seconds\n", peer->device->dev->name, peer->internal_id, &peer->endpoint.addr, (REJECT_AFTER_TIME * 3) / HZ);
noise_handshake_clear(&peer->handshake);
noise_keypairs_clear(&peer->keypairs);
peer_put(peer);