pppd: fix build errors with musl
authorFelix Fietkau <nbd@openwrt.org>
Thu, 20 Mar 2014 13:51:36 +0000 (13:51 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 20 Mar 2014 13:51:36 +0000 (13:51 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39963

14 files changed:
package/network/services/ppp/patches/130-no_cdefs_h.patch [new file with mode: 0644]
package/network/services/ppp/patches/131-missing_prototype_macro.patch [new file with mode: 0644]
package/network/services/ppp/patches/132-fix_linux_includes.patch [new file with mode: 0644]
package/network/services/ppp/patches/133-fix_sha1_include.patch [new file with mode: 0644]
package/network/services/ppp/patches/140-pppoe_compile_fix.patch [new file with mode: 0644]
package/network/services/ppp/patches/320-custom_iface_names.patch
package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch
package/network/services/ppp/patches/330-retain_foreign_default_routes.patch
package/network/services/ppp/patches/340-populate_default_gateway.patch
package/network/services/ppp/patches/400-simplify_kernel_checks.patch
package/network/services/ppp/patches/401-no_record_file.patch
package/network/services/ppp/patches/403-no_wtmp.patch
package/network/services/ppp/patches/406-no_modprobe.patch
package/network/services/ppp/patches/510-pptp_compile_fix.patch [new file with mode: 0644]

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 (file)
index 0000000..caa892e
--- /dev/null
@@ -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 <sys/cdefs.h> header file.  */
+-#define HAVE_SYS_CDEFS_H 1
++/* #undef HAVE_SYS_CDEFS_H */
+ /* Define if you have the <sys/dlpi.h> 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 (file)
index 0000000..868a08b
--- /dev/null
@@ -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 (file)
index 0000000..696dad1
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/pppd/sys-linux.c
++++ b/pppd/sys-linux.c
+@@ -73,12 +73,12 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
+-#include <sys/errno.h>
+ #include <sys/file.h>
+ #include <sys/stat.h>
+ #include <sys/utsname.h>
+ #include <sys/sysmacros.h>
++#include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <syslog.h>
+@@ -102,22 +102,15 @@
+ #define MAX_ADDR_LEN 7
+ #endif
+-#if __GLIBC__ >= 2
+ #include <asm/types.h>                /* glibc 2 conflicts with linux/types.h */
+ #include <net/if.h>
+ #include <net/if_arp.h>
+ #include <net/route.h>
+ #include <netinet/if_ether.h>
+-#else
+-#include <linux/types.h>
+-#include <linux/if.h>
+-#include <linux/if_arp.h>
+-#include <linux/route.h>
+-#include <linux/if_ether.h>
+-#endif
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <linux/sockios.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_ppp.h>
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 (file)
index 0000000..b5ccd08
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/pppd/sha1.c
++++ b/pppd/sha1.c
+@@ -18,7 +18,7 @@
+ #include <string.h>
+ #include <netinet/in.h>       /* htonl() */
+-#include <net/ppp_defs.h>
++#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 (file)
index 0000000..6f24c2c
--- /dev/null
@@ -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 <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#include <net/ethernet.h>
+ #include <net/if_arp.h>
+ #include <linux/ppp_defs.h>
++#include <linux/if_ether.h>
+ #include <linux/if_ppp.h>
+ #include <linux/if_pppox.h>
+--- a/pppd/plugins/rp-pppoe/pppoe.h
++++ b/pppd/plugins/rp-pppoe/pppoe.h
+@@ -86,17 +86,6 @@ typedef unsigned long UINT32_t;
+ #include <netinet/in.h>
+-#ifdef HAVE_NETINET_IF_ETHER_H
+-#include <sys/types.h>
+-
+-#ifdef HAVE_SYS_SOCKET_H
+-#include <sys/socket.h>
+-#endif
+-#ifndef HAVE_SYS_DLPI_H
+-#include <netinet/if_ether.h>
+-#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 <net/ethernet.h>
++#include <linux/if_ether.h>
+ #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 <string.h>
+ #include "pppoe.h"
++#include "pppd/pppd.h"
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+@@ -27,10 +28,6 @@
+ #include <linux/if_packet.h>
+ #endif
+-#ifdef HAVE_NET_ETHERNET_H
+-#include <net/ethernet.h>
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include <asm/types.h>
+ #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
index a95f4f8c81e8afb83f21e24141526853718a7464..28da9753ae9596cf289891261edc678198a29fbd 100644 (file)
@@ -45,7 +45,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
        "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 <jow@openwrt.org>
  /*
   * 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 <jow@openwrt.org>
  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 <jow@openwrt.org>
  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 <jow@openwrt.org>
  
        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");
index ed04886bac192a26fa84c9009588a374f8eccc98..dcdf34c4514af05e06d208621e18f35ba154664c 100644 (file)
@@ -118,7 +118,7 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
                        && 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 <george@znau.edu.ua>
  /*
   * 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);
index 6d93b0492288ddcb83199bbb2ca6f684a929e93f..96e616e00ea54d8754d2738762d7251cc838a5e8 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
 
 --- 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;
      }
  
index 1c6d9ac0dd4cbba6646bd7347a0a41040bdc9761..3fe954d108299967df36bfddd9bcbaa068dd90c4 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
 
 --- 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 <jow@openwrt.org>
      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;
      }
  
index 4494abac2e3c844a61642684dd1153d1d7612773..89c5861878bda2545e87ebe885738222fe74033f 100644 (file)
@@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
 
 --- 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 <jow@openwrt.org>
  
  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 <jow@openwrt.org>
  
  #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 <jow@openwrt.org>
      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 <jow@openwrt.org>
  
      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 <jow@openwrt.org>
  
        /* 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 <jow@openwrt.org>
  
  /*
   *  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 <jow@openwrt.org>
      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
            }
        }
      }
index 94c0263eaa595377191d80b565a136130ee5120a..7ae175df8f85289c924f06f3d86382219b9817d1 100644 (file)
@@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
 
 --- 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 */
index e8e76252c01d7ace72159b265498e5ad61b79bf3..60e1272d3bb4a421251e2565f3f865c314089b09 100644 (file)
@@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
 
 --- 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 <jow@openwrt.org>
      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
index 149d6739efac606bc29b3816a535e45626d5b318..54b4b44f9c3c84d14ea03658eb94165483628cdf 100644 (file)
@@ -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 (file)
index 0000000..04bb620
--- /dev/null
@@ -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 <net/if.h>
+-#include <net/ethernet.h>
++#include <linux/if_ether.h>
+ #include <linux/if_pppox.h>
+ #include <stdio.h>