Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From 52a1e41d7541b2c936285844c59bd1be21797860 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 29 May 2015 14:57:05 -0700 |
| 4 | Subject: [PATCH] Fix build with musl |
| 5 | |
| 6 | There are several assumption about glibc |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | include/net/ppp_defs.h | 2 ++ |
| 13 | pppd/Makefile.linux | 2 +- |
| 14 | pppd/magic.h | 6 +++--- |
| 15 | pppd/plugins/rp-pppoe/config.h | 5 ++++- |
| 16 | pppd/plugins/rp-pppoe/plugin.c | 1 - |
| 17 | pppd/plugins/rp-pppoe/pppoe-discovery.c | 8 ++++---- |
| 18 | pppd/plugins/rp-pppoe/pppoe.h | 2 +- |
| 19 | pppd/sys-linux.c | 3 ++- |
| 20 | 8 files changed, 17 insertions(+), 12 deletions(-) |
| 21 | |
| 22 | diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h |
| 23 | index b06eda5..dafa36c 100644 |
| 24 | --- a/include/net/ppp_defs.h |
| 25 | +++ b/include/net/ppp_defs.h |
| 26 | @@ -38,6 +38,8 @@ |
| 27 | #ifndef _PPP_DEFS_H_ |
| 28 | #define _PPP_DEFS_H_ |
| 29 | |
| 30 | +#include <sys/time.h> |
| 31 | + |
| 32 | /* |
| 33 | * The basic PPP frame. |
| 34 | */ |
| 35 | diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux |
| 36 | index 8ab2102..d7e2564 100644 |
| 37 | --- a/pppd/Makefile.linux |
| 38 | +++ b/pppd/Makefile.linux |
| 39 | @@ -126,7 +126,7 @@ LIBS += -lcrypt |
| 40 | #endif |
| 41 | |
| 42 | ifdef USE_LIBUTIL |
| 43 | -CFLAGS += -DHAVE_LOGWTMP=1 |
| 44 | +#CFLAGS += -DHAVE_LOGWTMP=1 |
| 45 | LIBS += -lutil |
| 46 | endif |
| 47 | |
| 48 | diff --git a/pppd/magic.h b/pppd/magic.h |
| 49 | index c81213b..9d399e3 100644 |
| 50 | --- a/pppd/magic.h |
| 51 | +++ b/pppd/magic.h |
| 52 | @@ -42,8 +42,8 @@ |
| 53 | * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $ |
| 54 | */ |
| 55 | |
| 56 | -void magic_init __P((void)); /* Initialize the magic number generator */ |
| 57 | -u_int32_t magic __P((void)); /* Returns the next magic number */ |
| 58 | +void magic_init (void); /* Initialize the magic number generator */ |
| 59 | +u_int32_t magic (void); /* Returns the next magic number */ |
| 60 | |
| 61 | /* Fill buffer with random bytes */ |
| 62 | -void random_bytes __P((unsigned char *buf, int len)); |
| 63 | +void random_bytes (unsigned char *buf, int len); |
| 64 | diff --git a/pppd/plugins/rp-pppoe/config.h b/pppd/plugins/rp-pppoe/config.h |
| 65 | index 5703087..fff032e 100644 |
| 66 | --- a/pppd/plugins/rp-pppoe/config.h |
| 67 | +++ b/pppd/plugins/rp-pppoe/config.h |
| 68 | @@ -78,8 +78,9 @@ |
| 69 | #define HAVE_NET_IF_ARP_H 1 |
| 70 | |
| 71 | /* Define if you have the <net/ethernet.h> header file. */ |
| 72 | +#ifdef __GLIBC__ |
| 73 | #define HAVE_NET_ETHERNET_H 1 |
| 74 | - |
| 75 | +#endif |
| 76 | /* Define if you have the <net/if.h> header file. */ |
| 77 | #define HAVE_NET_IF_H 1 |
| 78 | |
| 79 | @@ -102,7 +103,9 @@ |
| 80 | #define HAVE_NETPACKET_PACKET_H 1 |
| 81 | |
| 82 | /* Define if you have the <sys/cdefs.h> header file. */ |
| 83 | +#ifdef __GLIBC__ |
| 84 | #define HAVE_SYS_CDEFS_H 1 |
| 85 | +#endif |
| 86 | |
| 87 | /* Define if you have the <sys/dlpi.h> header file. */ |
| 88 | /* #undef HAVE_SYS_DLPI_H */ |
| 89 | diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c |
| 90 | index a8c2bb4..ca34d79 100644 |
| 91 | --- a/pppd/plugins/rp-pppoe/plugin.c |
| 92 | +++ b/pppd/plugins/rp-pppoe/plugin.c |
| 93 | @@ -46,7 +46,6 @@ static char const RCSID[] = |
| 94 | #include <unistd.h> |
| 95 | #include <fcntl.h> |
| 96 | #include <signal.h> |
| 97 | -#include <net/ethernet.h> |
| 98 | #include <net/if_arp.h> |
| 99 | #include <linux/ppp_defs.h> |
| 100 | #include <linux/if_pppox.h> |
| 101 | diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c |
| 102 | index 3d3bf4e..d42f619 100644 |
| 103 | --- a/pppd/plugins/rp-pppoe/pppoe-discovery.c |
| 104 | +++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c |
| 105 | @@ -27,10 +27,6 @@ |
| 106 | #include <linux/if_packet.h> |
| 107 | #endif |
| 108 | |
| 109 | -#ifdef HAVE_NET_ETHERNET_H |
| 110 | -#include <net/ethernet.h> |
| 111 | -#endif |
| 112 | - |
| 113 | #ifdef HAVE_ASM_TYPES_H |
| 114 | #include <asm/types.h> |
| 115 | #endif |
| 116 | @@ -47,6 +43,10 @@ |
| 117 | #include <net/if_arp.h> |
| 118 | #endif |
| 119 | |
| 120 | +#ifndef __GLIBC__ |
| 121 | +#define error(x...) fprintf(stderr, x) |
| 122 | +#endif |
| 123 | + |
| 124 | char *xstrdup(const char *s); |
| 125 | void usage(void); |
| 126 | |
| 127 | diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h |
| 128 | index 9ab2eee..75b9004 100644 |
| 129 | --- a/pppd/plugins/rp-pppoe/pppoe.h |
| 130 | +++ b/pppd/plugins/rp-pppoe/pppoe.h |
| 131 | @@ -92,7 +92,7 @@ typedef unsigned long UINT32_t; |
| 132 | #ifdef HAVE_SYS_SOCKET_H |
| 133 | #include <sys/socket.h> |
| 134 | #endif |
| 135 | -#ifndef HAVE_SYS_DLPI_H |
| 136 | +#if !defined HAVE_SYS_DLPI_H && defined HAVE_NET_ETHERNET_H |
| 137 | #include <netinet/if_ether.h> |
| 138 | #endif |
| 139 | #endif |
| 140 | diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c |
| 141 | index a105505..49b0273 100644 |
| 142 | --- a/pppd/sys-linux.c |
| 143 | +++ b/pppd/sys-linux.c |
| 144 | @@ -112,7 +112,7 @@ |
| 145 | #include <linux/types.h> |
| 146 | #include <linux/if.h> |
| 147 | #include <linux/if_arp.h> |
| 148 | -#include <linux/route.h> |
| 149 | +/* #include <linux/route.h> */ |
| 150 | #include <linux/if_ether.h> |
| 151 | #endif |
| 152 | #include <netinet/in.h> |
| 153 | @@ -145,6 +145,7 @@ |
| 154 | #endif |
| 155 | |
| 156 | #ifdef INET6 |
| 157 | +#include <net/route.h> |
| 158 | #ifndef _LINUX_IN6_H |
| 159 | /* |
| 160 | * This is in linux/include/net/ipv6.h. |
| 161 | -- |
| 162 | 2.1.4 |
| 163 | |