Navigation


Changeset 131:50d1dc19b221 in freeDiameter


Ignore:
Timestamp:
Dec 10, 2009, 5:18:59 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Hopefully removed infinite loop

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/p_ce.c

    r130 r131  
    261261
    262262/* Extract information sent by the remote peer and save it in our peer structure */
    263 static int save_remote_CE_info(struct msg * msg, struct fd_peer * peer, char ** error_code)
     263static int save_remote_CE_info(struct msg * msg, struct fd_peer * peer, char ** error_code, uint32_t *rc)
    264264{
    265265        struct avp * avp = NULL;
     
    292292                                }
    293293                               
    294                                 /* We check that the CEA Result-Code is Success, otherwise we disconnect */
    295                                 if (hdr->avp_value->u32 != ER_DIAMETER_SUCCESS) {
    296                                         TRACE_DEBUG(INFO, "Received CEA with Result-Code %d (expected %d), disconnect", hdr->avp_value->u32, ER_DIAMETER_SUCCESS);
    297                                         return EBADMSG;
    298                                 }
    299 
     294                                if (rc)
     295                                        *rc = hdr->avp_value->u32;
    300296                                break;
    301297               
     
    640636{
    641637        char * ec;
     638        uint32_t rc = 0;
    642639        TRACE_ENTRY("%p %p", msg, peer);
    643640        CHECK_PARAMS( msg && *msg && CHECK_PEER(peer) );
     
    672669       
    673670        /* Save info from the CEA into the peer */
    674         CHECK_FCT_DO( save_remote_CE_info(*msg, peer, &ec), goto cleanup );
     671        CHECK_FCT_DO( save_remote_CE_info(*msg, peer, &ec, &rc), goto cleanup );
    675672       
    676673        /* Dispose of the message, we don't need it anymore */
    677674        CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ );
    678675        *msg = NULL;
     676       
     677        /* Check the Result-Code */
     678        switch (rc) {
     679                case ER_DIAMETER_SUCCESS:
     680                        /* No problem, we can continue */
     681                        break;
     682                       
     683                case ER_DIAMETER_TOO_BUSY:
     684                        /* Retry later */
     685                        TRACE_DEBUG(INFO, "Peer %s replied a CEA with Result-Code AVP DIAMETER_TOO_BUSY, will retry later.", peer->p_hdr.info.pi_diamid);
     686                        fd_psm_cleanup(peer, 0);
     687                        fd_psm_next_timeout(peer, 0, 300);
     688                        return 0;
     689               
     690                case ER_ELECTION_LOST:
     691                        /* Ok, just wait for a little while for the CER to be processed on the other connection. */
     692                        TRACE_DEBUG(FULL, "Peer %s replied a CEA with Result-Code AVP ELECTION_LOST, waiting for events.", peer->p_hdr.info.pi_diamid);
     693                        return 0;
     694               
     695                default:
     696                        /* In any other case, we abort all attempts to connect to this peer */
     697                        TRACE_DEBUG(INFO, "Peer %s replied a CEA with Result-Code AVP %d, aborting connection attempts.", peer->p_hdr.info.pi_diamid, rc);
     698                        return EINVAL;
     699        }
    679700       
    680701        /* Handshake if needed, start clear otherwise */
     
    713734       
    714735cleanup:
    715         if (*msg) {
    716                 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ );
    717                 *msg = NULL;
    718         }
    719 
    720736        fd_p_ce_clear_cnx(peer, NULL);
    721737
     
    741757       
    742758        /* Parse the content of the received CER */
    743         CHECK_FCT_DO( save_remote_CE_info(msg, peer, &ec), goto error_abort );
     759        CHECK_FCT_DO( save_remote_CE_info(msg, peer, &ec, NULL), goto error_abort );
    744760       
    745761        /* Validate the peer if needed */
  • freeDiameter/p_psm.c

    r129 r131  
    532532                                break;
    533533                       
     534                        case STATE_WAITCEA:
    534535                        case STATE_OPEN:
    535536                        case STATE_REOPEN:
    536537                        case STATE_WAITCNXACK:
    537                         case STATE_WAITCEA:
    538538                        case STATE_SUSPECT:
    539539                        default:
  • include/freeDiameter/libfreeDiameter.h

    r124 r131  
    13831383#define ER_DIAMETER_TOO_BUSY                    3004
    13841384#define ER_DIAMETER_REDIRECT_INDICATION         3006
     1385#define ER_ELECTION_LOST                        4003
    13851386
    13861387
Note: See TracChangeset for help on using the changeset viewer.