From ce6655a372b67dbf744e1301300bef7c81ab2cb8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 13 May 2023 09:17:44 +0100 Subject: net-dialup/rp-pppoe : import from gentoo, fix build --- net-dialup/rp-pppoe/files/pppoe-server.confd | 10 +++ net-dialup/rp-pppoe/files/pppoe-server.initd | 9 +++ .../files/rp-pppoe-3.15-no_max_interfaces.patch | 91 ++++++++++++++++++++++ .../files/rp-pppoe-4.0-ar_environment.patch | 81 +++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 net-dialup/rp-pppoe/files/pppoe-server.confd create mode 100644 net-dialup/rp-pppoe/files/pppoe-server.initd create mode 100644 net-dialup/rp-pppoe/files/rp-pppoe-3.15-no_max_interfaces.patch create mode 100644 net-dialup/rp-pppoe/files/rp-pppoe-4.0-ar_environment.patch (limited to 'net-dialup/rp-pppoe/files') 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= +#AC_NAME= +#SERVICE_NAME= +#MAX_SESSIONS= +#MAX_SESESSION_PER_MAC= +#LOCAL_IP= +#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 + +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 +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 +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. + -- cgit v1.2.3