aboutsummaryrefslogtreecommitdiff
path: root/net/ocserv
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-10-03 14:46:00 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-10-03 14:46:00 +0000
commitec2c2c0cd4854a1b0aa631dbe2ec298e2c42b857 (patch)
tree73dc09bdc71d8fa587831265ddbe1c5b07526d26 /net/ocserv
parentc05c6d015ae434b31a92fdbf7ffa2d13fb76db90 (diff)
downloadports-ec2c2c0cd4854a1b0aa631dbe2ec298e2c42b857.tar.gz
ports-ec2c2c0cd4854a1b0aa631dbe2ec298e2c42b857.zip
Notes
Diffstat (limited to 'net/ocserv')
-rw-r--r--net/ocserv/Makefile2
-rw-r--r--net/ocserv/files/patch-src_tun.c25
-rw-r--r--net/ocserv/files/patch-src_tun.h9
-rw-r--r--net/ocserv/files/patch-src_worker-auth.c14
4 files changed, 49 insertions, 1 deletions
diff --git a/net/ocserv/Makefile b/net/ocserv/Makefile
index 94335fcd1987..b2875639ce3e 100644
--- a/net/ocserv/Makefile
+++ b/net/ocserv/Makefile
@@ -3,7 +3,7 @@
PORTNAME= ocserv
PORTVERSION= 0.12.4
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net net-vpn security
MASTER_SITES= ftp://ftp.infradead.org/pub/ocserv/
diff --git a/net/ocserv/files/patch-src_tun.c b/net/ocserv/files/patch-src_tun.c
new file mode 100644
index 000000000000..6fe5ed5e6246
--- /dev/null
+++ b/net/ocserv/files/patch-src_tun.c
@@ -0,0 +1,25 @@
+--- src/tun.c.orig 2018-04-14 07:52:35 UTC
++++ src/tun.c
+@@ -895,3 +895,22 @@ ssize_t tun_read(int sockfd, void *buf, size_t len)
+ return read(sockfd, buf, len);
+ }
+ #endif
++
++#ifndef __FreeBSD__
++int tun_claim(int sockfd)
++{
++
++ return (0);
++}
++#else
++/*
++ * FreeBSD has a mechanism by which a tunnel has a single controlling process,
++ * and only that one process may close it. When the controlling process closes
++ * the tunnel, the state is torn down.
++ */
++int tun_claim(int sockfd)
++{
++
++ return (ioctl(sockfd, TUNSIFPID, 0));
++}
++#endif /* !__FreeBSD__ */
diff --git a/net/ocserv/files/patch-src_tun.h b/net/ocserv/files/patch-src_tun.h
new file mode 100644
index 000000000000..0311177f3f78
--- /dev/null
+++ b/net/ocserv/files/patch-src_tun.h
@@ -0,0 +1,9 @@
+--- src/tun.h.orig 2018-01-13 18:43:41 UTC
++++ src/tun.h
+@@ -35,5 +35,6 @@ struct tun_lease_st {
+
+ ssize_t tun_write(int sockfd, const void *buf, size_t len);
+ ssize_t tun_read(int sockfd, void *buf, size_t len);
++int tun_claim(int sockfd);
+
+ #endif
diff --git a/net/ocserv/files/patch-src_worker-auth.c b/net/ocserv/files/patch-src_worker-auth.c
new file mode 100644
index 000000000000..f7e01eeed392
--- /dev/null
+++ b/net/ocserv/files/patch-src_worker-auth.c
@@ -0,0 +1,14 @@
+--- src/worker-auth.c.orig 2019-01-19 18:47:47 UTC
++++ src/worker-auth.c
+@@ -605,7 +605,10 @@ static int recv_cookie_auth_reply(worker_st * ws)
+ case AUTH__REP__OK:
+ if (socketfd != -1) {
+ ws->tun_fd = socketfd;
+-
++ if (tun_claim(ws->tun_fd) != 0) {
++ ret = ERR_AUTH_FAIL;
++ goto cleanup;
++ }
+ if (msg->vname == NULL || msg->config == NULL || msg->user_name == NULL || msg->sid.len != sizeof(ws->sid)) {
+ ret = ERR_AUTH_FAIL;
+ goto cleanup;