aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-07 19:19:25 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-08 03:14:52 +0200
commit8d5365719ac128eb64a3252d7ca4b910991a642a (patch)
treeb6a14e9fb82b3409763df1ae73c332628852f072
parentcompat: don't output for grep errors (diff)
downloadwireguard-monolithic-historical-8d5365719ac128eb64a3252d7ca4b910991a642a.tar.xz
wireguard-monolithic-historical-8d5365719ac128eb64a3252d7ca4b910991a642a.zip
global: prefix functions used in callbacks with wg_
Suggested-by: Jiri Pirko <jiri@resnulli.us>
-rw-r--r--src/compat/compat.h36
-rw-r--r--src/device.c40
-rw-r--r--src/netlink.c16
-rw-r--r--src/ratelimiter.c8
-rw-r--r--src/receive.c26
-rw-r--r--src/selftest/ratelimiter.c4
-rw-r--r--src/send.c20
-rw-r--r--src/socket.c4
-rw-r--r--src/timers.c31
9 files changed, 95 insertions, 90 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 58636da..3ef8620 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -502,7 +502,7 @@ static inline void kvfree_ours(const void *addr)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISOPENSUSE15)
-#define newlink(a,b,c,d,e) newlink(a,b,c,d)
+#define wg_newlink(a,b,c,d,e) wg_newlink(a,b,c,d)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
@@ -547,30 +547,36 @@ static inline struct nlattr **genl_family_attrbuf(const struct genl_family *fami
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 2) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 16) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 65) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 101) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 84)
-#define ___COMPAT_NETLINK_DUMP_BLOCK { int ret; skb->end -= nlmsg_total_size(sizeof(int)); ret = get_device_dump_real(skb, cb); skb->end += nlmsg_total_size(sizeof(int)); return ret; }
+#define ___COMPAT_NETLINK_DUMP_BLOCK { \
+ int ret; \
+ skb->end -= nlmsg_total_size(sizeof(int)); \
+ ret = wg_get_device_dump_real(skb, cb); \
+ skb->end += nlmsg_total_size(sizeof(int)); \
+ return ret; \
+}
#define ___COMPAT_NETLINK_DUMP_OVERRIDE
#else
-#define ___COMPAT_NETLINK_DUMP_BLOCK return get_device_dump_real(skb, cb);
+#define ___COMPAT_NETLINK_DUMP_BLOCK return wg_get_device_dump_real(skb, cb);
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 8) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 25) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 87)
-#define get_device_dump(a, b) get_device_dump_real(a, b); \
-static int get_device_dump(a, b) { \
+#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \
+static int wg_get_device_dump(a, b) { \
struct wireguard_device *wg = (struct wireguard_device *)cb->args[0]; \
if (!wg) { \
- int ret = get_device_start(cb); \
+ int ret = wg_get_device_start(cb); \
if (ret) \
return ret; \
} \
___COMPAT_NETLINK_DUMP_BLOCK \
} \
-static int get_device_dump_real(a, b)
+static int wg_get_device_dump_real(a, b)
#define COMPAT_CANNOT_USE_NETLINK_START
#elif defined(___COMPAT_NETLINK_DUMP_OVERRIDE)
-#define get_device_dump(a, b) get_device_dump_real(a, b); \
-static int get_device_dump(a, b) { \
+#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \
+static int wg_get_device_dump(a, b) { \
___COMPAT_NETLINK_DUMP_BLOCK \
} \
-static int get_device_dump_real(a, b)
+static int wg_get_device_dump_real(a, b)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
@@ -788,11 +794,11 @@ static inline void new_icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32
#endif
#if defined(RAP_PLUGIN) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#include <linux/timer.h>
-#define expired_retransmit_handshake(a) expired_retransmit_handshake(unsigned long timer)
-#define expired_send_keepalive(a) expired_send_keepalive(unsigned long timer)
-#define expired_new_handshake(a) expired_new_handshake(unsigned long timer)
-#define expired_zero_key_material(a) expired_zero_key_material(unsigned long timer)
-#define expired_send_persistent_keepalive(a) expired_send_persistent_keepalive(unsigned long timer)
+#define wg_expired_retransmit_handshake(a) wg_expired_retransmit_handshake(unsigned long timer)
+#define wg_expired_send_keepalive(a) wg_expired_send_keepalive(unsigned long timer)
+#define wg_expired_new_handshake(a) wg_expired_new_handshake(unsigned long timer)
+#define wg_expired_zero_key_material(a) wg_expired_zero_key_material(unsigned long timer)
+#define wg_expired_send_persistent_keepalive(a) wg_expired_send_persistent_keepalive(unsigned long timer)
#undef timer_setup
#define timer_setup(a, b, c) setup_timer(a, ((void (*)(unsigned long))b), ((unsigned long)a))
#undef from_timer
diff --git a/src/device.c b/src/device.c
index 72b93c7..0916ed6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -26,7 +26,7 @@
static LIST_HEAD(device_list);
-static int open(struct net_device *dev)
+static int wg_open(struct net_device *dev)
{
struct in_device *dev_v4 = __in_dev_get_rtnl(dev);
struct wireguard_device *wg = netdev_priv(dev);
@@ -67,8 +67,8 @@ static int open(struct net_device *dev)
}
#if defined(CONFIG_PM_SLEEP) && !defined(CONFIG_ANDROID)
-static int pm_notification(struct notifier_block *nb, unsigned long action,
- void *data)
+static int wg_pm_notification(struct notifier_block *nb, unsigned long action,
+ void *data)
{
struct wireguard_device *wg;
struct wireguard_peer *peer;
@@ -91,10 +91,10 @@ static int pm_notification(struct notifier_block *nb, unsigned long action,
rcu_barrier_bh();
return 0;
}
-static struct notifier_block pm_notifier = { .notifier_call = pm_notification };
+static struct notifier_block pm_notifier = { .notifier_call = wg_pm_notification };
#endif
-static int stop(struct net_device *dev)
+static int wg_stop(struct net_device *dev)
{
struct wireguard_device *wg = netdev_priv(dev);
struct wireguard_peer *peer;
@@ -115,7 +115,7 @@ static int stop(struct net_device *dev)
return 0;
}
-static netdev_tx_t xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct wireguard_device *wg = netdev_priv(dev);
struct wireguard_peer *peer;
@@ -212,13 +212,13 @@ err:
}
static const struct net_device_ops netdev_ops = {
- .ndo_open = open,
- .ndo_stop = stop,
- .ndo_start_xmit = xmit,
+ .ndo_open = wg_open,
+ .ndo_stop = wg_stop,
+ .ndo_start_xmit = wg_xmit,
.ndo_get_stats64 = ip_tunnel_get_stats64
};
-static void destruct(struct net_device *dev)
+static void wg_destruct(struct net_device *dev)
{
struct wireguard_device *wg = netdev_priv(dev);
@@ -252,7 +252,7 @@ static void destruct(struct net_device *dev)
static const struct device_type device_type = { .name = KBUILD_MODNAME };
-static void setup(struct net_device *dev)
+static void wg_setup(struct net_device *dev)
{
struct wireguard_device *wg = netdev_priv(dev);
enum { WG_NETDEV_FEATURES = NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
@@ -288,9 +288,9 @@ static void setup(struct net_device *dev)
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)
+static int wg_newlink(struct net *src_net, struct net_device *dev,
+ struct nlattr *tb[], struct nlattr *data[],
+ struct netlink_ext_ack *extack)
{
int ret = -ENOMEM;
struct wireguard_device *wg = netdev_priv(dev);
@@ -353,7 +353,7 @@ static int newlink(struct net *src_net, struct net_device *dev,
/* We wait until the end to assign priv_destructor, so that
* register_netdevice doesn't call it for us if it fails.
*/
- dev->priv_destructor = destruct;
+ dev->priv_destructor = wg_destruct;
pr_debug("%s: Interface created\n", dev->name);
return ret;
@@ -381,12 +381,12 @@ error_1:
static struct rtnl_link_ops link_ops __read_mostly = {
.kind = KBUILD_MODNAME,
.priv_size = sizeof(struct wireguard_device),
- .setup = setup,
- .newlink = newlink,
+ .setup = wg_setup,
+ .newlink = wg_newlink,
};
-static int netdevice_notification(struct notifier_block *nb,
- unsigned long action, void *data)
+static int wg_netdevice_notification(struct notifier_block *nb,
+ unsigned long action, void *data)
{
struct net_device *dev = ((struct netdev_notifier_info *)data)->dev;
struct wireguard_device *wg = netdev_priv(dev);
@@ -408,7 +408,7 @@ static int netdevice_notification(struct notifier_block *nb,
}
static struct notifier_block netdevice_notifier = {
- .notifier_call = netdevice_notification
+ .notifier_call = wg_netdevice_notification
};
int __init wg_device_init(void)
diff --git a/src/netlink.c b/src/netlink.c
index 56749ba..17aa575 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -166,7 +166,7 @@ err:
return -EMSGSIZE;
}
-static int get_device_start(struct netlink_callback *cb)
+static int wg_get_device_start(struct netlink_callback *cb)
{
struct nlattr **attrs = genl_family_attrbuf(&genl_family);
struct wireguard_device *wg;
@@ -190,7 +190,7 @@ static int get_device_start(struct netlink_callback *cb)
return 0;
}
-static int get_device_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int wg_get_device_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct wireguard_peer *peer, *next_peer_cursor, *last_peer_cursor;
struct allowedips_cursor *rt_cursor;
@@ -289,7 +289,7 @@ out:
*/
}
-static int get_device_done(struct netlink_callback *cb)
+static int wg_get_device_done(struct netlink_callback *cb)
{
struct wireguard_device *wg = (struct wireguard_device *)cb->args[0];
struct wireguard_peer *peer = (struct wireguard_peer *)cb->args[1];
@@ -475,7 +475,7 @@ out:
return ret;
}
-static int set_device(struct sk_buff *skb, struct genl_info *info)
+static int wg_set_device(struct sk_buff *skb, struct genl_info *info)
{
struct wireguard_device *wg = lookup_interface(info->attrs, skb);
int ret;
@@ -576,15 +576,15 @@ struct genl_ops genl_ops[] = {
{
.cmd = WG_CMD_GET_DEVICE,
#ifndef COMPAT_CANNOT_USE_NETLINK_START
- .start = get_device_start,
+ .start = wg_get_device_start,
#endif
- .dumpit = get_device_dump,
- .done = get_device_done,
+ .dumpit = wg_get_device_dump,
+ .done = wg_get_device_done,
.policy = device_policy,
.flags = GENL_UNS_ADMIN_PERM
}, {
.cmd = WG_CMD_SET_DEVICE,
- .doit = set_device,
+ .doit = wg_set_device,
.policy = device_policy,
.flags = GENL_UNS_ADMIN_PERM
}
diff --git a/src/ratelimiter.c b/src/ratelimiter.c
index 9c9bd8d..4e79032 100644
--- a/src/ratelimiter.c
+++ b/src/ratelimiter.c
@@ -16,8 +16,8 @@ static DEFINE_MUTEX(init_lock);
static atomic64_t refcnt = ATOMIC64_INIT(0);
static atomic_t total_entries = ATOMIC_INIT(0);
static unsigned int max_entries, table_size;
-static void gc_entries(struct work_struct *);
-static DECLARE_DEFERRABLE_WORK(gc_work, gc_entries);
+static void wg_ratelimiter_gc_entries(struct work_struct *);
+static DECLARE_DEFERRABLE_WORK(gc_work, wg_ratelimiter_gc_entries);
static struct hlist_head *table_v4;
#if IS_ENABLED(CONFIG_IPV6)
static struct hlist_head *table_v6;
@@ -53,7 +53,7 @@ static void entry_uninit(struct ratelimiter_entry *entry)
}
/* Calling this function with a NULL work uninits all entries. */
-static void gc_entries(struct work_struct *work)
+static void wg_ratelimiter_gc_entries(struct work_struct *work)
{
const u64 now = ktime_get_boot_fast_ns();
struct ratelimiter_entry *entry;
@@ -206,7 +206,7 @@ void wg_ratelimiter_uninit(void)
goto out;
cancel_delayed_work_sync(&gc_work);
- gc_entries(NULL);
+ wg_ratelimiter_gc_entries(NULL);
rcu_barrier();
kvfree(table_v4);
#if IS_ENABLED(CONFIG_IPV6)
diff --git a/src/receive.c b/src/receive.c
index 95c888d..9170e6a 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -18,7 +18,7 @@
#include <net/ip_tunnels.h>
/* Must be called with bh disabled. */
-static void rx_stats(struct wireguard_peer *peer, size_t len)
+static void update_rx_stats(struct wireguard_peer *peer, size_t len)
{
struct pcpu_sw_netstats *tstats =
get_cpu_ptr(peer->device->dev->tstats);
@@ -52,7 +52,7 @@ static size_t validate_header_len(struct sk_buff *skb)
return 0;
}
-static int skb_prepare_header(struct sk_buff *skb, struct wireguard_device *wg)
+static int prepare_skb_header(struct sk_buff *skb, struct wireguard_device *wg)
{
size_t data_offset, data_len, header_len;
struct udphdr *udp;
@@ -97,8 +97,8 @@ static int skb_prepare_header(struct sk_buff *skb, struct wireguard_device *wg)
return 0;
}
-static void receive_handshake_packet(struct wireguard_device *wg,
- struct sk_buff *skb)
+static void wg_receive_handshake_packet(struct wireguard_device *wg,
+ struct sk_buff *skb)
{
struct wireguard_peer *peer = NULL;
enum cookie_mac_state mac_state;
@@ -200,7 +200,7 @@ static void receive_handshake_packet(struct wireguard_device *wg,
}
local_bh_disable();
- rx_stats(peer, skb->len);
+ update_rx_stats(peer, skb->len);
local_bh_enable();
wg_timers_any_authenticated_packet_received(peer);
@@ -215,7 +215,7 @@ void wg_packet_handshake_receive_worker(struct work_struct *work)
struct sk_buff *skb;
while ((skb = skb_dequeue(&wg->incoming_handshakes)) != NULL) {
- receive_handshake_packet(wg, skb);
+ wg_receive_handshake_packet(wg, skb);
dev_kfree_skb(skb);
cond_resched();
}
@@ -337,9 +337,9 @@ out:
}
#include "selftest/counter.c"
-static void packet_consume_data_done(struct wireguard_peer *peer,
- struct sk_buff *skb,
- struct endpoint *endpoint)
+static void wg_packet_consume_data_done(struct wireguard_peer *peer,
+ struct sk_buff *skb,
+ struct endpoint *endpoint)
{
struct net_device *dev = peer->device->dev;
struct wireguard_peer *routed_peer;
@@ -360,7 +360,7 @@ static void packet_consume_data_done(struct wireguard_peer *peer,
/* A packet with length 0 is a keepalive packet */
if (unlikely(!skb->len)) {
- rx_stats(peer, message_data_len(0));
+ update_rx_stats(peer, message_data_len(0));
net_dbg_ratelimited("%s: Receiving keepalive packet from peer %llu (%pISpfsc)\n",
dev->name, peer->internal_id,
&peer->endpoint.addr);
@@ -413,7 +413,7 @@ static void packet_consume_data_done(struct wireguard_peer *peer,
dev->name, peer->internal_id,
&peer->endpoint.addr);
} else
- rx_stats(peer, message_data_len(len_before_trim));
+ update_rx_stats(peer, message_data_len(len_before_trim));
return;
dishonest_packet_peer:
@@ -478,7 +478,7 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget)
goto next;
wg_reset_packet(skb);
- packet_consume_data_done(peer, skb, &endpoint);
+ wg_packet_consume_data_done(peer, skb, &endpoint);
free = false;
next:
@@ -556,7 +556,7 @@ err_keypair:
void wg_packet_receive(struct wireguard_device *wg, struct sk_buff *skb)
{
- if (unlikely(skb_prepare_header(skb, wg) < 0))
+ if (unlikely(prepare_skb_header(skb, wg) < 0))
goto err;
switch (SKB_TYPE_LE32(skb)) {
case cpu_to_le32(MESSAGE_HANDSHAKE_INITIATION):
diff --git a/src/selftest/ratelimiter.c b/src/selftest/ratelimiter.c
index 0d956e0..724a571 100644
--- a/src/selftest/ratelimiter.c
+++ b/src/selftest/ratelimiter.c
@@ -92,7 +92,7 @@ restart:
maximum_jiffies_at_index(i))) { \
if (++tries >= 5000) \
goto err; \
- gc_entries(NULL); \
+ wg_ratelimiter_gc_entries(NULL); \
rcu_barrier(); \
msleep(500); \
goto restart; \
@@ -136,7 +136,7 @@ restart:
tries = 0;
restart2:
- gc_entries(NULL);
+ wg_ratelimiter_gc_entries(NULL);
rcu_barrier();
if (atomic_read(&total_entries))
diff --git a/src/send.c b/src/send.c
index 707efbe..e099282 100644
--- a/src/send.c
+++ b/src/send.c
@@ -19,7 +19,7 @@
#include <net/udp.h>
#include <net/sock.h>
-static void packet_send_handshake_initiation(struct wireguard_peer *peer)
+static void wg_packet_send_handshake_initiation(struct wireguard_peer *peer)
{
struct message_handshake_initiation packet;
@@ -49,7 +49,7 @@ void wg_packet_handshake_send_worker(struct work_struct *work)
struct wireguard_peer *peer = container_of(work, struct wireguard_peer,
transmit_handshake_work);
- packet_send_handshake_initiation(peer);
+ wg_packet_send_handshake_initiation(peer);
wg_peer_put(peer);
}
@@ -141,7 +141,7 @@ static void keep_key_fresh(struct wireguard_peer *peer)
wg_packet_send_queued_handshake_initiation(peer, false);
}
-static unsigned int skb_padding(struct sk_buff *skb)
+static unsigned int calculate_skb_padding(struct sk_buff *skb)
{
/* We do this modulo business with the MTU, just in case the networking
* layer gives us a packet that's bigger than the MTU. In that case, we
@@ -157,7 +157,7 @@ static unsigned int skb_padding(struct sk_buff *skb)
}
static bool encrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair,
- simd_context_t *simd_context)
+ simd_context_t *simd_context)
{
unsigned int padding_len, plaintext_len, trailer_len;
struct scatterlist sg[MAX_SKB_FRAGS + 8];
@@ -166,7 +166,7 @@ static bool encrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair,
int num_frags;
/* Calculate lengths. */
- padding_len = skb_padding(skb);
+ padding_len = calculate_skb_padding(skb);
trailer_len = padding_len + noise_encrypted_len(0);
plaintext_len = skb->len + padding_len;
@@ -244,8 +244,8 @@ static void skb_free_null_queue(struct sk_buff *first)
dev_kfree_skb(skb);
}
-static void packet_create_data_done(struct sk_buff *first,
- struct wireguard_peer *peer)
+static void wg_packet_create_data_done(struct sk_buff *first,
+ struct wireguard_peer *peer)
{
struct sk_buff *skb, *next;
bool is_keepalive, data_sent = false;
@@ -282,7 +282,7 @@ void wg_packet_tx_worker(struct work_struct *work)
keypair = PACKET_CB(first)->keypair;
if (likely(state == PACKET_STATE_CRYPTED))
- packet_create_data_done(first, peer);
+ wg_packet_create_data_done(first, peer);
else
skb_free_null_queue(first);
@@ -319,7 +319,7 @@ void wg_packet_encrypt_worker(struct work_struct *work)
simd_put(&simd_context);
}
-static void packet_create_data(struct sk_buff *first)
+static void wg_packet_create_data(struct sk_buff *first)
{
struct wireguard_peer *peer = PACKET_PEER(first);
struct wireguard_device *wg = peer->device;
@@ -393,7 +393,7 @@ void wg_packet_send_staged_packets(struct wireguard_peer *peer)
packets.prev->next = NULL;
wg_peer_get(keypair->entry.peer);
PACKET_CB(packets.next)->keypair = keypair;
- packet_create_data(packets.next);
+ wg_packet_create_data(packets.next);
return;
out_invalid:
diff --git a/src/socket.c b/src/socket.c
index 8e9adfd..25752da 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -319,7 +319,7 @@ void wg_socket_clear_peer_endpoint_src(struct wireguard_peer *peer)
write_unlock_bh(&peer->endpoint_lock);
}
-static int receive(struct sock *sk, struct sk_buff *skb)
+static int wg_receive(struct sock *sk, struct sk_buff *skb)
{
struct wireguard_device *wg;
@@ -357,7 +357,7 @@ int wg_socket_init(struct wireguard_device *wg, u16 port)
struct udp_tunnel_sock_cfg cfg = {
.sk_user_data = wg,
.encap_type = 1,
- .encap_rcv = receive
+ .encap_rcv = wg_receive
};
struct socket *new4 = NULL, *new6 = NULL;
struct udp_port_cfg port4 = {
diff --git a/src/timers.c b/src/timers.c
index f8cd5c5..5127485 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -53,7 +53,7 @@ static inline void del_peer_timer(struct wireguard_peer *peer,
rcu_read_unlock_bh();
}
-static void expired_retransmit_handshake(struct timer_list *timer)
+static void wg_expired_retransmit_handshake(struct timer_list *timer)
{
peer_get_from_timer(timer_retransmit_handshake);
@@ -91,7 +91,7 @@ static void expired_retransmit_handshake(struct timer_list *timer)
wg_peer_put(peer);
}
-static void expired_send_keepalive(struct timer_list *timer)
+static void wg_expired_send_keepalive(struct timer_list *timer)
{
peer_get_from_timer(timer_send_keepalive);
@@ -104,7 +104,7 @@ static void expired_send_keepalive(struct timer_list *timer)
wg_peer_put(peer);
}
-static void expired_new_handshake(struct timer_list *timer)
+static void wg_expired_new_handshake(struct timer_list *timer)
{
peer_get_from_timer(timer_new_handshake);
@@ -119,7 +119,7 @@ static void expired_new_handshake(struct timer_list *timer)
wg_peer_put(peer);
}
-static void expired_zero_key_material(struct timer_list *timer)
+static void wg_expired_zero_key_material(struct timer_list *timer)
{
peer_get_from_timer(timer_zero_key_material);
@@ -133,7 +133,7 @@ static void expired_zero_key_material(struct timer_list *timer)
}
rcu_read_unlock_bh();
}
-static void queued_expired_zero_key_material(struct work_struct *work)
+static void wg_queued_expired_zero_key_material(struct work_struct *work)
{
struct wireguard_peer *peer =
container_of(work, struct wireguard_peer, clear_peer_work);
@@ -146,7 +146,7 @@ static void queued_expired_zero_key_material(struct work_struct *work)
wg_peer_put(peer);
}
-static void expired_send_persistent_keepalive(struct timer_list *timer)
+static void wg_expired_send_persistent_keepalive(struct timer_list *timer)
{
peer_get_from_timer(timer_persistent_keepalive);
@@ -194,10 +194,9 @@ void wg_timers_any_authenticated_packet_received(struct wireguard_peer *peer)
/* Should be called after a handshake initiation message is sent. */
void wg_timers_handshake_initiated(struct wireguard_peer *peer)
{
- mod_peer_timer(
- peer, &peer->timer_retransmit_handshake,
- jiffies + REKEY_TIMEOUT * HZ +
- prandom_u32_max(REKEY_TIMEOUT_JITTER_MAX_JIFFIES));
+ mod_peer_timer(peer, &peer->timer_retransmit_handshake,
+ jiffies + REKEY_TIMEOUT * HZ +
+ prandom_u32_max(REKEY_TIMEOUT_JITTER_MAX_JIFFIES));
}
/* Should be called after a handshake response message is received and processed
@@ -233,13 +232,13 @@ void wg_timers_any_authenticated_packet_traversal(struct wireguard_peer *peer)
void wg_timers_init(struct wireguard_peer *peer)
{
timer_setup(&peer->timer_retransmit_handshake,
- expired_retransmit_handshake, 0);
- timer_setup(&peer->timer_send_keepalive, expired_send_keepalive, 0);
- timer_setup(&peer->timer_new_handshake, expired_new_handshake, 0);
- timer_setup(&peer->timer_zero_key_material, expired_zero_key_material, 0);
+ wg_expired_retransmit_handshake, 0);
+ timer_setup(&peer->timer_send_keepalive, wg_expired_send_keepalive, 0);
+ timer_setup(&peer->timer_new_handshake, wg_expired_new_handshake, 0);
+ timer_setup(&peer->timer_zero_key_material, wg_expired_zero_key_material, 0);
timer_setup(&peer->timer_persistent_keepalive,
- expired_send_persistent_keepalive, 0);
- INIT_WORK(&peer->clear_peer_work, queued_expired_zero_key_material);
+ wg_expired_send_persistent_keepalive, 0);
+ INIT_WORK(&peer->clear_peer_work, wg_queued_expired_zero_key_material);
peer->timer_handshake_attempts = 0;
peer->sent_lastminute_handshake = false;
peer->timer_need_another_keepalive = false;