net-dialup/xl2tpd: import xl2tpd 1.3.0 from upstream Gentoo

BUG=chromium-os:20746
TEST=emerge xl2tpd-1.3.0 for x86-generic and arm-generic

Change-Id: Iedc3cc3a16484f0fea205f756f8b53d2936b6e92
Reviewed-on: http://gerrit.chromium.org/gerrit/8176
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
This commit is contained in:
Ben Chan 2011-09-22 16:53:32 -07:00
parent 1c86a263aa
commit fcd4c83b9d
4 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,13 @@
=== 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

View File

@ -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

View File

@ -0,0 +1,32 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/xl2tpd/files/xl2tpd-init,v 1.2 2007/03/05 10:50:54 mrness Exp $
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 $?
}

View File

@ -0,0 +1,44 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/xl2tpd/xl2tpd-1.3.0.ebuild,v 1.1 2011/09/20 04:49:45 pva Exp $
EAPI="4"
inherit eutils toolchain-funcs
DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
HOMEPAGE="http://www.xelerance.com/services/software/xl2tpd/"
SRC_URI="ftp://ftp.xelerance.com/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="dnsretry"
DEPEND="net-libs/libpcap"
RDEPEND="${DEPEND}
net-dialup/ppp"
src_prepare() {
epatch "${FILESDIR}/${PN}-1.3.0-LDFLAGS.patch"
sed -i Makefile -e 's| -O2 ||g' || die "sed Makefile"
use dnsretry && epatch "${FILESDIR}/${PN}-dnsretry.patch"
}
src_compile() {
emake CC=$(tc-getCC)
}
src_install() {
emake PREFIX=/usr DESTDIR="${D}" install
dodoc CREDITS README.xl2tpd \
doc/README.patents doc/rfc2661.txt doc/*.sample
dodir /etc/xl2tpd
head -n 2 doc/l2tp-secrets.sample > "${ED}/etc/xl2tpd/l2tp-secrets" || die
fperms 0600 /etc/xl2tpd/l2tp-secrets
newinitd "${FILESDIR}"/xl2tpd-init xl2tpd
keepdir /var/run/xl2tpd
}