1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
9 #include <linux/netdevice.h>
10 #include <linux/udp.h>
11 #include <linux/if_vlan.h>
12 #include <linux/if_ether.h>
14 int wg_socket_init(struct wg_device
*wg
, u16 port
);
15 void wg_socket_reinit(struct wg_device
*wg
, struct sock
*new4
,
17 int wg_socket_send_buffer_to_peer(struct wg_peer
*peer
, void *data
,
19 int wg_socket_send_skb_to_peer(struct wg_peer
*peer
, struct sk_buff
*skb
,
21 int wg_socket_send_buffer_as_reply_to_skb(struct wg_device
*wg
,
22 struct sk_buff
*in_skb
,
23 void *out_buffer
, size_t len
);
25 int wg_socket_endpoint_from_skb(struct endpoint
*endpoint
,
26 const struct sk_buff
*skb
);
27 void wg_socket_set_peer_endpoint(struct wg_peer
*peer
,
28 const struct endpoint
*endpoint
);
29 void wg_socket_set_peer_endpoint_from_skb(struct wg_peer
*peer
,
30 const struct sk_buff
*skb
);
31 void wg_socket_clear_peer_endpoint_src(struct wg_peer
*peer
);
33 #if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
34 #define net_dbg_skb_ratelimited(fmt, dev, skb, ...) do { \
35 struct endpoint __endpoint; \
36 wg_socket_endpoint_from_skb(&__endpoint, skb); \
37 net_dbg_ratelimited(fmt, dev, &__endpoint.addr, \
41 #define net_dbg_skb_ratelimited(fmt, skb, ...)
44 #endif /* _WG_SOCKET_H */