projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MLPPP not working in cluster mode.
[l2tpns.git]
/
radius.c
diff --git
a/radius.c
b/radius.c
index
93a1cde
..
02b29b7
100644
(file)
--- a/
radius.c
+++ b/
radius.c
@@
-1,7
+1,5
@@
// L2TPNS Radius Stuff
// L2TPNS Radius Stuff
-char const *cvs_id_radius = "$Id: radius.c,v 1.56 2009/12/08 14:49:28 bodea Exp $";
-
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
@@
-365,6
+363,13
@@
void radiussend(uint16_t r, uint8_t state)
}
}
}
}
+ if (session[s].classlen) {
+ *p = 25; // class
+ p[1] = session[s].classlen + 2;
+ memcpy(p + 2, session[s].class, session[s].classlen);
+ p += p[1];
+ }
+
{
struct param_radius_account acct = { &tunnel[session[s].tunnel], &session[s], &p };
run_plugins(PLUGIN_RADIUS_ACCOUNT, &acct);
{
struct param_radius_account acct = { &tunnel[session[s].tunnel], &session[s], &p };
run_plugins(PLUGIN_RADIUS_ACCOUNT, &acct);
@@
-402,21
+407,11
@@
void radiussend(uint16_t r, uint8_t state)
int r;
for (r = 0; s && r < MAXROUTE && session[s].route[r].ip; r++)
{
int r;
for (r = 0; s && r < MAXROUTE && session[s].route[r].ip; r++)
{
- int width = 32;
- if (session[s].route[r].mask)
- {
- int mask = session[s].route[r].mask;
- while (!(mask & 1))
- {
- width--;
- mask >>= 1;
- }
- }
-
*p = 22; // Framed-Route
p[1] = sprintf((char *) p + 2, "%s/%d %s 1",
fmtaddr(htonl(session[s].route[r].ip), 0),
*p = 22; // Framed-Route
p[1] = sprintf((char *) p + 2, "%s/%d %s 1",
fmtaddr(htonl(session[s].route[r].ip), 0),
- width, fmtaddr(htonl(session[s].ip), 1)) + 2;
+ session[s].route[r].prefixlen,
+ fmtaddr(htonl(session[s].ip), 1)) + 2;
p += p[1];
}
p += p[1];
}
@@
-696,7
+691,7
@@
void processrad(uint8_t *buf, int len, char socket_index)
else if (*p == 22)
{
// Framed-Route
else if (*p == 22)
{
// Framed-Route
- in_addr_t ip = 0
, mask = 0
;
+ in_addr_t ip = 0;
uint8_t u = 0;
uint8_t bits = 0;
uint8_t *n = p + 2;
uint8_t u = 0;
uint8_t bits = 0;
uint8_t *n = p + 2;
@@
-718,14
+713,13
@@
void processrad(uint8_t *buf, int len, char socket_index)
n++;
while (n < e && isdigit(*n))
bits = bits * 10 + *n++ - '0';
n++;
while (n < e && isdigit(*n))
bits = bits * 10 + *n++ - '0';
- mask = (( -1) << (32 - bits));
}
else if ((ip >> 24) < 128)
}
else if ((ip >> 24) < 128)
-
mask = 0xFF0000
;
+
bits = 8
;
else if ((ip >> 24) < 192)
else if ((ip >> 24) < 192)
-
mask = 0xFFFF0000
;
+
bits = 16
;
else
else
-
mask = 0xFFFFFF00
;
+
bits = 24
;
if (routes == MAXROUTE)
{
if (routes == MAXROUTE)
{
@@
-733,11
+727,11
@@
void processrad(uint8_t *buf, int len, char socket_index)
}
else if (ip)
{
}
else if (ip)
{
- LOG(3, s, session[s].tunnel, " Radius reply contains route for %s/%
s
\n",
- fmtaddr(htonl(ip), 0),
fmtaddr(htonl(mask), 1)
);
+ LOG(3, s, session[s].tunnel, " Radius reply contains route for %s/%
d
\n",
+ fmtaddr(htonl(ip), 0),
bits
);
session[s].route[routes].ip = ip;
session[s].route[routes].ip = ip;
- session[s].route[routes].
mask = mask
;
+ session[s].route[routes].
prefixlen = bits
;
routes++;
}
}
routes++;
}
}
@@
-820,6
+814,15
@@
void processrad(uint8_t *buf, int len, char socket_index)
session[s].ipv6prefixlen = prefixlen;
}
}
session[s].ipv6prefixlen = prefixlen;
}
}
+ else if (*p == 25)
+ {
+ // Class
+ if (p[1] < 3) continue;
+ session[s].classlen = p[1] - 2;
+ if (session[s].classlen > MAXCLASS)
+ session[s].classlen = MAXCLASS;
+ memcpy(session[s].class, p + 2, session[s].classlen);
+ }
}
}
else if (r_code == AccessReject)
}
}
else if (r_code == AccessReject)