Added USE flags for raw, uml and vde sockets, bug #371131
authorAnthony G. Basile <blueness@gentoo.org>
Wed, 21 Dec 2011 17:32:22 +0000 (17:32 +0000)
committerAnthony G. Basile <blueness@gentoo.org>
Wed, 21 Dec 2011 17:32:22 +0000 (17:32 +0000)
Package-Manager: portage-2.1.10.41/cvs/Linux x86_64

net-misc/tinc/ChangeLog
net-misc/tinc/Manifest
net-misc/tinc/files/fix-compile-vde-uml.patch [new file with mode: 0644]
net-misc/tinc/files/fix-missing-vde.patch [new file with mode: 0644]
net-misc/tinc/metadata.xml
net-misc/tinc/tinc-1.0.16-r2.ebuild [new file with mode: 0644]

index 4a2dc3e30c093e6c1547ec4f8941f39679e8c0e9..1c826ac24e9ac1fd1d73222bc54bdcdf2c41e906 100644 (file)
@@ -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:
index 35191adfeadde4426e15cdb400bcf1d79cbdb63a..156751de46f26f4838676b264806ca6921a861e3 100644 (file)
@@ -1,6 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
+Hash: SHA256
 
+AUX fix-compile-vde-uml.patch 1321 RMD160 e75a27f2420f416bba858a6ff64f1f1d455b29f1 SHA1 6a2bd7ccb7780e61c7f791dc4c76951e50811c95 SHA256 bd31ba111affbabb7c947ce08cf13c15e78620788e50515594cf2ab48a13f09f
+AUX fix-missing-vde.patch 3667 RMD160 a433b5ddb8c3b9a6b22b2471852054efeedddf50 SHA1 071c5b0c40c9f9a7b1676683a9147fe4a4ffd4cf SHA256 47eb44c5c4ed3eefae69c1b5a59f94b9afc31eff62f281ca9211cea422664e61
 AUX tinc.networks 387 RMD160 cc842d8ab6fb137d87276553fbf7465baeccf871 SHA1 8339d5882e494a0fd2390e1abfd0f24163949ce4 SHA256 7165721abd3706c95973118fbb503e18f9a008da6bdbf21a4ce35ecf7818d5ad
 AUX tincd 1621 RMD160 8f398357762bbe598bb78c4cbca537db5a334aa3 SHA1 3b97a4b1f28b30ac3a0bfe416c05c4d75ed5b026 SHA256 be40d0ef2757d74c161eb4831b6b5fedd77196b84d9d069c4fa5d7eb45c8450c
 AUX tincd.1 1760 RMD160 9a6242f68a39d5207ab3654078f3a4bf992f7469 SHA1 40d35d9aca90c586147bb7f44805e0a476db95f5 SHA256 238e6a6555b42f0b90e4ec7b04d501ac677a86b729e841b573b64a88fe507a62
@@ -12,13 +14,14 @@ DIST tinc-1.0.13.tar.gz 508903 RMD160 72e3063887546fb82e5c740a71b52840bd04237d S
 DIST tinc-1.0.16.tar.gz 519460 RMD160 a4d44bd90d4c19f4cc8bc27c1f92a8fb437698d3 SHA1 6700e63c548228b1675f243f0075f98511f1e3a8 SHA256 f20863cb1155ba4e4dd4cf16c35a5d706cd326eb8fe62b8b0a31fd57241a5400
 EBUILD tinc-1.0.13.ebuild 1049 RMD160 5d7498f943b260e89662ef2aca40d93d9dc5b4cb SHA1 99586c0c96f382a8d7e3b488136ee1ed6f18a216 SHA256 f78730591f2e34e7b82ad476fe09df387881f72e0a32193d40a562c138cdbdb6
 EBUILD tinc-1.0.16-r1.ebuild 1069 RMD160 b57c3cec174383acab9a3bd4daa2ab06c39d12c2 SHA1 978fdb13534a38e3bb9ae096320f5e8449de828e SHA256 f88eaad106dc7be5ec36fb3ad4175b6a3ca4145ca0e681e1f4a87c8a9872a0fd
+EBUILD tinc-1.0.16-r2.ebuild 1877 RMD160 08867f600a8b9299d70f3b6728720b6aee351c70 SHA1 ed98816ab59af85fb952603a806e3f7da35f1891 SHA256 16f9297cfd01b3d1141a4f2eb618b420df6ca31b2c4bb0bd281cad52a3bab956
 EBUILD tinc-1.0.16.ebuild 1070 RMD160 c62b38596f6ad8fc0affb80fa7f0bdfe09775d6b SHA1 09a6d6b8af92be06eeb8e9a361022509f4495256 SHA256 6934f068171dcc6ca6105168e5dbfc9d6e1a9f9515c744a52d3ca80c58ce96d9
-MISC ChangeLog 4342 RMD160 0317c87c71abd3121cd7aab028beb8b61d52ef10 SHA1 e00fdd884a52d3dc2b5c2fdae0698a17caff95d2 SHA256 7cfa793c1b41eae61b1ebdfd343106d0faa9727341f6a89a6c29288393dd211c
-MISC metadata.xml 323 RMD160 4afa38944097d8968b63842a67ed19531f0d9ec4 SHA1 40e3e0444e37634e1c939a5dd5677cef74827778 SHA256 8a800ba6f409642a7327882575dab780d140d7692155b5644850421abb7bb4d5
+MISC ChangeLog 4593 RMD160 d14a139b63e45b5dfa91bdad6314105a67e8152a SHA1 f794c76e54b0c9d719a78fc9b33e8d51bdc2c967 SHA256 95316adda68888e0a42e31d60fb1b98b6bbd0852e98c928b6ec1170040ab917b
+MISC metadata.xml 552 RMD160 5c5409d1828ecc369ae2de83f0c37561650ac554 SHA1 5269ecc96eb0fd5ecc66b26570f34ceb90d490df SHA256 7ce6544bd535e945c4c3da2c159fc5c1f4a3cc9f36fd14375fa301b592506fc8
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (GNU/Linux)
 
-iEYEARECAAYFAk7bS80ACgkQI1lqEGTUzyR4rQCeM9m4P9R8lnIhgFNQAukCr9+h
-GyQAoK6EKxW8flBNgb5sAekycEBY8H1N
-=GFSy
+iEYEAREIAAYFAk7yGDAACgkQl5yvQNBFVTVkRQCfSo9Qo+iY1ScxUPZYPeqkrGvj
+ZXAAoKUe0KyIbHnkn508cWyfRf99sScx
+=2f0K
 -----END PGP SIGNATURE-----
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 (file)
index 0000000..acc30c9
--- /dev/null
@@ -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 (file)
index 0000000..6cf4d09
--- /dev/null
@@ -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);
++}
index ce4aedb5a103be3f063a650b5365858414a7825b..ef57095d3dc24627015aa9adf1b21760553e3b2c 100644 (file)
@@ -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 (file)
index 0000000..26d26e4
--- /dev/null
@@ -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"
+}