[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch
new file mode 100644
index 0000000..e967621
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch
@@ -0,0 +1,56 @@
+From 4848b9e4d516a9203c08432901a7b40419e8f43c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 19 Jul 2017 15:54:35 -0700
+Subject: [PATCH 1/3] Respect flags from env
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile      | 4 ++--
+ cli/Makefile  | 2 +-
+ pppd/Makefile | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index a05a000..439a978 100644
+--- a/Makefile
++++ b/Makefile
+@@ -81,8 +81,8 @@ LIBS.dmalloc=		-ldmalloc
+ export USE_DMALLOC
+ endif
+ 
+-CPPFLAGS=		$(CPPFLAGS.ippooltest)
+-CFLAGS=			-I. -Iusl -Icli -MMD -Wall -g $(CPPFLAGS) $(CPPFLAGS.dmalloc)
++CPPFLAGS+=		$(CPPFLAGS.ippooltest)
++CFLAGS+=			-I. -Iusl -Icli -MMD -Wall -g $(CPPFLAGS) $(CPPFLAGS.dmalloc)
+ LDFLAGS.ippoold=	$(LDFLAGS) -Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
+ LDFLAGS.ippoolconfig=	$(LDFLAGS) -Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
+ 
+diff --git a/cli/Makefile b/cli/Makefile
+index 4b5dd59..56fbf2f 100644
+--- a/cli/Makefile
++++ b/cli/Makefile
+@@ -7,7 +7,7 @@ CLI_SRCS_TEST.o=	$(CLI_SRCS_TEST.c:%.c=%.o)
+ 
+ LDFLAGS.cli_test=	-L.. -L. $(READLINE_LDFLAGS) -lcli -lusl -lreadline -lcurses -lc
+ 
+-CFLAGS=			$(CFLAGS.optimize) -MMD -Wall -Werror -I.. $(READLINE_CFLAGS)
++CFLAGS=			$(CFLAGS.optimize) -MMD -Wall -Werror -I.. $(READLINE_CFLAGS) $(CPPFLAGS)
+ 
+ .PHONY:			all test clean
+ 
+diff --git a/pppd/Makefile b/pppd/Makefile
+index 106deca..7fd815f 100644
+--- a/pppd/Makefile
++++ b/pppd/Makefile
+@@ -10,7 +10,7 @@ endif
+ 
+ # END CONFIGURABLE SETTINGS
+ 
+-CFLAGS	+= -g -I.. -I/usr/include/pppd $(CFLAGS.pppd) -fPIC
++CFLAGS	+= -g -I.. -I=/usr/include/pppd $(CFLAGS.pppd) -fPIC
+ LDFLAGS	+= -shared
+ 
+ all:	ippool.so
+-- 
+2.13.3
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch
new file mode 100644
index 0000000..7d3f9ac
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch
@@ -0,0 +1,31 @@
+From e4e0aae139b6489dc582fd14e54e562126482ce2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 07:23:53 -0700
+Subject: [PATCH 1/3] read() returns ssize_t
+
+Fixes
+usl_fd.c:284:10: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
+                if (nb < 0) {
+                    ~~ ^ ~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ usl/usl_fd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usl/usl_fd.c b/usl/usl_fd.c
+index 3b7a813..04ba48c 100644
+--- a/usl/usl_fd.c
++++ b/usl/usl_fd.c
+@@ -280,7 +280,7 @@ size_t usl_fd_read(int fd, void *buf, size_t count)
+ 	char *ptr = buf;
+ 
+ 	for (chars_read = 0; chars_read < count; ) {
+-		size_t nb = read(fd, ptr, count - chars_read);
++		ssize_t nb = read(fd, ptr, count - chars_read);
+ 		if (nb < 0) {
+ 			if (errno == EINTR)
+ 				continue;
+-- 
+2.14.1
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch
new file mode 100644
index 0000000..6fb7cc5
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch
@@ -0,0 +1,28 @@
+From 5d7f20c045b3c74dad2c53d65e30bd4840250082 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 Jun 2017 15:17:19 -0700
+Subject: [PATCH] usl_timer: Check for return value of write() API
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ usl/usl_timer.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/usl/usl_timer.c b/usl/usl_timer.c
+index fda752b..d8414a6 100644
+--- a/usl/usl_timer.c
++++ b/usl/usl_timer.c
+@@ -94,7 +94,9 @@ void usl_timer_tick(void)
+ 
+ 	if (!usl_tick_pending) {
+ 		usl_tick_pending = 1;
+-		write(usl_tick_pipe[1], &msg, sizeof(msg));
++		if (write(usl_tick_pipe[1], &msg, sizeof(msg)) != sizeof(msg)) {
++			fprintf(stderr, "write to fd %i failed: %s\n", usl_tick_pipe[1], strerror(errno));
++		}
+ 	}
+ }
+ 
+-- 
+2.13.2
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch
new file mode 100644
index 0000000..6e2bd52
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch
@@ -0,0 +1,31 @@
+From cf25576428903168cd41b183fb1ca9c2b7e2666e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 07:28:10 -0700
+Subject: [PATCH 2/3] Mark first element of a string as null
+
+Fixes
+cli_lib.c:427:20: error: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Werror,-Wnon-literal-null-conversion]
+                                        values[arg] = '\0';
+                                                      ^~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cli/cli_lib.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cli/cli_lib.c b/cli/cli_lib.c
+index 41a0b06..e4d2fd5 100644
+--- a/cli/cli_lib.c
++++ b/cli/cli_lib.c
+@@ -424,7 +424,7 @@ int cli_find_args(int argc, char *argv[], struct cli_node *cmd, struct cli_node
+ 			if (arg_string[1] == '\0') {
+ 				/* no arg value - only allowed for string args */
+ 				if (node->arg->parser == cli_arg_parse_string) {
+-					values[arg] = '\0';
++					*values[arg] = '\0';
+ 				} else {
+ 					result = -EINVAL;
+ 					break;
+-- 
+2.14.1
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch
new file mode 100644
index 0000000..d80f7b4
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch
@@ -0,0 +1,30 @@
+From 47aef26198431f7ad568c2277dded158bda3e36f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 19 Jul 2017 16:00:35 -0700
+Subject: [PATCH 2/3] link with libtirpc
+
+musl needs it
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 439a978..ea821eb 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,8 +83,8 @@ endif
+ 
+ CPPFLAGS+=		$(CPPFLAGS.ippooltest)
+ CFLAGS+=			-I. -Iusl -Icli -MMD -Wall -g $(CPPFLAGS) $(CPPFLAGS.dmalloc)
+-LDFLAGS.ippoold=	$(LDFLAGS) -Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
+-LDFLAGS.ippoolconfig=	$(LDFLAGS) -Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
++LDFLAGS.ippoold=	$(LDFLAGS) -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc -ltirpc
++LDFLAGS.ippoolconfig=	$(LDFLAGS) -Lcli -lcli -lreadline -lcurses $(LIBS.dmalloc) -lc -ltirpc
+ 
+ OPT_CFLAGS?=		-O
+ 
+-- 
+2.13.3
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch
new file mode 100644
index 0000000..3854b11
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch
@@ -0,0 +1,58 @@
+From 994d9575374d3cdb34b1b0f70c3c53ae76fe578e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 07:41:05 -0700
+Subject: [PATCH 3/3] cli: Mark return of strtol as long int
+
+strtol does not return unsigned long
+
+error: taking the absolute value of unsigned type 'unsigned long' has no effect [-Werror,-Wabsolute-value]
+        if ((*endp == '\0') && (labs(tmp) < 32768)) {
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cli/cli_lib.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/cli/cli_lib.c b/cli/cli_lib.c
+index e4d2fd5..5f487dc 100644
+--- a/cli/cli_lib.c
++++ b/cli/cli_lib.c
+@@ -522,7 +522,7 @@ int cli_arg_parse_int32(struct cli_node *arg, const char *val, void *result)
+ int cli_arg_parse_int16(struct cli_node *arg, const char *val, void *result)
+ {
+ 	int16_t *intval = result;
+-	unsigned long tmp;
++	long tmp;
+ 	char *endp;
+ 	int ret = 0;
+ 
+@@ -539,7 +539,7 @@ int cli_arg_parse_int16(struct cli_node *arg, const char *val, void *result)
+ int cli_arg_parse_int8(struct cli_node *arg, const char *val, void *result)
+ {
+ 	int8_t *intval = result;
+-	unsigned long tmp;
++	long tmp;
+ 	char *endp;
+ 	int ret = 0;
+ 
+@@ -573,7 +573,7 @@ int cli_arg_parse_uint32(struct cli_node *arg, const char *val, void *result)
+ int cli_arg_parse_uint16(struct cli_node *arg, const char *val, void *result)
+ {
+ 	uint16_t *intval = result;
+-	unsigned long tmp;
++	long tmp;
+ 	char *endp;
+ 	int ret = 0;
+ 
+@@ -590,7 +590,7 @@ int cli_arg_parse_uint16(struct cli_node *arg, const char *val, void *result)
+ int cli_arg_parse_uint8(struct cli_node *arg, const char *val, void *result)
+ {
+ 	uint8_t *intval = result;
+-	unsigned long tmp;
++	long tmp;
+ 	char *endp;
+ 	int ret = 0;
+ 
+-- 
+2.14.1
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch
new file mode 100644
index 0000000..952e4f0
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch
@@ -0,0 +1,80 @@
+From eb345047decba665e3f39908336a83f039e1ece2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 19 Jul 2017 16:01:32 -0700
+Subject: [PATCH 3/3] musl fixes
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cli/cli_readline.c |   7 +-
+ ippool_api.c       |   9 ++-
+ net/ppp_defs.h     | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ usl/usl.h          |   4 ++
+ 4 files changed, 208 insertions(+), 6 deletions(-)
+ create mode 100644 net/ppp_defs.h
+
+Index: ippool-1.3/cli/cli_readline.c
+===================================================================
+--- ippool-1.3.orig/cli/cli_readline.c
++++ ippool-1.3/cli/cli_readline.c
+@@ -17,13 +17,14 @@
+  *  Boston, MA 02110-1301 USA
+  *
+  *****************************************************************************/
+-
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/file.h>
+ #include <sys/stat.h>
+-#include <sys/errno.h>
++#include <fcntl.h>
++#include <errno.h>
+ #include <signal.h>
+ 
+ #include <readline/readline.h>
+@@ -630,7 +631,7 @@ static void cli_rl_uninstall_signal_hand
+ 
+ static int cli_rl_install_signal_handlers(void)
+ {
+-	__sighandler_t handler;
++	sighandler_t handler;
+ 
+ 	rl_catch_signals = 0;
+ 	rl_clear_signals();
+Index: ippool-1.3/ippool_api.c
+===================================================================
+--- ippool-1.3.orig/ippool_api.c
++++ ippool-1.3/ippool_api.c
+@@ -181,10 +181,13 @@ int ippool_api_rpc_check_request(SVCXPRT
+ 	 * non-loopback interface, reject the request.
+ 	 */
+ 	if ((!ippool_opt_remote_rpc) &&
+-	    ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) &&
+-	     (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) {
++	    ((xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_LOOPBACK)) &&
++	     (xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_ANY)))) {
++		char straddr[INET6_ADDRSTRLEN];
++		inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr));
++
+ 		if (ippool_opt_debug) {
+-			ippool_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr));
++			ippool_log(LOG_ERR, "Rejecting RPC request from %s", straddr);
+ 		}
+ 		svcerr_auth(xprt, AUTH_TOOWEAK);
+ 		return -EPERM;
+Index: ippool-1.3/usl/usl.h
+===================================================================
+--- ippool-1.3.orig/usl/usl.h
++++ ippool-1.3/usl/usl.h
+@@ -38,6 +38,10 @@
+ #include "usl_fsm.h"
+ #include "usl_list.h"
+ 
++#ifndef WAIT_ANY
++#define WAIT_ANY (-1)
++#endif
++
+ #define USL_VERSION	"0.6"
+ 
+ #ifdef DEBUG
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch
new file mode 100644
index 0000000..e475276
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch
@@ -0,0 +1,22 @@
+ippool: always log to syslog
+
+Even when running in the foreground, send log messages to syslog.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Joe Slater <jslater@windriver.com>
+
+
+--- a/ippool_main.c
++++ b/ippool_main.c
+@@ -251,9 +251,8 @@ void ippool_vlog(int level, const char *
+ 	if (ippool_opt_nodaemon) {
+ 		vprintf(fmt, ap);
+ 		printf("\n");
+-	} else {
+-		vsyslog(level, fmt, ap);
+ 	}
++	vsyslog(level, fmt, ap);
+ 	DMALLOC_VMESSAGE(fmt, ap);
+ }
+ 
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service
new file mode 100644
index 0000000..e5917fc
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=ip address pool allocator
+Requires=rpcbind.service
+After=rpcbind.service
+
+[Service]
+Type=simple
+# Start ippoold in the foreground!
+ExecStart=@SBINDIR@/ippoold -f
+# Normal output will go to syslog, so suppress stdout.
+StandardOutput=null
+StandardError=syslog
+# ExecStop is not needed. systemd will send SIGTERM
+# and ippoold will exit status 1.
+SuccessExitStatus=1
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch
new file mode 100644
index 0000000..14a768d
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch
@@ -0,0 +1,65 @@
+Fix start error if lsb init-functions doesn't exist
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+diff --git a/debian/init.d b/debian/init.d
+index 363ba89..0327fec 100644
+--- a/debian/init.d
++++ b/debian/init.d
+@@ -10,6 +10,9 @@
+ # Description:       Start ippool daemon
+ ### END INIT INFO
+ 
++# Source function library.
++. /etc/init.d/functions
++
+ DAEMON=/usr/sbin/ippoold
+ NAME=ippoold
+ MODULE=pppol2tp
+@@ -18,7 +21,23 @@ MODULE=pppol2tp
+ test -x $DAEMON || exit 0
+ 
+ # Get lsb functions
+-. /lib/lsb/init-functions
++if [ -f /lib/lsb/init-functions ]
++then
++  . /lib/lsb/init-functions
++else
++  log_begin_msg() {
++    echo -n $*
++  }
++
++  log_end_msg() {
++    if [ $1 -eq 0 ]; then
++      echo "done"
++    else
++      echo "failed"
++    fi
++  }
++fi
++
+ . /etc/default/rcS
+ 
+ case "$1" in
+@@ -35,6 +54,10 @@ case "$1" in
+     fi
+     log_end_msg $?
+     ;;
++  status)
++    status /usr/sbin/ippoold;
++    exit $?
++    ;;
+   restart)
+     $0 stop
+     sleep 1
+@@ -46,7 +69,7 @@ case "$1" in
+     log_end_msg $?
+     ;;
+   *)
+-    log_success_msg "Usage: /etc/init.d/ippoold {start|stop|restart|reload|force-reload}"
++    log_success_msg "Usage: /etc/init.d/ippoold {start|stop|status|restart|reload|force-reload}"
+     exit 1
+ esac
+ 
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch
new file mode 100644
index 0000000..1ebd95e
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch
@@ -0,0 +1,89 @@
+1)add -fPIC for $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o
+2)add sub target for subdirs-all, and those dependencies below
+  pppd plugin directory build depends on $(IPPOOL_RPC_STEM)_xdr.o 
+$(IPPOOL_RPC_STEM)_client.o ippool_rpc.h
+
+  ippoold depends on libusl
+  ippoolconfig depends on libcli
+
+  $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o 
+$(IPPOOL_RPC_STEM)_server.o *.o in main directory depends on ippool_rpc.h
+as those all directly or indirectly include ippool_rpc.h which is 
+dynamically generated by rpcgen
+
+to make parallel make working.
+3)include dependency files for pppd.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+---
+diff --git a/Makefile b/Makefile
+index 73aa72f..4f7af1d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -106,14 +106,14 @@ all:			generated-files $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o \
+ 			subdirs-all $(PROGS.sbin) $(PROGS.bin)
+ 
+ # Compile without -Wall because rpcgen-generated code is full of warnings
+-$(IPPOOL_RPC_STEM)_xdr.o:	$(IPPOOL_RPC_STEM)_xdr.c
+-			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
++$(IPPOOL_RPC_STEM)_xdr.o:	$(IPPOOL_RPC_STEM)_xdr.c $(IPPOOL_RPC_STEM).h
++			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
+ 
+-$(IPPOOL_RPC_STEM)_client.o:	$(IPPOOL_RPC_STEM)_client.c
+-			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
++$(IPPOOL_RPC_STEM)_client.o:	$(IPPOOL_RPC_STEM)_client.c $(IPPOOL_RPC_STEM).h
++			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
+ 
+-$(IPPOOL_RPC_STEM)_server.o:	$(IPPOOL_RPC_STEM)_server.c
+-			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $<
++$(IPPOOL_RPC_STEM)_server.o:	$(IPPOOL_RPC_STEM)_server.c $(IPPOOL_RPC_STEM).h
++			$(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC
+ 
+ $(IPPOOL_RPC_STEM)_xdr.c:	$(IPPOOL_RPC_STEM).x
+ 			-$(RM) $@
+@@ -136,8 +136,12 @@ $(IPPOOL_RPC_STEM).h:	$(IPPOOL_RPC_STEM).x
+ 
+ generated-files:	$(RPC_FILES)
+ 
+-subdirs-all:
+-			@for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done
++subdirs-all:	$(patsubst %,%-dir, $(SUBDIRS))
++
++pppd-dir: $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o $(IPPOOL_RPC_STEM).h
++
++$(patsubst %,%-dir,$(SUBDIRS)):
++			@for d in $(patsubst %-dir,%,$@); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done
+ 
+ clean:
+ 			@for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; if [ $$? -ne 0 ]; then exit 1; fi; done
+@@ -151,13 +155,13 @@ TAGS:
+ 			@for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done
+ 			etags -t $(wildcard *.c) $(wildcard *.h)
+ 
+-ippoold:		$(IPPOOLD_SRCS.o)
+-			$(CC) -o $@ $^ $(LDFLAGS.ippoold)
++ippoold:		$(IPPOOLD_SRCS.o) usl-dir
++			$(CC) -o $@ $(IPPOOLD_SRCS.o) $(LDFLAGS.ippoold)
+ 
+-ippoolconfig:		$(IPPOOLCONFIG_SRCS.o)
+-			$(CC) -o $@ $^ $(LDFLAGS.ippoolconfig)
++ippoolconfig:		$(IPPOOLCONFIG_SRCS.o) cli-dir
++			$(CC) -o $@ $(IPPOOLCONFIG_SRCS.o) $(LDFLAGS.ippoolconfig)
+ 
+-%.o:	%.c
++%.o:	%.c $(IPPOOL_RPC_STEM).h
+ 			$(CC) -c $(CFLAGS) $< -o $@
+ 
+ install:		all
+diff --git a/pppd/Makefile b/pppd/Makefile
+index 78d9b33..106deca 100644
+--- a/pppd/Makefile
++++ b/pppd/Makefile
+@@ -24,3 +24,5 @@ install: ippool.so
+ 
+ clean:
+ 	-rm -rf *.o *.so
++
++include $(wildcard *.d /dev/null)
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch
new file mode 100644
index 0000000..ca0e332
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch
@@ -0,0 +1,49 @@
+include limits.h to avoid UINT_MAX undefined compiling error.
+remove the unused assign which caused compiling error with -Werror.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+---
+
+diff --git a/usl/usl_timer.c b/usl/usl_timer.c
+index 734b820..fda752b 100644
+--- a/usl/usl_timer.c
++++ b/usl/usl_timer.c
+@@ -42,6 +42,7 @@
+ #include <signal.h>
+ #include <string.h>
+ #include <sys/time.h>
++#include <limits.h>
+ 
+ #include "usl.h"
+ 
+@@ -87,14 +88,13 @@ void (*usl_timer_tick_hook)(void);
+  */
+ void usl_timer_tick(void)
+ {
+-	int result;
+ 	char msg = '\0';
+ 
+ 	usl_tick++;
+ 
+ 	if (!usl_tick_pending) {
+ 		usl_tick_pending = 1;
+-		result = write(usl_tick_pipe[1], &msg, sizeof(msg));
++		write(usl_tick_pipe[1], &msg, sizeof(msg));
+ 	}
+ }
+ 
+@@ -111,11 +111,10 @@ static void usl_timer_tick_handler(int fd, void *arg)
+ 	struct usl_ord_list_head *tmp;
+ 	struct usl_list_head *iwalk;
+ 	struct usl_list_head *itmp;
+-	int result;
+ 	char msg;
+ 	USL_LIST_HEAD(expire_list);
+ 
+-	result = usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
++	usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
+ 	usl_tick_pending = 0;
+ 
+ 	usl_list_for_each(walk, tmp, &usl_timer_list) {
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch
new file mode 100644
index 0000000..7d5b715
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch
@@ -0,0 +1,21 @@
+Add LDFLAGS variable to Makefile so that extra linker flags can be sent via this variable.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+diff --git a/Makefile b/Makefile
+index 4f7af1d..a05a000 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,8 +83,8 @@ endif
+ 
+ CPPFLAGS=		$(CPPFLAGS.ippooltest)
+ CFLAGS=			-I. -Iusl -Icli -MMD -Wall -g $(CPPFLAGS) $(CPPFLAGS.dmalloc)
+-LDFLAGS.ippoold=	-Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
+-LDFLAGS.ippoolconfig=	-Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
++LDFLAGS.ippoold=	$(LDFLAGS) -Wl,-E -L. -Lusl -lusl -lnsl -ldl $(LIBS.dmalloc) -lc
++LDFLAGS.ippoolconfig=	$(LDFLAGS) -Lcli -lcli -lreadline -lcurses -lnsl $(LIBS.dmalloc) -lc
+ 
+ OPT_CFLAGS?=		-O
+ 
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh
new file mode 100644
index 0000000..f91f582
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+BANNER="----------------------------------------------------------------------------"
+TCLSH="tclsh all.tcl -preservecore 3 -verbose bps -tmpdir ./results -outfile test-ippool.result"
+
+test_setup() {
+        if [ -d ./results ]; then rm -fr ./results; fi
+        mkdir ./results
+}
+
+test_ippool() {
+        echo "${BANNER}"
+        eval $TCLSH -constraints "ipPool"
+}
+test_postprocess() {
+        echo "${BANNER}"
+        (failed=`grep FAILED results/*.result | wc -l`; \
+        let failed2=failed/2 ;\
+        passed=`grep PASSED results/*.result | wc -l`; \
+        echo "TEST SUMMARY: $passed tests PASSED, $failed2 tests FAILED" ;\
+        exit $failed2)
+}
+
+test_setup
+test_ippool
+test_postprocess
+
diff --git a/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool_1.3.bb b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool_1.3.bb
new file mode 100644
index 0000000..6fa4690
--- /dev/null
+++ b/meta/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool_1.3.bb
@@ -0,0 +1,109 @@
+SUMMARY = "An IP address pool manager"
+DESCRIPTION = "IpPool is implemented as a separate server daemon \
+to allow any application to use its address pools. This makes it possible \
+to define address pools that are shared by PPP, L2TP, PPTP etc. It may be \
+useful in some VPN server setups. IpPool comes with a command line \
+management application, ippoolconfig to manage and query address pool \
+status. A pppd plugin is supplied which allows pppd to request IP \
+addresses from ippoold. \
+"
+HOMEPAGE = "http://www.openl2tp.org/"
+SECTION = "console/network"
+LICENSE = "GPLv2+"
+
+SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
+           file://runtest.sh \
+           file://ippool.service \
+           file://ippool_usl_timer.patch \
+           file://ippool_parallel_make_and_pic.patch \
+           file://ippool_init.d.patch \
+           file://always_syslog.patch \
+           file://makefile-add-ldflags.patch \
+           file://0001-usl_timer-Check-for-return-value-of-write-API.patch \
+           file://0001-Respect-flags-from-env.patch \
+           file://0001-read-returns-ssize_t.patch \
+           file://0002-Mark-first-element-of-a-string-as-null.patch \
+           file://0003-cli-Mark-return-of-strtol-as-long-int.patch \
+           file://0002-link-with-libtirpc.patch \
+           file://0003-musl-fixes.patch \
+           "
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"
+SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"
+SRC_URI[sha256sum] = "d3eab7d6cad5da8ccc9d1e31d5303e27a39622c07bdb8fa3618eea314412075b"
+
+inherit systemd
+
+DEPENDS = "readline ppp ncurses gzip-native rpcsvc-proto-native libtirpc"
+RDEPENDS_${PN} = "rpcbind"
+
+EXTRA_OEMAKE = "CC='${CC}' AS='${AS}' LD='${LD}' AR='${AR}' NM='${NM}' STRIP='${STRIP}'"
+EXTRA_OEMAKE += "PPPD_VERSION=${PPPD_VERSION} SYS_LIBDIR=${libdir}"
+# enable self tests
+EXTRA_OEMAKE += "IPPOOL_TEST=y"
+
+CPPFLAGS += "${SELECTED_OPTIMIZATION} -I${STAGING_INCDIR}/tirpc"
+
+SYSTEMD_SERVICE_${PN} = "ippool.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
+
+do_compile_prepend() {
+    # fix the CFLAGS= and CPPFLAGS= in main Makefile, to have the extra CFLAGS in env
+    sed -i -e "s/^CFLAGS=/CFLAGS+=/" ${S}/Makefile
+    sed -i -e "s/^CPPFLAGS=/CPPFLAGS+=/" ${S}/Makefile
+
+    sed -i -e "s:-I/usr/include/pppd:-I=/usr/include/pppd:" ${S}/pppd/Makefile
+
+}
+
+
+do_install() {
+    oe_runmake DESTDIR=${D} install
+
+    install -D -m 0755 ${S}/debian/init.d ${D}${sysconfdir}/init.d/ippoold
+    install -D -m 0644 ${WORKDIR}/ippool.service ${D}${systemd_system_unitdir}/ippool.service
+    sed -i -e 's:@SBINDIR@:${sbindir}:g' ${D}${systemd_system_unitdir}/ippool.service
+
+    # install self test
+    install -d ${D}/opt/${BPN}
+    install ${S}/test/all.tcl  ${S}/test/ippool.test \
+        ${S}/test/test_procs.tcl ${D}/opt/${BPN}
+    install ${WORKDIR}/runtest.sh ${D}/opt/${BPN}
+    # fix the ../ippoolconfig in test_procs.tcl
+    sed -i -e "s:../ippoolconfig:ippoolconfig:" \
+        ${D}/opt/${BPN}/test_procs.tcl
+}
+
+
+PACKAGES =+ "${PN}-test"
+
+FILES_${PN} += "${libdir}/pppd/${PPPD_VERSION}/ippool.so"
+FILES_${PN}-dbg += "${libdir}/pppd/${PPPD_VERSION}/.debug/ippool.so"
+FILES_${PN}-test = "/opt/${BPN}"
+
+# needs tcl to run tests
+RDEPENDS_${PN}-test += "tcl ${BPN}"
+
+PPPD_VERSION="${@get_ppp_version(d)}"
+
+def get_ppp_version(d):
+    import re
+
+    pppd_plugin = d.expand('${STAGING_LIBDIR}/pppd')
+    if not os.path.isdir(pppd_plugin):
+        return None
+
+    bb.debug(1, "pppd plugin dir %s" % pppd_plugin)
+    r = re.compile("\d*\.\d*\.\d*")
+    for f in os.listdir(pppd_plugin):
+        if os.path.isdir(os.path.join(pppd_plugin, f)):
+            ma = r.match(f)
+            if ma:
+                bb.debug(1, "pppd version dir %s" % f)
+                return f
+            else:
+                bb.debug(1, "under pppd plugin dir %s" % f)
+
+    return None
+