pppd: fix build errors with musl
[openwrt/openwrt.git] / package / network / services / ppp / patches / 140-pppoe_compile_fix.patch
1 --- a/pppd/plugins/rp-pppoe/plugin.c
2 +++ b/pppd/plugins/rp-pppoe/plugin.c
3 @@ -46,9 +46,9 @@ static char const RCSID[] =
4 #include <unistd.h>
5 #include <fcntl.h>
6 #include <signal.h>
7 -#include <net/ethernet.h>
8 #include <net/if_arp.h>
9 #include <linux/ppp_defs.h>
10 +#include <linux/if_ether.h>
11 #include <linux/if_ppp.h>
12 #include <linux/if_pppox.h>
13
14 --- a/pppd/plugins/rp-pppoe/pppoe.h
15 +++ b/pppd/plugins/rp-pppoe/pppoe.h
16 @@ -86,17 +86,6 @@ typedef unsigned long UINT32_t;
17
18 #include <netinet/in.h>
19
20 -#ifdef HAVE_NETINET_IF_ETHER_H
21 -#include <sys/types.h>
22 -
23 -#ifdef HAVE_SYS_SOCKET_H
24 -#include <sys/socket.h>
25 -#endif
26 -#ifndef HAVE_SYS_DLPI_H
27 -#include <netinet/if_ether.h>
28 -#endif
29 -#endif
30 -
31
32
33 /* Ethernet frame types according to RFC 2516 */
34 --- a/pppd/plugins/rp-pppoe/if.c
35 +++ b/pppd/plugins/rp-pppoe/if.c
36 @@ -31,7 +31,7 @@ static char const RCSID[] =
37 #endif
38
39 #ifdef HAVE_NET_ETHERNET_H
40 -#include <net/ethernet.h>
41 +#include <linux/if_ether.h>
42 #endif
43
44 #ifdef HAVE_ASM_TYPES_H
45 --- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
46 +++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
47 @@ -16,6 +16,7 @@
48 #include <string.h>
49
50 #include "pppoe.h"
51 +#include "pppd/pppd.h"
52
53 #ifdef HAVE_UNISTD_H
54 #include <unistd.h>
55 @@ -27,10 +28,6 @@
56 #include <linux/if_packet.h>
57 #endif
58
59 -#ifdef HAVE_NET_ETHERNET_H
60 -#include <net/ethernet.h>
61 -#endif
62 -
63 #ifdef HAVE_ASM_TYPES_H
64 #include <asm/types.h>
65 #endif
66 @@ -717,6 +714,23 @@ char *xstrdup(const char *s)
67 return ret;
68 }
69
70 +void
71 +error(char *fmt, ...)
72 +{
73 + va_list pvar;
74 +
75 +#if defined(__STDC__)
76 + va_start(pvar, fmt);
77 +#else
78 + char *fmt;
79 + va_start(pvar);
80 + fmt = va_arg(pvar, char *);
81 +#endif
82 +
83 + fprintf(stderr, fmt, pvar);
84 + va_end(pvar);
85 +}
86 +
87 void usage(void)
88 {
89 fprintf(stderr, "Usage: pppoe-discovery [options]\n");
90 --- a/pppd/plugins/rp-pppoe/Makefile.linux
91 +++ b/pppd/plugins/rp-pppoe/Makefile.linux
92 @@ -33,7 +33,7 @@ pppoe-discovery: pppoe-discovery.o debug
93 $(CC) -o pppoe-discovery pppoe-discovery.o debug.o
94
95 pppoe-discovery.o: pppoe-discovery.c
96 - $(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c
97 + $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c
98
99 debug.o: debug.c
100 $(CC) $(CFLAGS) -c -o debug.o debug.c