diff options
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c index ac19a47..5b7bbf8 100644 --- a/src/socket.c +++ b/src/socket.c @@ -4,6 +4,7 @@ #include "socket.h" #include "packets.h" #include "messages.h" +#include "timers.h" #include <linux/net.h> #include <linux/if_vlan.h> @@ -250,8 +251,10 @@ int socket_send_skb_to_peer(struct wireguard_peer *peer, struct sk_buff *skb, u8 read_lock_bh(&peer->endpoint_lock); ret = send(dev, skb, dst, &peer->endpoint_flow.fl4, &peer->endpoint_flow.fl6, &peer->endpoint_addr, rcu_dereference(peer->device->sock4), rcu_dereference(peer->device->sock6), dscp); - if (!ret) + if (!ret) { + timers_any_packet_sent(peer); peer->tx_bytes += skb_len; + } read_unlock_bh(&peer->endpoint_lock); rcu_read_unlock(); @@ -265,7 +268,8 @@ int socket_send_buffer_to_peer(struct wireguard_peer *peer, void *buffer, size_t if (!skb) return -ENOMEM; skb_reserve(skb, SKB_HEADER_LEN); - memcpy(skb_put(skb, len), buffer, len); + if (likely(buffer)) + memcpy(skb_put(skb, len), buffer, len); return socket_send_skb_to_peer(peer, skb, dscp); } |