typo
[l2tpns.git] / radius.c
1 // L2TPNS Radius Stuff
2
3 char const *cvs_id_radius = "$Id: radius.c,v 1.29 2005-05-05 10:02:08 bodea Exp $";
4
5 #include <time.h>
6 #include <stdio.h>
7 #include <sys/types.h>
8 #include <sys/socket.h>
9 #include <malloc.h>
10 #include <string.h>
11 #include <fcntl.h>
12 #include <arpa/inet.h>
13 #include <ctype.h>
14 #include <netinet/in.h>
15 #include "md5.h"
16 #include "constants.h"
17 #include "l2tpns.h"
18 #include "plugin.h"
19 #include "util.h"
20
21 extern radiust *radius;
22 extern sessiont *session;
23 extern tunnelt *tunnel;
24 extern configt *config;
25 extern int *radfds;
26 extern ip_filtert *ip_filters;
27
28 // Set up socket for radius requests
29 void initrad(void)
30 {
31 int i;
32 LOG(3, 0, 0, "Creating %d sockets for RADIUS queries\n", config->num_radfds);
33 radfds = calloc(sizeof(int), config->num_radfds);
34 for (i = 0; i < config->num_radfds; i++)
35 {
36 int flags;
37 radfds[i] = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
38 flags = fcntl(radfds[i], F_GETFL, 0);
39 fcntl(radfds[i], F_SETFL, flags | O_NONBLOCK);
40 }
41 }
42
43 void radiusclear(uint16_t r, sessionidt s)
44 {
45 if (s) sess_local[s].radius = 0;
46 memset(&radius[r], 0, sizeof(radius[r])); // radius[r].state = RADIUSNULL;
47 }
48
49 static uint16_t get_free_radius()
50 {
51 int count;
52 static uint32_t next_radius_id = 0;
53
54 for (count = MAXRADIUS; count > 0 ; --count)
55 {
56 ++next_radius_id; // Find the next ID to check.
57 if (next_radius_id >= MAXRADIUS)
58 next_radius_id = 1;
59
60 if (radius[next_radius_id].state == RADIUSNULL)
61 {
62 return next_radius_id;
63 }
64 }
65
66 LOG(0, 0, 0, "Can't find a free radius session! This is very bad!\n");
67 return 0;
68 }
69
70 uint16_t radiusnew(sessionidt s)
71 {
72 uint16_t r = sess_local[s].radius;
73
74 /* re-use */
75 if (r)
76 {
77 LOG(3, s, session[s].tunnel, "Re-used radius %d\n", r);
78 return r;
79 }
80
81 if (!(r = get_free_radius()))
82 {
83 LOG(1, s, session[s].tunnel, "No free RADIUS sessions\n");
84 STAT(radius_overflow);
85 return 0;
86 };
87
88 memset(&radius[r], 0, sizeof(radius[r]));
89 sess_local[s].radius = r;
90 radius[r].session = s;
91 radius[r].state = RADIUSWAIT;
92 radius[r].retry = TIME + 1200; // Wait at least 120 seconds to re-claim this.
93
94 LOG(3, s, session[s].tunnel, "Allocated radius %d\n", r);
95 return r;
96 }
97
98 // Send a RADIUS request
99 void radiussend(uint16_t r, uint8_t state)
100 {
101 struct sockaddr_in addr;
102 uint8_t b[4096]; // RADIUS packet
103 char pass[129];
104 int pl;
105 uint8_t *p;
106 sessionidt s;
107
108 CSTAT(radiussend);
109
110 s = radius[r].session;
111 if (!config->numradiusservers)
112 {
113 LOG(0, s, session[s].tunnel, "No RADIUS servers\n");
114 return;
115 }
116 if (!*config->radiussecret)
117 {
118 LOG(0, s, session[s].tunnel, "No RADIUS secret\n");
119 return;
120 }
121
122 if (state != RADIUSAUTH && !config->radius_accounting)
123 {
124 // Radius accounting is turned off
125 radiusclear(r, s);
126 return;
127 }
128
129 if (radius[r].state != state)
130 radius[r].try = 0;
131
132 radius[r].state = state;
133 radius[r].retry = backoff(radius[r].try++);
134 LOG(4, s, session[s].tunnel, "Send RADIUS id %d sock %d state %s try %d\n",
135 r >> RADIUS_SHIFT, r & RADIUS_MASK,
136 radius_state(radius[r].state), radius[r].try);
137
138 if (radius[r].try > config->numradiusservers * 2)
139 {
140 if (s)
141 {
142 if (state == RADIUSAUTH)
143 sessionshutdown(s, "RADIUS timeout.", 3, 0);
144 else
145 {
146 LOG(1, s, session[s].tunnel, "RADIUS timeout, but in state %s so don't timeout session\n",
147 radius_state(state));
148 radiusclear(r, s);
149 }
150 STAT(radius_timeout);
151 }
152 else
153 {
154 STAT(radius_retries);
155 radius[r].state = RADIUSWAIT;
156 radius[r].retry = 100;
157 }
158 return;
159 }
160 // contruct RADIUS access request
161 switch (state)
162 {
163 case RADIUSAUTH:
164 b[0] = 1; // access request
165 break;
166 case RADIUSSTART:
167 case RADIUSSTOP:
168 case RADIUSINTERIM:
169 b[0] = 4; // accounting request
170 break;
171 default:
172 LOG(0, 0, 0, "Unknown radius state %d\n", state);
173 }
174 b[1] = r >> RADIUS_SHIFT; // identifier
175 memcpy(b + 4, radius[r].auth, 16);
176 p = b + 20;
177 if (s)
178 {
179 *p = 1; // user name
180 p[1] = strlen(session[s].user) + 2;
181 strcpy(p + 2, session[s].user);
182 p += p[1];
183 }
184 if (state == RADIUSAUTH)
185 {
186 if (radius[r].chap)
187 {
188 *p = 3; // CHAP password
189 p[1] = 19; // length
190 p[2] = radius[r].id; // ID
191 memcpy(p + 3, radius[r].pass, 16); // response from CHAP request
192 p += p[1];
193 *p = 60; // CHAP Challenge
194 p[1] = 18; // length
195 memcpy(p + 2, radius[r].auth, 16);
196 p += p[1];
197 }
198 else
199 {
200 strcpy(pass, radius[r].pass);
201 pl = strlen(pass);
202 while (pl & 15)
203 pass[pl++] = 0; // pad
204 if (pl)
205 { // encrypt
206 hasht hash;
207 int p = 0;
208 while (p < pl)
209 {
210 MD5_CTX ctx;
211 MD5Init(&ctx);
212 MD5Update(&ctx, config->radiussecret, strlen(config->radiussecret));
213 if (p)
214 MD5Update(&ctx, pass + p - 16, 16);
215 else
216 MD5Update(&ctx, radius[r].auth, 16);
217 MD5Final(hash, &ctx);
218 do
219 {
220 pass[p] ^= hash[p & 15];
221 p++;
222 }
223 while (p & 15);
224 }
225 }
226 *p = 2; // password
227 p[1] = pl + 2;
228 if (pl)
229 memcpy(p + 2, pass, pl);
230 p += p[1];
231 }
232 }
233 else if (state == RADIUSSTART || state == RADIUSSTOP || state == RADIUSINTERIM)
234 { // accounting
235 *p = 40; // accounting type
236 p[1] = 6;
237 *(uint32_t *) (p + 2) = htonl(state - RADIUSSTART + 1); // start=1, stop=2, interim=3
238 p += p[1];
239 if (s)
240 {
241 *p = 44; // session ID
242 p[1] = 18;
243 sprintf(p + 2, "%08X%08X", session[s].unique_id, session[s].opened);
244 p += p[1];
245 if (state == RADIUSSTART)
246 { // start
247 *p = 41; // delay
248 p[1] = 6;
249 *(uint32_t *) (p + 2) = htonl(time(NULL) - session[s].opened);
250 p += p[1];
251 sess_local[s].last_interim = time_now; // Setup "first" Interim
252 }
253 else
254 { // stop, interim
255 *p = 42; // input octets
256 p[1] = 6;
257 *(uint32_t *) (p + 2) = htonl(session[s].cin);
258 p += p[1];
259 *p = 43; // output octets
260 p[1] = 6;
261 *(uint32_t *) (p + 2) = htonl(session[s].cout);
262 p += p[1];
263 *p = 46; // session time
264 p[1] = 6;
265 *(uint32_t *) (p + 2) = htonl(time(NULL) - session[s].opened);
266 p += p[1];
267 *p = 47; // input packets
268 p[1] = 6;
269 *(uint32_t *) (p + 2) = htonl(session[s].pin);
270 p += p[1];
271 *p = 48; // output spackets
272 p[1] = 6;
273 *(uint32_t *) (p + 2) = htonl(session[s].pout);
274 p += p[1];
275 }
276
277 if (session[s].snoop_ip && session[s].snoop_port)
278 {
279 *p = 26; // vendor-specific
280 *(uint32_t *) (p + 2) = htonl(9); // Cisco
281 p[6] = 1; // Cisco-Avpair
282 p[7] = 2 + sprintf(p + 8, "intercept=%s:%d",
283 fmtaddr(session[s].snoop_ip, 0), session[s].snoop_port);
284
285 p[1] = p[7] + 6;
286 p += p[1];
287 }
288 }
289 }
290 if (s)
291 {
292 *p = 5; // NAS-Port
293 p[1] = 6;
294 *(uint32_t *) (p + 2) = htonl(s);
295 p += p[1];
296 }
297 if (s && session[s].ip)
298 {
299 *p = 8; // Framed-IP-Address
300 p[1] = 6;
301 *(uint32_t *) (p + 2) = htonl(session[s].ip);
302 p += p[1];
303 }
304 if (*session[s].called)
305 {
306 *p = 30; // called
307 p[1] = strlen(session[s].called) + 2;
308 strcpy(p + 2, session[s].called);
309 p += p[1];
310 }
311 if (*radius[r].calling)
312 {
313 *p = 31; // calling
314 p[1] = strlen(radius[r].calling) + 2;
315 strcpy(p + 2, radius[r].calling);
316 p += p[1];
317 }
318 else if (*session[s].calling)
319 {
320 *p = 31; // calling
321 p[1] = strlen(session[s].calling) + 2;
322 strcpy(p + 2, session[s].calling);
323 p += p[1];
324 }
325 // NAS-IP-Address
326 *p = 4;
327 p[1] = 6;
328 *(uint32_t *)(p + 2) = config->bind_address;
329 p += p[1];
330
331 // All AVpairs added
332 *(uint16_t *) (b + 2) = htons(p - b);
333 if (state != RADIUSAUTH)
334 {
335 // Build auth for accounting packet
336 char z[16] = {0};
337 char hash[16] = {0};
338 MD5_CTX ctx;
339 MD5Init(&ctx);
340 MD5Update(&ctx, b, 4);
341 MD5Update(&ctx, z, 16);
342 MD5Update(&ctx, b + 20, (p - b) - 20);
343 MD5Update(&ctx, config->radiussecret, strlen(config->radiussecret));
344 MD5Final(hash, &ctx);
345 memcpy(b + 4, hash, 16);
346 memcpy(radius[r].auth, hash, 16);
347 }
348 memset(&addr, 0, sizeof(addr));
349 addr.sin_family = AF_INET;
350 *(uint32_t *) & addr.sin_addr = config->radiusserver[(radius[r].try - 1) % config->numradiusservers];
351 {
352 // get radius port
353 uint16_t port = config->radiusport[(radius[r].try - 1) % config->numradiusservers];
354 // assume RADIUS accounting port is the authentication port +1
355 addr.sin_port = htons((state == RADIUSAUTH) ? port : port+1);
356 }
357
358 LOG_HEX(5, "RADIUS Send", b, (p - b));
359 sendto(radfds[r & RADIUS_MASK], b, p - b, 0, (void *) &addr, sizeof(addr));
360 }
361
362 // process RADIUS response
363 void processrad(uint8_t *buf, int len, char socket_index)
364 {
365 uint8_t b[MAXCONTROL];
366 MD5_CTX ctx;
367 uint16_t r;
368 sessionidt s;
369 tunnelidt t = 0;
370 hasht hash;
371 uint8_t routes = 0;
372 int r_code;
373 int r_id;
374
375 CSTAT(processrad);
376
377 LOG_HEX(5, "RADIUS Response", buf, len);
378 if (len < 20 || len < ntohs(*(uint16_t *) (buf + 2)))
379 {
380 LOG(1, 0, 0, "Duff RADIUS response length %d\n", len);
381 return ;
382 }
383
384 r_code = buf[0]; // response type
385 r_id = buf[1]; // radius reply indentifier.
386
387 len = ntohs(*(uint16_t *) (buf + 2));
388 r = socket_index | (r_id << RADIUS_SHIFT);
389 s = radius[r].session;
390 LOG(3, s, session[s].tunnel, "Received %s, radius %d response for session %u (%s, id %d)\n",
391 radius_state(radius[r].state), r, s, radius_code(r_code), r_id);
392
393 if (!s && radius[r].state != RADIUSSTOP)
394 {
395 LOG(1, s, session[s].tunnel, " Unexpected RADIUS response\n");
396 return;
397 }
398 if (radius[r].state != RADIUSAUTH && radius[r].state != RADIUSSTART
399 && radius[r].state != RADIUSSTOP && radius[r].state != RADIUSINTERIM)
400 {
401 LOG(1, s, session[s].tunnel, " Unexpected RADIUS response\n");
402 return;
403 }
404 t = session[s].tunnel;
405 MD5Init(&ctx);
406 MD5Update(&ctx, buf, 4);
407 MD5Update(&ctx, radius[r].auth, 16);
408 MD5Update(&ctx, buf + 20, len - 20);
409 MD5Update(&ctx, config->radiussecret, strlen(config->radiussecret));
410 MD5Final(hash, &ctx);
411 do {
412 if (memcmp(hash, buf + 4, 16))
413 {
414 LOG(0, s, session[s].tunnel, " Incorrect auth on RADIUS response!! (wrong secret in radius config?)\n");
415 return; // Do nothing. On timeout, it will try the next radius server.
416 }
417
418 if ((radius[r].state == RADIUSAUTH && r_code != AccessAccept && r_code != AccessReject) ||
419 ((radius[r].state == RADIUSSTART || radius[r].state == RADIUSSTOP || radius[r].state == RADIUSINTERIM) && r_code != AccountingResponse))
420 {
421 LOG(1, s, session[s].tunnel, " Unexpected RADIUS response %s\n", radius_code(r_code));
422 return; // We got something we didn't expect. Let the timeouts take
423 // care off finishing the radius session if that's really correct.
424 }
425
426 if (radius[r].state == RADIUSAUTH)
427 {
428 // run post-auth plugin
429 struct param_post_auth packet = {
430 &tunnel[t],
431 &session[s],
432 session[s].user,
433 (r_code == AccessAccept),
434 radius[r].chap ? PPPCHAP : PPPPAP
435 };
436
437 run_plugins(PLUGIN_POST_AUTH, &packet);
438 r_code = packet.auth_allowed ? AccessAccept : AccessReject;
439
440 // process auth response
441 if (radius[r].chap)
442 {
443 // CHAP
444 uint8_t *p = makeppp(b, sizeof(b), 0, 0, t, s, PPPCHAP);
445 if (!p) return; // Abort!
446
447 *p = (r_code == AccessAccept) ? 3 : 4; // ack/nak
448 p[1] = radius[r].id;
449 *(uint16_t *) (p + 2) = ntohs(4); // no message
450 tunnelsend(b, (p - b) + 4, t); // send it
451
452 LOG(3, s, session[s].tunnel, " CHAP User %s authentication %s.\n", session[s].user,
453 (r_code == AccessAccept) ? "allowed" : "denied");
454 }
455 else
456 {
457 // PAP
458 uint8_t *p = makeppp(b, sizeof(b), 0, 0, t, s, PPPPAP);
459 if (!p) return; // Abort!
460
461 // ack/nak
462 *p = r_code;
463 p[1] = radius[r].id;
464 *(uint16_t *) (p + 2) = ntohs(5);
465 p[4] = 0; // no message
466 tunnelsend(b, (p - b) + 5, t); // send it
467
468 LOG(3, s, session[s].tunnel, " PAP User %s authentication %s.\n", session[s].user,
469 (r_code == AccessAccept) ? "allowed" : "denied");
470 }
471
472 if (r_code == AccessAccept)
473 {
474 // Login successful
475 // Extract IP, routes, etc
476 uint8_t *p = buf + 20;
477 uint8_t *e = buf + len;
478 for (; p + 2 <= e && p[1] && p + p[1] <= e; p += p[1])
479 {
480 if (*p == 8)
481 {
482 // Framed-IP-Address
483 if (p[1] < 6) continue;
484 session[s].ip = ntohl(*(uint32_t *) (p + 2));
485 session[s].ip_pool_index = -1;
486 LOG(3, s, session[s].tunnel, " Radius reply contains IP address %s\n",
487 fmtaddr(htonl(session[s].ip), 0));
488
489 if (session[s].ip == 0xFFFFFFFE)
490 session[s].ip = 0; // assign from pool
491 }
492 else if (*p == 135)
493 {
494 // DNS address
495 if (p[1] < 6) continue;
496 session[s].dns1 = ntohl(*(uint32_t *) (p + 2));
497 LOG(3, s, session[s].tunnel, " Radius reply contains primary DNS address %s\n",
498 fmtaddr(htonl(session[s].dns1), 0));
499 }
500 else if (*p == 136)
501 {
502 // DNS address
503 if (p[1] < 6) continue;
504 session[s].dns2 = ntohl(*(uint32_t *) (p + 2));
505 LOG(3, s, session[s].tunnel, " Radius reply contains secondary DNS address %s\n",
506 fmtaddr(htonl(session[s].dns2), 0));
507 }
508 else if (*p == 22)
509 {
510 // Framed-Route
511 in_addr_t ip = 0, mask = 0;
512 uint8_t u = 0;
513 uint8_t bits = 0;
514 uint8_t *n = p + 2;
515 uint8_t *e = p + p[1];
516 while (n < e && (isdigit(*n) || *n == '.'))
517 {
518 if (*n == '.')
519 {
520 ip = (ip << 8) + u;
521 u = 0;
522 }
523 else
524 u = u * 10 + *n - '0';
525 n++;
526 }
527 ip = (ip << 8) + u;
528 if (*n == '/')
529 {
530 n++;
531 while (n < e && isdigit(*n))
532 bits = bits * 10 + *n++ - '0';
533 mask = (( -1) << (32 - bits));
534 }
535 else if ((ip >> 24) < 128)
536 mask = 0xFF0000;
537 else if ((ip >> 24) < 192)
538 mask = 0xFFFF0000;
539 else
540 mask = 0xFFFFFF00;
541
542 if (routes == MAXROUTE)
543 {
544 LOG(1, s, session[s].tunnel, " Too many routes\n");
545 }
546 else if (ip)
547 {
548 LOG(3, s, session[s].tunnel, " Radius reply contains route for %s/%s\n",
549 fmtaddr(htonl(ip), 0), fmtaddr(htonl(mask), 1));
550
551 session[s].route[routes].ip = ip;
552 session[s].route[routes].mask = mask;
553 routes++;
554 }
555 }
556 else if (*p == 11)
557 {
558 // Filter-Id
559 char *filter = p + 2;
560 int l = p[1] - 2;
561 char *suffix;
562 uint8_t *f = 0;
563 int i;
564
565 LOG(3, s, session[s].tunnel, " Radius reply contains Filter-Id \"%.*s\"\n", l, filter);
566 if ((suffix = memchr(filter, '.', l)))
567 {
568 int b = suffix - filter;
569 if (l - b == 3 && !memcmp("in", suffix+1, 2))
570 f = &session[s].filter_in;
571 else if (l - b == 4 && !memcmp("out", suffix+1, 3))
572 f = &session[s].filter_out;
573
574 l = b;
575 }
576
577 if (!f)
578 {
579 LOG(3, s, session[s].tunnel, " Invalid filter\n");
580 continue;
581 }
582
583 for (*f = 0, i = 0; !*f && i < MAXFILTER; i++)
584 if (strlen(ip_filters[i].name) == l &&
585 !strncmp(ip_filters[i].name, filter, l))
586 *f = i + 1;
587
588 if (*f)
589 ip_filters[*f - 1].used++;
590 else
591 LOG(3, s, session[s].tunnel, " Unknown filter\n");
592
593 }
594 else if (*p == 26 && p[1] >= 7)
595 {
596 // Vendor-Specific Attribute
597 int vendor = ntohl(*(int *)(p + 2));
598 char attrib = *(p + 6);
599 int attrib_length = *(p + 7) - 2;
600 char *avpair, *value, *key, *newp;
601
602 LOG(3, s, session[s].tunnel, " Radius reply contains Vendor-Specific. Vendor=%d Attrib=%d Length=%d\n", vendor, attrib, attrib_length);
603 if (vendor != 9 || attrib != 1)
604 {
605 LOG(3, s, session[s].tunnel, " Unknown vendor-specific\n");
606 continue;
607 }
608
609 if (attrib_length < 0) continue;
610
611 avpair = key = calloc(attrib_length + 1, 1);
612 memcpy(avpair, p + 8, attrib_length);
613 LOG(3, s, session[s].tunnel, " Cisco-Avpair value: %s\n", avpair);
614 do {
615 value = strchr(key, '=');
616 if (!value) break;
617 *value++ = 0;
618
619 // Trim quotes off reply string
620 if (*value == '\'' || *value == '\"')
621 {
622 char *x;
623 value++;
624 x = value + strlen(value) - 1;
625 if (*x == '\'' || *x == '\"')
626 *x = 0;
627 }
628
629 // Run hooks
630 newp = strchr(value, ',');
631 if (newp) *newp++ = 0;
632 {
633 struct param_radius_response p = { &tunnel[session[s].tunnel], &session[s], key, value };
634 run_plugins(PLUGIN_RADIUS_RESPONSE, &p);
635 }
636 key = newp;
637 } while (newp);
638 free(avpair);
639 }
640 else if (*p == 99)
641 {
642 // Framed-IPv6-Route
643 struct in6_addr r6;
644 int prefixlen;
645 uint8_t *n = p + 2;
646 uint8_t *e = p + p[1];
647 uint8_t *m = strchr(n, '/');
648
649 *m++ = 0;
650 inet_pton(AF_INET6, n, &r6);
651
652 prefixlen = 0;
653 while (m < e && isdigit(*m)) {
654 prefixlen = prefixlen * 10 + *m++ - '0';
655 }
656
657 if (prefixlen)
658 {
659 LOG(3, s, session[s].tunnel,
660 " Radius reply contains route for %s/%d\n",
661 n, prefixlen);
662 session[s].ipv6route = r6;
663 session[s].ipv6prefixlen = prefixlen;
664 }
665 }
666 }
667 }
668 else if (r_code == AccessReject)
669 {
670 LOG(2, s, session[s].tunnel, " Authentication rejected for %s\n", session[s].user);
671 sessionkill(s, "Authentication rejected");
672 break;
673 }
674
675 if (!session[s].dns1 && config->default_dns1)
676 {
677 session[s].dns1 = htonl(config->default_dns1);
678 LOG(3, s, t, " Sending dns1 = %s\n", fmtaddr(config->default_dns1, 0));
679 }
680 if (!session[s].dns2 && config->default_dns2)
681 {
682 session[s].dns2 = htonl(config->default_dns2);
683 LOG(3, s, t, " Sending dns2 = %s\n", fmtaddr(config->default_dns2, 0));
684 }
685
686 // Valid Session, set it up
687 session[s].unique_id = 0;
688 sessionsetup(t, s);
689 }
690 else
691 {
692 // An ack for a stop or start record.
693 LOG(3, s, t, " RADIUS accounting ack recv in state %s\n", radius_state(radius[r].state));
694 break;
695 }
696 } while (0);
697
698 // finished with RADIUS
699 radiusclear(r, s);
700 }
701
702 // Send a retry for RADIUS/CHAP message
703 void radiusretry(uint16_t r)
704 {
705 sessionidt s = radius[r].session;
706 tunnelidt t = 0;
707
708 CSTAT(radiusretry);
709
710 if (s) t = session[s].tunnel;
711
712 radius[r].retry = backoff(radius[r].try + 1);
713 switch (radius[r].state)
714 {
715 case RADIUSCHAP: // sending CHAP down PPP
716 sendchap(t, s);
717 break;
718 case RADIUSIPCP:
719 sendipcp(t, s); // send IPCP
720 break;
721 case RADIUSAUTH: // sending auth to RADIUS server
722 radiussend(r, RADIUSAUTH);
723 break;
724 case RADIUSSTART: // sending start accounting to RADIUS server
725 radiussend(r, RADIUSSTART);
726 break;
727 case RADIUSSTOP: // sending stop accounting to RADIUS server
728 radiussend(r, RADIUSSTOP);
729 break;
730 case RADIUSINTERIM: // sending interim accounting to RADIUS server
731 radiussend(r, RADIUSINTERIM);
732 break;
733 default:
734 case RADIUSNULL: // Not in use
735 case RADIUSWAIT: // waiting timeout before available, in case delayed reply from RADIUS server
736 // free up RADIUS task
737 radiusclear(r, s);
738 LOG(3, s, session[s].tunnel, "Freeing up radius session %d\n", r);
739 break;
740 }
741 }