From: bodea Date: Mon, 16 May 2005 04:51:16 +0000 (+0000) Subject: fix RADIUS indexing (should have 16K entries with 64 sockets) X-Git-Tag: release_2_1_0~21 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/af44e3e3bce1280732904d2683c712fd833fb0dd fix RADIUS indexing (should have 16K entries with 64 sockets) --- diff --git a/Changes b/Changes index fda010e..0b2f15f 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,4 @@ -* Tue May 10 2005 Brendan O'Dea 2.1.0 +* Mon May 16 2005 Brendan O'Dea 2.1.0 - Add IPv6 support from Jonathan McDowell. - Add CHAP support from Jordan Hrycaj. - Add interim accounting support from Vladislav Bjelic. @@ -61,6 +61,8 @@ - Make "show running-config" a privileged command (contains clear text shared secrets). - Add sessionctl plugin to provide drop/kill via nsctl. +- Add handling of "throttle=N" RADIUS attributes. +- Fix RADIUS indexing (should have 16K entries with 64 sockets). * Fri Dec 17 2004 Brendan O'Dea 2.0.13 - Better cluster master collision resolution: keep a counter of state diff --git a/l2tpns.c b/l2tpns.c index 9e9b34a..e0e3cf2 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // vim: sw=8 ts=8 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.103 2005/05/13 01:29:40 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.104 2005/05/16 04:51:16 bodea Exp $"; #include #include @@ -1566,7 +1566,7 @@ void sendipcp(tunnelidt t, sessionidt s) if (!q) return; *q = ConfigReq; - q[1] = r << RADIUS_SHIFT; // ID, dont care, we only send one type of request + q[1] = r >> RADIUS_SHIFT; // ID, dont care, we only send one type of request *(uint16_t *) (q + 2) = htons(10); q[4] = 3; q[5] = 6; @@ -1588,7 +1588,7 @@ void sendipcp(tunnelidt t, sessionidt s) if (!q) return; *q = ConfigReq; - q[1] = r << RADIUS_SHIFT; // ID, don't care, we + q[1] = r >> RADIUS_SHIFT; // ID, don't care, we // only send one type // of request *(uint16_t *) (q + 2) = htons(14); @@ -4005,7 +4005,7 @@ static void update_config() if (!config->numradiusservers) LOG(0, 0, 0, "No RADIUS servers defined!\n"); - config->num_radfds = 2 << RADIUS_SHIFT; + config->num_radfds = 1 << RADIUS_SHIFT; // parse radius_authtypes_s config->radius_authtypes = config->radius_authprefer = 0; diff --git a/l2tpns.h b/l2tpns.h index 77936b3..92e2f25 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -1,5 +1,5 @@ // L2TPNS Global Stuff -// $Id: l2tpns.h,v 1.68 2005/05/08 07:13:56 bodea Exp $ +// $Id: l2tpns.h,v 1.69 2005/05/16 04:51:16 bodea Exp $ #ifndef __L2TPNS_H__ #define __L2TPNS_H__ @@ -22,9 +22,9 @@ #define MAXSESSION 60000 // could be up to 65535 #define MAXTBFS 6000 // Maximum token bucket filters. Might need up to 2 * session. -#define RADIUS_SHIFT 5 -#define RADIUS_MASK ((unsigned short)(((unsigned short)~0) >> (16 - RADIUS_SHIFT))) -#define MAXRADIUS ((unsigned long)(1L << RADIUS_SHIFT) * 255) +#define RADIUS_SHIFT 6 +#define RADIUS_MASK ((1 << RADIUS_SHIFT) - 1) +#define MAXRADIUS ((1 << (RADIUS_SHIFT + 8)) - 1) #define T_UNDEF (0xffff) // A tunnel ID that won't ever be used. Mark session as undefined. #define T_FREE (0) // A tunnel ID that won't ever be used. Mark session as free. diff --git a/l2tpns.spec b/l2tpns.spec index e214492..1472f03 100644 --- a/l2tpns.spec +++ b/l2tpns.spec @@ -43,5 +43,5 @@ rm -rf %{buildroot} %attr(644,root,root) /usr/share/man/man[58]/* %changelog -* Tue May 10 2005 Brendan O'Dea 2.1.0-1 +* Mon May 16 2005 Brendan O'Dea 2.1.0-1 - 2.1.0 release, see /usr/share/doc/l2tpns-2.1.0/Changes diff --git a/radius.c b/radius.c index 395e7a0..d046d28 100644 --- a/radius.c +++ b/radius.c @@ -1,6 +1,6 @@ // L2TPNS Radius Stuff -char const *cvs_id_radius = "$Id: radius.c,v 1.30 2005/05/07 08:17:26 bodea Exp $"; +char const *cvs_id_radius = "$Id: radius.c,v 1.31 2005/05/16 04:51:16 bodea Exp $"; #include #include @@ -163,12 +163,12 @@ void radiussend(uint16_t r, uint8_t state) switch (state) { case RADIUSAUTH: - b[0] = 1; // access request + b[0] = AccessRequest; // access request break; case RADIUSSTART: case RADIUSSTOP: case RADIUSINTERIM: - b[0] = 4; // accounting request + b[0] = AccountingRequest; // accounting request break; default: LOG(0, 0, 0, "Unknown radius state %d\n", state);