1From eb345047decba665e3f39908336a83f039e1ece2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 Jul 2017 16:01:32 -0700
4Subject: [PATCH 3/3] musl fixes
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 cli/cli_readline.c |   7 +-
9 ippool_api.c       |   9 ++-
10 net/ppp_defs.h     | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++
11 usl/usl.h          |   4 ++
12 4 files changed, 208 insertions(+), 6 deletions(-)
13 create mode 100644 net/ppp_defs.h
14
15Index: ippool-1.3/cli/cli_readline.c
16===================================================================
17--- ippool-1.3.orig/cli/cli_readline.c
18+++ ippool-1.3/cli/cli_readline.c
19@@ -17,13 +17,14 @@
20  *  Boston, MA 02110-1301 USA
21  *
22  *****************************************************************************/
23-
24+#define _GNU_SOURCE
25 #include <stdio.h>
26 #include <unistd.h>
27 #include <sys/types.h>
28 #include <sys/file.h>
29 #include <sys/stat.h>
30-#include <sys/errno.h>
31+#include <fcntl.h>
32+#include <errno.h>
33 #include <signal.h>
34
35 #include <readline/readline.h>
36@@ -630,7 +631,7 @@ static void cli_rl_uninstall_signal_hand
37
38 static int cli_rl_install_signal_handlers(void)
39 {
40-	__sighandler_t handler;
41+	sighandler_t handler;
42
43 	rl_catch_signals = 0;
44 	rl_clear_signals();
45Index: ippool-1.3/ippool_api.c
46===================================================================
47--- ippool-1.3.orig/ippool_api.c
48+++ ippool-1.3/ippool_api.c
49@@ -181,10 +181,13 @@ int ippool_api_rpc_check_request(SVCXPRT
50 	 * non-loopback interface, reject the request.
51 	 */
52 	if ((!ippool_opt_remote_rpc) &&
53-	    ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) &&
54-	     (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) {
55+	    ((xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_LOOPBACK)) &&
56+	     (xprt->xp_raddr.sin6_addr.s6_addr != htonl(INADDR_ANY)))) {
57+		char straddr[INET6_ADDRSTRLEN];
58+		inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, sizeof(straddr));
59+
60 		if (ippool_opt_debug) {
61-			ippool_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr));
62+			ippool_log(LOG_ERR, "Rejecting RPC request from %s", straddr);
63 		}
64 		svcerr_auth(xprt, AUTH_TOOWEAK);
65 		return -EPERM;
66Index: ippool-1.3/usl/usl.h
67===================================================================
68--- ippool-1.3.orig/usl/usl.h
69+++ ippool-1.3/usl/usl.h
70@@ -38,6 +38,10 @@
71 #include "usl_fsm.h"
72 #include "usl_list.h"
73
74+#ifndef WAIT_ANY
75+#define WAIT_ANY (-1)
76+#endif
77+
78 #define USL_VERSION	"0.6"
79
80 #ifdef DEBUG
81