summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-daemons/ippool/ippool')
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch56
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch28
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch31
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch30
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch58
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch283
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch22
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service19
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch65
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch89
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch49
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch21
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh26
14 files changed, 808 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-Respect-flags-from-env.patch
new file mode 100644
index 000000000..e96762125
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-read-returns-ssize_t.patch
new file mode 100644
index 000000000..7d3f9acb6
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch
new file mode 100644
index 000000000..6fb7cc5c4
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-Mark-first-element-of-a-string-as-null.patch
new file mode 100644
index 000000000..6e2bd523d
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0002-link-with-libtirpc.patch
new file mode 100644
index 000000000..d80f7b436
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-cli-Mark-return-of-strtol-as-long-int.patch
new file mode 100644
index 000000000..3854b1133
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch
new file mode 100644
index 000000000..3cd5259fa
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/0003-musl-fixes.patch
@@ -0,0 +1,283 @@
+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
+
+diff --git a/cli/cli_readline.c b/cli/cli_readline.c
+index 2812e6e..542935c 100644
+--- a/cli/cli_readline.c
++++ b/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_handlers(void)
+
+ static int cli_rl_install_signal_handlers(void)
+ {
+- __sighandler_t handler;
++ sighandler_t handler;
+
+ rl_catch_signals = 0;
+ rl_clear_signals();
+diff --git a/ippool_api.c b/ippool_api.c
+index 2c10c47..d1127a9 100644
+--- a/ippool_api.c
++++ b/ippool_api.c
+@@ -181,10 +181,13 @@ int ippool_api_rpc_check_request(SVCXPRT *xprt)
+ * 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;
+diff --git a/net/ppp_defs.h b/net/ppp_defs.h
+new file mode 100644
+index 0000000..b06eda5
+--- /dev/null
++++ b/net/ppp_defs.h
+@@ -0,0 +1,194 @@
++/* $Id: ppp_defs.h,v 1.17 2002/12/06 09:49:15 paulus Exp $ */
++
++/*
++ * ppp_defs.h - PPP definitions.
++ *
++ * Copyright (c) 1984 Paul Mackerras. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ *
++ * 3. The name(s) of the authors of this software must not be used to
++ * endorse or promote products derived from this software without
++ * prior written permission.
++ *
++ * 4. Redistributions of any form whatsoever must retain the following
++ * acknowledgment:
++ * "This product includes software developed by Paul Mackerras
++ * <paulus@samba.org>".
++ *
++ * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
++ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
++ * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifndef _PPP_DEFS_H_
++#define _PPP_DEFS_H_
++
++/*
++ * The basic PPP frame.
++ */
++#define PPP_HDRLEN 4 /* octets for standard ppp header */
++#define PPP_FCSLEN 2 /* octets for FCS */
++
++/*
++ * Packet sizes
++ *
++ * Note - lcp shouldn't be allowed to negotiate stuff outside these
++ * limits. See lcp.h in the pppd directory.
++ * (XXX - these constants should simply be shared by lcp.c instead
++ * of living in lcp.h)
++ */
++#define PPP_MTU 1500 /* Default MTU (size of Info field) */
++#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
++#define PPP_MINMTU 64
++#define PPP_MRU 1500 /* default MRU = max length of info field */
++#define PPP_MAXMRU 65000 /* Largest MRU we allow */
++#define PPP_MINMRU 128
++
++#define PPP_ADDRESS(p) (((u_char *)(p))[0])
++#define PPP_CONTROL(p) (((u_char *)(p))[1])
++#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
++
++/*
++ * Significant octet values.
++ */
++#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
++#define PPP_UI 0x03 /* Unnumbered Information */
++#define PPP_FLAG 0x7e /* Flag Sequence */
++#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
++#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
++
++/*
++ * Protocol field values.
++ */
++#define PPP_IP 0x21 /* Internet Protocol */
++#define PPP_AT 0x29 /* AppleTalk Protocol */
++#define PPP_IPX 0x2b /* IPX protocol */
++#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
++#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
++#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
++#define PPP_COMP 0xfd /* compressed packet */
++#define PPP_IPCP 0x8021 /* IP Control Protocol */
++#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
++#define PPP_IPXCP 0x802b /* IPX Control Protocol */
++#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
++#define PPP_CCP 0x80fd /* Compression Control Protocol */
++#define PPP_ECP 0x8053 /* Encryption Control Protocol */
++#define PPP_LCP 0xc021 /* Link Control Protocol */
++#define PPP_PAP 0xc023 /* Password Authentication Protocol */
++#define PPP_LQR 0xc025 /* Link Quality Report protocol */
++#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
++#define PPP_CBCP 0xc029 /* Callback Control Protocol */
++#define PPP_EAP 0xc227 /* Extensible Authentication Protocol */
++
++/*
++ * Values for FCS calculations.
++ */
++#define PPP_INITFCS 0xffff /* Initial FCS value */
++#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
++#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
++
++/*
++ * A 32-bit unsigned integral type.
++ */
++
++#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) \
++ && !defined(__FreeBSD__) && (NS_TARGET < 40)
++#ifdef UINT32_T
++typedef UINT32_T u_int32_t;
++#else
++typedef unsigned int u_int32_t;
++typedef unsigned short u_int16_t;
++#endif
++#endif
++
++/*
++ * Extended asyncmap - allows any character to be escaped.
++ */
++typedef u_int32_t ext_accm[8];
++
++/*
++ * What to do with network protocol (NP) packets.
++ */
++enum NPmode {
++ NPMODE_PASS, /* pass the packet through */
++ NPMODE_DROP, /* silently drop the packet */
++ NPMODE_ERROR, /* return an error */
++ NPMODE_QUEUE /* save it up for later. */
++};
++
++/*
++ * Statistics.
++ */
++struct pppstat {
++ unsigned int ppp_ibytes; /* bytes received */
++ unsigned int ppp_ipackets; /* packets received */
++ unsigned int ppp_ierrors; /* receive errors */
++ unsigned int ppp_obytes; /* bytes sent */
++ unsigned int ppp_opackets; /* packets sent */
++ unsigned int ppp_oerrors; /* transmit errors */
++};
++
++struct vjstat {
++ unsigned int vjs_packets; /* outbound packets */
++ unsigned int vjs_compressed; /* outbound compressed packets */
++ unsigned int vjs_searches; /* searches for connection state */
++ unsigned int vjs_misses; /* times couldn't find conn. state */
++ unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
++ unsigned int vjs_compressedin; /* inbound compressed packets */
++ unsigned int vjs_errorin; /* inbound unknown type packets */
++ unsigned int vjs_tossed; /* inbound packets tossed because of error */
++};
++
++struct ppp_stats {
++ struct pppstat p; /* basic PPP statistics */
++ struct vjstat vj; /* VJ header compression statistics */
++};
++
++struct compstat {
++ unsigned int unc_bytes; /* total uncompressed bytes */
++ unsigned int unc_packets; /* total uncompressed packets */
++ unsigned int comp_bytes; /* compressed bytes */
++ unsigned int comp_packets; /* compressed packets */
++ unsigned int inc_bytes; /* incompressible bytes */
++ unsigned int inc_packets; /* incompressible packets */
++ unsigned int ratio; /* recent compression ratio << 8 */
++};
++
++struct ppp_comp_stats {
++ struct compstat c; /* packet compression statistics */
++ struct compstat d; /* packet decompression statistics */
++};
++
++/*
++ * The following structure records the time in seconds since
++ * the last NP packet was sent or received.
++ */
++struct ppp_idle {
++ time_t xmit_idle; /* time since last NP packet sent */
++ time_t recv_idle; /* time since last NP packet received */
++};
++
++#ifndef __P
++#ifdef __STDC__
++#define __P(x) x
++#else
++#define __P(x) ()
++#endif
++#endif
++
++#endif /* _PPP_DEFS_H_ */
+diff --git a/usl/usl.h b/usl/usl.h
+index cdc16db..88d2714 100644
+--- a/usl/usl.h
++++ b/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
+--
+2.13.3
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/always_syslog.patch
new file mode 100644
index 000000000..e475276c0
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool.service
new file mode 100644
index 000000000..e5917fc14
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_init.d.patch
new file mode 100644
index 000000000..14a768d0f
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_parallel_make_and_pic.patch
new file mode 100644
index 000000000..1ebd95ea1
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/ippool_usl_timer.patch
new file mode 100644
index 000000000..ca0e3320c
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/makefile-add-ldflags.patch
new file mode 100644
index 000000000..7d5b715ae
--- /dev/null
+++ b/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-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh b/meta-openembedded/meta-networking/recipes-daemons/ippool/ippool/runtest.sh
new file mode 100644
index 000000000..f91f58237
--- /dev/null
+++ b/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
+
OpenPOWER on IntegriCloud