summaryrefslogtreecommitdiff
path: root/net-dialup/xl2tpd
diff options
context:
space:
mode:
Diffstat (limited to 'net-dialup/xl2tpd')
-rw-r--r--net-dialup/xl2tpd/Manifest2
-rw-r--r--net-dialup/xl2tpd/files/xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.patch116
-rw-r--r--net-dialup/xl2tpd/xl2tpd-1.3.18-r2.ebuild69
3 files changed, 187 insertions, 0 deletions
diff --git a/net-dialup/xl2tpd/Manifest b/net-dialup/xl2tpd/Manifest
index bb6a6a1ea95e..329c1ccbd794 100644
--- a/net-dialup/xl2tpd/Manifest
+++ b/net-dialup/xl2tpd/Manifest
@@ -1,7 +1,9 @@
AUX xl2tpd-1.3.18-r1-close-calls-when-pppd-terminates.patch 1726 BLAKE2B 56433c1ca3a81e8f26c59235beeb0e105a9770e2faffa1657ff3c6bc79f48e248193fdb8b3ed50db11aa1c471a6b9a51c7801ff9857f572bb3ccdb6de7e4d513 SHA512 43a214c1fb0595648867e79b873356dff530340cc09b26cfac945152bb424b5ac0a912f5f53e9105ffc028cae3029018ea12c7c215a38fc57d7ded71dd1d6e5d
+AUX xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.patch 4029 BLAKE2B bdf288088991abe2fbb9e4e15a22e2db4508e0dbdeb4fe79cc05238b8d8b3a9ec052c5b92403b8c252a9952039889e49e11631fb1fb1e153581a705995994ee6 SHA512 b572171aab2cbc439424ac7387c0f1349db109ccb0fbc620ea3a0446e5747f54afc1235fae487d78a1784fe859c5558b248a808991838734984841deef05b60f
AUX xl2tpd-init-r1 261 BLAKE2B f4aba90e73feeaea22401448681d60baf09854efaebe6d0a5722c96d2bb860653273351d1ce8a516b52491626db0e14ee1e8727b1b994b1ed1e1722ab9463214 SHA512 6d5aab46ee9dcdf3d15acc08d6d0dbbf868d27c4755526f3ae7c19dc9ba528d028a369a7779324687effa2458a60a06ee00984df99bcafce6a8aaa1113fc1788
AUX xl2tpd.conf 14 BLAKE2B ab6ecadf65d4cabd37779ea2de61860f1bced5b59e66cc6e4e960204ba04a4ecf2cef9fdacb79faec2f2e0966e299682d0cf99f97dd07c9873b3c6914a6668af SHA512 b209f3b365de37eb4a6b8c55fd06d79a09ac674e6bfcd40d08a7296f4ab64eb3b6d6b7338461192d19068868258ff70ea02261a56eaffb1bd15672921382ef72
AUX xl2tpd.service 232 BLAKE2B 16578777774cd7d378efb37f917e368d39f84267c45184d9b72a9d501f75e59cf2f14e1326c347cc4d62c541696a2cf4e5af51f13c0c909c26f908a374944e39 SHA512 184b4f63492c5a09fa61ebf0913a4a47e1cd3b321b80b122f2177ff8f5c9eccdc4a73831dfffc3c2e39325f5cb0b30c4e3f99c1f0fed1f21935be5da38a83579
DIST xl2tpd-1.3.18.tar.gz 534937 BLAKE2B ce745855709ac79d5d6aefbe2fb31a4e799f01c6ad31ad2e436c276933e079116daf32bcdc97b7459e4792aa2bd1ddbb600d798d8b28d1432681ffd319fe0829 SHA512 d1114777de5f3895429409fd5474da91fe9e9c218615eb989c9294de3e4e36dea7d8ea880a9b1b1ca18760e5709c8b8156c80d81401db479eaf215c026c3d861
EBUILD xl2tpd-1.3.18-r1.ebuild 1436 BLAKE2B 400c15c7a9b483df3a28c8ae8f577e79e8f16d8c0b4820bd824724122c7275d34e6f00dfcd3b4dd0d79908dd62967dc0ef2c3ab55aac0ae22a079572ef99df4f SHA512 d2b4db639064978c64519b48c761b5353118b407b4a830cbad7a999ace9a9edb092e8152d5ab85302172cad5c19ce71709bc16d999e531b77a8b105fd3b1000d
+EBUILD xl2tpd-1.3.18-r2.ebuild 1504 BLAKE2B e22dff58f4602328864e8ea8fd325b5971dc4b21582df9e58df6d1dc827c661f00e7be5413c12be50ba0da134dd0ba7054f60f9f35c97e6eb668f1eb097d1733 SHA512 ca7897aec39b930d72524610431c814056343c10b7811ff049db435d6d3257135bab23609efd4f7fd2d70f78d6b97b2dffe01d8ebb197bae1fbdbdfc266c6cd2
MISC metadata.xml 879 BLAKE2B 45303811850f78008ae08da56724fd3e9ee5048db230735230504468a2ba03c8c4f19ebbc8b648f0f490504c9df35eb9c667c6dc320802105eaddad1f2098f8c SHA512 287af9f09cf7066768307b7dbb6b570291e4e15592c178e9dad215b1c3229cbfe9bee06994050184525d2636d3c3e87172caab49b084a27fd583461fed334df3
diff --git a/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.patch b/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.patch
new file mode 100644
index 000000000000..7d491b3c6542
--- /dev/null
+++ b/net-dialup/xl2tpd/files/xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.patch
@@ -0,0 +1,116 @@
+From b81956418ca6590d8c3b1a6758dccc0f2f05eb54 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Tue, 18 Oct 2022 12:46:11 +0200
+Subject: [PATCH] Pass remotenumber to pppd.
+
+By default this will be the IP address of the remote peer, but it could
+be the remote's number as provided by way of AVP should the newly added
+'trust remotenumber' LNS option be set to yes.
+
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+---
+ doc/l2tpd.conf.sample | 1 +
+ doc/xl2tpd.conf.5 | 6 ++++++
+ file.c | 17 +++++++++++++++++
+ file.h | 1 +
+ xl2tpd.c | 8 ++++++++
+ 5 files changed, 33 insertions(+)
+
+diff --git a/doc/l2tpd.conf.sample b/doc/l2tpd.conf.sample
+index 8f8fcb5..f6f0359 100644
+--- a/doc/l2tpd.conf.sample
++++ b/doc/l2tpd.conf.sample
+@@ -47,6 +47,7 @@
+ ; rx bps = 10000000 ; Receive tunnel speed
+ ; tx bps = 10000000 ; Transmit tunnel speed
+ ; bps = 100000 ; Define both receive and transmit speed in one option
++; trust remotenumber = no ; Trust dialing number AVP?
+
+ ; [lac marko] ; Example VPN LAC definition
+ ; lns = lns.marko.net ; * Who is our LNS?
+diff --git a/doc/xl2tpd.conf.5 b/doc/xl2tpd.conf.5
+index 2b1acbc..173a453 100644
+--- a/doc/xl2tpd.conf.5
++++ b/doc/xl2tpd.conf.5
+@@ -175,6 +175,12 @@ This will enable the debug for pppd.
+ .B pass peer
+ Pass the peer's IP address to pppd as ipparam. Enabled by default.
+
++.TP
++.B trust remotenumber
++When this is set to yes xl2tpd will trust the dialing number AVP and provide
++that as the remotenumber to pppd rather than the peer's IP address. Default is
++not trusted.
++
+ .TP
+ .B pppoptfile
+ Specify the path for a file which contains pppd configuration parameters
+diff --git a/file.c b/file.c
+index 17dc377..29fcb66 100644
+--- a/file.c
++++ b/file.c
+@@ -676,6 +676,22 @@ int set_pass_peer (char *word, char *value, int context, void *item)
+ return 0;
+ }
+
++int set_trust_remotenumber (char *word, char *value, int context, void *item)
++{
++ switch (context & ~CONTEXT_DEFAULT)
++ {
++ case CONTEXT_LNS:
++ if (set_boolean (word, value, &(((struct lns *) item)->trust_remotenumber)))
++ return -1;
++ break;
++ default:
++ snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
++ word);
++ return -1;
++ }
++ return 0;
++}
++
+ int set_pppoptfile (char *word, char *value, int context, void *item)
+ {
+ struct lac *l = (struct lac *) item;
+@@ -1611,6 +1627,7 @@ struct keyword words[] = {
+ {"hostname", &set_hostname},
+ {"ppp debug", &set_debug},
+ {"pass peer", &set_pass_peer},
++ {"trust remotenumber", &set_trust_remotenumber},
+ {"pppoptfile", &set_pppoptfile},
+ {"call rws", &set_rws},
+ {"tunnel rws", &set_rws},
+diff --git a/file.h b/file.h
+index a2707c2..9d76359 100644
+--- a/file.h
++++ b/file.h
+@@ -97,6 +97,7 @@ struct lns
+ int proxyauth; /* Allow proxy authentication? */
+ int debug; /* Debug PPP? */
+ int pass_peer; /* Pass peer IP to pppd as ipparam? */
++ int trust_remotenumber; /* Whether or not to trust remotely supplied "Dialing Number" AVP */
+ char pppoptfile[STRLEN]; /* File containing PPP options */
+ struct tunnel *t; /* Tunnel of this, if it's ready */
+ };
+diff --git a/xl2tpd.c b/xl2tpd.c
+index 3195988..b551146 100644
+--- a/xl2tpd.c
++++ b/xl2tpd.c
+@@ -495,6 +495,14 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
+ }
+
+ {
++ stropt[pos++] = strdup("remotenumber");
++ if (c->dialing[0] && (!c->lns || c->lns->trust_remotenumber)) {
++ /* if a remotenumber is available, and we're a LAC or the remote "dialing number" AVP is trusted */
++ stropt[pos++] = strdup(c->dialing);
++ } else {
++ stropt[pos++] = strdup(IPADDY(c->container->peer.sin_addr));
++ }
++
+ struct ppp_opts *p = opts;
+ int maxn_opts = sizeof(stropt) / sizeof(stropt[0]) - 1;
+ while (p && pos < maxn_opts)
+--
+2.44.2
+
diff --git a/net-dialup/xl2tpd/xl2tpd-1.3.18-r2.ebuild b/net-dialup/xl2tpd/xl2tpd-1.3.18-r2.ebuild
new file mode 100644
index 000000000000..ece525226f09
--- /dev/null
+++ b/net-dialup/xl2tpd/xl2tpd-1.3.18-r2.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2024 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"
+ "${FILESDIR}/xl2tpd-1.3.18-r2-Pass-remotenumber-to-pppd.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
+}