Revision 40b48c6c
Added by Ermal Luçi almost 16 years ago
etc/inc/captiveportal.inc | ||
---|---|---|
530 | 530 |
|
531 | 531 |
/* do periodic RADIUS reauthentication? */ |
532 | 532 |
if (!$timedout && isset($config['captiveportal']['reauthenticate']) && |
533 |
($radiusservers !== false)) {
|
|
533 |
!empty($radiusservers)) {
|
|
534 | 534 |
|
535 | 535 |
if (isset($config['captiveportal']['radacct_enable'])) { |
536 | 536 |
if ($config['captiveportal']['reauthenticateacct'] == "stopstart") { |
... | ... | |
539 | 539 |
$cpdb[$i][4], // username |
540 | 540 |
$cpdb[$i][5], // sessionid |
541 | 541 |
$cpdb[$i][0], // start time |
542 |
$radiusservers[0]['ipaddr'], |
|
543 |
$radiusservers[0]['acctport'], |
|
544 |
$radiusservers[0]['key'], |
|
542 |
$radiusservers, |
|
545 | 543 |
$cpdb[$i][2], // clientip |
546 | 544 |
$cpdb[$i][3], // clientmac |
547 | 545 |
10); // NAS Request |
... | ... | |
550 | 548 |
RADIUS_ACCOUNTING_START($cpdb[$i][1], // ruleno |
551 | 549 |
$cpdb[$i][4], // username |
552 | 550 |
$cpdb[$i][5], // sessionid |
553 |
$radiusservers[0]['ipaddr'], |
|
554 |
$radiusservers[0]['acctport'], |
|
555 |
$radiusservers[0]['key'], |
|
551 |
$radiusservers, |
|
556 | 552 |
$cpdb[$i][2], // clientip |
557 | 553 |
$cpdb[$i][3]); // clientmac |
558 | 554 |
} else if ($config['captiveportal']['reauthenticateacct'] == "interimupdate") { |
... | ... | |
560 | 556 |
$cpdb[$i][4], // username |
561 | 557 |
$cpdb[$i][5], // sessionid |
562 | 558 |
$cpdb[$i][0], // start time |
563 |
$radiusservers[0]['ipaddr'], |
|
564 |
$radiusservers[0]['acctport'], |
|
565 |
$radiusservers[0]['key'], |
|
559 |
$radiusservers, |
|
566 | 560 |
$cpdb[$i][2], // clientip |
567 | 561 |
$cpdb[$i][3], // clientmac |
568 | 562 |
10, // NAS Request |
... | ... | |
603 | 597 |
$stop_time = (empty($stop_time)) ? time() : $stop_time; |
604 | 598 |
|
605 | 599 |
/* this client needs to be deleted - remove ipfw rules */ |
606 |
if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
|
|
600 |
if (isset($config['captiveportal']['radacct_enable']) && !empty($radiusservers)) {
|
|
607 | 601 |
RADIUS_ACCOUNTING_STOP($dbent[1], // ruleno |
608 | 602 |
$dbent[4], // username |
609 | 603 |
$dbent[5], // sessionid |
610 | 604 |
$dbent[0], // start time |
611 |
$radiusservers[0]['ipaddr'], |
|
612 |
$radiusservers[0]['acctport'], |
|
613 |
$radiusservers[0]['key'], |
|
605 |
$radiusservers, |
|
614 | 606 |
$dbent[2], // clientip |
615 | 607 |
$dbent[3], // clientmac |
616 | 608 |
$term_cause, // Acct-Terminate-Cause |
... | ... | |
681 | 673 |
$cpdb = captiveportal_read_db(); |
682 | 674 |
|
683 | 675 |
$radiusservers = captiveportal_get_radius_servers(); |
684 |
if (isset($radiusservers[0])) {
|
|
676 |
if (!empty($radiusservers)) {
|
|
685 | 677 |
for ($i = 0; $i < count($cpdb); $i++) { |
686 | 678 |
RADIUS_ACCOUNTING_STOP($cpdb[$i][1], // ruleno |
687 | 679 |
$cpdb[$i][4], // username |
688 | 680 |
$cpdb[$i][5], // sessionid |
689 | 681 |
$cpdb[$i][0], // start time |
690 |
$radiusservers[0]['ipaddr'], |
|
691 |
$radiusservers[0]['acctport'], |
|
692 |
$radiusservers[0]['key'], |
|
682 |
$radiusservers, |
|
693 | 683 |
$cpdb[$i][2], // clientip |
694 | 684 |
$cpdb[$i][3], // clientmac |
695 | 685 |
7); // Admin Reboot |
usr/local/captiveportal/index.php | ||
---|---|---|
352 | 352 |
$attributes['idle_timeout'], |
353 | 353 |
$attributes['session_terminate_time']); |
354 | 354 |
|
355 |
if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
|
|
355 |
if (isset($config['captiveportal']['radacct_enable']) && !empty($radiusservers)) {
|
|
356 | 356 |
$acct_val = RADIUS_ACCOUNTING_START($ruleno, |
357 | 357 |
$username, |
358 | 358 |
$sessionid, |
359 |
$radiusservers[0]['ipaddr'], |
|
360 |
$radiusservers[0]['acctport'], |
|
361 |
$radiusservers[0]['key'], |
|
359 |
$radiusservers, |
|
362 | 360 |
$clientip, |
363 | 361 |
$clientmac); |
364 | 362 |
|
usr/local/captiveportal/radius_accounting.inc | ||
---|---|---|
47 | 47 |
----------------------- |
48 | 48 |
*/ |
49 | 49 |
|
50 |
function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip,$clientmac) {
|
|
50 |
function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers, $clientip, $clientmac) {
|
|
51 | 51 |
|
52 | 52 |
global $config; |
53 | 53 |
|
... | ... | |
85 | 85 |
|
86 | 86 |
// Construct data package |
87 | 87 |
$racct->username = $username; |
88 |
$racct->addServer($radiusip, $radiusport, $radiuskey); |
|
88 |
/* |
|
89 |
Add support for more then one radiusserver. |
|
90 |
At most 10 servers may be specified. |
|
91 |
When multiple servers are given, they are tried in round-robin fashion until a valid response is received |
|
92 |
*/ |
|
93 |
foreach ($radiusservers as $radsrv) { |
|
94 |
// Add a new server to our instance |
|
95 |
$racct->addServer($radsrv['ipaddr'], $radsrv['acctport'], $radsrv['key']); |
|
96 |
} |
|
89 | 97 |
|
90 | 98 |
if (PEAR::isError($racct->start())) { |
91 | 99 |
$retvalue['acct_val'] = 1; |
... | ... | |
150 | 158 |
----------------------------- |
151 | 159 |
*/ |
152 | 160 |
|
153 |
function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$clientmac, $term_cause = 1, $interimupdate=false,$stop_time = null) {
|
|
161 |
function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusservers,$clientip,$clientmac, $term_cause = 1, $interimupdate=false,$stop_time = null) {
|
|
154 | 162 |
|
155 | 163 |
global $config; |
156 | 164 |
|
... | ... | |
186 | 194 |
$racct = new Auth_RADIUS_Acct_Stop; |
187 | 195 |
|
188 | 196 |
/* |
189 |
* Currently disabled |
|
190 | 197 |
Add support for more then one radiusserver. |
191 | 198 |
At most 10 servers may be specified. |
192 | 199 |
When multiple servers are given, they are tried in round-robin fashion until a valid response is received |
193 |
|
|
200 |
*/ |
|
194 | 201 |
foreach ($radiusservers as $radsrv) { |
195 |
|
|
196 | 202 |
// Add a new server to our instance |
197 |
$racct->addServer($radsrv['ipaddr'], $radsrv['port'], $radsrv['key']); |
|
198 |
|
|
203 |
$racct->addServer($radsrv['ipaddr'], $radsrv['acctport'], $radsrv['key']); |
|
199 | 204 |
} |
200 |
*/ |
|
201 | 205 |
|
202 | 206 |
// See RADIUS_ACCOUNTING_START for info |
203 | 207 |
$racct->authentic = RADIUS_AUTH_RADIUS; |
204 | 208 |
|
205 | 209 |
// Construct data package |
206 | 210 |
$racct->username = $username; |
207 |
$racct->addServer($radiusip, $radiusport, $radiuskey); |
|
208 | 211 |
// Set session_time |
209 | 212 |
$racct->session_time = $session_time; |
210 | 213 |
|
Also available in: Unified diff
Fix multiple radius server handling.