aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/dco.c
diff options
context:
space:
mode:
authorArne Schwabe2022-12-01 12:01:28 +0100
committerGert Doering2022-12-01 14:45:42 +0100
commit0f7c5dde1bbd23353467ebd549ae955a6a03746f (patch)
treee40806942b103dc4176b521e2d568305ab451612 /src/openvpn/dco.c
parent8187bbba5cdfa46fec2595f5f05384fd77eb5714 (diff)
downloadopenvpn-0f7c5dde1bbd23353467ebd549ae955a6a03746f.zip
openvpn-0f7c5dde1bbd23353467ebd549ae955a6a03746f.tar.gz
Allow reconnecting in p2p mode work under FreeBSD
This commit consists of two parts. - explicitly removing an existing peer in p2p mode - ignoring the ping timeout notification that is generated by the first part Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20221201110128.271064-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25602.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/dco.c')
-rw-r--r--src/openvpn/dco.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index 47fb000..b1a3e78 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -458,6 +458,15 @@ dco_p2p_add_new_peer(struct context *c)
struct sockaddr *remoteaddr = &ls->info.lsa->actual.dest.addr.sa;
struct tls_multi *multi = c->c2.tls_multi;
+#ifdef TARGET_FREEBSD
+ /* In Linux in P2P mode the kernel automatically removes an existing peer
+ * when adding a new peer. FreeBSD needs to explicitly be told to do that */
+ if (c->c2.tls_multi->dco_peer_id != -1)
+ {
+ dco_del_peer(&c->c1.tuntap->dco, c->c2.tls_multi->dco_peer_id);
+ c->c2.tls_multi->dco_peer_id = -1;
+ }
+#endif
int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
c->c2.link_socket->sd, NULL, remoteaddr, NULL, NULL);
if (ret < 0)