From 59a3d197fdf9d15d0d78a794257f23b1faafaf36 Mon Sep 17 00:00:00 2001 From: "Alexandr D. Kanevskiy" Date: Mon, 15 Jul 2002 11:04:18 +0000 Subject: [PATCH] make Octets-Direction flag accept value=4. For NAS - it same as Octets-Direction = Maximum (3) but on radius side maximum can be computed as maximum in/out overal or per session/day/month/year... --- pppd/auth.c | 3 ++- pppd/plugins/radius/radius.c | 4 ++-- pppd/pppd.h | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pppd/auth.c b/pppd/auth.c index a1e9fd2..1e2602b 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -32,7 +32,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define RCSID "$Id: auth.c,v 1.78 2002/07/13 06:24:36 kad Exp $" +#define RCSID "$Id: auth.c,v 1.79 2002/07/15 11:04:18 kad Exp $" #include #include @@ -894,6 +894,7 @@ check_maxoctets(arg) used = link_stats.bytes_out; break; case PPP_OCTETS_DIRECTION_MAX: + case PPP_OCTETS_DIRECTION_MAX2: used = (link_stats.bytes_in > link_stats.bytes_out) ? link_stats.bytes_in : link_stats.bytes_out; break; default: diff --git a/pppd/plugins/radius/radius.c b/pppd/plugins/radius/radius.c index 29b2836..389dff9 100644 --- a/pppd/plugins/radius/radius.c +++ b/pppd/plugins/radius/radius.c @@ -24,7 +24,7 @@ * ***********************************************************************/ static char const RCSID[] = -"$Id: radius.c,v 1.10 2002/07/13 06:24:36 kad Exp $"; +"$Id: radius.c,v 1.11 2002/07/15 11:04:18 kad Exp $"; #include "pppd.h" #include "chap.h" @@ -511,7 +511,7 @@ radius_setparams(chap_state *cstate, VALUE_PAIR *vp, char *msg, break; case PW_OCTETS_DIRECTION: /* Session traffic limit direction check */ - maxoctets_dir = vp->lvalue & 3; + maxoctets_dir = ( vp->lvalue > 4 ) 0 : vp->lvalue ; break; #endif case PW_FRAMED_IP_ADDRESS: diff --git a/pppd/pppd.h b/pppd/pppd.h index 2ccdfa6..2d1cd17 100644 --- a/pppd/pppd.h +++ b/pppd/pppd.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pppd.h,v 1.69 2002/07/13 06:24:36 kad Exp $ + * $Id: pppd.h,v 1.70 2002/07/15 11:04:18 kad Exp $ */ /* @@ -295,10 +295,12 @@ extern int maxoctets_dir; /* Direction : 2 - out 3 - max(in,out) */ extern int maxoctets_timeout; /* Timeout for check of octets limit */ -#define PPP_OCTETS_DIRECTION_SUM 0 -#define PPP_OCTETS_DIRECTION_IN 1 -#define PPP_OCTETS_DIRECTION_OUT 2 -#define PPP_OCTETS_DIRECTION_MAX 3 +#define PPP_OCTETS_DIRECTION_SUM 0 +#define PPP_OCTETS_DIRECTION_IN 1 +#define PPP_OCTETS_DIRECTION_OUT 2 +#define PPP_OCTETS_DIRECTION_MAX 3 +/* same as previos, but little different on RADIUS side */ +#define PPP_OCTETS_DIRECTION_MAX2 4 #endif #ifdef PPP_FILTER -- 2.39.2