aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/socket.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-11-17 11:33:24 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-11-17 11:33:24 +0100
commit82e6e3b2588939b03d0a534b85f446183a13ceda (patch)
tree3dab6c0d4d9e000d214251714ff8238a10c2b4a1 /src/socket.h
parentcompat: fix compilation with PaX (diff)
downloadwireguard-monolithic-historical-82e6e3b2588939b03d0a534b85f446183a13ceda.tar.xz
wireguard-monolithic-historical-82e6e3b2588939b03d0a534b85f446183a13ceda.zip
socket: only free socket after successful creation of new
When an interface is down, the socket port can change freely. A socket will be allocated when the interface comes up, and if a socket can't be allocated, the interface doesn't come up. However, a socket port can change while the interface is up. In this case, if a new socket with a new port cannot be allocated, it's important to keep the interface in a consistent state. The choices are either to bring down the interface or to preserve the old socket. This patch implements the latter. Reported-by: Marc-Antoine Perennou <keruspe@exherbo.org>
Diffstat (limited to '')
-rw-r--r--src/socket.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/socket.h b/src/socket.h
index 843d544..161bd0b 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -8,8 +8,8 @@
#include <linux/if_vlan.h>
#include <linux/if_ether.h>
-int socket_init(struct wireguard_device *wg);
-void socket_uninit(struct wireguard_device *wg);
+int socket_init(struct wireguard_device *wg, u16 port);
+void socket_reinit(struct wireguard_device *wg, struct sock *new4, struct sock *new6);
int socket_send_buffer_to_peer(struct wireguard_peer *peer, void *data, size_t len, u8 ds);
int socket_send_skb_to_peer(struct wireguard_peer *peer, struct sk_buff *skb, u8 ds);
int socket_send_buffer_as_reply_to_skb(struct wireguard_device *wg, struct sk_buff *in_skb, void *out_buffer, size_t len);