Using vserver id as nas port to support darksolar control panel
authorNeutron Soutmun <neo.neutron@gmail.com>
Thu, 21 Jun 2012 09:59:58 +0000 (16:59 +0700)
committerNeutron Soutmun <neo.neutron@gmail.com>
Thu, 21 Jun 2012 09:59:58 +0000 (16:59 +0700)
* weblogin/{login,logout,xmlrpc_service}.php:
  - Using vserver id as nas port for RADIUS accounting.
* weblogin/rahu_radius.class.php:
  - Value of RADIUS_NAS_PORT should be passed as int.

weblogin/login.php
weblogin/logout.php
weblogin/rahu_radius.class.php
weblogin/xmlrpc_service.php

index 78b08bd..13773b3 100644 (file)
@@ -104,7 +104,7 @@ if (!$forward) {
       $racct->secret = $config["RADIUS_SECRET"];
       $racct->nas_identifier = $config["NAS_IDENTIFIER"];
       $racct->nas_ip_address = $config["NAS_IP_ADDRESS"];
-      $racct->nas_port = $config["NAS_PORT"];
+      $racct->nas_port = $config["VSERVER_ID"];
       $racct->framed_ip_address  = $_SERVER['REMOTE_ADDR'];
       $racct->calling_station_id = returnMacAddress();
       $racct->gen_session_id();
index bfdd665..d34c9c9 100644 (file)
@@ -143,7 +143,7 @@ if (!empty($_POST['do_logout'])) {
     $racct->secret = $config["RADIUS_SECRET"];
     $racct->nas_identifier = $config["NAS_IDENTIFIER"];
     $racct->nas_ip_address = $config["NAS_IP_ADDRESS"];
-    $racct->nas_port = $config["NAS_PORT"];
+    $racct->nas_port = $config["VSERVER_ID"];
     $racct->framed_ip_address  = $ip;
     $racct->calling_station_id = $mac_address;
     $racct->terminate_cause = RADIUS_TERM_USER_REQUEST;
index 09d2697..6b39c85 100644 (file)
@@ -257,7 +257,7 @@ class rahu_radius_acct {
                              ip2long($this->framed_ip_address));
     $racct->putAttribute(RADIUS_CALLING_STATION_ID, $this->calling_station_id);
     $racct->putAttribute(RADIUS_NAS_IDENTIFIER, $this->nas_identifier);
-    $racct->putAttribute(RADIUS_NAS_PORT, $this->nas_port);
+    $racct->putAttribute(RADIUS_NAS_PORT, intval($this->nas_port));
     $racct->putAttribute(RADIUS_CALLED_STATION_ID, $this->called_station_id);
 
     switch($accttype) {
index ae94b48..b9b2a53 100644 (file)
@@ -102,7 +102,7 @@ if ($GLOBALS["task"] == "do_stopacct") {
   $racct->framed_ip_address  = $ip;
   $racct->calling_station_id = $mac_address;
   $racct->terminate_cause = !empty($cause) ? $cause : RADIUS_TERM_NAS_ERROR;
-  $racct->nas_port = $config["NAS_PORT"];
+  $racct->nas_port = $config["VSERVER_ID"];
   $racct->session_id    = $session_id;
   $racct->session_start = $session_start;
   if ($racct->acctStop() === true) {