aboutsummaryrefslogtreecommitdiff
path: root/net/vtun
diff options
context:
space:
mode:
authorJun Kuriyama <kuriyama@FreeBSD.org>2011-04-21 15:03:57 +0000
committerJun Kuriyama <kuriyama@FreeBSD.org>2011-04-21 15:03:57 +0000
commit5b27d046658fb685ec13c137258555a7471e8713 (patch)
tree480d572e3a17351870849d558bb8b44c1e9cdf1b /net/vtun
parent66716206cf5f334df6b8bee5b81ce22c3376b2a5 (diff)
downloadports-5b27d046658fb685ec13c137258555a7471e8713.tar.gz
ports-5b27d046658fb685ec13c137258555a7471e8713.zip
Notes
Diffstat (limited to 'net/vtun')
-rw-r--r--net/vtun/Makefile2
-rw-r--r--net/vtun/files/patch-main.c67
-rw-r--r--net/vtun/files/vtunclient.in1
-rw-r--r--net/vtun/files/vtund.in1
4 files changed, 70 insertions, 1 deletions
diff --git a/net/vtun/Makefile b/net/vtun/Makefile
index 1e41637650ff..b0c42285070d 100644
--- a/net/vtun/Makefile
+++ b/net/vtun/Makefile
@@ -7,7 +7,7 @@
PORTNAME= vtun
PORTVERSION= 3.0.2
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net
MASTER_SITES= SF
diff --git a/net/vtun/files/patch-main.c b/net/vtun/files/patch-main.c
new file mode 100644
index 000000000000..6ec91f8e61ac
--- /dev/null
+++ b/net/vtun/files/patch-main.c
@@ -0,0 +1,67 @@
+--- main.c.orig 2008-01-08 07:35:53.000000000 +0900
++++ main.c 2011-04-21 23:54:45.376770964 +0900
+@@ -50,9 +50,11 @@
+ extern int optind,opterr,optopt;
+ extern char *optarg;
+
++static char* pidfile = VTUN_PID_FILE;
++
+ int main(int argc, char *argv[], char *env[])
+ {
+- int svr, daemon, sock, dofork, fd, opt;
++ int svr, daemon, sock, dofork, fd, opt, has_pid = 0;
+ struct vtun_host *host = NULL;
+ struct sigaction sa;
+ char *hst;
+@@ -89,7 +91,7 @@
+ /* Start logging to syslog and stderr */
+ openlog("vtund", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON);
+
+- while( (opt=getopt(argc,argv,"misf:P:L:t:np")) != EOF ){
++ while( (opt=getopt(argc,argv,"misf:P:L:t:npz:")) != EOF ){
+ switch(opt){
+ case 'm':
+ if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) {
+@@ -120,6 +122,10 @@
+ case 't':
+ vtun.timeout = atoi(optarg);
+ break;
++ case 'z':
++ pidfile = strdup(optarg);
++ has_pid = 1;
++ break;
+ default:
+ usage();
+ exit(1);
+@@ -198,6 +204,10 @@
+ server(sock);
+ } else {
+ init_title(argc,argv,env,"vtund[c]: ");
++
++ if ( has_pid )
++ write_pid();
++
+ client(host);
+ }
+
+@@ -214,7 +224,7 @@
+ {
+ FILE *f;
+
+- if( !(f=fopen(VTUN_PID_FILE,"w")) ){
++ if( !(f=fopen(pidfile,"w")) ){
+ vtun_syslog(LOG_ERR,"Can't write PID file");
+ return;
+ }
+@@ -236,9 +246,9 @@
+ printf("VTun ver %s\n", VTUN_VER);
+ printf("Usage: \n");
+ printf(" Server:\n");
+- printf("\tvtund <-s> [-f file] [-P port] [-L local address]\n");
++ printf("\tvtund <-s> [-f file] [-P port] [-L local address] [-z pidfile]\n");
+ printf(" Client:\n");
+ /* I don't think these work. I'm disabling the suggestion - bish 20050601*/
+ printf("\tvtund [-f file] " /* [-P port] [-L local address] */
+- "[-p] [-m] [-t timeout] <host profile> <server address>\n");
++ "[-p] [-m] [-t timeout] [-z pidfile] <host profile> <server address>\n");
+ }
diff --git a/net/vtun/files/vtunclient.in b/net/vtun/files/vtunclient.in
index 73dca65a014b..a5dc348d3931 100644
--- a/net/vtun/files/vtunclient.in
+++ b/net/vtun/files/vtunclient.in
@@ -49,6 +49,7 @@ else
for _client in ${vtunclient_list}; do
eval vtunclient_flags=\$vtunclient_${_client}_flags
eval pidfile=\$vtunclient_${_client}_pidfile
+ vtunclient_flags="-z $pidfile $vtunclient_flags"
run_rc_command "$cmd"
done
fi
diff --git a/net/vtun/files/vtund.in b/net/vtun/files/vtund.in
index e03240aceb21..d90f7c9adbec 100644
--- a/net/vtun/files/vtund.in
+++ b/net/vtun/files/vtund.in
@@ -19,6 +19,7 @@ vtund_flags=${vtund_flags:-"-s"}
name=vtund
rcvar=`set_rcvar`
required_files="%%PREFIX%%/etc/vtund.conf"
+pidfile=/var/run/vtund.pid
command=%%PREFIX%%/sbin/vtund