if (state == RADIUSSTOP && radius[r].term_cause)
{
- *p = 49; // acct-terminate-cause
+ *p = 49; // acct-terminate-cause
p[1] = 6;
*(uint32_t *) (p + 2) = htonl(radius[r].term_cause);
p += p[1];
*(uint32_t *) (p + 2) = htonl(s);
p += p[1];
- *p = 6; // Service-Type
+ *p = 6; // Service-Type
p[1] = 6;
*(uint32_t *) (p + 2) = htonl((state == RADIUSJUSTAUTH ? 8 : 2)); // Authenticate only or Framed-User respectevily
p += p[1];
- *p = 7; // Framed-Protocol
+ *p = 7; // Framed-Protocol
p[1] = htonl((state == RADIUSJUSTAUTH ? 0 : 6));
*(uint32_t *) (p + 2) = htonl((state == RADIUSJUSTAUTH ? 0 : 1)); // PPP
p += p[1];
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),
- width, fmtaddr(htonl(session[s].ip), 1)) + 2;
+ session[s].route[r].prefixlen,
+ fmtaddr(htonl(session[s].ip), 1)) + 2;
p += p[1];
}
}
else
{
- value = tmp;
+ value = tmp;
len = 0;
}
else if (vendor == 529 && attrib >= 135 && attrib <= 136) // Ascend
{
// handle old-format ascend DNS attributes below
- p += 6;
+ p += 6;
}
else
{
if (*p == 8)
{
// Framed-IP-Address
- if (p[1] < 6) continue;
+ if (p[1] < 6) continue;
session[s].ip = ntohl(*(uint32_t *) (p + 2));
session[s].ip_pool_index = -1;
LOG(3, s, session[s].tunnel, " Radius reply contains IP address %s\n",
else if (*p == 135)
{
// DNS address
- if (p[1] < 6) continue;
+ if (p[1] < 6) continue;
session[s].dns1 = ntohl(*(uint32_t *) (p + 2));
LOG(3, s, session[s].tunnel, " Radius reply contains primary DNS address %s\n",
fmtaddr(htonl(session[s].dns1), 0));
else if (*p == 136)
{
// DNS address
- if (p[1] < 6) continue;
+ if (p[1] < 6) continue;
session[s].dns2 = ntohl(*(uint32_t *) (p + 2));
LOG(3, s, session[s].tunnel, " Radius reply contains secondary DNS address %s\n",
fmtaddr(htonl(session[s].dns2), 0));
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;
n++;
while (n < e && isdigit(*n))
bits = bits * 10 + *n++ - '0';
- mask = (( -1) << (32 - bits));
}
else if ((ip >> 24) < 128)
- mask = 0xFF0000;
+ bits = 8;
else if ((ip >> 24) < 192)
- mask = 0xFFFF0000;
+ bits = 16;
else
- mask = 0xFFFFFF00;
+ bits = 24;
if (routes == MAXROUTE)
{
}
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].mask = mask;
+ session[s].route[routes].prefixlen = bits;
routes++;
}
}
else if (*p == 11)
{
- // Filter-Id
- char *filter = (char *) p + 2;
+ // Filter-Id
+ char *filter = (char *) p + 2;
int l = p[1] - 2;
char *suffix;
int f;
}
else if (*p == 27)
{
- // Session-Timeout
- if (p[1] < 6) continue;
+ // Session-Timeout
+ if (p[1] < 6) continue;
session[s].session_timeout = ntohl(*(uint32_t *)(p + 2));
LOG(3, s, session[s].tunnel, " Radius reply contains Session-Timeout = %u\n", session[s].session_timeout);
if(!session[s].session_timeout && config->kill_timedout_sessions)
- sessionshutdown(s, "Session timeout is zero", CDN_ADMIN_DISC, 0);
+ sessionshutdown(s, "Session timeout is zero", CDN_ADMIN_DISC, 0);
}
else if (*p == 28)
{
- // Idle-Timeout
- if (p[1] < 6) continue;
+ // Idle-Timeout
+ if (p[1] < 6) continue;
session[s].idle_timeout = ntohl(*(uint32_t *)(p + 2));
LOG(3, s, session[s].tunnel, " Radius reply contains Idle-Timeout = %u\n", session[s].idle_timeout);
}
case CoARequest: // Change of Authorization
if (error)
{
- r_code = CoANAK;
+ r_code = CoANAK;
break;
}