add ebuild for vtun with fix for build-time racing condition

This commit is contained in:
2012-06-12 00:57:07 +04:00
parent eda25ad341
commit 276fc1180b
8 changed files with 242 additions and 0 deletions

View File

@ -0,0 +1,17 @@
--- Makefile.in.orig 2012-06-12 00:20:24.359206241 +0400
+++ Makefile.in 2012-06-12 00:22:46.735301510 +0400
@@ -60,10 +60,12 @@
vtund: $(OBJS)
$(CC) $(CFLAGS) -o vtund $(OBJS) $(LFD_OBJS) $(LDFLAGS)
-cfg_file.tab.c: cfg_file.y cfg_kwords.h config.h
+cfg_file.tab.h:
$(YACC) $(YACCFLAGS) -b cfg_file cfg_file.y
-cfg_file.lex.c: cfg_file.l cfg_kwords.h config.h
+cfg_file.tab.c: cfg_file.y cfg_kwords.h config.h cfg_file.tab.h
+
+cfg_file.lex.c: cfg_file.l cfg_kwords.h config.h cfg_file.tab.h
$(LEX) $(LEXFLAGS) cfg_file.l > cfg_file.lex.c
depend:

View File

@ -0,0 +1,72 @@
--- a/lfd_encrypt.c 2008-01-07 23:35:32.000000000 +0100
+++ b/lfd_encrypt.c 2010-09-18 04:53:31.000000000 +0200
@@ -44,6 +44,7 @@
#include <strings.h>
#include <string.h>
#include <time.h>
+#include <arpa/inet.h> /* htonl() */
#include "vtun.h"
#include "linkfd.h"
--- a/lib.c 2008-01-07 23:35:40.000000000 +0100
+++ b/lib.c 2010-09-18 04:52:51.000000000 +0200
@@ -34,6 +34,7 @@
#include <sys/wait.h>
#include <syslog.h>
#include <errno.h>
+#include <time.h> /* nanosleep() */
#include "vtun.h"
#include "linkfd.h"
--- a/lib.h 2008-01-07 23:35:41.000000000 +0100
+++ b/lib.h 2010-09-18 04:56:50.000000000 +0200
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
+#include <unistd.h> /* read(), write() */
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
--- a/vtun.h 2008-01-07 23:36:07.000000000 +0100
+++ b/vtun.h 2010-09-18 04:56:08.000000000 +0200
@@ -219,5 +219,9 @@
int tunnel(struct vtun_host *host);
int read_config(char *file);
struct vtun_host * find_host(char *host);
+int send_msg(int len, char *in, char **out);
+int send_ib_mesg(int *len, char **in);
+int recv_msg(int len, char *in, char **out);
+int recv_ib_mesg(int *len, char **in);
#endif
--- a/lock.c 2008-01-07 23:35:50.000000000 +0100
+++ b/lock.c 2010-09-18 05:01:21.000000000 +0200
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
+#include <time.h> /* nanosleep() */
#include "vtun.h"
#include "linkfd.h"
--- a/server 2008-01-07 23:36:01.000000000 +0100
+++ b/server.c 2010-09-18 05:02:45.000000000 +0200
@@ -49,6 +49,7 @@
#include "auth.h"
#include "compat.h"
+#include "netlib.h" /* generic_addr() */
static volatile sig_atomic_t server_term;
static void sig_term(int sig)
--- a/lfd_shaper.c 2008-01-07 23:35:36.000000000 +0100
+++ b/lfd_shaper.c 2010-09-18 05:07:12.000000000 +0200
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <syslog.h>
+#include <time.h> /* nanosleep() */
#include "vtun.h"
#include "linkfd.h"

View File

@ -0,0 +1,13 @@
--- Makefile.in.orig 2012-06-11 23:31:11.416075337 +0400
+++ Makefile.in 2012-06-11 23:31:21.247324839 +0400
@@ -86,9 +86,7 @@
install_config:
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR)
- if [ ! -f $(ETC_DIR)/vtund.conf ]; then \
- $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); \
- fi
+ $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); \
install: vtund install_config install_man
$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run

View File

@ -0,0 +1,33 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/vtun/files/vtun.rc,v 1.8 2004/07/15 00:15:45 agriffis Exp $
depend() {
need net
}
start() {
IFS=$'\n'
for line in `grep -v '^[[:space:]]*#' /etc/vtund-start.conf | grep -v '^[[:space:]]*$'`
do
echo $line |
(IFS=" "
read host server args
if [ "$host" = "--server--" ]; then
ebegin "Starting vtund server"
/usr/sbin/vtund -s -P $server $args
eend $?
else
ebegin "Starting vtund client $host to $server"
/usr/sbin/vtund $args -- $host $server
eend $?
fi)
done
}
stop() {
ebegin "Stopping all vtund servers and clients"
killall vtund
eend $?
}

View File

@ -0,0 +1,33 @@
### this file defines whether vtund is run as a client or a server
###
### format is "[host] [server] <args>" or "--server-- [portnumber] <args>".
###
### [host] is the hostname to use as a client
###
### [server] is the server to connect to
###
### [args] is optional for both server and client and contains any additional
### command line args for that instance of vtund. not needed by most people.
###
### --server-- is the literal string '--server--'. nothing more, nothing less.
###
### [portnumber] is the port number to run the server on.
###
###
### you can have more than one client "host server" line if required,
### and in theory, it should be possible to run as both a client and a
### server simultaneously, but i haven't tested that.
### examples:
### to run as a client using hostname 'viper'.
#viper vtun-server.somewhere.com.au
### to run a persistent client connection using hostname 'viper'
### connecting to a server on port 6000 and using /etc/vtun.viper.conf
### as the config file.
#viper vtun-server.somewhere.com.au -f /etc/vtun.viper.conf -s -P 6000
### to run vtund as a server on port 5000, uncomment the following line:
#--server-- 5000