Mercurial > hg > freeDiameter
annotate extensions/app_radgw/rgwx_acct.c @ 536:f95cfc35d960
Add User Name in translated Accounting Responses
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 10 Sep 2010 10:59:14 +0900 |
parents | 72c511043f05 |
children | 616848d6f020 |
rev | line source |
---|---|
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 * Copyright (c) 2010, WIDE Project and NICT * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 /* RADIUS Accounting-Request messages translation plugin */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 #include "rgw_common.h" |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
40 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
41 /* Other constants we use */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
42 #define AI_ACCT 3 /* Diameter Base Accounting application */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
43 #define CC_AC 271 /* ACR/ACA */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
44 #define ACV_ART_START_RECORD 2 /* START_RECORD */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
45 #define ACV_ART_INTERIM_RECORD 3 /* INTERIM_RECORD */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
46 #define ACV_ART_STOP_RECORD 4 /* STOP_RECORD */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
47 #define ACV_ART_AUTHORIZE_AUTHENTICATE 3 /* AUTHORIZE_AUTHENTICATE */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
48 #define ER_DIAMETER_LIMITED_SUCCESS 2002 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
49 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
50 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 /* The state we keep for this plugin */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 struct rgwp_config { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 struct { |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
54 struct dict_object * Accounting_Record_Number; /* Accounting-Record-Number */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
55 struct dict_object * Accounting_Record_Type; /* Accounting-Record-Type */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
56 struct dict_object * Acct_Application_Id; /* Acct-Application-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
57 struct dict_object * Acct_Delay_Time; /* Acct-Delay-Time */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
58 struct dict_object * Accounting_Input_Octets; /* Accounting-Input-Octets */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
59 struct dict_object * Accounting_Output_Octets; /* Accounting-Output-Octets */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
60 struct dict_object * Accounting_Input_Packets; /* Accounting-Input-Packets */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
61 struct dict_object * Accounting_Output_Packets; /* Accounting-Output-Packets */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
62 struct dict_object * Acct_Link_Count; /* Acct-Link-Count */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
63 struct dict_object * Acct_Authentic; /* Acct-Authentic */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
64 struct dict_object * Acct_Multi_Session_Id; /* Acct-Multi-Session-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
65 struct dict_object * Acct_Session_Id; /* Acct-Session-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
66 struct dict_object * Acct_Session_Time; /* Acct-Session-Time */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
67 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
68 struct dict_object * ARAP_Password; /* ARAP-Password */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
69 struct dict_object * ARAP_Security; /* ARAP-Security */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
70 struct dict_object * ARAP_Security_Data; /* ARAP-Security-Data */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
71 struct dict_object * Auth_Application_Id; /* Auth-Application-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
72 struct dict_object * Auth_Request_Type; /* Auth-Request-Type */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
73 struct dict_object * Authorization_Lifetime; /* Authorization-Lifetime */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
74 struct dict_object * Callback_Number; /* Callback-Number */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
75 struct dict_object * Callback_Id; /* Callback-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
76 struct dict_object * Called_Station_Id; /* Called-Station-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
77 struct dict_object * Calling_Station_Id; /* Calling-Station-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
78 struct dict_object * Class; /* Class */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
79 struct dict_object * CHAP_Algorithm; /* CHAP-Algorithm */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
80 struct dict_object * CHAP_Auth; /* CHAP-Auth */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
81 struct dict_object * CHAP_Challenge; /* CHAP-Challenge */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
82 struct dict_object * CHAP_Ident; /* CHAP-Ident */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
83 struct dict_object * CHAP_Response; /* CHAP-Response */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
84 struct dict_object * Connect_Info; /* Connect-Info */ |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
85 struct dict_object * Destination_Host; /* Destination-Host */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
86 struct dict_object * Destination_Realm; /* Destination-Realm */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
87 struct dict_object * EAP_Payload; /* EAP-Payload */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 struct dict_object * Error_Message; /* Error-Message */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 struct dict_object * Error_Reporting_Host; /* Error-Reporting-Host */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
90 struct dict_object * Event_Timestamp; /* Event-Timestamp */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 struct dict_object * Failed_AVP; /* Failed-AVP */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
92 struct dict_object * Framed_AppleTalk_Link; /* Framed-AppleTalk-Link */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
93 struct dict_object * Framed_AppleTalk_Network; /* Framed-AppleTalk-Network */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
94 struct dict_object * Framed_AppleTalk_Zone; /* Framed-AppleTalk-Zone */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
95 struct dict_object * Framed_Compression; /* Framed-Compression */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
96 struct dict_object * Framed_IP_Address; /* Framed-IP-Address */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
97 struct dict_object * Framed_IP_Netmask; /* Framed-IP-Netmask */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
98 struct dict_object * Framed_Interface_Id; /* Framed-Interface-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
99 struct dict_object * Framed_IPv6_Prefix; /* Framed-IPv6-Prefix */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
100 struct dict_object * Framed_IPX_Network; /* Framed-IPX-Network */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
101 struct dict_object * Framed_MTU; /* Framed-MTU */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
102 struct dict_object * Framed_Protocol; /* Framed-Protocol */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
103 struct dict_object * Framed_Pool; /* Framed-Pool */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
104 struct dict_object * Framed_IPv6_Route; /* Framed-IPv6-Route */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
105 struct dict_object * Framed_IPv6_Pool; /* Framed-IPv6-Pool */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
106 struct dict_object * Framed_Route; /* Framed-Route */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
107 struct dict_object * Framed_Routing; /* Framed-Routing */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
108 struct dict_object * Filter_Id; /* Filter-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
109 struct dict_object * Idle_Timeout; /* Idle-Timeout */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
110 struct dict_object * Login_IP_Host; /* Login-IP-Host */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
111 struct dict_object * Login_IPv6_Host; /* Login-IPv6-Host */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
112 struct dict_object * Login_LAT_Group; /* Login-LAT-Group */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
113 struct dict_object * Login_LAT_Node; /* Login-LAT-Node */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
114 struct dict_object * Login_LAT_Port; /* Login-LAT-Port */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
115 struct dict_object * Login_LAT_Service; /* Login-LAT-Service */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
116 struct dict_object * Login_Service; /* Login-Service */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
117 struct dict_object * Login_TCP_Port; /* Login-TCP-Port */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
118 struct dict_object * NAS_Identifier; /* NAS-Identifier */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
119 struct dict_object * NAS_IP_Address; /* NAS-IP-Address */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
120 struct dict_object * NAS_IPv6_Address; /* NAS-IPv6-Address */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
121 struct dict_object * NAS_Port; /* NAS-Port */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
122 struct dict_object * NAS_Port_Id; /* NAS-Port-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
123 struct dict_object * NAS_Port_Type; /* NAS-Port-Type */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
124 struct dict_object * Origin_AAA_Protocol; /* Origin-AAA-Protocol */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 struct dict_object * Origin_Host; /* Origin-Host */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
126 struct dict_object * Origin_Realm; /* Origin-Realm */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
127 struct dict_object * Originating_Line_Info; /* Originating-Line-Info */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
128 struct dict_object * Port_Limit; /* Port-Limit */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
129 struct dict_object * Re_Auth_Request_Type; /* Re-Auth-Request-Type */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 struct dict_object * Result_Code; /* Result-Code */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
131 struct dict_object * Service_Type; /* Service-Type */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
132 struct dict_object * Session_Id; /* Session-Id */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
133 struct dict_object * Session_Timeout; /* Session-Timeout */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 struct dict_object * State; /* State */ |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
135 struct dict_object * Termination_Cause; /* Termination-Cause */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
136 struct dict_object * Tunneling; /* Tunneling */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
137 struct dict_object * Tunnel_Type; /* Tunnel-Type */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
138 struct dict_object * Tunnel_Assignment_Id; /* Tunnel-Assignment-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
139 struct dict_object * Tunnel_Medium_Type; /* Tunnel-Medium-Type */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
140 struct dict_object * Tunnel_Client_Endpoint; /* Tunnel-Client-Endpoint */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
141 struct dict_object * Tunnel_Server_Endpoint; /* Tunnel-Server-Endpoint */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
142 struct dict_object * Tunnel_Private_Group_Id; /* Tunnel-Private-Group-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
143 struct dict_object * Tunnel_Preference; /* Tunnel-Preference */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
144 struct dict_object * Tunnel_Client_Auth_Id; /* Tunnel-Client-Auth-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
145 struct dict_object * Tunnel_Server_Auth_Id; /* Tunnel-Server-Auth-Id */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
146 struct dict_object * User_Name; /* User-Name */ |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
147 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
148 struct dict_object * Session_Termination_Request;/* STR */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
149 } dict; /* cache of the dictionary objects we use */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
150 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
151 char * confstr; |
526
6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
448
diff
changeset
|
152 |
6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
448
diff
changeset
|
153 int ignore_nai; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 }; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
155 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
156 /* The state we store in the session */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
157 struct sess_state { |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
158 application_id_t auth_appl; /* Auth-Application-Id used for this session, if available (stored in a Class attribute) */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
159 int send_str; /* If not 0, we must send a STR when the ACA is received. */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
160 uint32_t term_cause; /* If not 0, the Termination-Cause to put in the STR. */ |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
161 /* Temporary : try sending the User-Name back in Accounting-Response for RADIUS */ |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
162 uint8_t *username; |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
163 size_t un_size; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
164 }; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
165 |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
166 static void free_sess_state(struct sess_state *s) { |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
167 if (s) |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
168 free(s->username); |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
169 free(s); |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
170 } |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
171 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
172 /* Initialize the plugin */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
173 static int acct_conf_parse(char * conffile, struct rgwp_config ** state) |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
174 { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
175 struct rgwp_config * new; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
176 struct dict_object * app; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
177 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
178 TRACE_ENTRY("%p %p", conffile, state); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
179 CHECK_PARAMS( state ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
180 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
181 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
182 memset(new, 0, sizeof(struct rgwp_config)); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
183 |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
184 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free_sess_state ) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
185 new->confstr = conffile; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
186 |
532
4cb8f63a0f67
Fix segfault when no configuration string is given to the plugins
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
530
diff
changeset
|
187 if (conffile && strstr(conffile, "nonai")) |
526
6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
448
diff
changeset
|
188 new->ignore_nai = 1; |
6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
448
diff
changeset
|
189 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
190 /* Resolve all dictionary objects we use */ |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
191 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Number", &new->dict.Accounting_Record_Number, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
192 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Record-Type", &new->dict.Accounting_Record_Type, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
193 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Application-Id", &new->dict.Acct_Application_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
194 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Delay-Time", &new->dict.Acct_Delay_Time, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
195 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Input-Octets", &new->dict.Accounting_Input_Octets, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
196 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Output-Octets", &new->dict.Accounting_Output_Octets, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
197 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Input-Packets", &new->dict.Accounting_Input_Packets, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
198 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Accounting-Output-Packets", &new->dict.Accounting_Output_Packets, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
199 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Authentic", &new->dict.Acct_Authentic, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
200 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Link-Count", &new->dict.Acct_Link_Count, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
201 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Multi-Session-Id", &new->dict.Acct_Multi_Session_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
202 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Session-Id", &new->dict.Acct_Session_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
203 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Acct-Session-Time", &new->dict.Acct_Session_Time, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
204 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
205 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Password", &new->dict.ARAP_Password, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
206 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security", &new->dict.ARAP_Security, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
207 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security-Data", &new->dict.ARAP_Security_Data, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
208 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Application-Id", &new->dict.Auth_Application_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
209 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Request-Type", &new->dict.Auth_Request_Type, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
210 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Authorization-Lifetime", &new->dict.Authorization_Lifetime, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
211 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Callback-Number", &new->dict.Callback_Number, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
212 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Callback-Id", &new->dict.Callback_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
213 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Called-Station-Id", &new->dict.Called_Station_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
214 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Calling-Station-Id", &new->dict.Calling_Station_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
215 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Class", &new->dict.Class, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
216 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Connect-Info", &new->dict.Connect_Info, ENOENT) ); |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
217 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &new->dict.Destination_Host, ENOENT) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
218 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &new->dict.Destination_Realm, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
219 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "EAP-Payload", &new->dict.EAP_Payload, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
220 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Error-Message", &new->dict.Error_Message, ENOENT) ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
221 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Error-Reporting-Host", &new->dict.Error_Reporting_Host, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
222 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Event-Timestamp", &new->dict.Event_Timestamp, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
223 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Failed-AVP", &new->dict.Failed_AVP, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
224 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-AppleTalk-Link", &new->dict.Framed_AppleTalk_Link, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
225 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-AppleTalk-Network", &new->dict.Framed_AppleTalk_Network, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
226 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-AppleTalk-Zone", &new->dict.Framed_AppleTalk_Zone, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
227 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Compression", &new->dict.Framed_Compression, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
228 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IP-Address", &new->dict.Framed_IP_Address, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
229 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IP-Netmask", &new->dict.Framed_IP_Netmask, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
230 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Interface-Id", &new->dict.Framed_Interface_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
231 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IPv6-Prefix", &new->dict.Framed_IPv6_Prefix, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
232 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IPX-Network", &new->dict.Framed_IPX_Network, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
233 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-MTU", &new->dict.Framed_MTU, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
234 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Protocol", &new->dict.Framed_Protocol, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
235 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Pool", &new->dict.Framed_Pool, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
236 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Route", &new->dict.Framed_Route, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
237 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IPv6-Route", &new->dict.Framed_IPv6_Route, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
238 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IPv6-Pool", &new->dict.Framed_IPv6_Pool, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
239 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Routing", &new->dict.Framed_Routing, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
240 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Filter-Id", &new->dict.Filter_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
241 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Idle-Timeout", &new->dict.Idle_Timeout, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
242 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-IP-Host", &new->dict.Login_IP_Host, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
243 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-IPv6-Host", &new->dict.Login_IPv6_Host, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
244 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Group", &new->dict.Login_LAT_Group, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
245 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Node", &new->dict.Login_LAT_Node, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
246 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Port", &new->dict.Login_LAT_Port, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
247 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Service", &new->dict.Login_LAT_Service, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
248 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-Service", &new->dict.Login_Service, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
249 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-TCP-Port", &new->dict.Login_TCP_Port, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
250 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Identifier", &new->dict.NAS_Identifier, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
251 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-IP-Address", &new->dict.NAS_IP_Address, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
252 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-IPv6-Address", &new->dict.NAS_IPv6_Address, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
253 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port", &new->dict.NAS_Port, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
254 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port-Id", &new->dict.NAS_Port_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
255 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port-Type", &new->dict.NAS_Port_Type, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
256 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-AAA-Protocol", &new->dict.Origin_AAA_Protocol, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
257 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &new->dict.Origin_Host, ENOENT) ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
258 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &new->dict.Origin_Realm, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
259 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Originating-Line-Info", &new->dict.Originating_Line_Info, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
260 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Port-Limit", &new->dict.Port_Limit, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
261 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Re-Auth-Request-Type", &new->dict.Re_Auth_Request_Type, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
262 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &new->dict.Result_Code, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
263 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Service-Type", &new->dict.Service_Type, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
264 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &new->dict.Session_Id, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
265 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Timeout", &new->dict.Session_Timeout, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
266 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "State", &new->dict.State, ENOENT) ); |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
267 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Termination-Cause", &new->dict.Termination_Cause, ENOENT) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
268 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunneling", &new->dict.Tunneling, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
269 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Assignment-Id", &new->dict.Tunnel_Assignment_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
270 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Type", &new->dict.Tunnel_Type, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
271 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Medium-Type", &new->dict.Tunnel_Medium_Type, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
272 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Client-Endpoint", &new->dict.Tunnel_Client_Endpoint, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
273 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Server-Endpoint", &new->dict.Tunnel_Server_Endpoint, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
274 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Private-Group-Id", &new->dict.Tunnel_Private_Group_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
275 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Preference", &new->dict.Tunnel_Preference, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
276 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Client-Auth-Id", &new->dict.Tunnel_Client_Auth_Id, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
277 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Server-Auth-Id", &new->dict.Tunnel_Server_Auth_Id, ENOENT) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
278 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Name", &new->dict.User_Name, ENOENT) ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
279 |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
280 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Session-Termination-Request", &new->dict.Session_Termination_Request, ENOENT) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
281 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
282 /* This plugin provides the following Diameter authentication applications support: */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
283 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Base Accounting", &app, ENOENT) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
284 CHECK_FCT( fd_disp_app_support ( app, NULL, 0, 1 ) ); |
268
b364ffffa2ed
Ported the Echo/Drop plugin from waaad
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
262
diff
changeset
|
285 |
262
cc2c568ef319
Missing affectation
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
259
diff
changeset
|
286 *state = new; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
287 return 0; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
288 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
289 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
290 /* deinitialize */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
291 static void acct_conf_free(struct rgwp_config * state) |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
292 { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
293 TRACE_ENTRY("%p", state); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
294 CHECK_PARAMS_DO( state, return ); |
448 | 295 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
296 free(state); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
297 return; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
298 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
299 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
300 /* Incoming RADIUS request */ |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
301 static int acct_rad_req( struct rgwp_config * cs, struct session ** session, struct radius_msg * rad_req, struct radius_msg ** rad_ans, struct msg ** diam_fw, struct rgw_client * cli ) |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
302 { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
303 int idx; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
304 int send_str=0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
305 uint32_t str_cause=0; |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
306 uint32_t e2eid = 0; |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
307 application_id_t auth_appl=0; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
308 int got_id = 0; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
309 uint32_t status_type; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
310 uint32_t termination_action = 0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
311 uint32_t gigawords_in=0, gigawords_out=0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
312 size_t nattr_used = 0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
313 union avp_value value; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
314 struct avp ** avp_tun = NULL, *avp = NULL; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
315 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
316 const char * prefix = "Diameter/"; |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
317 size_t pref_len; |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
318 uint8_t * si = NULL; |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
319 size_t si_len = 0; |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
320 uint8_t * un = NULL; |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
321 size_t un_len = 0; |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
322 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
323 TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
324 CHECK_PARAMS(rad_req && (rad_req->hdr->code == RADIUS_CODE_ACCOUNTING_REQUEST) && rad_ans && diam_fw && *diam_fw); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
325 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
326 pref_len = strlen(prefix); |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
327 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
328 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
329 Either NAS-IP-Address or NAS-Identifier MUST be present in a |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
330 RADIUS Accounting-Request. It SHOULD contain a NAS-Port or NAS- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
331 Port-Type attribute or both unless the service does not involve a |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
332 port or the NAS does not distinguish among its ports. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
333 */ |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
334 /* We also enforce that the message contains a CLASS attribute with Diameter/ prefix containing the Session-Id. */ |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
335 for (idx = 0; idx < rad_req->attr_used; idx++) { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
336 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
337 uint8_t * v = (uint8_t *)(attr + 1); |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
338 size_t attr_len = attr->length - sizeof(struct radius_attr_hdr); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
339 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
340 switch (attr->type) { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
341 case RADIUS_ATTR_NAS_IP_ADDRESS: |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
342 case RADIUS_ATTR_NAS_IDENTIFIER: |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
343 case RADIUS_ATTR_NAS_IPV6_ADDRESS: |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
344 got_id = 1; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
345 break; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
346 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
347 case RADIUS_ATTR_TERMINATION_ACTION: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
348 CHECK_PARAMS( attr->length == 6 ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
349 termination_action = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
350 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
351 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
352 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
353 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
354 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
355 case RADIUS_ATTR_ACCT_INPUT_GIGAWORDS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
356 CHECK_PARAMS( attr->length == 6 ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
357 gigawords_in = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
358 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
359 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
360 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
361 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
362 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
363 case RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
364 CHECK_PARAMS( attr->length == 6 ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
365 gigawords_out = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
366 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
367 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
368 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
369 break; |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
370 |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
371 case RADIUS_ATTR_CLASS: |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
372 if ((attr_len > pref_len ) && ! strncmp((char *)v, prefix, pref_len)) { |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
373 int i; |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
374 si = v + pref_len; |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
375 si_len = attr_len - pref_len; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
376 TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), SI:'%.*s'.", prefix, idx, si_len, si); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
377 /* Remove from the message */ |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
378 for (i = idx + 1; i < rad_req->attr_used; i++) |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
379 rad_req->attr_pos[i - 1] = rad_req->attr_pos[i]; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
380 rad_req->attr_used -= 1; |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
381 } |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
382 break; |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
383 |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
384 case RADIUS_ATTR_USER_NAME: |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
385 if (attr_len) { |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
386 un = v; |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
387 un_len = attr_len; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
388 TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", un_len, un); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
389 } |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
390 break; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
391 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
392 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
393 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
394 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
395 /* Check basic information is there */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
396 if (!got_id || radius_msg_get_attr_int32(rad_req, RADIUS_ATTR_ACCT_STATUS_TYPE, &status_type)) { |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
397 TRACE_DEBUG(INFO, "[acct.rgwx] RADIUS Account-Request from %s did not contain a NAS ip/identifier or Acct-Status-Type attribute, reject.", rgw_clients_id(cli)); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
398 return EINVAL; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
399 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
400 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
401 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
402 -- RFC2866: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
403 In Accounting-Request Packets, the Authenticator value is a 16 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
404 octet MD5 [5] checksum, called the Request Authenticator. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
405 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
406 The NAS and RADIUS accounting server share a secret. The Request |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
407 Authenticator field in Accounting-Request packets contains a one- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
408 way MD5 hash calculated over a stream of octets consisting of the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
409 Code + Identifier + Length + 16 zero octets + request attributes + |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
410 shared secret (where + indicates concatenation). The 16 octet MD5 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
411 hash value is stored in the Authenticator field of the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
412 Accounting-Request packet. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
413 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
414 Note that the Request Authenticator of an Accounting-Request can |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
415 not be done the same way as the Request Authenticator of a RADIUS |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
416 Access-Request, because there is no User-Password attribute in an |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
417 Accounting-Request. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
418 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
419 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
420 -- RFC5080: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
421 The Request Authenticator field MUST contain the correct data, as |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
422 given by the above calculation. Invalid packets are silently |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
423 discarded. Note that some early implementations always set the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
424 Request Authenticator to all zeros. New implementations of RADIUS |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
425 clients MUST use the above algorithm to calculate the Request |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
426 Authenticator field. New RADIUS server implementations MUST |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
427 silently discard invalid packets. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
428 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
429 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
430 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
431 uint8_t save[MD5_MAC_LEN]; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
432 uint8_t * secret; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
433 size_t secret_len; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
434 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
435 /* Get the shared secret */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
436 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
437 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
438 /* Copy the received Request Authenticator */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
439 memcpy(&save[0], &rad_req->hdr->authenticator[0], MD5_MAC_LEN); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
440 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
441 /* Compute the same authenticator */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
442 radius_msg_finish_acct(rad_req, secret, secret_len); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
443 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
444 /* And now compare with the received value */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
445 if (memcmp(&save[0], &rad_req->hdr->authenticator[0], MD5_MAC_LEN)) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
446 /* Invalid authenticator */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
447 TRACE_DEBUG_BUFFER(FULL+1, "Received ReqAuth: ", &save[0], MD5_MAC_LEN, "" ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
448 TRACE_DEBUG_BUFFER(FULL+1, "Expected ReqAuth: ", &rad_req->hdr->authenticator[0], MD5_MAC_LEN, "" ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
449 TRACE_DEBUG(INFO, "[acct.rgwx] Invalid Request Authenticator in Account-Request from %s, discarding the message.", rgw_clients_id(cli)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
450 return EINVAL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
451 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
452 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
453 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
454 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
455 /* Handle the Accounting-On case: nothing to do, just reply OK */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
456 if (status_type == RADIUS_ACCT_STATUS_TYPE_ACCOUNTING_ON) { |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
457 TRACE_DEBUG(FULL, "[acct.rgwx] Received Accounting-On Acct-Status-Type attribute, replying without translation to Diameter."); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
458 CHECK_MALLOC( *rad_ans = radius_msg_new(RADIUS_CODE_ACCOUNTING_RESPONSE, rad_req->hdr->identifier) ); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
459 return -2; |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
460 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
461 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
462 if (status_type == RADIUS_ACCT_STATUS_TYPE_ACCOUNTING_OFF) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
463 TRACE_DEBUG(FULL, "[acct.rgwx] Received Accounting-Off Acct-Status-Type attribute, we must terminate all active sessions."); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
464 TODO("RADIUS side is rebooting, send STR on all sessions?"); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
465 return ENOTSUP; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
466 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
467 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
468 /* Check if we got a valid session information, otherwise the server will not be able to handle the data... */ |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
469 if (!*session && !si) { |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
470 TRACE_DEBUG(INFO, "[acct.rgwx] RADIUS Account-Request from %s did not contain a CLASS attribute with Diameter session information, reject.", rgw_clients_id(cli)); |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
471 return EINVAL; |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
472 } |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
473 |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
474 /* Add the Destination-Realm */ |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
475 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) ); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
476 idx = 0; |
526
6fe3e5cf9fb2
Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
448
diff
changeset
|
477 if (un && ! cs->ignore_nai) { |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
478 /* Is there an '@' in the user name? We don't care for decorated NAI here */ |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
479 for (idx = un_len - 2; idx > 0; idx--) { |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
480 if (un[idx] == '@') { |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
481 idx++; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
482 break; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
483 } |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
484 } |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
485 } |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
486 if (idx == 0) { |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
487 /* Not found in the User-Name => we use the local domain of this gateway */ |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
488 value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm; |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
489 value.os.len = fd_g_config->cnf_diamrlm_len; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
490 } else { |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
491 value.os.data = un + idx; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
492 value.os.len = un_len - idx; |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
493 } |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
494 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
495 CHECK_FCT( fd_msg_avp_add ( *diam_fw, *session ? MSG_BRW_LAST_CHILD : MSG_BRW_FIRST_CHILD, avp) ); |
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
496 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
497 /* Create the Session-Id AVP if needed */ |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
498 if (!*session) { |
403
26aafbbc1640
Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
376
diff
changeset
|
499 CHECK_FCT( fd_sess_fromsid ( (char *)/* cast should be removed later */si, si_len, session, NULL) ); |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
500 |
535
72c511043f05
A few bug fixes on the RADIUS/Diameter gateway.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
532
diff
changeset
|
501 TRACE_DEBUG(FULL, "[acct.rgwx] Translating new accounting message for session '%.*s'...", si_len, si); |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
502 |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
503 /* Add the Session-Id AVP as first AVP */ |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
504 CHECK_FCT( fd_msg_avp_new ( cs->dict.Session_Id, 0, &avp ) ); |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
505 value.os.data = (unsigned char *)si; |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
506 value.os.len = si_len; |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
507 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
508 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) ); |
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
509 } |
358
7ea43915cade
Fix: added the Destination-Realm also
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
356
diff
changeset
|
510 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
511 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
512 /* Add the command code */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
513 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
514 struct msg_hdr * header = NULL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
515 CHECK_FCT( fd_msg_hdr ( *diam_fw, &header ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
516 header->msg_flags = CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
517 header->msg_code = CC_AC; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
518 header->msg_appl = AI_ACCT; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
519 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
520 /* Add the Acct-Application-Id */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
521 CHECK_FCT( fd_msg_avp_new ( cs->dict.Acct_Application_Id, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
522 value.i32 = header->msg_appl; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
523 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
524 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
525 |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
526 /* save the end to end id */ |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
527 e2eid = header->msg_eteid; |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
528 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
529 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
530 /* Convert the RADIUS attributes, as they appear in the message */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
531 for (idx = 0; idx < rad_req->attr_used; idx++) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
532 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
533 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
534 switch (attr->type) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
535 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
536 Any attribute valid in a RADIUS Access-Request or Access-Accept |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
537 packet is valid in a RADIUS Accounting-Request packet, except that |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
538 the following attributes MUST NOT be present in an Accounting- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
539 Request: User-Password, CHAP-Password, Reply-Message, State. |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
540 */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
541 case RADIUS_ATTR_USER_PASSWORD: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
542 case RADIUS_ATTR_CHAP_PASSWORD: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
543 case RADIUS_ATTR_REPLY_MESSAGE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
544 case RADIUS_ATTR_STATE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
545 case RADIUS_ATTR_MESSAGE_AUTHENTICATOR: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
546 case RADIUS_ATTR_EAP_MESSAGE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
547 TRACE_DEBUG(INFO, "[acct.rgwx] RADIUS Account-Request contains a forbidden attribute (%hhd), reject.", attr->type); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
548 return EINVAL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
549 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
550 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
551 /* This macro converts a RADIUS attribute to a Diameter AVP of type OctetString */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
552 #define CONV2DIAM_STR( _dictobj_ ) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
553 CHECK_PARAMS( attr->length >= 2 ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
554 /* Create the AVP with the specified dictionary model */ \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
555 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
556 value.os.len = attr->length - 2; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
557 value.os.data = (unsigned char *)(attr + 1); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
558 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
559 /* Add the AVP in the Diameter message. */ \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
560 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
561 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
562 /* Same thing, for scalar AVPs of 32 bits */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
563 #define CONV2DIAM_32B( _dictobj_ ) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
564 CHECK_PARAMS( attr->length == 6 ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
565 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
566 { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
567 uint8_t * v = (uint8_t *)(attr + 1); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
568 value.u32 = (v[0] << 24) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
569 | (v[1] << 16) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
570 | (v[2] << 8) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
571 | v[3] ; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
572 } \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
573 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
574 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
575 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
576 /* And the 64b version */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
577 #define CONV2DIAM_64B( _dictobj_ ) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
578 CHECK_PARAMS( attr->length == 10); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
579 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
580 { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
581 uint8_t * v = (uint8_t *)(attr + 1); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
582 value.u64 = ((uint64_t)(v[0]) << 56) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
583 | ((uint64_t)(v[1]) << 48) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
584 | ((uint64_t)(v[2]) << 40) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
585 | ((uint64_t)(v[3]) << 32) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
586 | ((uint64_t)(v[4]) << 24) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
587 | ((uint64_t)(v[5]) << 16) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
588 | ((uint64_t)(v[6]) << 8) \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
589 | (uint64_t)(v[7]) ; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
590 } \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
591 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
592 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
593 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
594 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
595 /* Attributes as listed in RFC2866, section 5.13 and RFC4005, section 10.2.1 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
596 case RADIUS_ATTR_USER_NAME: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
597 CONV2DIAM_STR( User_Name ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
598 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
599 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
600 case RADIUS_ATTR_NAS_IP_ADDRESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
601 CONV2DIAM_STR( NAS_IP_Address ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
602 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
603 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
604 case RADIUS_ATTR_NAS_PORT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
605 CONV2DIAM_32B( NAS_Port ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
606 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
607 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
608 case RADIUS_ATTR_SERVICE_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
609 CONV2DIAM_32B( Service_Type ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
610 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
611 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
612 case RADIUS_ATTR_FRAMED_PROTOCOL: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
613 CONV2DIAM_32B( Framed_Protocol ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
614 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
615 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
616 case RADIUS_ATTR_FRAMED_IP_ADDRESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
617 CONV2DIAM_STR( Framed_IP_Address ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
618 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
619 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
620 case RADIUS_ATTR_FRAMED_IP_NETMASK: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
621 CONV2DIAM_STR( Framed_IP_Netmask ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
622 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
623 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
624 case RADIUS_ATTR_FRAMED_ROUTING: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
625 CONV2DIAM_32B( Framed_Routing ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
626 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
627 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
628 case RADIUS_ATTR_FILTER_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
629 CONV2DIAM_STR( Filter_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
630 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
631 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
632 case RADIUS_ATTR_FRAMED_MTU: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
633 CONV2DIAM_32B( Framed_MTU ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
634 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
635 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
636 case RADIUS_ATTR_FRAMED_COMPRESSION: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
637 CONV2DIAM_32B( Framed_Compression ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
638 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
639 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
640 case RADIUS_ATTR_LOGIN_IP_HOST: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
641 CONV2DIAM_STR( Login_IP_Host ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
642 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
643 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
644 case RADIUS_ATTR_LOGIN_SERVICE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
645 CONV2DIAM_32B( Login_Service ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
646 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
647 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
648 case RADIUS_ATTR_LOGIN_TCP_PORT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
649 CONV2DIAM_32B( Login_TCP_Port ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
650 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
651 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
652 case RADIUS_ATTR_CALLBACK_NUMBER: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
653 CONV2DIAM_STR( Callback_Number ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
654 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
655 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
656 case RADIUS_ATTR_CALLBACK_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
657 CONV2DIAM_STR( Callback_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
658 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
659 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
660 case RADIUS_ATTR_FRAMED_ROUTE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
661 CONV2DIAM_STR( Framed_Route ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
662 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
663 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
664 case RADIUS_ATTR_FRAMED_IPX_NETWORK: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
665 CONV2DIAM_32B( Framed_IPX_Network ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
666 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
667 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
668 case RADIUS_ATTR_CLASS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
669 CONV2DIAM_STR( Class ); |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
670 /* In addition, save the data in the session if it is "our" CLASS_AAI_PREFIX Class attribute */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
671 { |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
672 char buf[32]; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
673 char * attr_val, *auth_val; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
674 attr_val = (char *)(attr + 1); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
675 auth_val = attr_val + strlen(CLASS_AAI_PREFIX); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
676 if ( (attr->length > sizeof(struct radius_attr_hdr) + strlen(CLASS_AAI_PREFIX) ) |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
677 && (attr->length < sizeof(struct radius_attr_hdr) + strlen(CLASS_AAI_PREFIX) + sizeof(buf)) |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
678 && ! strncmp(attr_val, CLASS_AAI_PREFIX, strlen(CLASS_AAI_PREFIX))) { |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
679 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
680 memset(buf, 0, sizeof(buf)); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
681 memcpy(buf, auth_val, attr->length - sizeof(struct radius_attr_hdr) - strlen(CLASS_AAI_PREFIX)); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
682 if (sscanf(buf, "%u", &auth_appl) == 1) { |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
683 TRACE_DEBUG(ANNOYING, "Found Class attribute with '%s' prefix (attr #%d), AAI:%u.", CLASS_AAI_PREFIX, idx, auth_appl); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
684 } |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
685 } |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
686 } |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
687 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
688 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
689 case RADIUS_ATTR_VENDOR_SPECIFIC: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
690 if (attr->length >= 6) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
691 uint32_t vendor_id; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
692 uint8_t * c = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
693 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
694 vendor_id = c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3]; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
695 c += 4; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
696 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
697 switch (vendor_id) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
698 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
699 /* For the vendors we KNOW they follow the VSA recommended format, we convert following the rules of RFC4005 (9.6.2) */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
700 case RADIUS_VENDOR_ID_MICROSOFT : /* RFC 2548 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
701 /* other vendors ? */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
702 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
703 size_t left; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
704 struct radius_attr_vendor *vtlv; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
705 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
706 left = attr->length - 6; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
707 vtlv = (struct radius_attr_vendor *)c; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
708 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
709 while ((left >= 2) && (vtlv->vendor_length <= left)) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
710 /* Search our dictionary for corresponding Vendor's AVP */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
711 struct dict_avp_request req; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
712 struct dict_object * avp_model = NULL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
713 memset(&req, 0, sizeof(struct dict_avp_request)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
714 req.avp_vendor = vendor_id; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
715 req.avp_code = vtlv->vendor_type; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
716 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
717 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_CODE_AND_VENDOR, &req, &avp_model, 0) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
718 if (!avp_model) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
719 TRACE_DEBUG(FULL, "Unknown attribute (vendor 0x%x, code 0x%x) ignored.", req.avp_vendor, req.avp_code); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
720 } else { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
721 CHECK_FCT( fd_msg_avp_new ( avp_model, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
722 value.os.len = vtlv->vendor_length - 2; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
723 value.os.data = (unsigned char *)(vtlv + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
724 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
725 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
726 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
727 c += vtlv->vendor_length; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
728 left -= vtlv->vendor_length; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
729 vtlv = (struct radius_attr_vendor *)c; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
730 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
731 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
732 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
733 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
734 /* Other vendors we KNOw how to convert the attributes would be added here... */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
735 /* case RADIUS_VENDOR_ID_CISCO : |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
736 break; */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
737 /* case RADIUS_VENDOR_ID_IETF : (extended RADIUS attributes) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
738 break; */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
739 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
740 /* When we don't know, just discard the attribute... VSA are optional with regards to RADIUS anyway */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
741 default: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
742 /* do nothing */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
743 TRACE_DEBUG(FULL, "VSA attribute from vendor %d discarded", vendor_id); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
744 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
745 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
746 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
747 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
748 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
749 case RADIUS_ATTR_SESSION_TIMEOUT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
750 /* Translation depends on Termination-Action : rfc4005#section-9.2.1 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
751 if (termination_action != RADIUS_TERMINATION_ACTION_RADIUS_REQUEST) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
752 CONV2DIAM_32B( Session_Timeout ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
753 } else { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
754 CONV2DIAM_32B( Authorization_Lifetime ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
755 /* And add this additional AVP */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
756 CHECK_FCT( fd_msg_avp_new ( cs->dict.Re_Auth_Request_Type, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
757 value.u32 = ACV_ART_AUTHORIZE_AUTHENTICATE; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
758 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
759 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
760 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
761 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
762 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
763 case RADIUS_ATTR_IDLE_TIMEOUT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
764 CONV2DIAM_32B( Idle_Timeout ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
765 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
766 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
767 case RADIUS_ATTR_TERMINATION_ACTION: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
768 /* Just remove */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
769 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
770 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
771 case RADIUS_ATTR_CALLED_STATION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
772 CONV2DIAM_STR( Called_Station_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
773 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
774 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
775 case RADIUS_ATTR_CALLING_STATION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
776 CONV2DIAM_STR( Calling_Station_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
777 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
778 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
779 case RADIUS_ATTR_NAS_IDENTIFIER: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
780 CONV2DIAM_STR( NAS_Identifier ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
781 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
782 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
783 /* Proxy-State is handled by echo_drop.rgwx plugin, we ignore it here */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
784 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
785 case RADIUS_ATTR_LOGIN_LAT_SERVICE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
786 CONV2DIAM_STR( Login_LAT_Service ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
787 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
788 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
789 case RADIUS_ATTR_LOGIN_LAT_NODE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
790 CONV2DIAM_STR( Login_LAT_Node ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
791 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
792 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
793 case RADIUS_ATTR_LOGIN_LAT_GROUP: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
794 CONV2DIAM_STR( Login_LAT_Group ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
795 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
796 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
797 case RADIUS_ATTR_FRAMED_APPLETALK_LINK: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
798 CONV2DIAM_32B( Framed_AppleTalk_Link ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
799 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
800 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
801 case RADIUS_ATTR_FRAMED_APPLETALK_NETWORK: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
802 CONV2DIAM_32B( Framed_AppleTalk_Network ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
803 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
804 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
805 case RADIUS_ATTR_FRAMED_APPLETALK_ZONE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
806 CONV2DIAM_STR( Framed_AppleTalk_Zone ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
807 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
808 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
809 case RADIUS_ATTR_ACCT_STATUS_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
810 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
811 - If the RADIUS message received is an Accounting-Request, the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
812 Acct-Status-Type attribute value must be converted to a |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
813 Accounting-Record-Type AVP value. If the Acct-Status-Type |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
814 attribute value is STOP, the local server MUST issue a |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
815 Session-Termination-Request message once the Diameter |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
816 Accounting-Answer message has been received. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
817 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
818 switch (status_type) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
819 case RADIUS_ACCT_STATUS_TYPE_START: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
820 value.u32 = ACV_ART_START_RECORD; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
821 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
822 case RADIUS_ACCT_STATUS_TYPE_STOP: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
823 value.u32 = ACV_ART_STOP_RECORD; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
824 send_str = 1; /* Register this info in the session */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
825 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
826 case RADIUS_ACCT_STATUS_TYPE_INTERIM_UPDATE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
827 value.u32 = ACV_ART_INTERIM_RECORD; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
828 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
829 default: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
830 TRACE_DEBUG(INFO, "Unknown RADIUS_ATTR_ACCT_STATUS_TYPE value %d, abording...", status_type); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
831 return ENOTSUP; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
832 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
833 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Record_Type, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
834 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
835 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
836 |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
837 /* While here, we also add the Accouting-Record-Number AVP. |
530
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
838 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
839 and identifies this record within one session. As Session-Id AVPs |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
840 are globally unique, the combination of Session-Id and Accounting- |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
841 Record-Number AVPs is also globally unique, and can be used in |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
842 matching accounting records with confirmations. An easy way to |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
843 produce unique numbers is to set the value to 0 for records of type |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
844 EVENT_RECORD and START_RECORD, and set the value to 1 for the first |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
845 INTERIM_RECORD, 2 for the second, and so on until the value for |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
846 STOP_RECORD is one more than for the last INTERIM_RECORD. |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
847 |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
848 -- we actually use the end-to-end id of the message here, which remains constant |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
849 if we send a duplicate, so it has the same properties as the suggested algorithm. |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
850 Anyway, it assumes that we are not converting twice the same RADIUS message. |
825a2992e3b9
Improved duplicate detection in RADIUS/Diameter gw. It will be changed again soon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
526
diff
changeset
|
851 . */ |
277
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
852 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Record_Number, 0, &avp ) ); |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
853 value.u32 = e2eid; |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
854 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
855 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
c94e4ea39f97
Add missing mandatory AVP
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
275
diff
changeset
|
856 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
857 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
858 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
859 case RADIUS_ATTR_ACCT_DELAY_TIME: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
860 CONV2DIAM_32B( Acct_Delay_Time ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
861 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
862 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
863 /* |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
864 - If the RADIUS message contains the Accounting-Input-Octets, |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
865 Accounting-Input-Packets, Accounting-Output-Octets, or |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
866 Accounting-Output-Packets, these attributes must be converted |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
867 to the Diameter equivalents. Further, if the Acct-Input- |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
868 Gigawords or Acct-Output-Gigawords attributes are present, |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
869 these must be used to properly compute the Diameter accounting |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
870 AVPs. |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
871 */ |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
872 case RADIUS_ATTR_ACCT_INPUT_OCTETS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
873 memset(&value, 0, sizeof(value)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
874 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
875 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
876 value.u64 = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
877 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
878 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
879 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
880 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
881 value.u64 += ((uint64_t)gigawords_in << 32); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
882 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Input_Octets, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
883 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
884 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
885 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
886 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
887 case RADIUS_ATTR_ACCT_OUTPUT_OCTETS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
888 memset(&value, 0, sizeof(value)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
889 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
890 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
891 value.u64 = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
892 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
893 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
894 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
895 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
896 value.u64 += ((uint64_t)gigawords_out << 32); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
897 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Output_Octets, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
898 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
899 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
900 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
901 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
902 case RADIUS_ATTR_ACCT_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
903 CONV2DIAM_STR( Acct_Session_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
904 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
905 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
906 case RADIUS_ATTR_ACCT_AUTHENTIC: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
907 CONV2DIAM_32B( Acct_Authentic ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
908 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
909 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
910 case RADIUS_ATTR_ACCT_SESSION_TIME: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
911 CONV2DIAM_32B( Acct_Session_Time ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
912 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
913 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
914 case RADIUS_ATTR_ACCT_INPUT_PACKETS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
915 memset(&value, 0, sizeof(value)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
916 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
917 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
918 value.u64 = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
919 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
920 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
921 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
922 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
923 /* value.u64 += (gigawords_in << 32); */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
924 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Input_Packets, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
925 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
926 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
927 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
928 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
929 case RADIUS_ATTR_ACCT_OUTPUT_PACKETS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
930 memset(&value, 0, sizeof(value)); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
931 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
932 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
933 value.u64 = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
934 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
935 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
936 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
937 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
938 /* value.u64 += (gigawords_out << 32); */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
939 CHECK_FCT( fd_msg_avp_new ( cs->dict.Accounting_Output_Packets, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
940 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
941 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
942 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
943 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
944 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
945 - If the Accounting message contains an Acct-Termination-Cause |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
946 attribute, it should be translated to the equivalent |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
947 Termination-Cause AVP value. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
948 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
949 case RADIUS_ATTR_ACCT_TERMINATE_CAUSE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
950 /* rfc4005#section-9.3.5 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
951 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
952 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
953 str_cause = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
954 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
955 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
956 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
957 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
958 str_cause += 10; /* This seems to be the rule, we can modify later if needed */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
959 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
960 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
961 case RADIUS_ATTR_ACCT_MULTI_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
962 CONV2DIAM_STR( Acct_Multi_Session_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
963 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
964 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
965 case RADIUS_ATTR_ACCT_LINK_COUNT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
966 CONV2DIAM_32B( Acct_Link_Count ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
967 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
968 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
969 /* CHAP-Challenge is not present in Accounting-Request */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
970 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
971 case RADIUS_ATTR_NAS_PORT_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
972 CONV2DIAM_32B( NAS_Port_Type ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
973 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
974 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
975 case RADIUS_ATTR_PORT_LIMIT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
976 CONV2DIAM_32B( Port_Limit ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
977 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
978 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
979 case RADIUS_ATTR_LOGIN_LAT_PORT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
980 CONV2DIAM_STR( Login_LAT_Port ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
981 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
982 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
983 /* RFC 3162 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
984 case RADIUS_ATTR_NAS_IPV6_ADDRESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
985 CONV2DIAM_STR( NAS_IPv6_Address ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
986 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
987 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
988 case RADIUS_ATTR_FRAMED_INTERFACE_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
989 CONV2DIAM_64B( Framed_Interface_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
990 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
991 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
992 case RADIUS_ATTR_FRAMED_IPV6_PREFIX: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
993 CONV2DIAM_STR( Framed_IPv6_Prefix ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
994 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
995 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
996 case RADIUS_ATTR_LOGIN_IPV6_HOST: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
997 CONV2DIAM_STR( Login_IPv6_Host ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
998 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
999 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1000 case RADIUS_ATTR_FRAMED_IPV6_ROUTE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1001 CONV2DIAM_STR( Framed_IPv6_Route ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1002 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1003 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1004 case RADIUS_ATTR_FRAMED_IPV6_POOL: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1005 CONV2DIAM_STR( Framed_IPv6_Pool ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1006 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1007 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1008 /* RFC 2868 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1009 /* Prepare the top-level Tunneling AVP for each tag values, as needed, and add to the Diameter message. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1010 This macro is called when an AVP is added inside the group, so we will not have empty grouped AVPs */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1011 #define AVP_TUN_PREPARE() { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1012 if (avp_tun == NULL) { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1013 CHECK_MALLOC( avp_tun = calloc(sizeof(struct avp *), 32 ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1014 } \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1015 tag = *(uint8_t *)(attr + 1); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1016 if (tag > 0x1F) tag = 0; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1017 if (avp_tun[tag] == NULL) { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1018 CHECK_FCT( fd_msg_avp_new ( cs->dict.Tunneling, 0, &avp_tun[tag] ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1019 CHECK_FCT( fd_msg_avp_add (*diam_fw, MSG_BRW_LAST_CHILD, avp_tun[tag]));\ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1020 } \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1021 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1022 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1023 /* Convert an attribute to an OctetString AVP and add inside the Tunneling AVP corresponding to the tag */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1024 #define CONV2DIAM_TUN_STR( _dictobj_ ) { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1025 uint8_t tag; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1026 CHECK_PARAMS( attr->length >= 3); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1027 AVP_TUN_PREPARE(); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1028 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1029 value.os.len = attr->length - (tag ? 3 : 2); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1030 value.os.data = ((unsigned char *)(attr + 1)) + (tag ? 1 : 0); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1031 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1032 CHECK_FCT( fd_msg_avp_add ( avp_tun[tag], MSG_BRW_LAST_CHILD, avp) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1033 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1034 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1035 /* Convert an attribute to a scalar AVP and add inside the Tunneling AVP corresponding to the tag */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1036 #define CONV2DIAM_TUN_24B( _dictobj_ ) { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1037 uint8_t tag; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1038 CHECK_PARAMS( attr->length == 6); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1039 AVP_TUN_PREPARE(); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1040 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1041 { \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1042 uint8_t * v = (uint8_t *)(attr + 1); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1043 value.u32 = (v[1] << 16) | (v[2] <<8) | v[3] ; \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1044 } \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1045 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1046 CHECK_FCT( fd_msg_avp_add ( avp_tun[tag], MSG_BRW_LAST_CHILD, avp) ); \ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1047 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1048 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1049 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1050 - If the RADIUS message contains Tunnel information [RADTunnels], |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1051 the attributes or tagged groups should each be converted to a |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1052 Diameter Tunneling Grouped AVP set. If the tunnel information |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1053 contains a Tunnel-Password attribute, the RADIUS encryption |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1054 must be resolved, and the password forwarded, by using Diameter |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1055 security methods. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1056 -> If the RADIUS message does not use properly the Tag info, result is unpredictable here.. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1057 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1058 case RADIUS_ATTR_TUNNEL_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1059 CONV2DIAM_TUN_24B( Tunnel_Type ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1060 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1061 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1062 case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1063 CONV2DIAM_TUN_24B( Tunnel_Medium_Type ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1064 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1065 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1066 case RADIUS_ATTR_TUNNEL_CLIENT_ENDPOINT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1067 CONV2DIAM_TUN_STR( Tunnel_Client_Endpoint ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1068 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1069 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1070 case RADIUS_ATTR_TUNNEL_SERVER_ENDPOINT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1071 CONV2DIAM_TUN_STR( Tunnel_Server_Endpoint ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1072 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1073 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1074 /* Tunnel-Password never present in an Accounting-Request */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1075 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1076 case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1077 CONV2DIAM_TUN_STR( Tunnel_Private_Group_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1078 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1079 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1080 case RADIUS_ATTR_TUNNEL_ASSIGNMENT_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1081 CONV2DIAM_TUN_STR( Tunnel_Assignment_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1082 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1083 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1084 /* Tunnel-Reference never present in an Accounting-Request */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1085 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1086 case RADIUS_ATTR_TUNNEL_CLIENT_AUTH_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1087 CONV2DIAM_TUN_STR( Tunnel_Client_Auth_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1088 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1089 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1090 case RADIUS_ATTR_TUNNEL_SERVER_AUTH_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1091 CONV2DIAM_TUN_STR( Tunnel_Server_Auth_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1092 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1093 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1094 /* RFC 2869 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1095 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1096 Acct-Input-Gigawords, Acct-Output- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1097 Gigawords, Event-Timestamp, and NAS-Port-Id may have 0-1 instances in |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1098 an Accounting-Request packet. Connect-Info may have 0+ instances in |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1099 an Accounting-Request packet. The other attributes added in this |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1100 document must not be present in an Accounting-Request. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1101 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1102 case RADIUS_ATTR_ACCT_INPUT_GIGAWORDS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1103 break; /* we already saved the value in gigawords_in */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1104 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1105 case RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1106 break; /* we already saved the value in gigawords_out */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1107 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1108 case RADIUS_ATTR_EVENT_TIMESTAMP: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1109 /* RADIUS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1110 The Value field is four octets encoding an unsigned integer with |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1111 the number of seconds since January 1, 1970 00:00 UTC. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1112 Diameter: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1113 The Time format is derived from the OctetString AVP Base Format. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1114 The string MUST contain four octets, in the same format as the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1115 first four bytes are in the NTP timestamp format. The NTP |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1116 Timestamp format is defined in Chapter 3 of [RFC4330]. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1117 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1118 This represents the number of seconds since 0h on 1 January 1900 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1119 with respect to the Coordinated Universal Time (UTC). |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1120 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1121 -- RFC4330: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1122 NTP timestamps are represented as a 64-bit unsigned |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1123 fixed-point number, in seconds relative to 0h on 1 January 1900. The |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1124 integer part is in the first 32 bits, and the fraction part in the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1125 last 32 bits. In the fraction part, the non-significant low-order |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1126 bits are not specified and are ordinarily set to 0. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1127 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1128 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1129 uint32_t ts; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1130 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1131 uint8_t * v = (uint8_t *)(attr + 1); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1132 /* Read the RADIUS attribute value */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1133 ts = (v[0] << 24) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1134 | (v[1] << 16) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1135 | (v[2] << 8) |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1136 | v[3] ; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1137 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1138 /* Add the 70 missing years */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1139 ts += 2208988800U; /* 60 * 60 * 24 * ( 365 * 70 + 17 ) */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1140 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1141 /* Convert to network byte order */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1142 ts = htonl(ts); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1143 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1144 /* Diameter Time datatype is derived from OctetString */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1145 value.os.data = (void *) &ts; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1146 value.os.len = sizeof(uint32_t); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1147 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1148 CHECK_FCT( fd_msg_avp_new ( cs->dict.Event_Timestamp, 0, &avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1149 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1150 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1151 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1152 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1153 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1154 case RADIUS_ATTR_NAS_PORT_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1155 CONV2DIAM_STR( NAS_Port_Id ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1156 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1157 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1158 case RADIUS_ATTR_CONNECT_INFO: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1159 CONV2DIAM_STR( Connect_Info ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1160 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1161 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1162 case RADIUS_ATTR_FRAMED_POOL: /* To follow the IPv6 version */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1163 CONV2DIAM_STR( Framed_Pool ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1164 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1165 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1166 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1167 /* RFC 3579 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1168 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1169 The EAP-Message and Message-Authenticator attributes specified in |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1170 this document MUST NOT be present in an Accounting-Request. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1171 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1172 case RADIUS_ATTR_ORIGINATING_LINE_INFO: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1173 CONV2DIAM_STR( Originating_Line_Info ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1174 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1175 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1176 /* Default */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1177 default: /* unknown attribute */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1178 /* We just keep the attribute in the RADIUS message */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1179 rad_req->attr_pos[nattr_used++] = rad_req->attr_pos[idx]; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1180 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1181 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1182 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1183 /* Update the radius message to remove all handled attributes */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1184 rad_req->attr_used = nattr_used; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1185 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1186 /* Store useful information in the session */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1187 { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1188 struct sess_state * st; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1189 CHECK_PARAMS(session); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1190 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1191 CHECK_MALLOC( st = malloc(sizeof(struct sess_state)) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1192 memset(st, 0, sizeof(struct sess_state)); |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1193 st->auth_appl = auth_appl; |
296
e11a9f90a65a
Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
295
diff
changeset
|
1194 if (auth_appl) { /* We use the value 0 for servers which indicated NO STATE MAINTAINED, hence have no need for STR */ |
e11a9f90a65a
Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
295
diff
changeset
|
1195 st->send_str = send_str; |
e11a9f90a65a
Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
295
diff
changeset
|
1196 } |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1197 st->term_cause = str_cause; |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1198 if (un && un_len) { |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1199 CHECK_MALLOC( st->username = malloc(un_len) ); |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1200 memcpy(st->username, un, un_len); |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1201 st->un_size = un_len; |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1202 } |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
1203 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, *session, &st ) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1204 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1205 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1206 return 0; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1207 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1208 |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1209 /* Callback when an STA is received after having sent an STR. */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1210 static void handle_sta(void * data, struct msg ** answer) |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1211 { |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1212 struct rgwp_config * cs = data; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1213 struct avp *avp; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1214 struct avp_hdr *ahdr; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1215 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1216 CHECK_PARAMS_DO( data && answer && *answer, goto out ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1217 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1218 /* Check the Diameter error code */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1219 CHECK_FCT_DO( fd_msg_search_avp (*answer, cs->dict.Result_Code, &avp), goto out ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1220 CHECK_PARAMS_DO( avp, goto out ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1221 CHECK_FCT_DO( fd_msg_avp_hdr ( avp, &ahdr ), goto out ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1222 if (ahdr->avp_value->u32 != ER_DIAMETER_SUCCESS) |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1223 goto out; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1224 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1225 /* OK, discard the message without complaining */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1226 fd_msg_free(*answer); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1227 *answer = NULL; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1228 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1229 out: |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1230 if (answer && *answer) { |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1231 TRACE_DEBUG(INFO, "Received the following problematic STA message, discarding..."); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1232 fd_msg_dump_walk( INFO, *answer ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1233 fd_msg_free(*answer); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1234 *answer = NULL; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1235 } |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1236 return; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1237 } |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1238 |
356
e203fc0c95e3
Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
296
diff
changeset
|
1239 static int acct_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli, int * stateful ) |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1240 { |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1241 struct sess_state * st = NULL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1242 struct avp *avp, *next; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1243 struct avp_hdr *ahdr, *sid, *oh, *or; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1244 |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1245 TRACE_ENTRY("%p %p %p %p %p", cs, session, diam_ans, rad_fw, cli); |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1246 CHECK_PARAMS(cs); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1247 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1248 if (session) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1249 CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, session, &st ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1250 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1251 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1252 if (!st) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1253 TRACE_DEBUG(INFO, "Received an ACA without corresponding session information, cannot translate to RADIUS"); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1254 return EINVAL; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1255 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1256 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1257 /* Search these AVPs first */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1258 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Session_Id, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1259 CHECK_FCT( fd_msg_avp_hdr ( avp, &sid ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1260 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1261 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Origin_Host, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1262 CHECK_FCT( fd_msg_avp_hdr ( avp, &oh ) ); |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1263 |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1264 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Origin_Realm, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1265 CHECK_FCT( fd_msg_avp_hdr ( avp, &or ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1266 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1267 /* Check the Diameter error code */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1268 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Result_Code, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1269 ASSERT( avp ); /* otherwise the message should have been discarded a lot earlier because of ABNF */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1270 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1271 switch (ahdr->avp_value->u32) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1272 case ER_DIAMETER_SUCCESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1273 case ER_DIAMETER_LIMITED_SUCCESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1274 (*rad_fw)->hdr->code = RADIUS_CODE_ACCOUNTING_RESPONSE; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1275 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1276 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1277 default: |
535
72c511043f05
A few bug fixes on the RADIUS/Diameter gateway.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
532
diff
changeset
|
1278 fd_log_debug("[acct.rgwx] Received Diameter answer with error code '%d' from server '%.*s', session %.*s, not translating into Accounting-Response\n", |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1279 ahdr->avp_value->u32, |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1280 oh->avp_value->os.len, oh->avp_value->os.data, |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1281 sid->avp_value->os.len, sid->avp_value->os.data); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1282 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Message, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1283 if (avp) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1284 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) ); |
535
72c511043f05
A few bug fixes on the RADIUS/Diameter gateway.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
532
diff
changeset
|
1285 fd_log_debug("[acct.rgwx] Error-Message content: '%.*s'\n", |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1286 ahdr->avp_value->os.len, ahdr->avp_value->os.data); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1287 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1288 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Reporting_Host, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1289 if (avp) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1290 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) ); |
535
72c511043f05
A few bug fixes on the RADIUS/Diameter gateway.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
532
diff
changeset
|
1291 fd_log_debug("[acct.rgwx] Error-Reporting-Host: '%.*s'\n", |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1292 ahdr->avp_value->os.len, ahdr->avp_value->os.data); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1293 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1294 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Failed_AVP, &avp) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1295 if (avp) { |
535
72c511043f05
A few bug fixes on the RADIUS/Diameter gateway.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
532
diff
changeset
|
1296 fd_log_debug("[acct.rgwx] Failed-AVP was included in the message.\n"); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1297 /* Dump its content ? */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1298 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1299 return -1; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1300 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1301 /* Remove this Result-Code avp */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1302 CHECK_FCT( fd_msg_free( avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1303 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1304 /* If it was a response to a STOP record, we must send an STR for this session */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1305 if (st->send_str) { |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1306 struct msg * str = NULL; |
294
0e940240c436
Fix application id in the STR header. Not sure what is really expected there, though...
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
277
diff
changeset
|
1307 struct msg_hdr * hdr = NULL; |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1308 char * fqdn; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1309 char * realm; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1310 union avp_value avp_val; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1311 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1312 /* Create a new STR message */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1313 CHECK_FCT( fd_msg_new ( cs->dict.Session_Termination_Request, MSGFL_ALLOC_ETEID, &str ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1314 |
294
0e940240c436
Fix application id in the STR header. Not sure what is really expected there, though...
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
277
diff
changeset
|
1315 /* Set the application-id to the auth application if available, accouting otherwise (not sure what is actually expected...) */ |
0e940240c436
Fix application id in the STR header. Not sure what is really expected there, though...
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
277
diff
changeset
|
1316 CHECK_FCT( fd_msg_hdr ( str, &hdr ) ); |
0e940240c436
Fix application id in the STR header. Not sure what is really expected there, though...
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
277
diff
changeset
|
1317 hdr->msg_appl = st->auth_appl ?: AI_ACCT; |
0e940240c436
Fix application id in the STR header. Not sure what is really expected there, though...
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
277
diff
changeset
|
1318 |
273
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1319 /* Add the Session-Id AVP as first AVP */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1320 CHECK_FCT( fd_msg_avp_new ( cs->dict.Session_Id, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1321 CHECK_FCT( fd_msg_avp_setvalue ( avp, sid->avp_value ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1322 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_FIRST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1323 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1324 /* Add the Destination-Realm as next AVP */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1325 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1326 CHECK_FCT( fd_msg_avp_setvalue ( avp, or->avp_value ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1327 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1328 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1329 /* Get information on the NAS */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1330 CHECK_FCT( rgw_clients_get_origin(cli, &fqdn, &realm) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1331 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1332 /* Add the Origin-Host as next AVP */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1333 CHECK_FCT( fd_msg_avp_new ( cs->dict.Origin_Host, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1334 memset(&avp_val, 0, sizeof(avp_val)); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1335 avp_val.os.data = (unsigned char *)fqdn; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1336 avp_val.os.len = strlen(fqdn); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1337 CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1338 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1339 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1340 /* Add the Origin-Realm as next AVP */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1341 CHECK_FCT( fd_msg_avp_new ( cs->dict.Origin_Realm, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1342 memset(&avp_val, 0, sizeof(avp_val)); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1343 avp_val.os.data = (unsigned char *)realm; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1344 avp_val.os.len = strlen(realm); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1345 CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1346 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1347 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1348 /* Auth-Application-Id -- if we did not get it from our Class attribute, we just set "0" */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1349 CHECK_FCT( fd_msg_avp_new ( cs->dict.Auth_Application_Id, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1350 avp_val.u32 = st->auth_appl; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1351 CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1352 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1353 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1354 /* Termination-Cause */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1355 CHECK_FCT( fd_msg_avp_new ( cs->dict.Termination_Cause, 0, &avp ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1356 avp_val.u32 = st->term_cause; |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1357 CHECK_FCT( fd_msg_avp_setvalue ( avp, &avp_val ) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1358 CHECK_FCT( fd_msg_avp_add ( str, MSG_BRW_LAST_CHILD, avp) ); |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1359 |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1360 /* Send this message */ |
bce8e5b7bf78
Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
271
diff
changeset
|
1361 CHECK_FCT( fd_msg_send ( &str, handle_sta, cs ) ); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1362 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1363 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1364 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1365 No attributes should be found in |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1366 Accounting-Response packets except Proxy-State and possibly Vendor- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1367 Specific. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1368 */ |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1369 |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1370 /* Well, it seems some devices are expecting the user name ??? */ |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1371 if (st->username) { |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1372 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, RADIUS_ATTR_USER_NAME, st->username, st->un_size)); |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1373 } |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1374 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1375 /* Now loop in the list of AVPs and convert those that we know how */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1376 CHECK_FCT( fd_msg_browse(*diam_ans, MSG_BRW_FIRST_CHILD, &next, NULL) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1377 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1378 while (next) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1379 int handled = 1; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1380 avp = next; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1381 CHECK_FCT( fd_msg_browse(avp, MSG_BRW_NEXT, &next, NULL) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1382 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1383 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1384 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1385 if (!(ahdr->avp_flags & AVP_FLAG_VENDOR)) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1386 switch (ahdr->avp_code) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1387 /* Based on RFC4005, sec 3.10 */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1388 case DIAM_ATTR_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1389 case DIAM_ATTR_ORIGIN_HOST: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1390 case DIAM_ATTR_ORIGIN_REALM: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1391 case DIAM_ATTR_ACCOUNTING_RECORD_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1392 case DIAM_ATTR_ACCOUNTING_RECORD_NUMBER: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1393 case DIAM_ATTR_ACCT_APPLICATION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1394 case DIAM_ATTR_VENDOR_SPECIFIC_APPLICATION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1395 case DIAM_ATTR_USER_NAME: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1396 case DIAM_ATTR_ACCOUNTING_SUB_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1397 case DIAM_ATTR_ACCT_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1398 case DIAM_ATTR_ACCT_MULTI_SESSION_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1399 case DIAM_ATTR_EVENT_TIMESTAMP: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1400 case DIAM_ATTR_ORIGIN_AAA_PROTOCOL: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1401 case DIAM_ATTR_ORIGIN_STATE_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1402 case DIAM_ATTR_NAS_IDENTIFIER: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1403 case DIAM_ATTR_NAS_IP_ADDRESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1404 case DIAM_ATTR_NAS_IPV6_ADDRESS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1405 case DIAM_ATTR_NAS_PORT: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1406 case DIAM_ATTR_NAS_PORT_ID: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1407 case DIAM_ATTR_NAS_PORT_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1408 case DIAM_ATTR_SERVICE_TYPE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1409 case DIAM_ATTR_TERMINATION_CAUSE: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1410 case DIAM_ATTR_ACCOUNTING_REALTIME_REQUIRED: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1411 case DIAM_ATTR_ACCT_INTERIM_INTERVAL: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1412 case DIAM_ATTR_CLASS: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1413 /* We just remove these AVP, they are not expected in RADIUS client */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1414 break; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1415 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1416 default: |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1417 /* Leave the AVP in the message for further treatment */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1418 handled = 0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1419 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1420 } else { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1421 /* Vendor-specific AVPs */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1422 switch (ahdr->avp_vendor) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1423 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1424 default: /* unknown vendor */ |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1425 handled = 0; |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1426 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1427 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1428 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1429 if (handled) { |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1430 CHECK_FCT( fd_msg_free( avp ) ); |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1431 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1432 } |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1433 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1434 /* |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1435 The Authenticator field in an Accounting-Response packet is called |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1436 the Response Authenticator, and contains a one-way MD5 hash |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1437 calculated over a stream of octets consisting of the Accounting- |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1438 Response Code, Identifier, Length, the Request Authenticator field |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1439 from the Accounting-Request packet being replied to, and the |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1440 response attributes if any, followed by the shared secret. The |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1441 resulting 16 octet MD5 hash value is stored in the Authenticator |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1442 field of the Accounting-Response packet. |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1443 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1444 -- done in radius_msg_finish_srv |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1445 */ |
536
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1446 |
f95cfc35d960
Add User Name in translated Accounting Responses
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
535
diff
changeset
|
1447 free_sess_state(st); |
271
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1448 |
411314907b43
Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
268
diff
changeset
|
1449 return 0; |
259
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1450 } |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1451 |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1452 /* The exported symbol */ |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1453 struct rgw_api rgwp_descriptor = { |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1454 .rgwp_name = "acct", |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1455 .rgwp_conf_parse = acct_conf_parse, |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1456 .rgwp_conf_free = acct_conf_free, |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1457 .rgwp_rad_req = acct_rad_req, |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1458 .rgwp_diam_ans = acct_diam_ans |
359e8e394423
Ported the incomplete acct plugin (from waaad)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1459 }; |