summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2011-12-21 17:32:22 +0000
committerAnthony G. Basile <blueness@gentoo.org>2011-12-21 17:32:22 +0000
commit49e5e9a141cac6c050725e0c396c58f154dacef9 (patch)
tree01fc5a4686a1a961801729c101cc0067073f0106 /net-misc/tinc
parentUse mask vde flag for net-misc/tinc on arm and sparc (diff)
downloadgentoo-2-49e5e9a141cac6c050725e0c396c58f154dacef9.tar.gz
gentoo-2-49e5e9a141cac6c050725e0c396c58f154dacef9.tar.bz2
gentoo-2-49e5e9a141cac6c050725e0c396c58f154dacef9.zip
Added USE flags for raw, uml and vde sockets, bug #371131
(Portage version: 2.1.10.41/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/tinc')
-rw-r--r--net-misc/tinc/ChangeLog8
-rw-r--r--net-misc/tinc/files/fix-compile-vde-uml.patch54
-rw-r--r--net-misc/tinc/files/fix-missing-vde.patch138
-rw-r--r--net-misc/tinc/metadata.xml5
-rw-r--r--net-misc/tinc/tinc-1.0.16-r2.ebuild66
5 files changed, 270 insertions, 1 deletions
diff --git a/net-misc/tinc/ChangeLog b/net-misc/tinc/ChangeLog
index 4a2dc3e30c09..1c826ac24e9a 100644
--- a/net-misc/tinc/ChangeLog
+++ b/net-misc/tinc/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-misc/tinc
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/ChangeLog,v 1.26 2011/12/04 10:30:32 swegener Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/ChangeLog,v 1.27 2011/12/21 17:32:22 blueness Exp $
+
+*tinc-1.0.16-r2 (21 Dec 2011)
+
+ 21 Dec 2011; Anthony G. Basile <blueness@gentoo.org> +tinc-1.0.16-r2.ebuild,
+ +files/fix-compile-vde-uml.patch, +files/fix-missing-vde.patch, metadata.xml:
+ Added USE flags for raw, uml and vde sockets, bug #371131
04 Dec 2011; Sven Wegener <swegener@gentoo.org> files/tincd, files/tincd.1,
files/tincd.lo, files/tincd.lo.1:
diff --git a/net-misc/tinc/files/fix-compile-vde-uml.patch b/net-misc/tinc/files/fix-compile-vde-uml.patch
new file mode 100644
index 000000000000..acc30c9f7522
--- /dev/null
+++ b/net-misc/tinc/files/fix-compile-vde-uml.patch
@@ -0,0 +1,54 @@
+diff --git a/src/uml_socket/device.c b/src/uml_socket/device.c
+index a2da757..a371e7b 100644
+--- a/src/uml_socket/device.c
++++ b/src/uml_socket/device.c
+@@ -28,6 +28,7 @@
+ #include "logger.h"
+ #include "utils.h"
+ #include "route.h"
++#include "xalloc.h"
+
+ int device_fd = -1;
+ static int listen_fd = -1;
+@@ -40,7 +41,7 @@ char *iface = NULL;
+ static char *device_info;
+
+ extern char *identname;
+-extern bool running;
++extern volatile bool running;
+
+ static uint64_t device_total_in = 0;
+ static uint64_t device_total_out = 0;
+@@ -175,7 +176,7 @@ bool read_packet(vpn_packet_t *packet) {
+ switch(state) {
+ case 0: {
+ struct sockaddr sa;
+- int salen = sizeof sa;
++ socklen_t salen = sizeof sa;
+
+ request_fd = accept(listen_fd, &sa, &salen);
+ if(request_fd < 0) {
+@@ -244,6 +245,10 @@ bool read_packet(vpn_packet_t *packet) {
+
+ return true;
+ }
++
++ default:
++ logger(LOG_ERR, "Invalid value for state variable in " __FILE__);
++ abort();
+ }
+ }
+
+diff --git a/src/vde/device.c b/src/vde/device.c
+index 63171f9..74cf3b6 100644
+--- a/src/vde/device.c
++++ b/src/vde/device.c
+@@ -39,7 +39,7 @@ char *iface = NULL;
+ static char *device_info;
+
+ extern char *identname;
+-extern bool running;
++extern volatile bool running;
+
+ static uint64_t device_total_in = 0;
+ static uint64_t device_total_out = 0;
diff --git a/net-misc/tinc/files/fix-missing-vde.patch b/net-misc/tinc/files/fix-missing-vde.patch
new file mode 100644
index 000000000000..6cf4d09a9533
--- /dev/null
+++ b/net-misc/tinc/files/fix-missing-vde.patch
@@ -0,0 +1,138 @@
+diff -Naur src/vde/device.c src/vde/device.c
+--- src/vde/device.c 1969-12-31 19:00:00.000000000 -0500
++++ src/vde/device.c 2011-12-21 11:20:34.000000000 -0500
+@@ -0,0 +1,134 @@
++/*
++ device.c -- VDE plug
++ Copyright (C) 2011 Guus Sliepen <guus@tinc-vpn.org>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++*/
++
++#include "system.h"
++
++#include <libvdeplug_dyn.h>
++
++#include "conf.h"
++#include "device.h"
++#include "net.h"
++#include "logger.h"
++#include "utils.h"
++#include "route.h"
++#include "xalloc.h"
++
++int device_fd = -1;
++static struct vdepluglib plug;
++static struct vdeconn *conn = NULL;
++static int port = 0;
++static char *group = NULL;
++char *device = NULL;
++char *iface = NULL;
++static char *device_info;
++
++extern char *identname;
++extern bool running;
++
++static uint64_t device_total_in = 0;
++static uint64_t device_total_out = 0;
++
++bool setup_device(void) {
++ libvdeplug_dynopen(plug);
++
++ if(!plug.dl_handle) {
++ logger(LOG_ERR, "Could not open libvdeplug library!");
++ return false;
++ }
++
++ if(!get_config_string(lookup_config(config_tree, "Device"), &device))
++ xasprintf(&device, LOCALSTATEDIR "/run/vde.ctl");
++
++ get_config_string(lookup_config(config_tree, "Interface"), &iface);
++
++ get_config_int(lookup_config(config_tree, "VDEPort"), &port);
++
++ get_config_string(lookup_config(config_tree, "VDEGroup"), &group);
++
++ device_info = "VDE socket";
++
++ struct vde_open_args args = {
++ .port = port,
++ .group = group,
++ .mode = 0700,
++ };
++
++ conn = plug.vde_open(device, identname, &args);
++ if(!conn) {
++ logger(LOG_ERR, "Could not open VDE socket %s", device);
++ return false;
++ }
++
++ device_fd = plug.vde_datafd(conn);
++
++ logger(LOG_INFO, "%s is a %s", device, device_info);
++
++ if(routing_mode == RMODE_ROUTER)
++ overwrite_mac = true;
++
++ return true;
++}
++
++void close_device(void) {
++ if(conn)
++ plug.vde_close(conn);
++
++ if(plug.dl_handle)
++ libvdeplug_dynclose(plug);
++
++ free(device);
++
++ free(iface);
++}
++
++bool read_packet(vpn_packet_t *packet) {
++ int lenin = plug.vde_recv(conn, packet->data, MTU, 0);
++ if(lenin <= 0) {
++ logger(LOG_ERR, "Error while reading from %s %s: %s", device_info, device, strerror(errno));
++ running = false;
++ return false;
++ }
++
++ packet->len = lenin;
++ device_total_in += packet->len;
++ ifdebug(TRAFFIC) logger(LOG_DEBUG, "Read packet of %d bytes from %s", packet->len, device_info);
++
++ return true;
++}
++
++bool write_packet(vpn_packet_t *packet) {
++ if(plug.vde_send(conn, packet->data, packet->len, 0) < 0) {
++ if(errno != EINTR && errno != EAGAIN) {
++ logger(LOG_ERR, "Can't write to %s %s: %s", device_info, device, strerror(errno));
++ running = false;
++ }
++
++ return false;
++ }
++
++ device_total_out += packet->len;
++
++ return true;
++}
++
++void dump_device_stats(void) {
++ logger(LOG_DEBUG, "Statistics for %s %s:", device_info, device);
++ logger(LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
++ logger(LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
++}
diff --git a/net-misc/tinc/metadata.xml b/net-misc/tinc/metadata.xml
index ce4aedb5a103..ef57095d3dc2 100644
--- a/net-misc/tinc/metadata.xml
+++ b/net-misc/tinc/metadata.xml
@@ -6,4 +6,9 @@
<name>Anthony G. Basile</name>
</maintainer>
<longdescription>tinc is an easy to configure VPN implementation.</longdescription>
+ <use>
+ <flag name='raw'> Enable support for Raw Sockets</flag>
+ <flag name='uml'> Enable support for User Mode Linux Sockets</flag>
+ <flag name='vde'> Enable Virtual Distributed Ethernet (VDE) based networking</flag>
+ </use>
</pkgmetadata>
diff --git a/net-misc/tinc/tinc-1.0.16-r2.ebuild b/net-misc/tinc/tinc-1.0.16-r2.ebuild
new file mode 100644
index 000000000000..26d26e40682a
--- /dev/null
+++ b/net-misc/tinc/tinc-1.0.16-r2.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/tinc-1.0.16.ebuild,v 1.2
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="tinc is an easy to configure VPN implementation"
+HOMEPAGE="http://www.tinc-vpn.org/"
+SRC_URI="http://www.tinc-vpn.org/packages/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="+lzo +zlib raw uml vde"
+
+DEPEND=">=dev-libs/openssl-0.9.7c
+ lzo? ( dev-libs/lzo:2 )
+ zlib? ( >=sys-libs/zlib-1.1.4-r2 )
+ vde? ( net-misc/vde )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ local COUNT=0
+ use raw && COUNT=$(($COUNT+1))
+ use uml && COUNT=$(($COUNT+1))
+ use vde && COUNT=$(($COUNT+1))
+
+ if [[ ${COUNT} -gt 1 ]]; then
+ eerror
+ eerror "\033[1;31m**************************************************\033[1;31m"
+ eerror
+ eerror "\033[1;31m If you selected either raw, uml or vde,\033[1;31m"
+ eerror "\033[1;31m you can select only one.\033[1;31m"
+ eerror
+ eerror "\033[1;31m**************************************************\033[1;31m"
+ eerror
+ die
+ fi
+
+ epatch "${FILESDIR}"/fix-missing-vde.patch
+ epatch "${FILESDIR}"/fix-compile-vde-uml.patch
+}
+
+src_configure() {
+ econf --enable-jumbograms $(use_enable lzo) $(use_enable zlib)
+ use raw && cd "${S}"/src && ln -sf raw_socket/device.c
+ use uml && cd "${S}"/src && ln -sf uml_socket/device.c
+ use vde && cd "${S}"/src && ln -sf vde/device.c
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodir /etc/tinc
+ dodoc AUTHORS NEWS README THANKS
+ newinitd "${FILESDIR}"/tincd.1 tincd
+ newinitd "${FILESDIR}"/tincd.lo.1 tincd.lo
+ doconfd "${FILESDIR}"/tinc.networks
+ newconfd "${FILESDIR}"/tincd.conf.1 tincd
+}
+
+pkg_postinst() {
+ elog "This package requires the tun/tap kernel device."
+ elog "Look at http://www.tinc-vpn.org/ for how to configure tinc"
+}