summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-dialup/xl2tpd
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-dialup/xl2tpd')
-rw-r--r--net-dialup/xl2tpd/Manifest2
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.0-LDFLAGS.patch15
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.1-CFLAGS.patch19
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.1-kernelmode.patch361
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.1-no-type-punning-b119c0da.patch23
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-dnsretry.patch42
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-init32
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-init-r112
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd.conf1
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd.service12
-rw-r--r--net-dialup/xl2tpd/metadata.xml17
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.1-r2.ebuild53
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.1-r3.ebuild53
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.1-r4.ebuild53
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.6.ebuild46
15 files changed, 741 insertions, 0 deletions
diff --git a/net-dialup/xl2tpd/Manifest b/net-dialup/xl2tpd/Manifest
new file mode 100644
index 000000000000..fd7f44773ff2
--- /dev/null
+++ b/net-dialup/xl2tpd/Manifest
@@ -0,0 +1,2 @@
+DIST xl2tpd-1.3.1.tar.gz 551923 SHA256 147ea96a957628bc31bba6fd5f5ef5522366691f936ce4c0a0988d9876e3ba14 SHA512 2265a19eda1521fd4314ad1b28cc1bb781d2f0edb06ad619afbb364f5896e23db7e444ac10709c1ae9b9ac648e4354aea7af57bb5bc20b706b00e2a131fc29d6 WHIRLPOOL b5465605ae5c3bbf73227f11958a43c66191bb557447ce224de044358e738331cf8e64e783bb5527517683cbcc59d57df9cc17c990f652fe7aed1ab2cfd7f9b2
+DIST xl2tpd-1.3.6.tar.gz 553981 SHA256 49b069aa8d873e1d8f615ccc4212351e427bf681ba453fdd211256a8345bb7fb SHA512 868c65660e6a45fb8dc22b95542e9d6ca0dc8e5033cc9df04171a651ef273bc5d711a85f61d4a971d714089f7a10ee67460d8ab9f3c007fcffe0e11e81ae0bfd WHIRLPOOL 92bf661e0ae95bcf80cb8b8c5c9c8648d3aa5375a9dc598f0f4fa3be3bce2bc9a36a60eabf44da3dad24fb3f2b03e30b960d73e6a16c51c8ea25397639766328
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.0-LDFLAGS.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.0-LDFLAGS.patch
new file mode 100644
index 000000000000..8203e51ebc1f
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.0-LDFLAGS.patch
@@ -0,0 +1,15 @@
+"Submitted" upstream: https://github.com/xelerance/xl2tpd/pull/4
+
+=== modified file 'Makefile'
+--- Makefile 2011-09-20 04:44:23 +0000
++++ Makefile 2011-09-20 04:44:35 +0000
+@@ -114,7 +114,7 @@
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
+
+ $(CONTROL_EXEC): $(CONTROL_SRCS)
+- $(CC) $(CONTROL_SRCS) -o $@
++ $(CC) $(LDFLAGS) $(CONTROL_SRCS) -o $@
+
+ pfc:
+ $(CC) $(CFLAGS) -c contrib/pfc.c
+
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.1-CFLAGS.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-CFLAGS.patch
new file mode 100644
index 000000000000..b069a9a4822d
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-CFLAGS.patch
@@ -0,0 +1,19 @@
+commit 898e8541804d0f5a6475b27f8ca5e57cf282208f
+Author: Mike Gilbert <floppym@gentoo.org>
+Date: Tue Dec 25 16:05:33 2012 -0500
+
+ Respect CFLAGS for xl2tpd-control.
+
+diff --git a/Makefile b/Makefile
+index 2a0f341..d694246 100644
+--- a/Makefile
++++ b/Makefile
+@@ -115,7 +115,7 @@ $(EXEC): $(OBJS) $(HDRS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
+
+ $(CONTROL_EXEC): $(CONTROL_SRCS)
+- $(CC) $(LDFLAGS) $(CONTROL_SRCS) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) $(CONTROL_SRCS) -o $@
+
+ pfc:
+ $(CC) $(CFLAGS) -c contrib/pfc.c
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.1-kernelmode.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-kernelmode.patch
new file mode 100644
index 000000000000..5ce9b1244c76
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-kernelmode.patch
@@ -0,0 +1,361 @@
+https://bugs.gentoo.org/show_bug.cgi?id=441828
+
+Based on Fedora patch
+http://pkgs.fedoraproject.org/cgit/xl2tpd.git/plain/xl2tpd-1.3.1-kernelmode.patch
+
+Which is based on a patch by Sergey Fionov (sigwall)
+https://github.com/sigwall/overlay/blob/master/net-dialup/xl2tpd/files/xl2tpd-1.3.0-kernel.patch
+
+diff --git a/call.c b/call.c
+index d1b1858..b672f91 100644
+--- a/call.c
++++ b/call.c
+@@ -680,6 +680,8 @@ struct call *get_call (int tunnel, int call, struct in_addr addr, int port,
+ st->peer.sin_port = port;
+ st->refme = refme;
+ st->refhim = refhim;
++ st->udp_fd = -1;
++ st->pppox_fd = -1;
+ bcopy (&addr, &st->peer.sin_addr, sizeof (addr));
+ st->next = tunnels.head;
+ tunnels.head = st;
+diff --git a/control.c b/control.c
+index 6a41143..8937f2e 100644
+--- a/control.c
++++ b/control.c
+@@ -596,6 +596,9 @@ int control_finish (struct tunnel *t, struct call *c)
+ if (gconfig.debug_state)
+ l2tp_log (LOG_DEBUG, "%s: sending SCCCN\n", __FUNCTION__);
+ control_xmit (buf);
++
++ connect_pppol2tp(t);
++
+ /* Schedule a HELLO */
+ tv.tv_sec = HELLO_DELAY;
+ tv.tv_usec = 0;
+@@ -608,6 +611,7 @@ int control_finish (struct tunnel *t, struct call *c)
+ "Connection established to %s, %d. Local: %d, Remote: %d (ref=%u/%u).\n",
+ IPADDY (t->peer.sin_addr),
+ ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim);
++
+ if (t->lac)
+ {
+ /* This is part of a LAC, so we want to go ahead
+@@ -635,6 +639,9 @@ int control_finish (struct tunnel *t, struct call *c)
+ IPADDY (t->peer.sin_addr),
+ ntohs (t->peer.sin_port), t->ourtid, t->tid, t->refme, t->refhim,
+ t->lns->entname);
++
++ connect_pppol2tp(t);
++
+ /* Schedule a HELLO */
+ tv.tv_sec = HELLO_DELAY;
+ tv.tv_usec = 0;
+diff --git a/l2tp.h b/l2tp.h
+index ac22f3f..0062095 100644
+--- a/l2tp.h
++++ b/l2tp.h
+@@ -167,6 +167,8 @@ struct tunnel
+ int ourrws; /* Receive Window Size */
+ int rxspeed; /* Receive bps */
+ int txspeed; /* Transmit bps */
++ int udp_fd; /* UDP fd */
++ int pppox_fd; /* PPPOX tunnel fd */
+ struct call *self;
+ struct lns *lns; /* LNS that owns us */
+ struct lac *lac; /* LAC that owns us */
+@@ -220,6 +222,7 @@ extern void control_xmit (void *);
+ extern int ppd;
+ extern int switch_io; /* jz */
+ extern int control_fd;
++extern int connect_pppol2tp(struct tunnel *t);
+ extern int start_pppd (struct call *c, struct ppp_opts *);
+ extern void magic_lac_dial (void *);
+ extern int get_entropy (unsigned char *, int);
+diff --git a/network.c b/network.c
+index 82aedd7..8a3fec2 100644
+--- a/network.c
++++ b/network.c
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
++#include <sys/wait.h>
+ #ifndef LINUX
+ # include <sys/uio.h>
+ #endif
+@@ -36,7 +37,6 @@ int server_socket; /* Server socket */
+ int kernel_support; /* Kernel Support there or not? */
+ #endif
+
+-
+ int init_network (void)
+ {
+ long arg;
+@@ -45,6 +45,7 @@ int init_network (void)
+ server.sin_family = AF_INET;
+ server.sin_addr.s_addr = gconfig.listenaddr;
+ server.sin_port = htons (gconfig.port);
++ int flags;
+ if ((server_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
+ {
+ l2tp_log (LOG_CRIT, "%s: Unable to allocate socket. Terminating.\n",
+@@ -52,6 +53,10 @@ int init_network (void)
+ return -EINVAL;
+ };
+
++ flags = 1;
++ setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
++ setsockopt(server_socket, SOL_SOCKET, SO_NO_CHECK, &flags, sizeof(flags));
++
+ if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
+ {
+ close (server_socket);
+@@ -94,7 +99,7 @@ int init_network (void)
+ int kernel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
+ if (kernel_fd < 0)
+ {
+- l2tp_log (LOG_INFO, "L2TP kernel support not detected.\n");
++ l2tp_log (LOG_INFO, "L2TP kernel support not detected (try modprobing l2tp_ppp and pppol2tp)\n");
+ kernel_support = 0;
+ }
+ else
+@@ -321,6 +326,11 @@ int build_fdset (fd_set *readfds)
+
+ while (tun)
+ {
++ if (tun->udp_fd > -1) {
++ if (tun->udp_fd > max)
++ max = tun->udp_fd;
++ FD_SET (tun->udp_fd, readfds);
++ }
+ call = tun->call_head;
+ while (call)
+ {
+@@ -390,6 +400,8 @@ void network_thread ()
+ struct iovec iov;
+ char cbuf[256];
+ unsigned int refme, refhim;
++ int * currentfd;
++ int server_socket_processed;
+
+ /* This one buffer can be recycled for everything except control packets */
+ buf = new_buf (MAX_RECV_SIZE);
+@@ -428,7 +440,21 @@ void network_thread ()
+ {
+ do_control ();
+ }
+- if (FD_ISSET (server_socket, &readfds))
++ server_socket_processed = 0;
++ currentfd = NULL;
++ st = tunnels.head;
++ while (st || !server_socket_processed) {
++ if (st && (st->udp_fd == -1)) {
++ st=st->next;
++ continue;
++ }
++ if (st) {
++ currentfd = &st->udp_fd;
++ } else {
++ currentfd = &server_socket;
++ server_socket_processed = 1;
++ }
++ if (FD_ISSET (*currentfd, &readfds))
+ {
+ /*
+ * Okay, now we're ready for reading and processing new data.
+@@ -456,12 +482,19 @@ void network_thread ()
+ msgh.msg_flags = 0;
+
+ /* Receive one packet. */
+- recvsize = recvmsg(server_socket, &msgh, 0);
++ recvsize = recvmsg(*currentfd, &msgh, 0);
+
+ if (recvsize < MIN_PAYLOAD_HDR_LEN)
+ {
+ if (recvsize < 0)
+ {
++ if (errno == ECONNREFUSED) {
++ close(*currentfd);
++ }
++ if ((errno == ECONNREFUSED) ||
++ (errno == EBADF)) {
++ *currentfd = -1;
++ }
+ if (errno != EAGAIN)
+ l2tp_log (LOG_WARNING,
+ "%s: recvfrom returned error %d (%s)\n",
+@@ -566,6 +599,8 @@ void network_thread ()
+ }
+ };
+ }
++ if (st) st=st->next;
++ }
+
+ /*
+ * finished obvious sources, look for data from PPP connections.
+@@ -638,3 +673,82 @@ void network_thread ()
+ }
+
+ }
++
++int connect_pppol2tp(struct tunnel *t) {
++#ifdef USE_KERNEL
++ if (kernel_support) {
++ int ufd = -1, fd2 = -1;
++ int flags;
++ struct sockaddr_pppol2tp sax;
++
++ struct sockaddr_in server;
++ server.sin_family = AF_INET;
++ server.sin_addr.s_addr = gconfig.listenaddr;
++ server.sin_port = htons (gconfig.port);
++ if ((ufd = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
++ {
++ l2tp_log (LOG_CRIT, "%s: Unable to allocate UDP socket. Terminating.\n",
++ __FUNCTION__);
++ return -EINVAL;
++ };
++
++ flags=1;
++ setsockopt(ufd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
++ setsockopt(ufd, SOL_SOCKET, SO_NO_CHECK, &flags, sizeof(flags));
++
++ if (bind (ufd, (struct sockaddr *) &server, sizeof (server)))
++ {
++ close (ufd);
++ l2tp_log (LOG_CRIT, "%s: Unable to bind UDP socket: %s. Terminating.\n",
++ __FUNCTION__, strerror(errno), errno);
++ return -EINVAL;
++ };
++ server = t->peer;
++ flags = fcntl(ufd, F_GETFL);
++ if (flags == -1 || fcntl(ufd, F_SETFL, flags | O_NONBLOCK) == -1) {
++ l2tp_log (LOG_WARNING, "%s: Unable to set UDP socket nonblock.\n",
++ __FUNCTION__);
++ return -EINVAL;
++ }
++ if (connect (ufd, (struct sockaddr *) &server, sizeof(server)) < 0) {
++ l2tp_log (LOG_CRIT, "%s: Unable to connect UDP peer. Terminating.\n",
++ __FUNCTION__);
++ return -EINVAL;
++ }
++
++ t->udp_fd=ufd;
++
++ fd2 = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
++ if (fd2 < 0) {
++ l2tp_log (LOG_WARNING, "%s: Unable to allocate PPPoL2TP socket.\n",
++ __FUNCTION__);
++ return -EINVAL;
++ }
++ flags = fcntl(fd2, F_GETFL);
++ if (flags == -1 || fcntl(fd2, F_SETFL, flags | O_NONBLOCK) == -1) {
++ l2tp_log (LOG_WARNING, "%s: Unable to set PPPoL2TP socket nonblock.\n",
++ __FUNCTION__);
++ return -EINVAL;
++ }
++ sax.sa_family = AF_PPPOX;
++ sax.sa_protocol = PX_PROTO_OL2TP;
++ sax.pppol2tp.pid = 0;
++ sax.pppol2tp.fd = t->udp_fd;
++ sax.pppol2tp.addr.sin_addr.s_addr = t->peer.sin_addr.s_addr;
++ sax.pppol2tp.addr.sin_port = t->peer.sin_port;
++ sax.pppol2tp.addr.sin_family = AF_INET;
++ sax.pppol2tp.s_tunnel = t->ourtid;
++ sax.pppol2tp.s_session = 0;
++ sax.pppol2tp.d_tunnel = t->tid;
++ sax.pppol2tp.d_session = 0;
++ if ((connect(fd2, (struct sockaddr *)&sax, sizeof(sax))) < 0) {
++ l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket. %d %s\n",
++ __FUNCTION__, errno, strerror(errno));
++ close(fd2);
++ return -EINVAL;
++ }
++ t->pppox_fd = fd2;
++ }
++#endif
++ return 0;
++}
+diff --git a/xl2tpd.c b/xl2tpd.c
+index e98c948..8d7d117 100644
+--- a/xl2tpd.c
++++ b/xl2tpd.c
+@@ -278,7 +278,11 @@ void death_handler (int signal)
+ struct tunnel *st, *st2;
+ int sec;
+ l2tp_log (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
++#ifdef USE_KERNEL
++ if (kernel_support || signal != SIGTERM) {
++#else
+ if (signal != SIGTERM) {
++#endif
+ st = tunnels.head;
+ while (st)
+ {
+@@ -349,7 +353,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ int flags;
+ #endif
+ int pos = 1;
+- int fd2;
++ int fd2 = -1;
+ #ifdef DEBUG_PPPD
+ int x;
+ #endif
+@@ -397,7 +401,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ sax.sa_family = AF_PPPOX;
+ sax.sa_protocol = PX_PROTO_OL2TP;
+ sax.pppol2tp.pid = 0;
+- sax.pppol2tp.fd = server_socket;
++ sax.pppol2tp.fd = c->container->udp_fd;
+ sax.pppol2tp.addr.sin_addr.s_addr = c->container->peer.sin_addr.s_addr;
+ sax.pppol2tp.addr.sin_port = c->container->peer.sin_port;
+ sax.pppol2tp.addr.sin_family = AF_INET;
+@@ -408,6 +412,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ if (connect(fd2, (struct sockaddr *)&sax, sizeof(sax)) < 0) {
+ l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket.\n",
+ __FUNCTION__);
++ close(fd2);
+ return -EINVAL;
+ }
+ stropt[pos++] = strdup ("plugin");
+@@ -484,7 +489,7 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ dup2 (fd2, 0);
+ dup2 (fd2, 1);
+ close(fd2);
+-
++ }
+ /* close all the calls pty fds */
+ st = tunnels.head;
+ while (st)
+@@ -492,12 +497,17 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ sc = st->call_head;
+ while (sc)
+ {
+- close (sc->fd);
++#ifdef USE_KERNEL
++ if (kernel_support) {
++ close(st->udp_fd); /* tunnel UDP fd */
++ close(st->pppox_fd); /* tunnel PPPoX fd */
++ } else
++#endif
++ close (sc->fd); /* call pty fd */
+ sc = sc->next;
+ }
+ st = st->next;
+ }
+- }
+
+ /* close the UDP socket fd */
+ close (server_socket);
+@@ -615,6 +625,10 @@ void destroy_tunnel (struct tunnel *t)
+ the memory pointed to by t->chal_us.vector at some other place */
+ if (t->chal_them.vector)
+ free (t->chal_them.vector);
++ if (t->pppox_fd > -1 )
++ close (t->pppox_fd);
++ if (t->udp_fd > -1 )
++ close (t->udp_fd);
+ free (t);
+ free (me);
+ }
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.1-no-type-punning-b119c0da.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-no-type-punning-b119c0da.patch
new file mode 100644
index 000000000000..681d9a6f94c4
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.1-no-type-punning-b119c0da.patch
@@ -0,0 +1,23 @@
+commit b119c0daf006dcf9d960e5a98902d619cdfdf485
+Author: Ted Phelps <phelps@gnusto.com>
+Date: Thu Dec 20 17:53:54 2012 +1100
+
+ Avoid type punning: it makes gcc grumpy.
+
+ Compilers don't like it when we write to memory as one type and read from it
+ as another. Use memcpy instead of typecast games to avoid doing that.
+
+diff --git a/md5.c b/md5.c
+index 175edcc..cb056da 100644
+--- a/md5.c
++++ b/md5.c
+@@ -161,8 +161,7 @@ void MD5Final (unsigned char digest[16], struct MD5Context *ctx)
+ byteReverse (ctx->in, 14);
+
+ /* Append length in bits and transform */
+- ((uint32 *) ctx->in)[14] = ctx->bits[0];
+- ((uint32 *) ctx->in)[15] = ctx->bits[1];
++ memcpy(ctx->in + 14 * sizeof(uint32), ctx->bits, sizeof(ctx->bits));
+
+ MD5Transform (ctx->buf, (uint32 *) ctx->in);
+ byteReverse ((unsigned char *) ctx->buf, 4);
diff --git a/net-dialup/xl2tpd/files/xl2tpd-dnsretry.patch b/net-dialup/xl2tpd/files/xl2tpd-dnsretry.patch
new file mode 100644
index 000000000000..b27703fe435e
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-dnsretry.patch
@@ -0,0 +1,42 @@
+https://bugs.gentoo.org/show_bug.cgi?id=307489
+http://homenet.beeline.ru/index.php?showtopic=192551&st=0&p=1063626345&#entry1063626345
+
+--- xl2tpd.c 2010-05-10 22:35:43.000000000 +0200
++++ xl2tpd.c 2010-08-15 22:02:14.000000000 +0200
+@@ -587,9 +587,33 @@
+ hp = gethostbyname (host);
+ if (!hp)
+ {
+- l2tp_log (LOG_WARNING, "Host name lookup failed for %s.\n",
+- host);
+- return NULL;
++ if ( lac->redial )
++ {
++ int imax=lac->rmax;
++ if ( lac->rmax == 0 )
++ imax = 1;
++ while ( imax > 0 )
++ {
++ hp = gethostbyname ( host );
++ if ( hp )
++ break;
++ l2tp_log ( LOG_WARNING, "Y: Host name lookup failed for %s. Trying to look again in %d seconds.\n", host, lac->rtimeout );
++ if ( lac->rtimeout > 0 )
++ sleep ( lac->rtimeout );
++ if ( lac->rmax > 0 )
++ imax--;
++ }
++ if ( ( imax == 0 ) && ( lac->rmax > 0 ) )
++ {
++ l2tp_log ( LOG_WARNING, "Y: Host name lookup failed for %s after %d tries. Lookup stops now.\n", host, lac->rmax );
++ return NULL;
++ }
++ }
++ else
++ {
++ l2tp_log (LOG_WARNING, "Host name lookup failed for %s.\n", host);
++ return NULL;
++ }
+ }
+ bcopy (hp->h_addr, &addr, hp->h_length);
+ /* Force creation of a new tunnel
diff --git a/net-dialup/xl2tpd/files/xl2tpd-init b/net-dialup/xl2tpd/files/xl2tpd-init
new file mode 100644
index 000000000000..f8b5a1a26bd3
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -f /etc/xl2tpd/xl2tpd.conf ] ; then
+ eerror "Missing /etc/xl2tpd/xl2tpd.conf configuration file!"
+ eerror "Example configuration file could be found in doc directory."
+ return 1
+ fi
+
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting xl2tpd"
+ start-stop-daemon --start --quiet --exec /usr/sbin/xl2tpd
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping xl2tpd"
+ start-stop-daemon --stop --quiet --pidfile /var/run/xl2tpd.pid
+ eend $?
+}
diff --git a/net-dialup/xl2tpd/files/xl2tpd-init-r1 b/net-dialup/xl2tpd/files/xl2tpd-init-r1
new file mode 100644
index 000000000000..4e381e795916
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-init-r1
@@ -0,0 +1,12 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+command="/usr/sbin/xl2tpd"
+pidfile="/var/run/xl2tpd.pid"
+required_files="/etc/xl2tpd/xl2tpd.conf"
+
+start_pre() {
+ checkpath -d /var/run/xl2tpd
+}
diff --git a/net-dialup/xl2tpd/files/xl2tpd.conf b/net-dialup/xl2tpd/files/xl2tpd.conf
new file mode 100644
index 000000000000..67162b26df06
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd.conf
@@ -0,0 +1 @@
+d /var/run/xl2tpd
diff --git a/net-dialup/xl2tpd/files/xl2tpd.service b/net-dialup/xl2tpd/files/xl2tpd.service
new file mode 100644
index 000000000000..37d46cc63493
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Layer 2 Tunneling Protocol Daemon (L2TP)
+After=syslog.target network.target
+After=ipsec.service
+
+[Service]
+ExecStart=/usr/sbin/xl2tpd -D
+KillSignal=SIGINT
+SuccessExitStatus=1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-dialup/xl2tpd/metadata.xml b/net-dialup/xl2tpd/metadata.xml
new file mode 100644
index 000000000000..0c7e5f5bfb42
--- /dev/null
+++ b/net-dialup/xl2tpd/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-dialup</herd>
+ <maintainer>
+ <email>floppym@gentoo.org</email>
+ <name>Mike Gilbert</name>
+ </maintainer>
+ <longdescription>The Layer 2 Tunneling Protocol (L2TP) daemon mantained by Xelerance Corporation.</longdescription>
+ <use>
+ <flag name="dnsretry">Patch for host lookup retries, activated by redial feature</flag>
+ <flag name="kernel">Enable kernel interface for PPPoL2TP</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">xelerance/xl2tpd</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.1-r2.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.1-r2.ebuild
new file mode 100644
index 000000000000..d65acad3457b
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.1-r2.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs vcs-snapshot
+
+DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE="http://www.xelerance.com/services/software/xl2tpd/"
+SRC_URI="https://github.com/xelerance/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="dnsretry +kernel"
+
+DEPEND="net-libs/libpcap"
+RDEPEND="${DEPEND}
+ net-dialup/ppp"
+DEPEND+=" kernel? ( >=sys-kernel/linux-headers-2.6.23 )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.3.0-LDFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-CFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-no-type-punning-b119c0da.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-kernelmode.patch"
+ sed -i Makefile -e 's| -O2||g' || die "sed Makefile"
+ # The below patch is questionable. Why wasn't it submitted upstream? If it
+ # ever breaks, it will just be removed. -darkside 20120914
+ use dnsretry && epatch "${FILESDIR}/${PN}-dnsretry.patch"
+ # Remove bundled headers
+ rm -r linux || die
+}
+
+src_compile() {
+ tc-export CC
+ export OSFLAGS="-DLINUX"
+ use kernel && OSFLAGS+=" -DUSE_KERNEL"
+ emake
+}
+
+src_install() {
+ emake PREFIX=/usr DESTDIR="${D}" install
+
+ dodoc CREDITS README.xl2tpd BUGS CHANGES TODO doc/README.patents doc/rfc2661.txt
+
+ dodir /etc/xl2tpd
+ cp doc/l2tp-secrets.sample "${ED}/etc/xl2tpd/l2tp-secrets" || die
+ cp doc/l2tpd.conf.sample "${ED}/etc/xl2tpd/xl2tpd.conf" || die
+ fperms 0600 /etc/xl2tpd/l2tp-secrets
+ newinitd "${FILESDIR}"/xl2tpd-init-r1 xl2tpd
+}
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.1-r3.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.1-r3.ebuild
new file mode 100644
index 000000000000..71c446619292
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.1-r3.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils systemd toolchain-funcs vcs-snapshot
+
+DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE="http://www.xelerance.com/services/software/xl2tpd/"
+SRC_URI="https://github.com/xelerance/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="dnsretry +kernel"
+
+DEPEND="net-libs/libpcap"
+RDEPEND="${DEPEND}
+ net-dialup/ppp"
+DEPEND+=" kernel? ( >=sys-kernel/linux-headers-2.6.23 )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.3.0-LDFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-CFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-no-type-punning-b119c0da.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-kernelmode.patch"
+ sed -i Makefile -e 's| -O2||g' || die "sed Makefile"
+ # The below patch is questionable. Why wasn't it submitted upstream? If it
+ # ever breaks, it will just be removed. -darkside 20120914
+ use dnsretry && epatch "${FILESDIR}/${PN}-dnsretry.patch"
+ # Remove bundled headers
+ rm -r linux || die
+}
+
+src_compile() {
+ tc-export CC
+ export OSFLAGS="-DLINUX"
+ use kernel && OSFLAGS+=" -DUSE_KERNEL"
+ emake
+}
+
+src_install() {
+ emake PREFIX=/usr DESTDIR="${D}" install
+ dodoc CREDITS README.xl2tpd BUGS CHANGES TODO doc/README.patents doc/rfc2661.txt
+ insinto /etc/xl2tpd
+ newins doc/l2tpd.conf.sample xl2tpd.conf
+ newins doc/l2tp-secrets.sample l2tp-secrets
+ fperms 0600 /etc/xl2tpd/l2tp-secrets
+ newinitd "${FILESDIR}"/xl2tpd-init-r1 xl2tpd
+ systemd_dounit "${FILESDIR}"/xl2tpd.service
+ systemd_dotmpfilesd "${FILESDIR}"/xl2tpd.conf
+}
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.1-r4.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.1-r4.ebuild
new file mode 100644
index 000000000000..a769eee35ad5
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.1-r4.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils systemd toolchain-funcs vcs-snapshot
+
+DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE="http://www.xelerance.com/services/software/xl2tpd/"
+SRC_URI="https://github.com/xelerance/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~ppc x86"
+IUSE="dnsretry +kernel"
+
+DEPEND="net-libs/libpcap"
+RDEPEND="${DEPEND}
+ net-dialup/ppp"
+DEPEND+=" kernel? ( >=sys-kernel/linux-headers-2.6.23 )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.3.0-LDFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-CFLAGS.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-no-type-punning-b119c0da.patch"
+ epatch "${FILESDIR}/${PN}-1.3.1-kernelmode.patch"
+ sed -i Makefile -e 's| -O2||g' || die "sed Makefile"
+ # The below patch is questionable. Why wasn't it submitted upstream? If it
+ # ever breaks, it will just be removed. -darkside 20120914
+ use dnsretry && epatch "${FILESDIR}/${PN}-dnsretry.patch"
+ # Remove bundled headers
+ rm -r linux || die
+}
+
+src_compile() {
+ tc-export CC
+ export OSFLAGS="-DLINUX"
+ use kernel && OSFLAGS+=" -DUSE_KERNEL"
+ emake
+}
+
+src_install() {
+ emake PREFIX=/usr DESTDIR="${D}" install
+ dodoc CREDITS README.xl2tpd BUGS CHANGES TODO doc/README.patents doc/rfc2661.txt
+ insinto /etc/xl2tpd
+ newins doc/l2tpd.conf.sample xl2tpd.conf
+ newins doc/l2tp-secrets.sample l2tp-secrets
+ fperms 0600 /etc/xl2tpd/l2tp-secrets
+ newinitd "${FILESDIR}"/xl2tpd-init-r1 xl2tpd
+ systemd_dounit "${FILESDIR}"/xl2tpd.service
+ systemd_dotmpfilesd "${FILESDIR}"/xl2tpd.conf
+}
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.6.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.6.ebuild
new file mode 100644
index 000000000000..c245ef30ba97
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.6.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils systemd toolchain-funcs
+
+DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE="http://www.xelerance.com/services/software/xl2tpd/"
+SRC_URI="https://github.com/xelerance/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~mips ~ppc ppc64 ~x86"
+IUSE="dnsretry"
+
+DEPEND="net-libs/libpcap"
+RDEPEND="${DEPEND}
+ net-dialup/ppp"
+DEPEND+=" >=sys-kernel/linux-headers-2.6.23"
+
+src_prepare() {
+ sed -i Makefile -e 's| -O2||g' || die "sed Makefile"
+ # The below patch is questionable. Why wasn't it submitted upstream? If it
+ # ever breaks, it will just be removed. -darkside 20120914
+ use dnsretry && epatch "${FILESDIR}/${PN}-dnsretry.patch"
+}
+
+src_compile() {
+ tc-export CC
+ export OSFLAGS="-DLINUX"
+ emake
+}
+
+src_install() {
+ emake PREFIX=/usr DESTDIR="${D}" install
+ dodoc CREDITS README.xl2tpd BUGS CHANGES TODO doc/README.patents doc/rfc2661.txt
+ insinto /etc/xl2tpd
+ newins doc/l2tpd.conf.sample xl2tpd.conf
+ newins doc/l2tp-secrets.sample l2tp-secrets
+ fperms 0600 /etc/xl2tpd/l2tp-secrets
+ newinitd "${FILESDIR}"/xl2tpd-init-r1 xl2tpd
+ systemd_dounit "${FILESDIR}"/xl2tpd.service
+ systemd_dotmpfilesd "${FILESDIR}"/xl2tpd.conf
+}