Re: FW: Duplicate Accounting maybe once, twice a day

2011-04-13 Thread Alan DeKok
Marius Pesé wrote:
 This is both the same package. Maybe the odd thing is not the duplicate every 
 once in a while but rather the fact that the bulk of them is not duplicated?

  Accounting packets WILL get sent twice.  There's little you can do to
avoid that.

  You need to design the system so that it handles duplicate accounting
packets.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: FW: Duplicate Accounting maybe once, twice a day

2011-04-13 Thread Marius Pesé
Hi Alan,

thanks for the quick reply.
If accounting packets are sent twice per default, do you have a guess as to why 
1 or 2 per day lead to duplicate entries and the other hundred or so just have 
1 entry?

Thanks 
Marius

From: freeradius-users-bounces+marius=mindspring.co...@lists.freeradius.org 
[freeradius-users-bounces+marius=mindspring.co...@lists.freeradius.org] On 
Behalf Of Alan DeKok [al...@deployingradius.com]
Sent: Wednesday, April 13, 2011 12:12 PM
To: FreeRadius users mailing list
Subject: Re: FW: Duplicate Accounting maybe once, twice a day

Marius Pesé wrote:
 This is both the same package. Maybe the odd thing is not the duplicate every 
 once in a while but rather the fact that the bulk of them is not duplicated?

  Accounting packets WILL get sent twice.  There's little you can do to
avoid that.

  You need to design the system so that it handles duplicate accounting
packets.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: FW: Duplicate Accounting maybe once, twice a day

2011-04-13 Thread Alan DeKok
Marius Pesé wrote:
 thanks for the quick reply.
 If accounting packets are sent twice per default, 

  That's not what I said.

 do you have a guess as to why 1 or 2 per day lead to duplicate entries and 
 the other hundred or so just have 1 entry?

  They CAN get sent twice.  Sometimes.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: FW: Duplicate Accounting maybe once, twice a day

2011-04-13 Thread Fajar A. Nugraha
On Wed, Apr 13, 2011 at 5:12 PM, Alan DeKok al...@deployingradius.com wrote:
 Marius Pesé wrote:
 This is both the same package. Maybe the odd thing is not the duplicate 
 every once in a while but rather the fact that the bulk of them is not 
 duplicated?

  Accounting packets WILL get sent twice.  There's little you can do to
 avoid that.

  You need to design the system so that it handles duplicate accounting
 packets.

... which sometimes is as simple as changing the database schema to
use (username,acctuniqid) as unique key. When you do that and a
duplicate accounting start packet arrives, the default
accounting_start_query (insert) on dialup.conf should fail and
accounting_start_query_alt (update) will be executed instead. So you
won't have duplicate records.

-- 
Fajar

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Duplicate Accounting maybe once, twice a day

2011-04-11 Thread Marius Pesé
Hi everyone,

we are having an issue on our FreeRadius setup where our redundant servers will 
maybe once, twice a day create duplicate accounting entries.
I have switched the servers to debug for a full day and caught one of these 
incidents in the log file, see attached.

The strange thing is it only happens maybe once a day, regardless of realm or 
user, and the other couple of hundred accounting requests are fine.
Can anyone see why this particular one would bounce back and forth?

Our setup consists of two virtually identical FreeRadius2 servers, each with 
their own mySQL database, so each of them is capable of doing Auth and Acct, 
and proxies Acct to the other one.
Also I changed the acct_update_alt query to write to a failover table since I 
thought this was the alt query being triggered, but this does not make a 
difference. Still duplicates in radacct table.

Thanks!
Marius

__
Marius Pesé
Senior Software Developer
B.Sc. Computer Science
[cid:image003.jpg@01CBF85B.77F8AF50]http://www.mindspring.co.za/
Unit 5, Doncaster Office ParkMindspring Computing
Punters Way, Kenilworth   P O Box 46926
Cape Town, South Africa   Glosderry 7702
Phone: +27 21 657 1780  Fax   : +27 21 671 7599
Cell : 072 100 70 73
E-mail: mar...@mindspring.co.zamailto:mar...@mindspring.co.za

inline: image003.jpgrad_recv: Accounting-Request packet from host 196.43.1.87 port 1820, id=1, 
length=261
Acct-Session-Id = 3/0/0/5.159_00A0493F
Framed-Protocol = PPP
Framed-IP-Address = 41.144.110.38
User-Name = aba...@msp.co.za
X-Ascend-Connect-Progress = LAN-Session-Up
X-Ascend-PreSession-Time = 3
X-Ascend-Xmit-Rate = 4096000
X-Ascend-Data-Rate = 4096000
Acct-Session-Time = 3404
Acct-Input-Octets = 970
Acct-Output-Octets = 994
X-Ascend-Pre-Input-Octets = 86
X-Ascend-Pre-Output-Octets = 91
Acct-Input-Packets = 62
Acct-Output-Packets = 62
X-Ascend-Pre-Input-Packets = 5
X-Ascend-Pre-Output-Packets = 6
Acct-Authentic = RADIUS
Acct-Status-Type = Interim-Update
NAS-Port-Type = Virtual
NAS-Port = 805634207
NAS-Port-Id = 3/0/0/5.159
Connect-Info = AutoShapedVC
Calling-Station-Id = 0182932392
Class = NL1
Service-Type = Framed-User
NAS-IP-Address = 196.43.27.100
X-Ascend-Session-Svr-Key = 01FB51D4
Acct-Delay-Time = 5
Telkom-Access-Type = DSL
Proxy-State = 0x3436
+- entering group preacct {...}
++[preprocess] returns ok
[acct_unique] Hashing 'NAS-Port = 805634207,Client-IP-Address = 
196.43.1.87,NAS-IP-Address = 196.43.27.100,Acct-Session-Id = 
3/0/0/5.159_00A0493F,User-Name = aba...@msp.co.za'
[acct_unique] Acct-Unique-Session-ID = bf140131ce2e1d1f.
++[acct_unique] returns ok
[suffix] Looking up realm msp.co.za for User-Name = aba...@msp.co.za
[suffix] Found realm msp.co.za
[suffix] Adding Stripped-User-Name = abacus
[suffix] Adding Realm = msp.co.za
[suffix] Proxying request from user abacus to realm msp.co.za
[suffix] Preparing to proxy accounting request to realm msp.co.za 
++[suffix] returns updated
++[files] returns noop
+- entering group accounting {...}
[radutmp]   expand: /var/log/radius/radutmp - /var/log/radius/radutmp
[radutmp]   expand: %{User-Name} - aba...@msp.co.za
++[radutmp] returns ok
[sql]   expand: %{User-Name} - aba...@msp.co.za
[sql] sql_set_user escaped user -- 'aba...@msp.co.za'
[sql]   expand: %{Acct-Input-Gigawords} - 
[sql]   ... expanding second conditional
[sql]   expand: %{Acct-Input-Octets} - 970
[sql]   expand: %{Acct-Output-Gigawords} - 
[sql]   ... expanding second conditional
[sql]   expand: %{Acct-Output-Octets} - 994
[sql]   expand:UPDATE radacct   SET  
framedipaddress = '%{Framed-IP-Address}',  acctsessiontime = 
'%{Acct-Session-Time}',  acctinputoctets = 
'%{%{Acct-Input-Gigawords}:-0}'   32 |
'%{%{Acct-Input-Octets}:-0}',  acctoutputoctets= 
'%{%{Acct-Output-Gigawords}:-0}'  32 |
'%{%{Acct-Output-Octets}:-0}'   WHERE acctsessionid = 
'%{Acct-Session-Id}'   AND username= '%{SQL-User-Name}' 
  AND nasipaddress= '%{NAS-IP-Address}' -UPDATE radacct
   SET  framedipaddress = '41.144.110.38',  
acctsessiontime = '3404',  acctinputoctets = '0'   32 |   
 '970',  acctoutputoctets= '0' 
 32 |'994'   WHERE acctsessionid 
= '3/0/0/5.159_00A0493F'   AND username= 'aba...@msp.co.za
rlm_sql (sql): xlat failed.
rlm_sql (sql): Reserving sql socket id: 5
rlm_sql_mysql: query: UPDATE radacct   SET  
framedipaddress