]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/options.c
Let ./configure control the paths for pppd
[ppp.git] / pppd / options.c
index d4906c9506239101c4556a3239817aab0d7a2006..92997e6c2310d1cd67c6bb2ce1a3bfc99ab21164 100644 (file)
 #include <syslog.h>
 #include <string.h>
 #include <pwd.h>
-#ifdef PLUGIN
+#include <sys/param.h>
+#include <net/if.h>
+#ifdef PPP_WITH_PLUGINS
 #include <dlfcn.h>
 #endif
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 #include <pcap.h>
 /*
  * There have been 3 or 4 different names for this in libpcap CVS, but
@@ -73,7 +75,7 @@
 #define DLT_PPP_PPPD   DLT_PPP
 #endif
 #endif
-#endif /* PPP_FILTER */
+#endif /* PPP_WITH_FILTER */
 
 #include "pppd.h"
 #include "pathnames.h"
@@ -131,22 +133,20 @@ int       child_wait = 5;         /* # seconds to wait for children at exit */
 struct userenv *userenv_list;  /* user environment variables */
 int    dfl_route_metric = -1;  /* metric of the default route to set over the PPP link */
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
 char   path_ipv6up[MAXPATHLEN];   /* pathname of ipv6-up script */
 char   path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */
 #endif
 
-#ifdef MAXOCTETS
 unsigned int  maxoctets = 0;    /* default - no limit */
 int maxoctets_dir = 0;       /* default - sum of traffic */
 int maxoctets_timeout = 1;   /* default 1 second */ 
-#endif
 
 
 extern option_t auth_options[];
 extern struct stat devstat;
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 struct bpf_program pass_filter;/* Filter program for packets to pass */
 struct bpf_program active_filter; /* Filter program for link-active pkts */
 #endif
@@ -173,18 +173,16 @@ static int showversion(char **);
 static int showhelp(char **);
 static void usage(void);
 static int setlogfile(char **);
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
 static int loadplugin(char **);
 #endif
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 static int setpassfilter(char **);
 static int setactivefilter(char **);
 #endif
 
-#ifdef MAXOCTETS
 static int setmodir(char **);
-#endif
 
 static int user_setenv(char **);
 static void user_setprint(option_t *, printer_func, void *);
@@ -335,7 +333,7 @@ option_t general_options[] = {
       "Set pathname of ip-down script",
       OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
 
-#ifdef INET6
+#ifdef PPP_WITH_IPV6CP
     { "ipv6-up-script", o_string, path_ipv6up,
       "Set pathname of ipv6-up script",
       OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
@@ -344,7 +342,7 @@ option_t general_options[] = {
       OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
 #endif
 
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
     { "multilink", o_bool, &multilink,
       "Enable multilink operation", OPT_PRIO | 1 },
     { "mp", o_bool, &multilink,
@@ -356,14 +354,14 @@ option_t general_options[] = {
 
     { "bundle", o_string, &bundle_name,
       "Bundle name for multilink", OPT_PRIO },
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
 
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
     { "plugin", o_special, (void *)loadplugin,
       "Load a plug-in module into pppd", OPT_PRIV | OPT_A2LIST },
 #endif
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
     { "pass-filter", o_special, setpassfilter,
       "set filter for packets to pass", OPT_PRIO },
 
@@ -371,7 +369,6 @@ option_t general_options[] = {
       "set filter for active pkts", OPT_PRIO },
 #endif
 
-#ifdef MAXOCTETS
     { "maxoctets", o_int, &maxoctets,
       "Set connection traffic limit",
       OPT_PRIO | OPT_LLIMIT | OPT_NOINCR | OPT_ZEROINF },
@@ -382,7 +379,6 @@ option_t general_options[] = {
       "Set direction for limit traffic (sum,in,out,max)" },
     { "mo-timeout", o_int, &maxoctets_timeout,
       "Check for traffic limit every N seconds", OPT_PRIO | OPT_LLIMIT | 1 },
-#endif
 
     /* Dummy option, does nothing */
     { "noipx", o_bool, &noipx_opt, NULL, OPT_NOPRINT | 1 },
@@ -535,7 +531,7 @@ options_from_user(void)
     pw = getpwuid(getuid());
     if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0)
        return 1;
-    file = _PATH_USEROPT;
+    file = PPP_PATH_USEROPT;
     pl = strlen(user) + strlen(file) + 2;
     path = malloc(pl);
     if (path == NULL)
@@ -567,13 +563,13 @@ options_for_tty(void)
        dev = p + 5;
     if (dev[0] == 0 || strcmp(dev, "tty") == 0)
        return 1;               /* don't look for /etc/ppp/options.tty */
-    pl = strlen(_PATH_TTYOPT) + strlen(dev) + 1;
+    pl = strlen(PPP_PATH_TTYOPT) + strlen(dev) + 1;
     path = malloc(pl);
     if (path == NULL)
        novm("tty init file name");
-    slprintf(path, pl, "%s%s", _PATH_TTYOPT, dev);
+    slprintf(path, pl, "%s%s", PPP_PATH_TTYOPT, dev);
     /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */
-    for (p = path + strlen(_PATH_TTYOPT); *p != 0; ++p)
+    for (p = path + strlen(PPP_PATH_TTYOPT); *p != 0; ++p)
        if (*p == '/')
            *p = '.';
     option_priority = OPRIO_CFGFILE;
@@ -1470,10 +1466,10 @@ callfile(char **argv)
        return 0;
     }
 
-    l = strlen(arg) + strlen(_PATH_PEERFILES) + 1;
+    l = strlen(arg) + strlen(PPP_PATH_PEERFILES) + 1;
     if ((fname = (char *) malloc(l)) == NULL)
        novm("call file name");
-    slprintf(fname, l, "%s%s", _PATH_PEERFILES, arg);
+    slprintf(fname, l, "%s%s", PPP_PATH_PEERFILES, arg);
     script_setenv("CALL_FILE", arg, 0);
 
     ok = options_from_file(fname, 1, 1, 1);
@@ -1482,7 +1478,7 @@ callfile(char **argv)
     return ok;
 }
 
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
 /*
  * setpassfilter - Set the pass filter for packets
  */
@@ -1572,7 +1568,6 @@ setlogfile(char **argv)
     return 1;
 }
 
-#ifdef MAXOCTETS
 static int
 setmodir(char **argv)
 {
@@ -1589,9 +1584,8 @@ setmodir(char **argv)
     }
     return 1;
 }
-#endif
 
-#ifdef PLUGIN
+#ifdef PPP_WITH_PLUGINS
 static int
 loadplugin(char **argv)
 {
@@ -1603,7 +1597,7 @@ loadplugin(char **argv)
     const char *vers;
 
     if (strchr(arg, '/') == 0) {
-       const char *base = _PATH_PLUGIN;
+       const char *base = PPP_PATH_PLUGIN;
        int l = strlen(base) + strlen(arg) + 2;
        path = malloc(l);
        if (path == 0)
@@ -1644,7 +1638,7 @@ loadplugin(char **argv)
        free(path);
     return 0;
 }
-#endif /* PLUGIN */
+#endif /* PPP_WITH_PLUGINS */
 
 /*
  * Set an environment variable specified by the user.