Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for libfdcore/p_dw.c


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_dw.c

    r662 r706  
    3838/* This file contains code to handle Device Watchdog messages (DWR and DWA) */
    3939
    40 /* Check the value of Origin-State-Id is consistent in a DWR or  DWA -- we just log if it is not the case */
    41 static void check_state_id(struct msg * msg, struct fd_peer * peer)
     40/* Check the value of Origin-State-Id is consistent in a DWR or DWA -- we return an error otherwise */
     41static int check_state_id(struct msg * msg, struct fd_peer * peer)
    4242{
    4343        struct avp * osi;
     44       
    4445        /* Check if the request contains the Origin-State-Id */
    45         CHECK_FCT_DO( fd_msg_search_avp ( msg, fd_dict_avp_OSI, &osi ), return );
     46        CHECK_FCT( fd_msg_search_avp ( msg, fd_dict_avp_OSI, &osi ) );
    4647        if (osi) {
    4748                /* Check the value is consistent with the saved one */
    4849                struct avp_hdr * hdr;
    49                 CHECK_FCT_DO(  fd_msg_avp_hdr( osi, &hdr ), return  );
     50                CHECK_FCT(  fd_msg_avp_hdr( osi, &hdr )  );
    5051                if (hdr->avp_value == NULL) {
    5152                        /* This is a sanity check */
     
    5657
    5758                if (peer->p_hdr.info.runtime.pir_orstate != hdr->avp_value->u32) {
    58                         fd_log_debug("Received a new Origin-State-Id from peer %s! (%x / %x)\n",
     59                        TRACE_DEBUG(INFO, "Received a new Origin-State-Id from peer '%s'! (%x -> %x); resetting the connection.\n",
    5960                                peer->p_hdr.info.pi_diamid,
    60                                 hdr->avp_value->u32,
    61                                 peer->p_hdr.info.runtime.pir_orstate );
     61                                peer->p_hdr.info.runtime.pir_orstate,
     62                                hdr->avp_value->u32 );
     63                        return EINVAL;
    6264                }
    6365        }
     66        return 0;
    6467}
    6568
     
    9295       
    9396        /* Check the value of OSI for information */
    94         check_state_id(*msg, peer);
     97        CHECK_FCT( check_state_id(*msg, peer) );
    9598       
    9699        if (req) {
     
    102105               
    103106        } else {
    104                 /* Just discard the DWA */
     107                /* Discard the DWA */
    105108                CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ );
    106109                *msg = NULL;
     
    123126       
    124127        /* If we are in REOPEN state, increment the counter */
    125         fd_cpu_flush_cache();
    126         if (peer->p_hdr.info.runtime.pir_state == STATE_REOPEN) {
     128        if (fd_peer_getstate(peer) == STATE_REOPEN) {
    127129                peer->p_flags.pf_reopen_cnt += 1;
    128130               
Note: See TracChangeset for help on using the changeset viewer.