From: Felix Fietkau Date: Thu, 20 Mar 2014 13:51:36 +0000 (+0000) Subject: pppd: fix build errors with musl X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7fa3fe6741b08fb26058e92a43dfd9d3798d102a;p=openwrt%2Fstaging%2Flinusw.git pppd: fix build errors with musl Signed-off-by: Felix Fietkau SVN-Revision: 39963 --- diff --git a/package/network/services/ppp/patches/130-no_cdefs_h.patch b/package/network/services/ppp/patches/130-no_cdefs_h.patch new file mode 100644 index 0000000000..caa892ec6b --- /dev/null +++ b/package/network/services/ppp/patches/130-no_cdefs_h.patch @@ -0,0 +1,11 @@ +--- a/pppd/plugins/rp-pppoe/config.h ++++ b/pppd/plugins/rp-pppoe/config.h +@@ -102,7 +102,7 @@ + #define HAVE_NETPACKET_PACKET_H 1 + + /* Define if you have the header file. */ +-#define HAVE_SYS_CDEFS_H 1 ++/* #undef HAVE_SYS_CDEFS_H */ + + /* Define if you have the header file. */ + /* #undef HAVE_SYS_DLPI_H */ diff --git a/package/network/services/ppp/patches/131-missing_prototype_macro.patch b/package/network/services/ppp/patches/131-missing_prototype_macro.patch new file mode 100644 index 0000000000..868a08b60f --- /dev/null +++ b/package/network/services/ppp/patches/131-missing_prototype_macro.patch @@ -0,0 +1,23 @@ +--- a/pppd/pppd.h ++++ b/pppd/pppd.h +@@ -67,6 +67,9 @@ + #define volatile + #endif + ++#undef __P ++#define __P(args) args ++ + #ifdef INET6 + #include "eui64.h" + #endif +--- a/pppd/magic.h ++++ b/pppd/magic.h +@@ -42,6 +42,8 @@ + * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $ + */ + ++#include "pppd.h" ++ + void magic_init __P((void)); /* Initialize the magic number generator */ + u_int32_t magic __P((void)); /* Returns the next magic number */ + diff --git a/package/network/services/ppp/patches/132-fix_linux_includes.patch b/package/network/services/ppp/patches/132-fix_linux_includes.patch new file mode 100644 index 0000000000..696dad1198 --- /dev/null +++ b/package/network/services/ppp/patches/132-fix_linux_includes.patch @@ -0,0 +1,40 @@ +--- a/pppd/sys-linux.c ++++ b/pppd/sys-linux.c +@@ -73,12 +73,12 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + ++#include + #include + #include + #include +@@ -102,22 +102,15 @@ + #define MAX_ADDR_LEN 7 + #endif + +-#if __GLIBC__ >= 2 + #include /* glibc 2 conflicts with linux/types.h */ + #include + #include + #include + #include +-#else +-#include +-#include +-#include +-#include +-#include +-#endif + #include + #include + ++#include + #include + #include + diff --git a/package/network/services/ppp/patches/133-fix_sha1_include.patch b/package/network/services/ppp/patches/133-fix_sha1_include.patch new file mode 100644 index 0000000000..b5ccd0852d --- /dev/null +++ b/package/network/services/ppp/patches/133-fix_sha1_include.patch @@ -0,0 +1,11 @@ +--- a/pppd/sha1.c ++++ b/pppd/sha1.c +@@ -18,7 +18,7 @@ + + #include + #include /* htonl() */ +-#include ++#include "pppd.h" + #include "sha1.h" + + static void diff --git a/package/network/services/ppp/patches/140-pppoe_compile_fix.patch b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch new file mode 100644 index 0000000000..6f24c2cb32 --- /dev/null +++ b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch @@ -0,0 +1,100 @@ +--- a/pppd/plugins/rp-pppoe/plugin.c ++++ b/pppd/plugins/rp-pppoe/plugin.c +@@ -46,9 +46,9 @@ static char const RCSID[] = + #include + #include + #include +-#include + #include + #include ++#include + #include + #include + +--- a/pppd/plugins/rp-pppoe/pppoe.h ++++ b/pppd/plugins/rp-pppoe/pppoe.h +@@ -86,17 +86,6 @@ typedef unsigned long UINT32_t; + + #include + +-#ifdef HAVE_NETINET_IF_ETHER_H +-#include +- +-#ifdef HAVE_SYS_SOCKET_H +-#include +-#endif +-#ifndef HAVE_SYS_DLPI_H +-#include +-#endif +-#endif +- + + + /* Ethernet frame types according to RFC 2516 */ +--- a/pppd/plugins/rp-pppoe/if.c ++++ b/pppd/plugins/rp-pppoe/if.c +@@ -31,7 +31,7 @@ static char const RCSID[] = + #endif + + #ifdef HAVE_NET_ETHERNET_H +-#include ++#include + #endif + + #ifdef HAVE_ASM_TYPES_H +--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c ++++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c +@@ -16,6 +16,7 @@ + #include + + #include "pppoe.h" ++#include "pppd/pppd.h" + + #ifdef HAVE_UNISTD_H + #include +@@ -27,10 +28,6 @@ + #include + #endif + +-#ifdef HAVE_NET_ETHERNET_H +-#include +-#endif +- + #ifdef HAVE_ASM_TYPES_H + #include + #endif +@@ -717,6 +714,23 @@ char *xstrdup(const char *s) + return ret; + } + ++void ++error(char *fmt, ...) ++{ ++ va_list pvar; ++ ++#if defined(__STDC__) ++ va_start(pvar, fmt); ++#else ++ char *fmt; ++ va_start(pvar); ++ fmt = va_arg(pvar, char *); ++#endif ++ ++ fprintf(stderr, fmt, pvar); ++ va_end(pvar); ++} ++ + void usage(void) + { + fprintf(stderr, "Usage: pppoe-discovery [options]\n"); +--- a/pppd/plugins/rp-pppoe/Makefile.linux ++++ b/pppd/plugins/rp-pppoe/Makefile.linux +@@ -33,7 +33,7 @@ pppoe-discovery: pppoe-discovery.o debug + $(CC) -o pppoe-discovery pppoe-discovery.o debug.o + + pppoe-discovery.o: pppoe-discovery.c +- $(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c ++ $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c + + debug.o: debug.c + $(CC) $(CFLAGS) -c -o debug.o debug.c diff --git a/package/network/services/ppp/patches/320-custom_iface_names.patch b/package/network/services/ppp/patches/320-custom_iface_names.patch index a95f4f8c81..28da9753ae 100644 --- a/package/network/services/ppp/patches/320-custom_iface_names.patch +++ b/package/network/services/ppp/patches/320-custom_iface_names.patch @@ -45,7 +45,7 @@ Signed-off-by: Jo-Philipp Wich "Maximum number of unsuccessful connection attempts to allow", --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -71,6 +71,10 @@ +@@ -74,6 +74,10 @@ #include "eui64.h" #endif @@ -56,7 +56,7 @@ Signed-off-by: Jo-Philipp Wich /* * Limits. */ -@@ -309,6 +313,7 @@ extern char *record_file; /* File to rec +@@ -312,6 +316,7 @@ extern char *record_file; /* File to rec extern bool sync_serial; /* Device is synchronous serial device */ extern int maxfail; /* Max # of unsuccessful connection attempts */ extern char linkname[MAXPATHLEN]; /* logical name for link */ @@ -66,7 +66,7 @@ Signed-off-by: Jo-Philipp Wich extern int max_data_rate; /* max bytes/sec through charshunt */ --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -168,6 +168,10 @@ struct in6_ifreq { +@@ -161,6 +161,10 @@ struct in6_ifreq { /* We can get an EIO error on an ioctl if the modem has hung up */ #define ok_error(num) ((num)==EIO) @@ -77,7 +77,7 @@ Signed-off-by: Jo-Philipp Wich static int tty_disc = N_TTY; /* The TTY discipline */ static int ppp_disc = N_PPP; /* The PPP discpline */ static int initfdflags = -1; /* Initial file descriptor flags for fd */ -@@ -622,7 +626,8 @@ void generic_disestablish_ppp(int dev_fd +@@ -615,7 +619,8 @@ void generic_disestablish_ppp(int dev_fd */ static int make_ppp_unit() { @@ -87,7 +87,7 @@ Signed-off-by: Jo-Philipp Wich if (ppp_dev_fd >= 0) { dbglog("in make_ppp_unit, already had /dev/ppp open?"); -@@ -645,6 +650,30 @@ static int make_ppp_unit() +@@ -638,6 +643,30 @@ static int make_ppp_unit() } if (x < 0) error("Couldn't create new ppp unit: %m"); diff --git a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index ed04886bac..dcdf34c451 100644 --- a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -118,7 +118,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -700,6 +700,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -693,6 +693,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -135,7 +135,7 @@ Signed-off-by: George Kashperko /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -718,6 +728,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -711,6 +721,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch b/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch index 6d93b04922..96e616e00e 100644 --- a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch +++ b/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1755,6 +1755,7 @@ int cifdefaultroute (int unit, u_int32_t +@@ -1748,6 +1748,7 @@ int cifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index 1c6d9ac0dd..3fe954d108 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1709,6 +1709,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -1702,6 +1702,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich rt.rt_dev = ifname; if (kernel_version > KVERSION(2,1,0)) { -@@ -1716,7 +1719,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -1709,7 +1712,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 4494abac2e..89c5861878 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -203,7 +203,7 @@ static int driver_is_old = 0; +@@ -196,7 +196,7 @@ static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -220,8 +220,8 @@ static int looped; /* 1 if using loop +@@ -213,8 +213,8 @@ static int looped; /* 1 if using loop static int link_mtu; /* mtu for the link (not bundle) */ static struct utsname utsname; /* for the kernel version */ @@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich #define MAX_IFS 100 -@@ -1450,11 +1450,12 @@ int ccp_fatal_error (int unit) +@@ -1443,11 +1443,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +44,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1476,6 +1477,7 @@ static char *path_to_procfs(const char * +@@ -1469,6 +1470,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2128,15 +2130,19 @@ int ppp_available(void) +@@ -2121,15 +2123,19 @@ int ppp_available(void) int my_version, my_modification, my_patch; int osmaj, osmin, ospatch; @@ -72,7 +72,7 @@ Signed-off-by: Jo-Philipp Wich /* XXX should get from driver */ driver_version = 2; -@@ -2197,6 +2203,7 @@ int ppp_available(void) +@@ -2190,6 +2196,7 @@ int ppp_available(void) if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) ok = 0; @@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich /* * This is the PPP device. Validate the version of the driver at this -@@ -2690,6 +2697,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2683,6 +2690,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } #endif /* TIOCGPTN */ @@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -2708,6 +2716,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2701,6 +2709,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } } } diff --git a/package/network/services/ppp/patches/401-no_record_file.patch b/package/network/services/ppp/patches/401-no_record_file.patch index 94c0263eaa..7ae175df8f 100644 --- a/package/network/services/ppp/patches/401-no_record_file.patch +++ b/package/network/services/ppp/patches/401-no_record_file.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -309,7 +309,6 @@ extern int holdoff; /* Dead time before +@@ -312,7 +312,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ diff --git a/package/network/services/ppp/patches/403-no_wtmp.patch b/package/network/services/ppp/patches/403-no_wtmp.patch index e8e76252c0..60e1272d3b 100644 --- a/package/network/services/ppp/patches/403-no_wtmp.patch +++ b/package/network/services/ppp/patches/403-no_wtmp.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -2266,6 +2266,7 @@ int ppp_available(void) +@@ -2259,6 +2259,7 @@ int ppp_available(void) void logwtmp (const char *line, const char *name, const char *host) { @@ -15,7 +15,7 @@ Signed-off-by: Jo-Philipp Wich struct utmp ut, *utp; pid_t mypid = getpid(); #if __GLIBC__ < 2 -@@ -2331,6 +2332,7 @@ void logwtmp (const char *line, const ch +@@ -2324,6 +2325,7 @@ void logwtmp (const char *line, const ch close (wtmp); } #endif diff --git a/package/network/services/ppp/patches/406-no_modprobe.patch b/package/network/services/ppp/patches/406-no_modprobe.patch index 149d6739ef..54b4b44f9c 100644 --- a/package/network/services/ppp/patches/406-no_modprobe.patch +++ b/package/network/services/ppp/patches/406-no_modprobe.patch @@ -1,8 +1,6 @@ -Index: ppp-2.4.5/pppd/plugins/pppoatm/pppoatm.c -=================================================================== ---- ppp-2.4.5.orig/pppd/plugins/pppoatm/pppoatm.c 2013-11-11 14:36:41.708298496 +0100 -+++ ppp-2.4.5/pppd/plugins/pppoatm/pppoatm.c 2013-11-11 14:39:03.556301877 +0100 -@@ -133,8 +133,6 @@ +--- a/pppd/plugins/pppoatm/pppoatm.c ++++ b/pppd/plugins/pppoatm/pppoatm.c +@@ -133,8 +133,6 @@ static int connect_pppoatm(void) int fd; struct atm_qos qos; diff --git a/package/network/services/ppp/patches/510-pptp_compile_fix.patch b/package/network/services/ppp/patches/510-pptp_compile_fix.patch new file mode 100644 index 0000000000..04bb620e76 --- /dev/null +++ b/package/network/services/ppp/patches/510-pptp_compile_fix.patch @@ -0,0 +1,11 @@ +--- a/pppd/plugins/pptp/pptp.c ++++ b/pppd/plugins/pptp/pptp.c +@@ -48,7 +48,7 @@ + + #include "pptp_callmgr.h" + #include +-#include ++#include + #include + + #include