X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=92997e6c2310d1cd67c6bb2ce1a3bfc99ab21164;hb=66a8c74c3f73d7480a09923a225b56b8829ae790;hp=b35c0591eb0e85d20be96a9c639b7497c35a40d3;hpb=898d3f4b437ca1348abc1bbd036b0106c66a7ba6;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index b35c059..92997e6 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -54,11 +54,13 @@ #include #include #include +#include +#include #ifdef PPP_WITH_PLUGINS #include #endif -#ifdef PPP_FILTER +#ifdef PPP_WITH_FILTER #include /* * 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" @@ -136,17 +138,15 @@ 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 @@ -177,14 +177,12 @@ static int setlogfile(char **); 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 *); @@ -363,7 +361,7 @@ option_t general_options[] = { "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,7 +1584,6 @@ setmodir(char **argv) } return 1; } -#endif #ifdef PPP_WITH_PLUGINS static int @@ -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)