Navigation


Changeset 548:345537783a90 in freeDiameter


Ignore:
Timestamp:
Sep 15, 2010, 10:41:43 AM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Allow duplicate messages to be processed after Diameter answer has been received.

Location:
extensions/app_radgw
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/rgw.h

    r516 r548  
    100100int rgw_clients_create_origin(struct rgw_radius_msg_meta *msg, struct rgw_client * cli, struct msg ** diam);
    101101int rgw_client_finish_send(struct radius_msg ** msg, struct rgw_radius_msg_meta * req, struct rgw_client * cli);
     102int rgw_client_finish_nosend(struct rgw_radius_msg_meta * req, struct rgw_client * cli);
    102103void rgw_clients_dispose(struct rgw_client ** ref);
    103104void rgw_clients_dump(void);
  • extensions/app_radgw/rgw_clients.c

    r547 r548  
    10531053}
    10541054
     1055/* Call this function when a RADIUS request has explicitely no answer (mainly accounting) so
     1056that we purge the duplicate cache and allow further message to be translated again.
     1057This is useful for example when a temporary error occurred in Diameter (like UNABLE_TO_DELIVER) */
     1058int rgw_client_finish_nosend(struct rgw_radius_msg_meta * req, struct rgw_client * cli)
     1059{
     1060        int p;
     1061        struct fd_list * li;
     1062       
     1063        TRACE_ENTRY("%p %p", req, cli);
     1064        CHECK_PARAMS( req && cli );
     1065       
     1066        /* update the duplicate cache */
     1067        if (req->serv_type == RGW_PLG_TYPE_AUTH)
     1068                p = 0;
     1069        else
     1070                p = 1;
     1071       
     1072        CHECK_POSIX( pthread_mutex_lock( &cli->dupl_info[p].dupl_lock ) );
     1073       
     1074        /* Search this message in our list */
     1075        for (li = cli->dupl_info[p].dupl_by_id.next; li != &cli->dupl_info[p].dupl_by_id; li = li->next) {
     1076                int cmp = 0;
     1077                struct req_info * r = (struct req_info *)(li->o);
     1078                if (r->id < req->radius.hdr->identifier)
     1079                        continue;
     1080                if (r->id > req->radius.hdr->identifier)
     1081                        break;
     1082                if (r->port < req->port)
     1083                        continue;
     1084                if (r->port > req->port)
     1085                        break;
     1086                cmp = memcmp(&r->auth[0], &req->radius.hdr->authenticator[0], 16);
     1087                if (cmp < 0)
     1088                        continue;
     1089                if (cmp > 0)
     1090                        break;
     1091               
     1092                /* We have the request in our duplicate cache, remove it */
     1093                fd_list_unlink(&r->by_id);
     1094                fd_list_unlink(&r->by_time);
     1095                dupl_free_req_info(r);
     1096                break;
     1097        }
     1098               
     1099        CHECK_POSIX( pthread_mutex_unlock( &cli->dupl_info[p].dupl_lock ) );
     1100       
     1101        /* Finished */
     1102        return 0;
     1103}
     1104
  • extensions/app_radgw/rgw_worker.c

    r535 r548  
    288288        if (rad_ans) {
    289289                CHECK_FCT_DO( rgw_client_finish_send(&rad_ans, pa->rad, pa->cli), );   
     290        } else {
     291                /* Remove the request from the duplicate cache */
     292                CHECK_FCT_DO( rgw_client_finish_nosend(pa->rad, pa->cli), );
    290293        }
    291294
Note: See TracChangeset for help on using the changeset viewer.