diff extensions/app_radgw/rgwx_acct.c @ 530:825a2992e3b9

Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 06 Sep 2010 14:28:53 +0900
parents 6fe3e5cf9fb2
children 4cb8f63a0f67
line wrap: on
line diff
--- a/extensions/app_radgw/rgwx_acct.c	Fri Sep 03 16:50:04 2010 +0900
+++ b/extensions/app_radgw/rgwx_acct.c	Mon Sep 06 14:28:53 2010 +0900
@@ -826,7 +826,20 @@
 				CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
 				
 				/* While here, we also add the Accouting-Record-Number AVP.
-				   We don't have a dedicated counter nor a state, so we just use the Diameter message End-to-end id here, which fits the conditions on the value. */
+					  The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32
+					   and identifies this record within one session.  As Session-Id AVPs
+					   are globally unique, the combination of Session-Id and Accounting-
+					   Record-Number AVPs is also globally unique, and can be used in
+					   matching accounting records with confirmations.  An easy way to
+					   produce unique numbers is to set the value to 0 for records of type
+					   EVENT_RECORD and START_RECORD, and set the value to 1 for the first
+					   INTERIM_RECORD, 2 for the second, and so on until the value for
+					   STOP_RECORD is one more than for the last INTERIM_RECORD.
+					   
+				  -- we actually use the end-to-end id of the message here, which remains constant
+				    if we send a duplicate, so it has the same properties as the suggested algorithm.
+				    Anyway, it assumes that we are not converting twice the same RADIUS message.
+				   . */
 				CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Record_Number, 0, &avp ) );
 				value.u32 = e2eid;
 				CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
"Welcome to our mercurial repository"