Changeset 706:4ffbc9f1e922 in freeDiameter for libfdcore/p_dw.c
- Timestamp:
- Feb 9, 2011, 3:26:58 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/p_dw.c
r662 r706 38 38 /* This file contains code to handle Device Watchdog messages (DWR and DWA) */ 39 39 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 voidcheck_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 */ 41 static int check_state_id(struct msg * msg, struct fd_peer * peer) 42 42 { 43 43 struct avp * osi; 44 44 45 /* 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 ) ); 46 47 if (osi) { 47 48 /* Check the value is consistent with the saved one */ 48 49 struct avp_hdr * hdr; 49 CHECK_FCT _DO( fd_msg_avp_hdr( osi, &hdr ), return);50 CHECK_FCT( fd_msg_avp_hdr( osi, &hdr ) ); 50 51 if (hdr->avp_value == NULL) { 51 52 /* This is a sanity check */ … … 56 57 57 58 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", 59 60 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; 62 64 } 63 65 } 66 return 0; 64 67 } 65 68 … … 92 95 93 96 /* Check the value of OSI for information */ 94 check_state_id(*msg, peer);97 CHECK_FCT( check_state_id(*msg, peer) ); 95 98 96 99 if (req) { … … 102 105 103 106 } else { 104 /* Just discard the DWA */107 /* Discard the DWA */ 105 108 CHECK_FCT_DO( fd_msg_free(*msg), /* continue */ ); 106 109 *msg = NULL; … … 123 126 124 127 /* 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) { 127 129 peer->p_flags.pf_reopen_cnt += 1; 128 130
Note: See TracChangeset
for help on using the changeset viewer.