7fa8e87a6c8784df61d4a1ee3c5dec4450922592
[l2tpns.git] / l2tplac.c
1 /*
2 * Add functionality "LAC" to l2tpns.
3 * Used to forward a ppp session to another "LNS".
4 */
5 #include <errno.h>
6 #include <string.h>
7
8 #include "md5.h"
9 #include "l2tpns.h"
10 #include "util.h"
11
12 #include "l2tplac.h"
13
14 /* sequence diagram: Client <--> LAC <--> LNS1 <--> LNS2
15 *
16 * LCP Negotiation
17 * Client <-------------------> LAC
18 * Challenge (CHAP/PAP)
19 * Client <-------------------> LAC
20 * SCCRQ
21 * LAC --------------------> LNS1 (Tunnel Open)
22 * SCCRP
23 * LAC <-------------------- LNS1 (Tunnel Open)
24 * SCCCN
25 * LAC --------------------> LNS1 (Tunnel Open)
26 * ZLB
27 * LAC <-------------------- LNS1 (Tunnel Open)
28 * ICRQ
29 * LAC --------------------> LNS1 (Session Open)
30 * ICRP
31 * LAC <-------------------- LNS1 (Session Open)
32 * ICCN
33 * LAC --------------------> LNS1 (Session Open)
34 * ZLB
35 * LAC <-------------------- LNS1 (Session Open)
36 * LCP Negotiation
37 * Client <---------------------------------------------> LNS1
38 * Challenge (CHAP/PAP)
39 * Client <---------------------------------------------> LNS1
40 * SCCRQ
41 * LNS1 --------------------> LNS2 (Tunnel Open)
42 * SCCRP
43 * LNS1 <-------------------- LNS2 (Tunnel Open)
44 * SCCCN
45 * LNS1 --------------------> LNS2 (Tunnel Open)
46 * ZLB
47 * LNS1 <-------------------- LNS2 (Tunnel Open)
48 * ICRQ
49 * LNS1 --------------------> LNS2 (Session Open)
50 * ICRP
51 * LNS1 <-------------------- LNS2 (Session Open)
52 * ICCN
53 * LNS1 --------------------> LNS2 (Session Open)
54 * ZLB
55 * LNS1 <-------------------- LNS2 (Session Open)
56 * LCP Negotiation
57 * Client <------------------------------------------------------------------------> LNS2
58 * PAP/CHAP Authentification
59 * Client <------------------------------------------------------------------------> LNS2
60 * DATA (ppp)
61 * Client <------------------------------------------------------------------------> LNS2
62 * */
63
64 typedef struct
65 {
66 uint32_t tunnel_type;
67 uint32_t tunnel_medium_type;
68 in_addr_t tunnel_server_endpoint; /* IP remote LNS */
69 char tunnel_password[64]; /* l2tpsecret remote LNS */
70 char tunnel_assignment_id[256];
71 } tunnelrlnst;
72
73 // Max Radius Tunnels by remote LNS
74 #define MAXTAGTUNNEL 0x20
75 static tunnelrlnst ptunnelrlns[MAXTAGTUNNEL];
76
77 /*
78 * Possible configrlns states
79 * CONFRLNSFREE -> CONFRLNSSET -> CONFRLNSFREE
80 */
81 enum
82 {
83 CONFRLNSFREE = 0, // Not in use
84 CONFRLNSSET, // Config Set
85 CONFRLNSSETBYRADIUS // Config Set
86 };
87
88 // struct remote lns
89 typedef struct
90 {
91 int state; // conf state (tunnelstate enum)
92 in_addr_t ip; // Ip for far end
93 uint16_t port; // port for far end
94 hasht auth; // request authenticator
95 char strmaskuser[MAXUSER];
96 char l2tp_secret[64]; // L2TP shared secret
97 char tunnel_assignment_id[256];
98 }
99 configrlns;
100
101 configrlns *pconfigrlns = NULL;
102
103 // Init data structures
104 void lac_initremotelnsdata()
105 {
106 confrlnsidt i;
107
108 if ( !(pconfigrlns = shared_malloc(sizeof(pconfigrlns[0]) * MAXRLNSTUNNEL)) )
109 {
110 LOG(0, 0, 0, "Error doing malloc for tunnels lac: %s\n", strerror(errno));
111 exit(1);
112 }
113
114 memset(pconfigrlns, 0, sizeof(pconfigrlns[0]) * MAXRLNSTUNNEL);
115
116 // Mark all the conf as free.
117 for (i = 1; i < MAXRLNSTUNNEL; i++)
118 pconfigrlns[i].state = CONFRLNSFREE; // mark it as not filled in.
119
120 config->highest_rlnsid = 0;
121
122 lac_reset_rad_tag_tunnel_ctxt();
123 }
124
125 // Reset Radius TAG tunnel context
126 void lac_reset_rad_tag_tunnel_ctxt()
127 {
128 memset(ptunnelrlns, 0, sizeof(ptunnelrlns[0]) * MAXTAGTUNNEL);
129 }
130
131 // Add tunnel_type radius TAG tunnel to context
132 void lac_set_rad_tag_tunnel_type(uint8_t tag, uint32_t tunnel_type)
133 {
134 if (tag < MAXTAGTUNNEL)
135 ptunnelrlns[tag].tunnel_type = tunnel_type;
136 }
137
138 // Add tunnel_medium_type Radius TAG tunnel to context
139 void lac_set_rad_tag_tunnel_medium_type(uint8_t tag, uint32_t tunnel_medium_type)
140 {
141 if (tag < MAXTAGTUNNEL)
142 ptunnelrlns[tag].tunnel_medium_type = tunnel_medium_type;
143 }
144
145 // Add tunnel_server_endpoint Radius TAG tunnel to context
146 void lac_set_rad_tag_tunnel_serv_endpt(uint8_t tag, char *tunnel_server_endpoint)
147 {
148 if (tag < MAXTAGTUNNEL)
149 {
150 ptunnelrlns[tag].tunnel_server_endpoint = ntohl(inet_addr(tunnel_server_endpoint));
151 }
152 }
153
154 // Add tunnel_password Radius TAG tunnel to context
155 void lac_set_rad_tag_tunnel_password(uint8_t tag, char *tunnel_password)
156 {
157 if ((tag < MAXTAGTUNNEL) && (strlen(tunnel_password) < 64))
158 {
159 strcpy(ptunnelrlns[tag].tunnel_password, tunnel_password);
160 }
161 }
162
163 // Add tunnel_assignment_id Radius TAG tunnel to context
164 void lac_set_rad_tag_tunnel_assignment_id(uint8_t tag, char *tunnel_assignment_id)
165 {
166 if ((tag < MAXTAGTUNNEL) && (strlen(tunnel_assignment_id) < 256))
167 {
168 strcpy(ptunnelrlns[tag].tunnel_assignment_id, tunnel_assignment_id);
169 }
170 }
171
172 // Select a tunnel_assignment_id
173 int lac_rad_select_assignment_id(sessionidt s, char *assignment_id)
174 {
175 int idtag;
176 int nbtagfound = 0;
177 int bufidtag[MAXTAGTUNNEL];
178
179 for (idtag = 0; idtag < MAXTAGTUNNEL; ++idtag)
180 {
181 if (ptunnelrlns[idtag].tunnel_type == 0)
182 continue;
183 else if (ptunnelrlns[idtag].tunnel_type != 3) // 3 == L2TP tunnel type
184 LOG(1, s, session[s].tunnel, "Error, Only L2TP tunnel type supported\n");
185 else if (ptunnelrlns[idtag].tunnel_medium_type != 1)
186 LOG(1, s, session[s].tunnel, "Error, Only IP tunnel medium type supported\n");
187 else if (ptunnelrlns[idtag].tunnel_server_endpoint == 0)
188 LOG(1, s, session[s].tunnel, "Error, Bad IP tunnel server endpoint \n");
189 else if (strlen(ptunnelrlns[idtag].tunnel_assignment_id) > 0)
190 {
191 bufidtag[nbtagfound] = idtag;
192 nbtagfound++;
193 }
194 }
195
196 if (nbtagfound > 0)
197 {
198 // random between 0 and nbtagfound-1
199 idtag = (nbtagfound*rand()/(RAND_MAX+1.0));
200 if (idtag >= nbtagfound)
201 idtag = 0; //Sanity checks.
202
203 strcpy(assignment_id, ptunnelrlns[bufidtag[idtag]].tunnel_assignment_id);
204 return 1;
205 }
206
207 // Error no tunnel_assignment_id found
208 return 0;
209 }
210
211 // Save the 'radius tag tunnels' context on global configuration
212 void lac_save_rad_tag_tunnels(sessionidt s)
213 {
214 confrlnsidt idrlns;
215 int idtag;
216
217 for (idtag = 0; idtag < MAXTAGTUNNEL; ++idtag)
218 {
219 if (ptunnelrlns[idtag].tunnel_type == 0)
220 continue;
221 else if (ptunnelrlns[idtag].tunnel_type != 3) // 3 == L2TP tunnel type
222 LOG(1, s, session[s].tunnel, "Error, Only L2TP tunnel type supported\n");
223 else if (ptunnelrlns[idtag].tunnel_medium_type != 1)
224 LOG(1, s, session[s].tunnel, "Error, Only IP tunnel medium type supported\n");
225 else if (ptunnelrlns[idtag].tunnel_server_endpoint == 0)
226 LOG(1, s, session[s].tunnel, "Error, Bad IP tunnel server endpoint \n");
227 else if (strlen(ptunnelrlns[idtag].tunnel_assignment_id) <= 0)
228 LOG(1, s, session[s].tunnel, "Error, No tunnel_assignment_id \n");
229 else
230 for (idrlns = 1; idrlns < MAXRLNSTUNNEL; ++idrlns)
231 {
232 if (pconfigrlns[idrlns].state == CONFRLNSFREE)
233 {
234 pconfigrlns[idrlns].ip = ptunnelrlns[idtag].tunnel_server_endpoint;
235 pconfigrlns[idrlns].port = L2TPPORT; //Default L2TP poart
236 strcpy(pconfigrlns[idrlns].l2tp_secret, ptunnelrlns[idtag].tunnel_password);
237 strcpy(pconfigrlns[idrlns].tunnel_assignment_id, ptunnelrlns[idtag].tunnel_assignment_id);
238
239 config->highest_rlnsid = idrlns;
240
241 pconfigrlns[idrlns].state = CONFRLNSSETBYRADIUS;
242
243 break;
244 }
245 else if (pconfigrlns[idrlns].state == CONFRLNSSETBYRADIUS)
246 {
247 if ( (pconfigrlns[idrlns].ip == ptunnelrlns[idtag].tunnel_server_endpoint) &&
248 (strcmp(pconfigrlns[idrlns].tunnel_assignment_id, ptunnelrlns[idtag].tunnel_assignment_id) == 0) )
249 {
250 LOG(3, s, session[s].tunnel, "Tunnel IP %s already defined\n", fmtaddr(htonl(pconfigrlns[idrlns].ip), 0));
251 // l2tp_secret may be changed
252 strcpy(pconfigrlns[idrlns].l2tp_secret, ptunnelrlns[idtag].tunnel_password);
253 pconfigrlns[idrlns].port = L2TPPORT; //Default L2TP poart
254
255 if (config->highest_rlnsid < idrlns) config->highest_rlnsid = idrlns;
256
257 break;
258 }
259 }
260 }
261
262 if (idrlns >= MAXRLNSTUNNEL)
263 {
264 LOG(0, s, session[s].tunnel, "No more Remote LNS Conf Free\n");
265 return;
266 }
267 }
268 }
269
270 // Create Remote LNS a Tunnel or Session
271 static int lac_create_tunnelsession(tunnelidt t, sessionidt s, confrlnsidt i_conf, char * puser)
272 {
273 if (t == 0)
274 {
275 if (main_quit == QUIT_SHUTDOWN) return 0;
276
277 // Start Open Tunnel
278 if (!(t = lac_new_tunnel()))
279 {
280 LOG(1, 0, 0, "No more tunnels\n");
281 STAT(tunnel_overflow);
282 return 0;
283 }
284 lac_tunnelclear(t);
285 tunnel[t].ip = pconfigrlns[i_conf].ip;
286 tunnel[t].port = pconfigrlns[i_conf].port;
287 tunnel[t].window = 4; // default window
288 tunnel[t].isremotelns = i_conf;
289 STAT(tunnel_created);
290
291 random_data(pconfigrlns[i_conf].auth, sizeof(pconfigrlns[i_conf].auth));
292
293 LOG(2, 0, t, "Create New tunnel to REMOTE LNS %s for user %s\n", fmtaddr(htonl(tunnel[t].ip), 0), puser);
294 lac_send_SCCRQ(t, pconfigrlns[i_conf].auth, sizeof(pconfigrlns[i_conf].auth));
295 }
296 else if (tunnel[t].state == TUNNELOPEN)
297 {
298 if (main_quit != QUIT_SHUTDOWN)
299 {
300
301 /**********************/
302 /** Open New session **/
303 /**********************/
304 sessionidt new_sess = sessionfree;
305
306 sessionfree = session[new_sess].next;
307 memset(&session[new_sess], 0, sizeof(session[new_sess]));
308
309 if (new_sess > config->cluster_highest_sessionid)
310 config->cluster_highest_sessionid = new_sess;
311
312 session[new_sess].opened = time_now;
313 session[new_sess].tunnel = t;
314 session[new_sess].last_packet = session[s].last_data = time_now;
315
316 session[new_sess].ppp.phase = Establish;
317 session[new_sess].ppp.lcp = Starting;
318 session[s].ppp.phase = Establish;
319
320 LOG(2, 0, t, "Open New session to REMOTE LNS %s for user: %s\n", fmtaddr(htonl(tunnel[t].ip), 0), puser);
321 // Sent ICRQ Incoming-call-request
322 lac_send_ICRQ(t, new_sess);
323
324 // Set session to forward to another LNS
325 session[s].forwardtosession = new_sess;
326 session[new_sess].forwardtosession = s;
327 strncpy(session[s].user, puser, sizeof(session[s].user) - 1);
328 strncpy(session[new_sess].user, puser, sizeof(session[new_sess].user) - 1);
329
330 STAT(session_created);
331 }
332 else
333 {
334 lac_tunnelshutdown(t, "Shutting down", 6, 0, 0);
335 }
336 }
337 else
338 {
339 /** TODO **/
340 LOG(1, 0, t, "(REMOTE LNS) tunnel is not open\n");
341 }
342
343 return 1;
344 }
345 // Check if session must be forwarded to another LNS
346 // return 1 if the session must be forwarded (and Creating a tunnel/session has been started)
347 // else 0.
348 // Note: check from the configuration read on the startup-config (see setforward)
349 int lac_conf_forwardtoremotelns(sessionidt s, char * puser)
350 {
351 tunnelidt t, j;
352 confrlnsidt i;
353
354 for (i = 1; i <= config->highest_rlnsid ; ++i)
355 {
356 if ( (pconfigrlns[i].state == CONFRLNSSET) && (NULL != strstr(puser, pconfigrlns[i].strmaskuser)) )
357 {
358 t = 0;
359 for (j = 0; j <= config->cluster_highest_tunnelid ; ++j)
360 {
361 if ((tunnel[j].isremotelns) &&
362 (tunnel[j].ip == pconfigrlns[i].ip) &&
363 (tunnel[j].port == pconfigrlns[i].port) &&
364 (tunnel[j].state != TUNNELDIE))
365 {
366 t = j;
367 if (tunnel[t].isremotelns != i)
368 {
369 if ( (tunnel[t].state == TUNNELOPEN) || (tunnel[t].state == TUNNELOPENING) )
370 {
371 LOG(1, 0, t, "Tunnel Remote LNS ID inconsistency (IP RLNS:%s)\n",
372 fmtaddr(htonl(pconfigrlns[i].ip), 0));
373
374 tunnel[t].isremotelns = i;
375 }
376 else t = 0;
377 }
378 break;
379 }
380 }
381
382 return lac_create_tunnelsession(t, s, i, puser);
383 }
384 }
385
386 return 0;
387 }
388
389 // return 1 if the session must be forwarded (and Creating a tunnel/session has been started)
390 // else 0.
391 // Note: Started from a radius response
392 int lac_rad_forwardtoremotelns(sessionidt s, char *assignment_id, char * puser)
393 {
394 tunnelidt t, j;
395 confrlnsidt i;
396
397 for (i = 1; i <= config->highest_rlnsid ; ++i)
398 {
399 if ((pconfigrlns[i].state == CONFRLNSSETBYRADIUS) &&
400 (strcmp(pconfigrlns[i].tunnel_assignment_id, assignment_id) == 0))
401 {
402 t = 0;
403 for (j = 1; j <= config->cluster_highest_tunnelid ; ++j)
404 {
405 if ((tunnel[j].isremotelns == i) &&
406 (tunnel[j].ip == pconfigrlns[i].ip) &&
407 (tunnel[j].port == pconfigrlns[i].port) &&
408 (tunnel[j].state != TUNNELDIE))
409 {
410 if ( (tunnel[j].state == TUNNELOPEN) ||
411 (tunnel[j].state == TUNNELOPENING) )
412 {
413 t = j;
414 LOG(3, 0, t, "Tunnel Remote LNS already open(ing) (RLNS IP:%s)\n", fmtaddr(htonl(pconfigrlns[i].ip), 0));
415 break;
416 }
417 }
418 }
419
420 return lac_create_tunnelsession(t, s, i, puser);
421 }
422 }
423
424 return 0;
425 }
426
427 // Calcul the remote LNS auth
428 void lac_calc_rlns_auth(tunnelidt t, uint8_t id, uint8_t *out)
429 {
430 MD5_CTX ctx;
431 confrlnsidt idrlns;
432
433 idrlns = tunnel[t].isremotelns;
434
435 MD5_Init(&ctx);
436 MD5_Update(&ctx, &id, 1);
437 MD5_Update(&ctx, pconfigrlns[idrlns].l2tp_secret, strlen(pconfigrlns[idrlns].l2tp_secret));
438 MD5_Update(&ctx, pconfigrlns[idrlns].auth, 16);
439 MD5_Final(out, &ctx);
440 }
441
442 // Forward session to LAC or Remote LNS
443 int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto)
444 {
445 uint16_t t = 0, s = 0;
446 uint8_t *p = buf + 2; // First word L2TP options
447
448 s = session[sess].forwardtosession;
449 if (session[s].forwardtosession != sess)
450 {
451 LOG(0, sess, session[sess].tunnel, "Link Session (%u) broken\n", s);
452 return 0;
453 }
454
455 t = session[s].tunnel;
456 if (t >= MAXTUNNEL)
457 {
458 LOG(1, s, t, "Session with invalid tunnel ID\n");
459 return 0;
460 }
461
462 if ((!tunnel[t].isremotelns) && (!tunnel[session[sess].tunnel].isremotelns))
463 {
464 LOG(0, sess, session[sess].tunnel, "Link Tunnel Session (%u) broken\n", s);
465 return 0;
466 }
467
468 if (*buf & 0x40)
469 { // length
470 p += 2;
471 }
472
473 *(uint16_t *) p = htons(tunnel[t].far); // tunnel
474 p += 2;
475 *(uint16_t *) p = htons(session[s].far); // session
476 p += 2;
477
478 if (*buf & 0x08)
479 { // ns/nr
480 *(uint16_t *) p = htons(tunnel[t].ns); // sequence
481 p += 2;
482 *(uint16_t *) p = htons(tunnel[t].nr); // sequence
483 p += 2;
484 }
485
486 if ((proto == PPPIP) || (proto == PPPMP) ||(proto == PPPIPV6 && config->ipv6_prefix.s6_addr[0]))
487 {
488 session[sess].last_packet = session[sess].last_data = time_now;
489 // Update STAT IN
490 increment_counter(&session[sess].cin, &session[sess].cin_wrap, len);
491 session[sess].cin_delta += len;
492 session[sess].pin++;
493 sess_local[sess].cin += len;
494 sess_local[sess].pin++;
495
496 session[s].last_data = time_now;
497 // Update STAT OUT
498 increment_counter(&session[s].cout, &session[s].cout_wrap, len); // byte count
499 session[s].cout_delta += len;
500 session[s].pout++;
501 sess_local[s].cout += len;
502 sess_local[s].pout++;
503 }
504 else
505 session[sess].last_packet = time_now;
506
507 tunnelsend(buf, len, t); // send it...
508
509 return 1;
510 }
511
512 // Add new Remote LNS from CLI
513 // return:
514 // 0 = Error
515 // 1 = New Remote LNS conf ADD
516 // 2 = Remote LNS Conf Updated
517 int lac_addremotelns(char *mask, char *IP_RemoteLNS, char *Port_RemoteLNS, char *SecretRemoteLNS)
518 {
519 confrlnsidt idrlns;
520
521 for (idrlns = 1; idrlns < MAXRLNSTUNNEL; ++idrlns)
522 {
523 if (pconfigrlns[idrlns].state == CONFRLNSFREE)
524 {
525 snprintf((char *) pconfigrlns[idrlns].strmaskuser, sizeof(pconfigrlns[idrlns].strmaskuser), "%s", mask);
526 pconfigrlns[idrlns].ip = ntohl(inet_addr(IP_RemoteLNS));
527 pconfigrlns[idrlns].port = atoi(Port_RemoteLNS);
528 snprintf((char *) pconfigrlns[idrlns].l2tp_secret, sizeof(pconfigrlns[idrlns].l2tp_secret), "%s", SecretRemoteLNS);
529
530 config->highest_rlnsid = idrlns;
531
532 pconfigrlns[idrlns].state = CONFRLNSSET;
533
534 return 1;
535 }
536 else if ((pconfigrlns[idrlns].state == CONFRLNSSET) && (strcmp(pconfigrlns[idrlns].strmaskuser, mask) == 0))
537 {
538 if ( (pconfigrlns[idrlns].ip != ntohl(inet_addr(IP_RemoteLNS))) ||
539 (pconfigrlns[idrlns].port != atoi(Port_RemoteLNS)) ||
540 (strcmp(pconfigrlns[idrlns].l2tp_secret, SecretRemoteLNS) != 0) )
541 {
542 memset(&pconfigrlns[idrlns], 0, sizeof(pconfigrlns[idrlns]));
543 snprintf((char *) pconfigrlns[idrlns].strmaskuser, sizeof(pconfigrlns[idrlns].strmaskuser), "%s", mask);
544 pconfigrlns[idrlns].ip = ntohl(inet_addr(IP_RemoteLNS));
545 pconfigrlns[idrlns].port = atoi(Port_RemoteLNS);
546 snprintf((char *) pconfigrlns[idrlns].l2tp_secret, sizeof(pconfigrlns[idrlns].l2tp_secret), "%s", SecretRemoteLNS);
547
548 if (config->highest_rlnsid < idrlns) config->highest_rlnsid = idrlns;
549
550 pconfigrlns[idrlns].state = CONFRLNSSET;
551 // Conf Updated, the tunnel must be dropped
552 return 2;
553 }
554
555 return 1;
556 }
557 }
558
559 LOG(0, 0, 0, "No more Remote LNS Conf Free\n");
560
561 return 0;
562 }
563
564 // Cli Show remote LNS defined
565 int lac_cli_show_remotelns(confrlnsidt idrlns, char *strout)
566 {
567 if (idrlns > config->highest_rlnsid)
568 return 0;
569
570 if (idrlns == 0)
571 // Show Summary
572 sprintf(strout, "%15s %-32s %-32s %11s %7s %10s",
573 "IP Remote LNS",
574 "l2tp secret",
575 "assignment Id",
576 "File/Radius",
577 "State",
578 "Count Sess");
579 else
580 {
581 tunnelidt t;
582 sessionidt s;
583 int countsess = 0;
584 char state[20];
585
586 strcpy(state, "Close");
587 for (t = 0; t <= config->cluster_highest_tunnelid ; ++t)
588 {
589 if ((tunnel[t].isremotelns) &&
590 (tunnel[t].ip == pconfigrlns[idrlns].ip) &&
591 (tunnel[t].port == pconfigrlns[idrlns].port) &&
592 (tunnel[t].state != TUNNELDIE))
593 {
594 if (tunnel[t].isremotelns)
595 {
596 if (tunnel[t].state == TUNNELOPENING)
597 strcpy(state, "Opening");
598 else if (tunnel[t].state == TUNNELOPEN)
599 strcpy(state, "Open");
600
601 for (s = 1; s <= config->cluster_highest_sessionid ; ++s)
602 if (session[s].tunnel == t)
603 countsess++;
604
605 break;
606 }
607 }
608 }
609
610 sprintf(strout, "%15s %-32s %-32s %11s %7s %10u",
611 fmtaddr(htonl(pconfigrlns[idrlns].ip), 0),
612 pconfigrlns[idrlns].l2tp_secret,
613 pconfigrlns[idrlns].tunnel_assignment_id,
614 (pconfigrlns[idrlns].state == CONFRLNSSET?"File":(pconfigrlns[idrlns].state == CONFRLNSSETBYRADIUS?"Radius":"Free")),
615 state,
616 countsess);
617 }
618
619 return 1;
620 }