summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-dialup/xl2tpd')
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch51
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.18-r1.ebuild68
2 files changed, 119 insertions, 0 deletions
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch
new file mode 100644
index 000000000000..ee70ca91cf2e
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch
@@ -0,0 +1,51 @@
+https://github.com/xelerance/xl2tpd/pull/261
+From 65a0473569c51a07309bbc0836ff4262b72297c7 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Fri, 1 Sep 2023 11:05:29 +0200
+Subject: [PATCH] xl2tpd: Close calls when underlying pppd terminate.
+
+Unsure the cause, but we found that upon ppp terminating xl2tpd would
+only reap the PID, but not actually close the inner call, then at a
+later stage would issue a kill() for that PID.
+
+In our environment with high call turnover this would eventually result
+in xl2tpd kill()'ing other critical services like mariadb and/or
+syslog-ng which would upon reloads and rotations have a tendency to
+re-use PIDs that were previously used by pppd processes.
+
+We also believe that this should sort out the problem where IPs wouldn't
+get cycled and re-used.
+
+Closes: #252
+Closes: #255
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+---
+ xl2tpd.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/xl2tpd.c b/xl2tpd.c
+index 791d5a4..4047bca 100644
+--- a/xl2tpd.c
++++ b/xl2tpd.c
+@@ -257,6 +257,9 @@ static void child_handler (int sig)
+ {
+ if (c->pppd == pid)
+ {
++ /* pid is no longer valid, avoid killing it later by accident in destroy_call() */
++ c->pppd = 0;
++
+ if ( WIFEXITED( status ) )
+ {
+ l2tp_log (LOG_DEBUG, "%s : pppd exited for call %d with code %d\n", __FUNCTION__,
+@@ -283,6 +286,8 @@ static void child_handler (int sig)
+ #endif
+ close (c->fd);
+ #ifdef USE_KERNEL
++ } else {
++ call_close (c);
+ }
+ #endif
+ c->fd = -1;
+--
+2.41.0
+
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.18-r1.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.18-r1.ebuild
new file mode 100644
index 000000000000..7a4b224fb5ef
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.18-r1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd toolchain-funcs tmpfiles
+
+DESCRIPTION="A modern version of the Layer 2 Tunneling Protocol (L2TP) daemon"
+HOMEPAGE="https://github.com/xelerance/xl2tpd"
+SRC_URI="https://github.com/xelerance/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~x86"
+IUSE="+kernel"
+
+DEPEND="
+ net-libs/libpcap
+ >=sys-kernel/linux-headers-2.6"
+
+RDEPEND="
+ ${DEPEND}
+ net-dialup/ppp"
+
+DOCS=( CREDITS README.md BUGS CHANGES TODO doc/README.patents )
+
+PATCHES=(
+ "${FILESDIR}/xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch"
+)
+
+src_prepare() {
+ default
+ sed -e 's:/var/run/:/run/:' -i \
+ file.h \
+ l2tp.h \
+ xl2tpd-control.c \
+ doc/l2tp-secrets.5 \
+ doc/xl2tpd.8 \
+ doc/xl2tpd.conf.5 \
+ || die "Error updating /var/run to /run"
+}
+
+src_compile() {
+ tc-export CC
+ local OSFLAGS="-DLINUX"
+ use kernel && OSFLAGS+=" -DUSE_KERNEL"
+ emake OSFLAGS="${OSFLAGS}"
+}
+
+src_install() {
+ emake PREFIX=/usr DESTDIR="${D}" install
+
+ newinitd "${FILESDIR}"/xl2tpd-init-r1 xl2tpd
+
+ systemd_dounit "${FILESDIR}"/xl2tpd.service
+ dotmpfiles "${FILESDIR}"/xl2tpd.conf
+
+ einstalldocs
+
+ insinto /etc/xl2tpd
+ newins doc/l2tpd.conf.sample xl2tpd.conf
+ insopts -m 0600
+ newins doc/l2tp-secrets.sample l2tp-secrets
+}
+
+pkg_postinst() {
+ tmpfiles_process xl2tpd.conf
+}