Changeset 356:e203fc0c95e3 in freeDiameter for extensions/app_radgw/rgw_worker.c
- Timestamp:
- Jul 1, 2010, 3:47:34 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_radgw/rgw_worker.c
r278 r356 130 130 131 131 /* Note: after this point, the radius message buffer may not be consistent with the array of attributes anymore. */ 132 diam_msg = NULL; 133 134 /* Create an empty message with only Origin information (no session, no destination -- added by the plugins) */ 135 CHECK_FCT_DO( rgw_msg_create_base(cli, &diam_msg), 136 { 137 /* An error occurred, discard message */ 138 rgw_msg_free(&msg); 139 rgw_clients_dispose(&cli); 140 continue; 141 } ); 132 142 133 143 session = NULL; 134 diam_msg = NULL;135 136 /* Create the session and an empty message with default common AVPs */137 CHECK_FCT_DO( rgw_msg_create_base(msg, cli, &session, &diam_msg),138 {139 /* An error occurred, discard message */140 rgw_msg_free(&msg);141 rgw_clients_dispose(&cli);142 continue;143 } );144 144 145 145 /* Pass the message to the list of registered plugins */ … … 158 158 continue; 159 159 } ); 160 if (msg == NULL) { 160 if (msg == NULL) { /* Error or RADIUS answer locally generated */ 161 161 rgw_clients_dispose(&cli); 162 162 if (diam_msg) { … … 164 164 diam_msg = NULL; 165 165 } 166 if (session) {167 CHECK_FCT_DO( fd_sess_destroy(&session), );168 }169 166 continue; /* the message was handled already */ 170 167 } … … 172 169 pb = 0; 173 170 174 /* Check the created Diameter message */171 /* Check the created Diameter message -- it will be invalid if no callback has handled the RADIUS message */ 175 172 if ((diam_msg == NULL) || ( fd_msg_parse_rules(diam_msg, fd_g_config->cnf_dict, NULL) ) ) { 176 173 fd_log_debug("[radgw] No or invalid Diameter message was generated after processing the RADIUS command %hhd (%s).\n" 177 " This is likely an implementation problem, please report.\n",174 " It may indicate a gateway configuration problem, or implementation issue in a plugin.\n", 178 175 msg->radius.hdr->code, rgw_msg_code_str(msg->radius.hdr->code)); 179 /* We might also dump the conflicting rule here if useful*/176 /* We should also dump the conflicting rule here to help debug? */ 180 177 pb++; 181 178 } … … 189 186 msg->radius.hdr->code, rgw_msg_code_str(msg->radius.hdr->code)); 190 187 } 191 192 /* Check the session is correct (for debug) */193 ASSERT(session != NULL);194 188 195 189 if (pb) { … … 253 247 struct avp_hdr *ahdr; 254 248 int pb = 0; 249 int keepsession=0; 255 250 256 251 TRACE_ENTRY("%p %p", pa, ans); … … 261 256 262 257 /* Pass the Diameter answer to the same extensions as the request */ 263 CHECK_FCT_DO( rgw_plg_loop_ans(pa->rad, pa->sess, ans, &rad_ans, pa->cli ), goto out );258 CHECK_FCT_DO( rgw_plg_loop_ans(pa->rad, pa->sess, ans, &rad_ans, pa->cli, &keepsession), goto out ); 264 259 265 260 if (*ans != NULL) { … … 293 288 294 289 if (pb) { 295 TRACE_DEBUG(INFO, "[radgw] WARNING: %d mandatory AVP in the Diameter answer have not been translated to RADIUS!\n Please use plg_debug.rgwx for more information.", pb);290 TRACE_DEBUG(INFO, "[radgw] WARNING: %d mandatory AVP in the Diameter answer have not been translated to RADIUS!\n Please use debug.rgwx for more information.", pb); 296 291 } 297 292 } … … 303 298 304 299 out: 305 /* Destroy remaining session data (stateless gateway) */ 306 CHECK_FCT_DO( fd_sess_destroy(&pa->sess), ); 300 if (!keepsession) { 301 /* Destroy remaining session data (stateless gateway) */ 302 CHECK_FCT_DO( fd_sess_destroy(&pa->sess), ); 303 } 307 304 308 305 /* Clear the Diameter message */
Note: See TracChangeset
for help on using the changeset viewer.