summaryrefslogtreecommitdiff
path: root/net-dialup/rp-pppoe/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-05-13 09:17:44 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-05-13 09:17:44 +0100
commitce6655a372b67dbf744e1301300bef7c81ab2cb8 (patch)
tree40205742efceb2af63cdba4faf164309f84f59b6 /net-dialup/rp-pppoe/files
parent0e968c4f90483490ac9579b6b2da60032ad311d9 (diff)
net-dialup/rp-pppoe : import from gentoo, fix build
Diffstat (limited to 'net-dialup/rp-pppoe/files')
-rw-r--r--net-dialup/rp-pppoe/files/pppoe-server.confd10
-rw-r--r--net-dialup/rp-pppoe/files/pppoe-server.initd9
-rw-r--r--net-dialup/rp-pppoe/files/rp-pppoe-3.15-no_max_interfaces.patch91
-rw-r--r--net-dialup/rp-pppoe/files/rp-pppoe-4.0-ar_environment.patch81
4 files changed, 191 insertions, 0 deletions
diff --git a/net-dialup/rp-pppoe/files/pppoe-server.confd b/net-dialup/rp-pppoe/files/pppoe-server.confd
new file mode 100644
index 00000000..bb5b2e90
--- /dev/null
+++ b/net-dialup/rp-pppoe/files/pppoe-server.confd
@@ -0,0 +1,10 @@
+#Multiple interfaces allowed. Example: PPPOE_INTERFACE="vlan10 -I vlan11 -I vlan12" and so on.
+#Multiple interfaces allowed. Example: PPPOE_INTERFACE="vlan10 -I vlan11 -I vlan12" and so on.
+
+#PPPOE_INTERFACE=<interface name>
+#AC_NAME=<AC Name>
+#SERVICE_NAME=<Service Name>
+#MAX_SESSIONS=<Max PPPoE Sessions>
+#MAX_SESESSION_PER_MAC=<Max PPPoE Sessions per MAC>
+#LOCAL_IP=<PPP Local IP Addr>
+#OTHER_OPTIONS="-p /etc/ppp/ip-pools"
diff --git a/net-dialup/rp-pppoe/files/pppoe-server.initd b/net-dialup/rp-pppoe/files/pppoe-server.initd
new file mode 100644
index 00000000..39caee9d
--- /dev/null
+++ b/net-dialup/rp-pppoe/files/pppoe-server.initd
@@ -0,0 +1,9 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+description="rp-pppoe server"
+pidfile="/run/pppoe-server.pid"
+command="/usr/sbin/pppoe-server"
+command_args="-I ${PPPOE_INTERFACE:-eth0} -C ${AC_NAME:-$(hostname)} -S ${SERVICE_NAME:-default} -N ${MAX_SESSIONS:-64} -x ${MAX_SESESSION_PER_MAC:-1} -L ${LOCAL_IP:-10.0.0.1.} -k -F ${OTHER_OPTIONS}"
+command_background="true"
diff --git a/net-dialup/rp-pppoe/files/rp-pppoe-3.15-no_max_interfaces.patch b/net-dialup/rp-pppoe/files/rp-pppoe-3.15-no_max_interfaces.patch
new file mode 100644
index 00000000..ecf70f09
--- /dev/null
+++ b/net-dialup/rp-pppoe/files/rp-pppoe-3.15-no_max_interfaces.patch
@@ -0,0 +1,91 @@
+pppoe-server: MAX_INTERFACES 64 is a problem for ULS.
+
+We currently require 77 interfaces, this code just lifts the limit entirely and
+will keep adding interfaces for as much RAM as you have to store an array as
+required.
+
+Signed-off-by: Jaco Kroon <jaco@uls.co.za>
+
+diff -rau rp-pppoe-3.15/src.o/pppoe-server.c rp-pppoe-3.15/src/pppoe-server.c
+--- rp-pppoe-3.15.o/src/pppoe-server.c 2021-05-07 15:18:00.000000000 +0200
++++ rp-pppoe-3.15/src/pppoe-server.c 2021-12-07 21:53:46.755693003 +0200
+@@ -115,8 +115,9 @@
+ ClientSession *BusySessions = NULL;
+
+ /* Interfaces we're listening on */
+-Interface interfaces[MAX_INTERFACES];
++Interface *interfaces = NULL;
+ int NumInterfaces = 0;
++int MaxInterfaces = 0;
+
+ /* The number of session slots */
+ size_t NumSessionSlots;
+@@ -1235,11 +1236,16 @@
+ exit(1);
+ }
+
+- memset(interfaces, 0, sizeof(interfaces));
+-
+ /* Initialize syslog */
+ openlog("pppoe-server", LOG_PID, LOG_DAEMON);
+
++ MaxInterfaces = INIT_INTERFACES;
++ interfaces = malloc(sizeof(*interfaces) * INIT_INTERFACES);
++ if (!interfaces) {
++ fprintf(stderr, "Out of memory allocating initial interfaces.\n");
++ exit(1);
++ }
++
+ /* Default number of session slots */
+ NumSessionSlots = DEFAULT_MAX_SESSIONS;
+ MaxSessionsPerMac = 0; /* No limit */
+@@ -1406,10 +1412,14 @@
+ break;
+
+ case 'I':
+- if (NumInterfaces >= MAX_INTERFACES) {
+- fprintf(stderr, "Too many -I options (max %d)\n",
+- MAX_INTERFACES);
+- exit(EXIT_FAILURE);
++ if (NumInterfaces >= MaxInterfaces) {
++ MaxInterfaces *= 2;
++ interfaces = realloc(interfaces, sizeof(*interfaces) * MaxInterfaces);
++ if (!interfaces) {
++ fprintf(stderr, "Memory allocation failure trying to increase MaxInterfaces to %d\n",
++ MaxInterfaces);
++ exit(EXIT_FAILURE);
++ }
+ }
+ found = 0;
+ for (i=0; i<NumInterfaces; i++) {
+@@ -1419,6 +1429,7 @@
+ }
+ }
+ if (!found) {
++ memset(&interfaces[NumInterfaces], 0, sizeof(*interfaces));
+ strncpy(interfaces[NumInterfaces].name, optarg, IFNAMSIZ);
+ NumInterfaces++;
+ }
+diff -rau rp-pppoe-3.15/src.o/pppoe-server.h rp-pppoe-3.15/src/pppoe-server.h
+--- rp-pppoe-3.15/src.o/pppoe-server.h 2021-05-07 15:18:00.000000000 +0200
++++ rp-pppoe-3.15/src/pppoe-server.h 2021-12-07 21:44:09.945578094 +0200
+@@ -97,8 +97,8 @@
+ /* Hack for daemonizing */
+ #define CLOSEFD 64
+
+-/* Max. number of interfaces to listen on */
+-#define MAX_INTERFACES 64
++/* Initial Max. number of interfaces to listen on */
++#define INIT_INTERFACES 8
+
+ /* Max. 64 sessions by default */
+ #define DEFAULT_MAX_SESSIONS 64
+@@ -107,7 +107,7 @@
+ extern ClientSession *Sessions;
+
+ /* Interfaces we're listening on */
+-extern Interface interfaces[MAX_INTERFACES];
++extern Interface *interfaces;
+ extern int NumInterfaces;
+
+ /* The number of session slots */
diff --git a/net-dialup/rp-pppoe/files/rp-pppoe-4.0-ar_environment.patch b/net-dialup/rp-pppoe/files/rp-pppoe-4.0-ar_environment.patch
new file mode 100644
index 00000000..651dc907
--- /dev/null
+++ b/net-dialup/rp-pppoe/files/rp-pppoe-4.0-ar_environment.patch
@@ -0,0 +1,81 @@
+From 7686d18a896118d4b99b15313edac34e6f5a2370 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Thu, 11 May 2023 13:44:06 +0200
+Subject: [PATCH 1/2] libevent: avoid failure in case ar isn't ar but something
+ else.
+
+---
+ src/libevent/Makefile.in | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/libevent/Makefile.in b/src/libevent/Makefile.in
+index 5f4f43f..02ebe21 100644
+--- a/libevent/Makefile.in
++++ b/libevent/Makefile.in
+@@ -14,13 +14,12 @@ OBJS=event.o event_tcp.o hash.o event_sig.o
+ SRCS=$(OBJS:.o=.c)
+ HDRS=event.h event_tcp.h eventpriv.h hash.h
+ CFLAGS=@CFLAGS@ -I.. $(DEFINES)
+-AR=ar
+
+ all: libevent.a
+
+ libevent.a: $(OBJS)
+ rm -f libevent.a
+- $(AR) -cq libevent.a $(OBJS)
++ @AR@ -cq libevent.a $(OBJS)
+ @RANLIB@ libevent.a
+
+ event.o: event.c $(HDRS)
+
+From 162bf8bf6b9c6776e3b6ac000a1e88afe49d9d31 Mon Sep 17 00:00:00 2001
+From: Jaco Kroon <jaco@uls.co.za>
+Date: Thu, 11 May 2023 13:49:48 +0200
+Subject: [PATCH 2/2] ./configure - marginally improve ar detection.
+
+---
+ src/configure | 6 +++++-
+ src/configure.ac | 6 +++++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index 7eb80d0..9a31790 100755
+--- a/configure
++++ b/configure
+@@ -3088,7 +3088,7 @@ $as_echo "no" >&6; }
+ fi
+
+ if test "x$ac_ct_AR" = x; then
+- AR="/bin/false"
++ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+ yes:)
+@@ -3103,6 +3103,10 @@ else
+ fi
+
+
++if test "no$AR" = no ; then
++ as_fn_error $? "ar is a required program" "$LINENO" 5
++fi
++
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+diff --git a/src/configure.ac b/src/configure.ac
+index cb7a094..a09241a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -13,7 +13,11 @@ AC_PREFIX_DEFAULT(/usr)
+ dnl Checks for programs.
+ AC_PROG_CC
+ AC_PROG_RANLIB
+-AC_CHECK_TOOL([AR],[ar],[/bin/false])
++AC_CHECK_TOOL([AR],[ar])
++
++if test "no$AR" = no ; then
++ AC_ERROR(ar is a required program)
++fi
+
+ dnl Checks for libraries.
+