<?php
/*
-$Id$
+ $Id$
radius_accounting.inc
part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
+ Copyright (C) M0n0wall Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
- // This version of radius_accounting.inc has been modified by
- // Rob Parker <rob.parker@keycom.co.uk>. Changes made include:
- // * now sends Framed-IP-Address (client IP)
- // * now sends Called-Station-ID (NAS IP)
- // * now sends Calling-Station-ID (client IP)
-
- // This version of radius_accounting.inc has been modified by
- // Jonathan De Graeve <jonathan@imelda.be>. Changes made include:
- // - RFC2869 (Radius Extensions)
- // * now sends Acct-Input-Gigawords
- // * now sends Acct-Output-Gigawords
- // * full implementation of nas-ip/nas_mac and called/calling-station ids
-
*/
function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip,$clientmac) {
/* set 5 second timeout on socket i/o */
stream_set_timeout($fd, 5) ;
- $nas_ip = get_nas_ip();
+ $nas_ip = get_current_wan_address();
$nas_ip_exp = explode(".",$nas_ip);
$nas_mac = get_interface_mac($config['interfaces']['wan']['if']); // This function is defined in radius_authentication.inc
$nas_port = $ruleno - 10000;
/* set 5 second timeout on socket i/o */
stream_set_timeout($fd, 5) ;
- $nas_ip = get_nas_ip();
+ $nas_ip = get_current_wan_address();
$nas_ip_exp = explode(".",$nas_ip);
$nas_port = $ruleno - 10000;
$nas_mac = get_interface_mac($config['interfaces']['wan']['if']);
This version of RADIUS.php has been modified by
Jonathan De Graeve <jonathan@imelda.be> to integrate with M0n0wall <http://www.m0n0.ch/wall>
- $Id_jdg: 2005/12/22 14:22:42
-
Changes made include:
* StandardAttributes for M0n0wall use
* Removed internal Session-Id creation
*/
var $password = null;
+ /**
+ * NAS-IP-Address
+ * @var string
+ */
+ var $nas_ip = null;
+
+ /**
+ * NAS-Identifier
+ * @var array (note: RFC specifies string and PECL specifies integer)
+ */
+ var $nas_id = array();
+
/**
* List of known attributes.
* @var array
{
$this->_servers[] = array($servername, $port, $sharedSecret, $timeout, $maxtries);
}
-
+
+ /**
+ * Get the NAS-Identifier
+ *
+ * We will use our local hostname to make up the nas_id
+ */
+ function getNasID()
+ {
+ exec("/bin/hostname", $nas_id);
+ if(!$nas_id[0])
+ $nas_id[0] = "m0n0wall";
+ return $nas_id[0];
+ }
+
+ /**
+ * Get the NAS-IP-Address based on the current wan address
+ *
+ * Use functions in interfaces.inc to find this out
+ *
+ */
+ function getNasIP()
+ {
+ $nas_ip = get_current_wan_address();
+ return $nas_ip;
+ }
+
/**
* Returns an error message, if an error occurred.
*
/**
* Puts standard attributes.
*
+ * These attributes will always be present in a radius request
+ *
* @access public
*/
function putStandardAttributes()
{
+ // Not sure if these need to be in here but for the moment its ok
$this->putAttribute(RADIUS_NAS_PORT_TYPE, RADIUS_ETHERNET);
$this->putAttribute(RADIUS_SERVICE_TYPE, RADIUS_LOGIN);
+
+ // Add support for sending NAS-IP-Address, set this explicitly as an ip_addr
+ $this->putAttribute(RADIUS_NAS_IP_ADDRESS, $this->getNasIP(), addr);
+
+ // Add support for sending NAS-Identifier
+ $this->putAttribute(RADIUS_NAS_IDENTIFIER, $this->getNasID());
+
}
/**
}
$this->createRequest();
- $this->putStandardAttributes();
+ $this->putStandardAttributes();
$this->putAuthAttributes();
return true;
}