From ebe6b4ad00c2290a9147b9bedb57c1c49bb18b02 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Fri, 15 Jul 2022 15:21:27 -0700 Subject: [PATCH] Removing option to configure PPP_WITH_MAXOCTETS, helps clean up the code and it can be controlled via config options. It does nothing by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- configure.ac | 7 ------- pppd/auth.c | 9 --------- pppd/options.c | 8 -------- pppd/plugins/radius/radius.c | 4 ---- pppd/pppd.h | 4 ---- pppd/pppdconf.h.in | 3 --- 6 files changed, 35 deletions(-) diff --git a/configure.ac b/configure.ac index a6cf829..5a134fa 100644 --- a/configure.ac +++ b/configure.ac @@ -116,13 +116,6 @@ AM_CONDITIONAL(PPP_WITH_CBCP, test "x${enable_cbcp}" = "xyes") AM_COND_IF([PPP_WITH_CBCP], AC_DEFINE([PPP_WITH_CBCP], 1, [Have Callback Protocol support])) -# -# Disable support for limiting session duration by maximum octets -AC_ARG_ENABLE([maxoctets], - AS_HELP_STRING([--disable-maxoctets], [Disable support for limiting session by maximum octets])) -AS_IF([test "x$enable_maxoctets" != "xno"], - AC_DEFINE([PPP_WITH_MAXOCTETS], 1, [Limit sessions by maximum number of octets])) - # # Disable Microsoft extensions will remove CHAP and MPPE support AC_ARG_ENABLE([microsoft-extensions], diff --git a/pppd/auth.c b/pppd/auth.c index 1e9cba0..fc28390 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -317,10 +317,7 @@ static int set_noauth_addr (char **); static int set_permitted_number (char **); static void check_access (FILE *, char *); static int wordlist_count (struct wordlist *); - -#ifdef PPP_WITH_MAXOCTETS static void check_maxoctets (void *); -#endif /* * Authentication-related options. @@ -1164,10 +1161,8 @@ np_up(int unit, int proto) if (maxconnect > 0) TIMEOUT(connect_time_expired, 0, maxconnect); -#ifdef PPP_WITH_MAXOCTETS if (maxoctets > 0) TIMEOUT(check_maxoctets, NULL, maxoctets_timeout); -#endif /* * Detach now, if the updetach option was given. @@ -1194,9 +1189,7 @@ np_down(int unit, int proto) if (--num_np_up == 0) { UNTIMEOUT(check_idle, NULL); UNTIMEOUT(connect_time_expired, NULL); -#ifdef PPP_WITH_MAXOCTETS UNTIMEOUT(check_maxoctets, NULL); -#endif new_phase(PHASE_NETWORK); } } @@ -1213,7 +1206,6 @@ np_finished(int unit, int proto) } } -#ifdef PPP_WITH_MAXOCTETS static void check_maxoctets(void *arg) { @@ -1246,7 +1238,6 @@ check_maxoctets(void *arg) TIMEOUT(check_maxoctets, NULL, maxoctets_timeout); } } -#endif /* * check_idle - check whether the link has been idle for long diff --git a/pppd/options.c b/pppd/options.c index ec36bfe..1fbe46e 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -138,11 +138,9 @@ char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */ #endif -#ifdef PPP_WITH_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[]; @@ -184,9 +182,7 @@ static int setpassfilter(char **); static int setactivefilter(char **); #endif -#ifdef PPP_WITH_MAXOCTETS static int setmodir(char **); -#endif static int user_setenv(char **); static void user_setprint(option_t *, printer_func, void *); @@ -373,7 +369,6 @@ option_t general_options[] = { "set filter for active pkts", OPT_PRIO }, #endif -#ifdef PPP_WITH_MAXOCTETS { "maxoctets", o_int, &maxoctets, "Set connection traffic limit", OPT_PRIO | OPT_LLIMIT | OPT_NOINCR | OPT_ZEROINF }, @@ -384,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 }, @@ -1574,7 +1568,6 @@ setlogfile(char **argv) return 1; } -#ifdef PPP_WITH_MAXOCTETS static int setmodir(char **argv) { @@ -1591,7 +1584,6 @@ setmodir(char **argv) } return 1; } -#endif #ifdef PPP_WITH_PLUGINS static int diff --git a/pppd/plugins/radius/radius.c b/pppd/plugins/radius/radius.c index 0417454..02875b4 100644 --- a/pppd/plugins/radius/radius.c +++ b/pppd/plugins/radius/radius.c @@ -606,7 +606,6 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info, /* idle parameter */ idle_time_limit = vp->lvalue; break; -#ifdef PPP_WITH_MAXOCTETS case PW_SESSION_OCTETS_LIMIT: /* Session traffic limit */ maxoctets = vp->lvalue; @@ -615,7 +614,6 @@ radius_setparams(VALUE_PAIR *vp, char *msg, REQUEST_INFO *req_info, /* Session traffic limit direction check */ maxoctets_dir = ( vp->lvalue > 4 ) ? 0 : vp->lvalue ; break; -#endif case PW_ACCT_INTERIM_INTERVAL: /* Send accounting updates every few seconds */ rstate.acct_interim_interval = vp->lvalue; @@ -1089,11 +1087,9 @@ radius_acct_stop(void) av_type = PW_ACCT_SESSION_TIMEOUT; break; -#ifdef PPP_WITH_MAXOCTETS case EXIT_TRAFFIC_LIMIT: av_type = PW_NAS_REQUEST; break; -#endif default: av_type = PW_NAS_ERROR; diff --git a/pppd/pppd.h b/pppd/pppd.h index e59e0e5..bd9faf0 100644 --- a/pppd/pppd.h +++ b/pppd/pppd.h @@ -386,7 +386,6 @@ extern char *tls_verify_method; extern char *pkcs12_file; #endif /* PPP_WITH_EAPTLS */ -#ifdef PPP_WITH_MAXOCTETS extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ extern int maxoctets_dir; /* Direction : 0 - in+out (default) @@ -400,7 +399,6 @@ extern int maxoctets_timeout; /* Timeout for check of octets limit */ #define PPP_OCTETS_DIRECTION_MAXOVERAL 3 /* same as previos, but little different on RADIUS side */ #define PPP_OCTETS_DIRECTION_MAXSESSION 4 -#endif #ifdef PPP_WITH_FILTER extern struct bpf_program pass_filter; /* Filter for pkts to pass */ @@ -895,9 +893,7 @@ extern void (*snoop_send_hook)(unsigned char *p, int len); #define EXIT_LOOPBACK 17 #define EXIT_INIT_FAILED 18 #define EXIT_AUTH_TOPEER_FAILED 19 -#ifdef PPP_WITH_MAXOCTETS #define EXIT_TRAFFIC_LIMIT 20 -#endif #define EXIT_CNID_AUTH_FAILED 21 /* diff --git a/pppd/pppdconf.h.in b/pppd/pppdconf.h.in index 2ae6255..64c37f7 100644 --- a/pppd/pppdconf.h.in +++ b/pppd/pppdconf.h.in @@ -24,9 +24,6 @@ /* Have support for loadable plugins */ #undef PPP_WITH_PLUGINS -/* Limit sessions by maximum number of octets */ -#undef PPP_WITH_MAXOCTETS - /* Have Callback Protocol support */ #undef PPP_WITH_CBCP -- 2.39.2