added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
From 1f8d336a5cd88b87e15596d05980f6fe77a0f226 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Mar 2017 11:28:41 -0700
Subject: [PATCH 1/4] Use -1 instead of WAIT_ANY
WAIT_ANY is not supported by POSIX and some C libraries
e.g. musl do not define this.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
usl/usl_pid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usl/usl_pid.c b/usl/usl_pid.c
index 103458b..9819473 100644
--- a/usl/usl_pid.c
+++ b/usl/usl_pid.c
@@ -78,7 +78,7 @@ int usl_pid_reap_children(int waitfor)
/* Wait for processes in our process group. */
- while (((pid = waitpid(WAIT_ANY, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) {
+ while (((pid = waitpid(-1, &status, (waitfor ? 0: WNOHANG))) != -1) && (pid != 0)) {
have_callback = 0;
usl_list_for_each(walk, tmp, &usl_child_list) {
child = usl_list_entry(walk, struct usl_pid_child, list);
--
2.12.1

View File

@@ -0,0 +1,34 @@
From 25dce20a75bc84ae9e4ec640590cef0c12750789 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Mar 2017 17:48:13 -0700
Subject: [PATCH 1/2] l2tp_api: Included needed headers
These are flagged by musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
l2tp_api.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/l2tp_api.c b/l2tp_api.c
index d16f80e..9d6f60a 100644
--- a/l2tp_api.c
+++ b/l2tp_api.c
@@ -22,9 +22,12 @@
* Each module implements the required RPC xxx_1_svc() callbacks which
* are called directly by the RPC library.
*/
-
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
#include <rpc/pmap_clnt.h>
-#include <net/ethernet.h>
+//#include <netinet/in.h>
#include "usl.h"
--
2.12.1

View File

@@ -0,0 +1,28 @@
From ded84ed583e9b0617bc35ab1798032d18b873144 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 29 Aug 2022 23:30:02 -0700
Subject: [PATCH] l2tp_rpc_server.c: Add missing prototype for
l2tp_api_rpc_check_request
Upstream-Status: Inappropriate [no upstream]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 0815b31..2fa5b2f 100644
--- a/Makefile
+++ b/Makefile
@@ -236,6 +236,7 @@ endif
-$(RM) $@ $@.tmp
$(RPCGEN) $(RPCGENFLAGS) -m -o $@.tmp $<
cat $@.tmp | sed -e 's/switch (rqstp->rq_proc) {/if (l2tp_api_rpc_check_request(transp) < 0) return; switch (rqstp->rq_proc) {/' > $@
+ sed -i '21i int l2tp_api_rpc_check_request(SVCXPRT *xprt);' $@
%_client.c: %.x
-$(RM) $@
--
2.37.2

View File

@@ -0,0 +1,45 @@
From 2bfdd02d288de92ff118bf41b54c135a6a318c19 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 29 Aug 2022 23:42:11 -0700
Subject: [PATCH] lex/yacc: Add missing function prototypes
Fixes build with clang15
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
l2tp_config_parse.y | 3 +++
l2tp_config_token.l | 3 +++
2 files changed, 6 insertions(+)
diff --git a/l2tp_config_parse.y b/l2tp_config_parse.y
index 4baf1e0..15392d0 100644
--- a/l2tp_config_parse.y
+++ b/l2tp_config_parse.y
@@ -29,6 +29,9 @@ static struct l2tp_api_session_msg_data session;
extern void l2tp_log(int level, char *fmt, ...);
extern void yyfatal(const char *s);
+extern const char *l2tp_strerror(int error);
+extern int yylex (void);
+extern void yyerror(const char *s);
%}
diff --git a/l2tp_config_token.l b/l2tp_config_token.l
index 9016af6..43b8f0a 100644
--- a/l2tp_config_token.l
+++ b/l2tp_config_token.l
@@ -15,6 +15,9 @@
#include "l2tp_config_types.h"
#include "l2tp_config_parse.h"
+extern void l2tp_log(int level, char *fmt, ...);
+extern const char *l2tp_strerror(int error);
+
void yyfatal(const char *s);
void yyerror(const char *s);
--
2.37.2

View File

@@ -0,0 +1,38 @@
From ce5f5563ab54db9d28dba44a0e25e8a8c7bb9876 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 19 Oct 2016 00:34:35 +0000
Subject: [PATCH] test/pppd_dummy.c: Fix return value
pause() is defined in unistd.h, clang does not
like the fact that we are using a function without
declaration
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
test/pppd_dummy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/pppd_dummy.c b/test/pppd_dummy.c
index 148e7d2..b564c36 100644
--- a/test/pppd_dummy.c
+++ b/test/pppd_dummy.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <syslog.h>
+#include <unistd.h>
#define PPPD_DUMMY_TMP_FILE "/tmp/pppd_dummy"
@@ -40,7 +41,7 @@ int main(int argc, char **argv)
if (file == NULL) {
syslog(LOG_ERR, "Failed to open %s\n", filename);
- return;
+ return -1;
}
for (arg = 1; arg < argc; arg++) {
--
1.9.1

View File

@@ -0,0 +1,25 @@
From 2d633f4c18ff3cb52234449fd86a0a63b55d669b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Mar 2017 11:31:55 -0700
Subject: [PATCH 2/4] cli: include fcntl.h for O_CREAT define
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
cli/cli_readline.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/cli/cli_readline.c b/cli/cli_readline.c
index 097ed6a..127136c 100644
--- a/cli/cli_readline.c
+++ b/cli/cli_readline.c
@@ -24,6 +24,7 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/errno.h>
+#include <fcntl.h>
#include <signal.h>
#include <readline/readline.h>
--
2.12.1

View File

@@ -0,0 +1,36 @@
From a41cbeee3cf660663a9baac80545050a8d960898 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Mar 2017 18:09:58 -0700
Subject: [PATCH 2/2] user ipv6 structures
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Update for ipv6 address compare
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
l2tp_api.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/l2tp_api.c b/l2tp_api.c
index 9d6f60a..f0946fd 100644
--- a/l2tp_api.c
+++ b/l2tp_api.c
@@ -450,10 +450,12 @@ int l2tp_api_rpc_check_request(SVCXPRT *xprt)
* non-loopback interface, reject the request.
*/
if ((!l2tp_opt_remote_rpc) &&
- ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) &&
- (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) {
+ ((memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_loopback, sizeof(struct in6_addr)) != 0) &&
+ (memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_any, sizeof(struct in6_addr)) != 0))) {
+ char straddr[INET6_ADDRSTRLEN];
+ inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr));
if (l2tp_opt_trace_flags & L2TP_DEBUG_API) {
- l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr));
+ l2tp_log(LOG_ERR, "Rejecting RPC request from %s", straddr);
}
svcerr_auth(xprt, AUTH_TOOWEAK);
return -EPERM;
--
2.12.1

View File

@@ -0,0 +1,35 @@
From 74fe72583472bcc3c89a52839cac2ebbad6c8a74 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Mar 2017 11:34:52 -0700
Subject: [PATCH 3/4] cli: Define _GNU_SOURCE for getting sighandler_t
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
cli/cli_readline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/cli_readline.c b/cli/cli_readline.c
index 127136c..931779b 100644
--- a/cli/cli_readline.c
+++ b/cli/cli_readline.c
@@ -17,7 +17,7 @@
* Boston, MA 02110-1301 USA
*
*****************************************************************************/
-
+#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
@@ -634,7 +634,7 @@ static void cli_rl_uninstall_signal_handlers(void)
static int cli_rl_install_signal_handlers(void)
{
- __sighandler_t handler;
+ sighandler_t handler;
rl_catch_signals = 0;
rl_clear_signals();
--
2.12.1

View File

@@ -0,0 +1,106 @@
From 152486fa3c36c3b99d17d5b553cf87ef412fae8e Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Mon, 1 Dec 2014 01:53:41 +0900
Subject: [PATCH] Makefile:modify CFLAGS to aviod build error.
Upstream-Status: Pending
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
---
Makefile | 22 +++++++++++-----------
plugins/Makefile | 6 +++---
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 4aaa448..baa7882 100644
--- a/Makefile
+++ b/Makefile
@@ -152,10 +152,10 @@ LIBS.dmalloc= -ldmalloc
export USE_DMALLOC
endif
-CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
-CFLAGS= -I. -Iusl -Icli -isystem include \
- -MMD -Wall -Werror -Wno-strict-aliasing \
- $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
+ADD_CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
+ADD_CFLAGS= -I. -Iusl -Icli -isystem include \
+ -MMD -Wall -Wno-strict-aliasing \
+ $(ADD_CPPFLAGS) $(CPPFLAGS.dmalloc) \
-DSYS_LIBDIR=$(SYS_LIBDIR)
LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
@@ -170,10 +170,10 @@ CFLAGS.optimize= $(OPT_CFLAGS)
endif
export CFLAGS.optimize
-CFLAGS+= $(CFLAGS.optimize)
+ADD_CFLAGS+= $(CFLAGS.optimize)
ifeq ($(L2TP_USE_ASYNC_RPC),y)
-CPPFLAGS+= -DL2TP_ASYNC_RPC
+ADD_CPPFLAGS+= -DL2TP_ASYNC_RPC
endif
ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
@@ -220,13 +220,13 @@ endif
# Compile without -Wall because rpcgen-generated code is full of warnings.
%_xdr.o: %_xdr.c
- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
+ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
%_client.o: %_client.c
- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
+ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
%_server.o: %_server.c
- $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
+ $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
%_xdr.c: %.x
-$(RM) $@
@@ -272,7 +272,7 @@ l2tpconfig: $(L2TPCONFIG_SRCS.o)
$(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
%.o: %.c
- $(CC) -c $(CFLAGS) $< -o $@
+ $(CC) -c $(CFLAGS) $(ADD_CFLAGS) $< -o $@
l2tp_options.h: FORCE
@rm -f $@.tmp
@@ -325,7 +325,7 @@ install: install-all
install-all: all install-daemon install-app
install-daemon:
- @for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
+ @for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS) $(ADD_CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
$(INSTALL) -d $(DESTDIR)/usr/sbin
$(INSTALL) openl2tpd $(DESTDIR)/usr/sbin
diff --git a/plugins/Makefile b/plugins/Makefile
index 5be996d..6810236 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -1,7 +1,7 @@
-CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
+ADD_CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
-isystem ../include \
-I. -I.. -I../usl -fPIC $(EXTRA_CFLAGS)
-LDFLAGS := -shared
+ADD_LDFLAGS := -shared
PLUGINS.c:= ppp_unix.c ppp_null.c ipsec.c event_sock.c
@@ -21,7 +21,7 @@ clean:
$(RM) $(PLUGINS.so) $(wildcard *.o) $(wildcard *.d) $(SRC.generated)
%.so: %.c
- $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $<
+ $(CC) -o $@ $(LDFLAGS) $(ADD_LDFLAGS) $(CFLAGS) $(ADD_CFLAGS) $<
install: all
$(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
--
1.8.4.2

View File

@@ -0,0 +1,15 @@
Upstream-Status: Pending
--- openl2tp-1.8/Makefile.orig 2016-09-16 14:54:18.554291976 +0200
+++ openl2tp-1.8/Makefile 2016-09-16 14:57:23.559090400 +0200
@@ -157,8 +157,8 @@ ADD_CFLAGS= -I. -Iusl -Icli -isystem i
-MMD -Wall -Wno-strict-aliasing \
$(ADD_CPPFLAGS) $(CPPFLAGS.dmalloc) \
-DSYS_LIBDIR=$(SYS_LIBDIR)
-LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
-LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
+LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc $(LDFLAGS)
+LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc $(LDFLAGS)
OPT_CFLAGS?= -O

View File

@@ -0,0 +1,44 @@
This fixes a compile issue introduced with linux kernel 4.15
include/linux/in.h:222:8: error: redefinition of 'struct in_pktinfo'
| struct in_pktinfo {
Upstream-Status: Pending
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Index: openl2tp-1.8/plugins/ppp_unix.c
===================================================================
--- openl2tp-1.8.orig/plugins/ppp_unix.c
+++ openl2tp-1.8/plugins/ppp_unix.c
@@ -25,9 +25,14 @@
#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#include <net/ethernet.h>
#include <net/if.h>
#include <netinet/in.h>
+#endif
+
#include <arpa/inet.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -41,12 +46,12 @@
#define __user
#endif
#include <sys/ioctl.h>
-#include <linux/if_ether.h>
-#include <linux/if_pppox.h>
#include <linux/ppp_defs.h>
#include <linux/if_ppp.h>
+#include <linux/if_pppox.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#include <linux/if_pppol2tp.h>
-
+#endif
#include "usl.h"
#include "l2tp_private.h"

View File

@@ -0,0 +1,41 @@
From 460549a3de27f8dd8371b6d6fc1f69d8bffa102b Mon Sep 17 00:00:00 2001
From: Joe MacDonald <joe_macdonald@mentor.com>
Date: Tue, 6 Jan 2015 11:23:21 -0500
Subject: [PATCH] openl2tp: simplify gcc warning hack
The hack to work around the gcc warning causes problems with some modern
gcc configurations. Since the redef behaviour is essentially correct
everywhere and since the hack is still required on 32-bit builders, leave
it in place but remove the #if guard since it is only there to ensure that
the l2tp_private.h file is updated if the rpc source file is changed and
the two get out of sync.
Upstream-Status: Pending
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
---
l2tp_private.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/l2tp_private.h b/l2tp_private.h
index f3c1af7..cca6806 100644
--- a/l2tp_private.h
+++ b/l2tp_private.h
@@ -89,14 +89,8 @@
* So we redefine the constant with UL suffix to avoid the gcc warning.
* Is there some C preprocessor magic that could avoid having to do this?
*/
-#if L2TP_API_TUNNEL_FLAG_MTU != 2147483648
-#error Constant L2TP_API_TUNNEL_FLAG_MTU changed. Update local definition here.
-#endif
#undef L2TP_API_TUNNEL_FLAG_MTU
#define L2TP_API_TUNNEL_FLAG_MTU 2147483648UL
-#if L2TP_API_SESSION_FLAG_NO_PPP != 2147483648
-#error Constant L2TP_API_SESSION_FLAG_NO_PPP changed. Update local definition here.
-#endif
#undef L2TP_API_SESSION_FLAG_NO_PPP
#define L2TP_API_SESSION_FLAG_NO_PPP 2147483648UL
--
1.9.1

View File

@@ -0,0 +1,24 @@
commit 3e96a6c41bdd26417265a45ed685138d8eed564e
Author: Aws Ismail <aws.ismail@windriver.com>
Date: Fri Sep 14 02:32:53 2012 -0400
openl2tp: Enable tests
Build the test direcctory as part
of the overall build
Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
diff --git a/Makefile b/Makefile
index 412cf4d..adf4f44 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ L2TP_FEATURE_LOCAL_CONF_FILE= y
# Define to include test code. This must be defined to run the
# regression tests
-# L2TP_TEST= y
+L2TP_TEST=y
# Define to compile in debug code. Also makes default trace flags
# enable all messages

View File

@@ -0,0 +1,35 @@
commit 6ea3125e2bec15004f312814022335d94cdf7e94
Author: Aws Ismail <aws.ismail@windriver.com>
Date: Wed Sep 19 11:34:48 2012 -0400
Fix openl2tp config script location
Correct the location of the sysconfig
script. Use /etc/default/ instead of
/etc/sysconfig/
Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
Upstream-Status: Inappropriate [configuration]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd
index 7f27bb7..4194f63 100755
--- a/etc/rc.d/init.d/openl2tpd
+++ b/etc/rc.d/init.d/openl2tpd
@@ -8,12 +8,12 @@
# can be used to implement L2TP VPNs. As a server, it can handle
# hundreds of tunnels and sessions.
# processname: openl2tpd
-# config: /etc/sysconfig/openl2tpd
+# config: /etc/default/openl2tpd
# pidfile: /var/run/openl2tpd.pid
# Source function library.
. /etc/init.d/functions
-. /etc/sysconfig/openl2tpd
+. /etc/default/openl2tpd
# See how we were called.

View File

@@ -0,0 +1,32 @@
openl2tp: eliminate warning from modprobe
modprobe will emit alarming warnings if it cannot
find a module, but we only care that it find one
of two possible modules when we start openl2tpd.
Suppress messages from modprobe.
Upstream-Status: Pending
Signed-off-by: Joe Slater <jslater@windriver.com>
--- a/etc/rc.d/init.d/openl2tpd
+++ b/etc/rc.d/init.d/openl2tpd
@@ -29,7 +29,7 @@ start() {
return 1
fi
fi
- modprobe -s pppol2tp || modprobe -s l2tp_ppp
+ modprobe -sq pppol2tp || modprobe -sq l2tp_ppp
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS
@@ -57,7 +57,7 @@ stop() {
return 1;
fi
killproc openl2tpd
- modprobe -s -r pppol2tp || modprobe -s -r l2tp_ppp
+ modprobe -srq pppol2tp || modprobe -srq l2tp_ppp
echo
rm -f /var/run/openl2tpd.pid
rm -f /var/lock/subsys/openl2tpd

View File

@@ -0,0 +1,49 @@
commit 7c58a1e244ea83a9e7bbd51a6d354cee25cdbd33
Author: Aws Ismail <aws.ismail@windriver.com>
Date: Wed Sep 12 23:35:40 2012 -0400
Fix openl2tpd initscript
- Correct the location of the retval statement.
- use start-stop-daemon instead of daemon.
Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
diff --git a/etc/rc.d/init.d/openl2tpd b/etc/rc.d/init.d/openl2tpd
index ce21b50..7f27bb7 100755
--- a/etc/rc.d/init.d/openl2tpd
+++ b/etc/rc.d/init.d/openl2tpd
@@ -24,7 +24,7 @@ start() {
if [ -e /var/lock/subsys/openl2tpd ]; then
if [ -e /var/run/openl2tpd.pid ] && [ -e /proc/`cat /var/run/openl2tpd.pid` ]; then
echo -n $"cannot start openl2tpd: openl2tpd is already running.";
- failure $"cannot start openl2tpd: openl2tpd already running.";
+ #failure $"cannot start openl2tpd: openl2tpd already running.";
echo
return 1
fi
@@ -32,9 +32,9 @@ start() {
modprobe -s pppol2tp || modprobe -s l2tp_ppp
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
- daemon openl2tpd $OPENL2TPDARGS
+ start-stop-daemon --start --exec openl2tpd $OPENL2TPDARGS
+ RETVAL=$?
fi
- RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/openl2tpd
@@ -52,7 +52,7 @@ stop() {
echo -n $"Stopping $prog: "
if [ ! -e /var/lock/subsys/openl2tpd ]; then
echo -n $"cannot stop openl2tpd: openl2tpd is not running."
- failure $"cannot stop openl2tpd: openl2tpd is not running."
+ #failure $"cannot stop openl2tpd: openl2tpd is not running."
echo
return 1;
fi

View File

@@ -0,0 +1,17 @@
[Unit]
Description=The open L2TP implementation
After=network.target remote-fs.target nss-lookup.target rpcbind.target
Requires=rpcbind.service
[Service]
Type=forking
PIDFile=/run/openl2tpd.pid
EnvironmentFile=@SYSCONFDIR@/default/openl2tpd
ExecStartPre=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -sq l2tp_ppp || @BASE_SBINDIR@/modprobe -sq pppol2tp"
ExecStart=@SBINDIR@/openl2tpd $OPENL2TPDARGS
ExecStartPost=@BASE_BINDIR@/sh -c 'if [ -n "$OPENL2TPD_CONFIG_FILE" ]; then sleep 1; @BINDIR@/l2tpconfig config restore file=$OPENL2TPD_CONFIG_FILE; fi'
ExecStopPost=@BASE_BINDIR@/sh -c "@BASE_SBINDIR@/modprobe -rsq l2tp_ppp || @BASE_SBINDIR@/modprobe -rsq pppol2tp"
SuccessExitStatus=1
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,97 @@
#!/bin/sh
TMP_DIR=`mktemp -d /tmp/std.26.tmp.XXXXXX`
# restore the file if exist
restore_file()
{
filelist="test_procs.tcl tunnel.test session.test"
for file in ${filelist}
do
if [ -f ${TMP_DIR}/${file} ]; then
mv ${TMP_DIR}/${file} ${OPENL2TP_DIR}
fi
done
}
exit_cus()
{
restore_file
echo $1
exit $2
}
if [ -d /usr/lib64/openl2tp/ptest ]; then
OPENL2TP_DIR="/usr/lib64/openl2tp"
elif [ -d /usr/lib/openl2tp/ptest ]; then
OPENL2TP_DIR="/usr/lib/openl2tp"
else
exit_cus "The openl2tp ptest directory not installed, skip the test" 1
fi
#read -p "Please input the network interface you use to test(such as eth0, em1 etc):" ETH_TEST
echo "Please input the network interface you use to test(such as eth0, em1 etc):"
read ETH_TEST > /dev/null
if [ x"$ETH_TEST" = x ]; then
exit_cus "The network interface cannot be null" 1
fi
ifconfig | grep $ETH_TEST > /dev/null || exit_cus "The network interface you provide is invalid" 1
# check openl2tp related kernel config
zcat /proc/config.gz | grep CONFIG_L2TP=y > /dev/null || exit_cus "Failed to check CONFIG_L2TP=y, skip the tests." 1
zcat /proc/config.gz | grep CONFIG_PPPOL2TP=m > /dev/null || exit_cus "Failed to check CONFIG_PPPOL2TP=m, skip the tests." 1
SYSV_INIT="/etc/init.d/rpcbind"
if [ -e ${SYSV_INIT} ]; then
${SYSV_INIT} status > /dev/null || ${SYSV_INIT} start > /dev/null
else
systemctl status rpcbind > /dev/null || systemctl start rpcbind > /dev/null
fi
which systemctl > /dev/null && systemctl status rpcbind > /dev/null || service rpcbind status > /dev/null
[ $? -ne 0 ] && exit_cus "Failed to start rpcbind service, skip the tests." 1
# backup the below files
cp ${OPENL2TP_DIR}/ptest/test_procs.tcl $TMP_DIR
cp ${OPENL2TP_DIR}/ptest/tunnel.test $TMP_DIR
cp ${OPENL2TP_DIR}/ptest/session.test $TMP_DIR
# customise the config
if [ x"$ETH_TEST" = x ]; then
exit_cus "Please set ETH_TEST which used to test first, skip the tests." 1
fi
sed -i 's/eth2/'\"$ETH_TEST\"'/g' ${OPENL2TP_DIR}/ptest/test_procs.tcl
test_ip="`ifconfig $ETH_TEST | grep 'inet ' | sed 's/^.*inet addr://g' | \
sed 's/ *Mask.*$//g'|sed 's/ *Bcast.*$//g'`"
sed -i 's/192.168.0.1/'"$test_ip"'/g' ${OPENL2TP_DIR}/ptest/tunnel.test
# load module l2tp_ppp
modprobe l2tp_ppp > /dev/null
lsmod | grep l2tp_ppp > /dev/null || exit_cus "FAIL: Load module l2tp_ppp" 2
# start openl2tpd
ps aux | grep openl2tpd | grep -v grep > /dev/null && killall openl2tpd > /dev/null
ppp_path=`rpm -ql openl2tp | grep ppp_null.so`
echo "test it here"
/usr/sbin/openl2tpd -d all -D -f -p ${ppp_path} & > /dev/null
# prepare the test env
rm -rf $OPENL2TP_DIR/results
mkdir -p $OPENL2TP_DIR/results || exit_cus "FAIL: mkdir $OPENL2TP_DIR/results" 2
cp /usr/bin/l2tpconfig ${OPENL2TP_DIR} || exit_cus "FAIL: copy /usr/bin/l2tpconfig to ${OPENL2TP_DIR}" 2
# start the test
cd ${OPENL2TP_DIR}/ptest && tclsh all.tcl -preservecore 3 -verbose bps -tmpdir $OPENL2TP_DIR/results -outfile test-l2tpd.result -constraints "l2tpdRunning peerProfile tunnelProfile sessionProfile pppProfile system" -match "peer_profile-1.1 tunnel_profile-1.1 session_profile-1.1 ppp_profile-1.1 system-1.1"
# check the result
PASSNUM=`grep PASS $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
FAILNUM=`grep FAIL $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
if [ $PASSNUM -ne 0 ] && [ $FAILNUM -eq 0 ]; then
echo "PASS: openl2tp"
else
echo "FAIL: openl2tp"
fi
restore_file

View File

@@ -0,0 +1,96 @@
SUMMARY = "An L2TP client/server, designed for VPN use."
DESCRIPTION = "OpenL2TP is an open source L2TP client / server, written \
specifically for Linux. It has been designed for use as an enterprise \
L2TP VPN server or in commercial, Linux-based, embedded networking \
products and is able to support hundreds of sessions, each with \
different configuration. It is used by several ISPs to provide \
L2TP services and by corporations to implement L2TP VPNs."
HOMEPAGE = "http://www.openl2tp.org/"
SECTION = "net"
# cli and usl use license LGPL-2.1
LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=e9d9259cbbf00945adc25a470c1d3585 \
file://LICENSE;md5=f8970abd5ea9be701a0deedf5afd77a5 \
file://cli/LICENSE;md5=9c1387a3c5213aa40671438af3e00793 \
file://usl/LICENSE;md5=9c1387a3c5213aa40671438af3e00793 \
"
DEPENDS = "popt flex readline rpcsvc-proto-native bison-native"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${PV}/${BP}.tar.gz \
file://Makefile-modify-CFLAGS-to-aviod-build-error.patch \
file://openl2tp-simplify-gcc-warning-hack.patch \
file://Makefile-obey-LDFLAGS.patch \
file://0001-test-pppd_dummy.c-Fix-return-value.patch \
file://0001-Use-1-instead-of-WAIT_ANY.patch \
file://0002-cli-include-fcntl.h-for-O_CREAT-define.patch \
file://0003-cli-Define-_GNU_SOURCE-for-getting-sighandler_t.patch \
file://0001-l2tp_api-Included-needed-headers.patch \
file://openl2tpd-initscript-fix.patch \
file://openl2tpd-initscript-fix-sysconfig.patch \
file://openl2tpd-initscript-fix-warning.patch \
file://openl2tpd.service \
file://openl2tpd-enable-tests.patch \
file://run-ptest \
file://fix_linux_4.15_compile.patch \
file://0002-user-ipv6-structures.patch \
file://0001-l2tp_rpc_server.c-Add-missing-prototype-for-l2tp_api.patch \
file://0001-lex-yacc-Add-missing-function-prototypes.patch \
"
SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0"
SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f"
inherit autotools-brokensep pkgconfig systemd ptest
SYSTEMD_SERVICE:${PN} = "openl2tpd.service"
SYSTEMD_AUTO_ENABLE = "disable"
DEPENDS += "libtirpc"
CPPFLAGS += "-I${STAGING_INCDIR}/tirpc"
CFLAGS += "-I${STAGING_INCDIR}/tirpc"
LDFLAGS += "-ltirpc"
PARALLEL_MAKE = ""
EXTRA_OEMAKE = 'CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" CPPFLAGS="${CPPFLAGS}" OPT_CFLAGS="${CFLAGS}"'
do_compile:prepend() {
sed -i -e "s:SYS_LIBDIR=.*:SYS_LIBDIR=${libdir}:g" \
-e 's:$(CROSS_COMPILE)as:${AS}:g' \
-e 's:$(CROSS_COMPILE)ld:${LD}:g' \
-e 's:$(CROSS_COMPILE)gcc:${CC}:g' \
-e 's:$(CROSS_COMPILE)ar:${AR}:g' \
-e 's:$(CROSS_COMPILE)nm:${NM}:g' \
-e 's:$(CROSS_COMPILE)strip:${STRIP}:g' \
-e 's:$(CROSS_COMPILE)install:install:g' \
-e 's:CPPFLAGS-y:CPPFLAGS:g' \
${S}/Makefile
}
do_install:append () {
install -d ${D}${sysconfdir}/init.d
install -d ${D}${sysconfdir}/default
install -m 0755 ${S}/etc/rc.d/init.d/openl2tpd ${D}${sysconfdir}/init.d/openl2tpd
install -m 0755 ${S}/etc/sysconfig/openl2tpd ${D}${sysconfdir}/default/openl2tpd
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -D -m 0644 ${WORKDIR}/openl2tpd.service ${D}${systemd_system_unitdir}/openl2tpd.service
sed -i -e 's,@STATEDIR@,${localstatedir},g' \
-e 's,@SYSCONFDIR@,${sysconfdir},g' \
-e 's,@SBINDIR@,${sbindir},g' \
-e 's,@BINDIR@,${bindir},g' \
-e 's,@BASE_SBINDIR@,${base_sbindir},g' \
-e 's,@BASE_BINDIR@,${base_bindir},g' \
${D}${systemd_system_unitdir}/openl2tpd.service
fi
}
do_install_ptest () {
for i in all.tcl configfile.test peer_profile.test ppp_profile.test \
session_profile.test session.test system.test test_procs.tcl \
thirdparty_lns.test tunnel_profile.test tunnel.test; do
install -m 0755 ${S}/test/$i ${D}${PTEST_PATH}
done
}
RDEPENDS:${PN} = "ppp ppp-l2tp bash"