summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/ippool/ippool
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons/ippool/ippool')
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch22
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/ippool.service19
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch65
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch89
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch49
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch21
-rw-r--r--meta-networking/recipes-daemons/ippool/ippool/runtest.sh26
7 files changed, 291 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch b/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch
new file mode 100644
index 000000000..e475276c0
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch
@@ -0,0 +1,22 @@
1ippool: always log to syslog
2
3Even when running in the foreground, send log messages to syslog.
4
5Upstream-Status: Inappropriate [embedded specific]
6
7Signed-off-by: Joe Slater <jslater@windriver.com>
8
9
10--- a/ippool_main.c
11+++ b/ippool_main.c
12@@ -251,9 +251,8 @@ void ippool_vlog(int level, const char *
13 if (ippool_opt_nodaemon) {
14 vprintf(fmt, ap);
15 printf("\n");
16- } else {
17- vsyslog(level, fmt, ap);
18 }
19+ vsyslog(level, fmt, ap);
20 DMALLOC_VMESSAGE(fmt, ap);
21 }
22
diff --git a/meta-networking/recipes-daemons/ippool/ippool/ippool.service b/meta-networking/recipes-daemons/ippool/ippool/ippool.service
new file mode 100644
index 000000000..e5917fc14
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/ippool.service
@@ -0,0 +1,19 @@
1[Unit]
2Description=ip address pool allocator
3Requires=rpcbind.service
4After=rpcbind.service
5
6[Service]
7Type=simple
8# Start ippoold in the foreground!
9ExecStart=@SBINDIR@/ippoold -f
10# Normal output will go to syslog, so suppress stdout.
11StandardOutput=null
12StandardError=syslog
13# ExecStop is not needed. systemd will send SIGTERM
14# and ippoold will exit status 1.
15SuccessExitStatus=1
16
17[Install]
18WantedBy=multi-user.target
19
diff --git a/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch b/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch
new file mode 100644
index 000000000..14a768d0f
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch
@@ -0,0 +1,65 @@
1Fix start error if lsb init-functions doesn't exist
2
3Upstream-Status: Inappropriate [embedded specific]
4
5Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
6
7diff --git a/debian/init.d b/debian/init.d
8index 363ba89..0327fec 100644
9--- a/debian/init.d
10+++ b/debian/init.d
11@@ -10,6 +10,9 @@
12 # Description: Start ippool daemon
13 ### END INIT INFO
14
15+# Source function library.
16+. /etc/init.d/functions
17+
18 DAEMON=/usr/sbin/ippoold
19 NAME=ippoold
20 MODULE=pppol2tp
21@@ -18,7 +21,23 @@ MODULE=pppol2tp
22 test -x $DAEMON || exit 0
23
24 # Get lsb functions
25-. /lib/lsb/init-functions
26+if [ -f /lib/lsb/init-functions ]
27+then
28+ . /lib/lsb/init-functions
29+else
30+ log_begin_msg() {
31+ echo -n $*
32+ }
33+
34+ log_end_msg() {
35+ if [ $1 -eq 0 ]; then
36+ echo "done"
37+ else
38+ echo "failed"
39+ fi
40+ }
41+fi
42+
43 . /etc/default/rcS
44
45 case "$1" in
46@@ -35,6 +54,10 @@ case "$1" in
47 fi
48 log_end_msg $?
49 ;;
50+ status)
51+ status /usr/sbin/ippoold;
52+ exit $?
53+ ;;
54 restart)
55 $0 stop
56 sleep 1
57@@ -46,7 +69,7 @@ case "$1" in
58 log_end_msg $?
59 ;;
60 *)
61- log_success_msg "Usage: /etc/init.d/ippoold {start|stop|restart|reload|force-reload}"
62+ log_success_msg "Usage: /etc/init.d/ippoold {start|stop|status|restart|reload|force-reload}"
63 exit 1
64 esac
65
diff --git a/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch b/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch
new file mode 100644
index 000000000..1ebd95ea1
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch
@@ -0,0 +1,89 @@
11)add -fPIC for $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o
22)add sub target for subdirs-all, and those dependencies below
3 pppd plugin directory build depends on $(IPPOOL_RPC_STEM)_xdr.o
4$(IPPOOL_RPC_STEM)_client.o ippool_rpc.h
5
6 ippoold depends on libusl
7 ippoolconfig depends on libcli
8
9 $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o
10$(IPPOOL_RPC_STEM)_server.o *.o in main directory depends on ippool_rpc.h
11as those all directly or indirectly include ippool_rpc.h which is
12dynamically generated by rpcgen
13
14to make parallel make working.
153)include dependency files for pppd.
16
17Upstream-Status: Pending
18
19Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
20---
21diff --git a/Makefile b/Makefile
22index 73aa72f..4f7af1d 100644
23--- a/Makefile
24+++ b/Makefile
25@@ -106,14 +106,14 @@ all: generated-files $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o \
26 subdirs-all $(PROGS.sbin) $(PROGS.bin)
27
28 # Compile without -Wall because rpcgen-generated code is full of warnings
29-$(IPPOOL_RPC_STEM)_xdr.o: $(IPPOOL_RPC_STEM)_xdr.c
30- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
31+$(IPPOOL_RPC_STEM)_xdr.o: $(IPPOOL_RPC_STEM)_xdr.c $(IPPOOL_RPC_STEM).h
32+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
33
34-$(IPPOOL_RPC_STEM)_client.o: $(IPPOOL_RPC_STEM)_client.c
35- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
36+$(IPPOOL_RPC_STEM)_client.o: $(IPPOOL_RPC_STEM)_client.c $(IPPOOL_RPC_STEM).h
37+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
38
39-$(IPPOOL_RPC_STEM)_server.o: $(IPPOOL_RPC_STEM)_server.c
40- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
41+$(IPPOOL_RPC_STEM)_server.o: $(IPPOOL_RPC_STEM)_server.c $(IPPOOL_RPC_STEM).h
42+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
43
44 $(IPPOOL_RPC_STEM)_xdr.c: $(IPPOOL_RPC_STEM).x
45 -$(RM) $@
46@@ -136,8 +136,12 @@ $(IPPOOL_RPC_STEM).h: $(IPPOOL_RPC_STEM).x
47
48 generated-files: $(RPC_FILES)
49
50-subdirs-all:
51- @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done
52+subdirs-all: $(patsubst %,%-dir, $(SUBDIRS))
53+
54+pppd-dir: $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o $(IPPOOL_RPC_STEM).h
55+
56+$(patsubst %,%-dir,$(SUBDIRS)):
57+ @for d in $(patsubst %-dir,%,$@); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done
58
59 clean:
60 @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; if [ $$? -ne 0 ]; then exit 1; fi; done
61@@ -151,13 +155,13 @@ TAGS:
62 @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done
63 etags -t $(wildcard *.c) $(wildcard *.h)
64
65-ippoold: $(IPPOOLD_SRCS.o)
66- $(CC) -o $@ $^ $(LDFLAGS.ippoold)
67+ippoold: $(IPPOOLD_SRCS.o) usl-dir
68+ $(CC) -o $@ $(IPPOOLD_SRCS.o) $(LDFLAGS.ippoold)
69
70-ippoolconfig: $(IPPOOLCONFIG_SRCS.o)
71- $(CC) -o $@ $^ $(LDFLAGS.ippoolconfig)
72+ippoolconfig: $(IPPOOLCONFIG_SRCS.o) cli-dir
73+ $(CC) -o $@ $(IPPOOLCONFIG_SRCS.o) $(LDFLAGS.ippoolconfig)
74
75-%.o: %.c
76+%.o: %.c $(IPPOOL_RPC_STEM).h
77 $(CC) -c $(CFLAGS) $< -o $@
78
79 install: all
80diff --git a/pppd/Makefile b/pppd/Makefile
81index 78d9b33..106deca 100644
82--- a/pppd/Makefile
83+++ b/pppd/Makefile
84@@ -24,3 +24,5 @@ install: ippool.so
85
86 clean:
87 -rm -rf *.o *.so
88+
89+include $(wildcard *.d /dev/null)
diff --git a/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch b/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch
new file mode 100644
index 000000000..ca0e3320c
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch
@@ -0,0 +1,49 @@
1include limits.h to avoid UINT_MAX undefined compiling error.
2remove the unused assign which caused compiling error with -Werror.
3
4Upstream-Status: Pending
5
6Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
7---
8
9diff --git a/usl/usl_timer.c b/usl/usl_timer.c
10index 734b820..fda752b 100644
11--- a/usl/usl_timer.c
12+++ b/usl/usl_timer.c
13@@ -42,6 +42,7 @@
14 #include <signal.h>
15 #include <string.h>
16 #include <sys/time.h>
17+#include <limits.h>
18
19 #include "usl.h"
20
21@@ -87,14 +88,13 @@ void (*usl_timer_tick_hook)(void);
22 */
23 void usl_timer_tick(void)
24 {
25- int result;
26 char msg = '\0';
27
28 usl_tick++;
29
30 if (!usl_tick_pending) {
31 usl_tick_pending = 1;
32- result = write(usl_tick_pipe[1], &msg, sizeof(msg));
33+ write(usl_tick_pipe[1], &msg, sizeof(msg));
34 }
35 }
36
37@@ -111,11 +111,10 @@ static void usl_timer_tick_handler(int fd, void *arg)
38 struct usl_ord_list_head *tmp;
39 struct usl_list_head *iwalk;
40 struct usl_list_head *itmp;
41- int result;
42 char msg;
43 USL_LIST_HEAD(expire_list);
44
45- result = usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
46+ usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
47 usl_tick_pending = 0;
48
49 usl_list_for_each(walk, tmp, &usl_timer_list) {
diff --git a/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch b/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch
new file mode 100644
index 000000000..7d5b715ae
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch
@@ -0,0 +1,21 @@
1Add LDFLAGS variable to Makefile so that extra linker flags can be sent via this variable.
2
3Upstream-Status: Pending
4
5Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
6
7diff --git a/Makefile b/Makefile
8index 4f7af1d..a05a000 100644
9--- a/Makefile
10+++ b/Makefile
11@@ -83,8 +83,8 @@ endif
12
13 CPPFLAGS= $(CPPFLAGS.ippooltest)
14 CFLAGS= -I. -Iusl -Icli -MMD -Wall -g $(CPPFLAGS) $(CPPFLAGS.dmalloc)
15-LDFLAGS.ippoold= -Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
16-LDFLAGS.ippoolconfig= -Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
17+LDFLAGS.ippoold= $(LDFLAGS) -Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
18+LDFLAGS.ippoolconfig= $(LDFLAGS) -Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
19
20 OPT_CFLAGS?= -O
21
diff --git a/meta-networking/recipes-daemons/ippool/ippool/runtest.sh b/meta-networking/recipes-daemons/ippool/ippool/runtest.sh
new file mode 100644
index 000000000..f91f58237
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/runtest.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2BANNER="----------------------------------------------------------------------------"
3TCLSH="tclsh all.tcl -preservecore 3 -verbose bps -tmpdir ./results -outfile test-ippool.result"
4
5test_setup() {
6 if [ -d ./results ]; then rm -fr ./results; fi
7 mkdir ./results
8}
9
10test_ippool() {
11 echo "${BANNER}"
12 eval $TCLSH -constraints "ipPool"
13}
14test_postprocess() {
15 echo "${BANNER}"
16 (failed=`grep FAILED results/*.result | wc -l`; \
17 let failed2=failed/2 ;\
18 passed=`grep PASSED results/*.result | wc -l`; \
19 echo "TEST SUMMARY: $passed tests PASSED, $failed2 tests FAILED" ;\
20 exit $failed2)
21}
22
23test_setup
24test_ippool
25test_postprocess
26