diff options
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/socket.c b/src/socket.c index 25752da..03dcb65 100644 --- a/src/socket.c +++ b/src/socket.c @@ -17,7 +17,7 @@ #include <net/udp_tunnel.h> #include <net/ipv6.h> -static int send4(struct wireguard_device *wg, struct sk_buff *skb, +static int send4(struct wg_device *wg, struct sk_buff *skb, struct endpoint *endpoint, u8 ds, struct dst_cache *cache) { struct flowi4 fl = { @@ -98,7 +98,7 @@ out: return ret; } -static int send6(struct wireguard_device *wg, struct sk_buff *skb, +static int send6(struct wg_device *wg, struct sk_buff *skb, struct endpoint *endpoint, u8 ds, struct dst_cache *cache) { #if IS_ENABLED(CONFIG_IPV6) @@ -172,8 +172,7 @@ out: #endif } -int wg_socket_send_skb_to_peer(struct wireguard_peer *peer, struct sk_buff *skb, - u8 ds) +int wg_socket_send_skb_to_peer(struct wg_peer *peer, struct sk_buff *skb, u8 ds) { size_t skb_len = skb->len; int ret = -EAFNOSUPPORT; @@ -194,7 +193,7 @@ int wg_socket_send_skb_to_peer(struct wireguard_peer *peer, struct sk_buff *skb, return ret; } -int wg_socket_send_buffer_to_peer(struct wireguard_peer *peer, void *buffer, +int wg_socket_send_buffer_to_peer(struct wg_peer *peer, void *buffer, size_t len, u8 ds) { struct sk_buff *skb = alloc_skb(len + SKB_HEADER_LEN, GFP_ATOMIC); @@ -208,7 +207,7 @@ int wg_socket_send_buffer_to_peer(struct wireguard_peer *peer, void *buffer, return wg_socket_send_skb_to_peer(peer, skb, ds); } -int wg_socket_send_buffer_as_reply_to_skb(struct wireguard_device *wg, +int wg_socket_send_buffer_as_reply_to_skb(struct wg_device *wg, struct sk_buff *in_skb, void *buffer, size_t len) { @@ -277,7 +276,7 @@ static bool endpoint_eq(const struct endpoint *a, const struct endpoint *b) unlikely(!a->addr.sa_family && !b->addr.sa_family); } -void wg_socket_set_peer_endpoint(struct wireguard_peer *peer, +void wg_socket_set_peer_endpoint(struct wg_peer *peer, const struct endpoint *endpoint) { /* First we check unlocked, in order to optimize, since it's pretty rare @@ -302,7 +301,7 @@ out: write_unlock_bh(&peer->endpoint_lock); } -void wg_socket_set_peer_endpoint_from_skb(struct wireguard_peer *peer, +void wg_socket_set_peer_endpoint_from_skb(struct wg_peer *peer, const struct sk_buff *skb) { struct endpoint endpoint; @@ -311,7 +310,7 @@ void wg_socket_set_peer_endpoint_from_skb(struct wireguard_peer *peer, wg_socket_set_peer_endpoint(peer, &endpoint); } -void wg_socket_clear_peer_endpoint_src(struct wireguard_peer *peer) +void wg_socket_clear_peer_endpoint_src(struct wg_peer *peer) { write_lock_bh(&peer->endpoint_lock); memset(&peer->endpoint.src6, 0, sizeof(peer->endpoint.src6)); @@ -321,7 +320,7 @@ void wg_socket_clear_peer_endpoint_src(struct wireguard_peer *peer) static int wg_receive(struct sock *sk, struct sk_buff *skb) { - struct wireguard_device *wg; + struct wg_device *wg; if (unlikely(!sk)) goto err; @@ -351,7 +350,7 @@ static void set_sock_opts(struct socket *sock) sk_set_memalloc(sock->sk); } -int wg_socket_init(struct wireguard_device *wg, u16 port) +int wg_socket_init(struct wg_device *wg, u16 port) { int ret; struct udp_tunnel_sock_cfg cfg = { @@ -410,7 +409,7 @@ retry: return 0; } -void wg_socket_reinit(struct wireguard_device *wg, struct sock *new4, +void wg_socket_reinit(struct wg_device *wg, struct sock *new4, struct sock *new6) { struct sock *old4, *old6; |