Navigation



Ignore:
Timestamp:
Mar 20, 2013, 12:13:14 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Children:
997:632913581c37, 998:ad6c1ee04d2d
Phase:
public
Message:

Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/rgwx_echodrop.c

    r979 r996  
    119119
    120120/* Handle attributes from a RADIUS request as specified in the configuration */
    121 static int ed_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 )
     121static int ed_rad_req( struct rgwp_config * cs, struct radius_msg * rad_req, struct radius_msg ** rad_ans, struct msg ** diam_fw, struct rgw_client * cli )
    122122{
    123123        size_t nattr_used = 0;
    124124        int idx;
    125        
    126125        struct fd_list echo_list = FD_LIST_INITIALIZER(echo_list);
    127126        struct fd_list *li;
    128127       
    129         TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli);
    130         CHECK_PARAMS(cs && rad_req && session);
     128        TRACE_ENTRY("%p %p %p %p %p", cs, rad_req, rad_ans, diam_fw, cli);
     129        CHECK_PARAMS(cs && rad_req);
    131130       
    132131        /* For each attribute in the original message */
     
    217216        /* Save the echoed values in the session, if any */
    218217        if (!FD_IS_LIST_EMPTY(&echo_list)) {
    219                 CHECK_PARAMS_DO(*session,
     218                struct session * sess;
     219               
     220                CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_fw, &sess, NULL) );
     221
     222                CHECK_PARAMS_DO(sess,
    220223                        {
    221224                                fd_log_debug(   "[echodrop.rgwx] The extension is configured to echo some attributes from this message, but no session object has been created for it (yet)."
     
    231234               
    232235                /* Save the list in the session */
    233                 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, *session, &li ) );
     236                CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &li ) );
    234237        }
    235238       
     
    238241
    239242/* Process an answer: add the ECHO attributes back, if any */
    240 static int ed_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli, int * stateful )
     243static int ed_diam_ans( struct rgwp_config * cs, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli )
    241244{
    242245        struct fd_list * list = NULL;
    243        
    244         TRACE_ENTRY("%p %p %p %p %p %p", cs, session, diam_ans, rad_fw, cli, stateful);
     246        struct session * sess;
     247       
     248        TRACE_ENTRY("%p %p %p %p", cs, diam_ans, rad_fw, cli);
    245249        CHECK_PARAMS(cs);
    246250       
     251        CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_ans, &sess, NULL) );
     252       
    247253        /* If there is no session associated, just give up */
    248         if (! session ) {
     254        if (! sess ) {
    249255                TRACE_DEBUG(FULL, "No session associated with the message, nothing to do here...");
    250256                return 0;
     
    252258       
    253259        /* Now try and retrieve any data from the session */
    254         CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, session, &list ) );
     260        CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &list ) );
    255261        if (list == NULL) {
    256262                /* No attribute saved in the session, just return */
Note: See TracChangeset for help on using the changeset viewer.