freetdm: fixed cgu/cgb commands wrongly setting cic status when

the range covers one or more signaling links
This commit is contained in:
James Zhang 2012-02-09 14:32:08 -05:00
parent b78b612b47
commit 7b3a3d86b9
1 changed files with 73 additions and 71 deletions

View File

@ -2415,41 +2415,40 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
else { else {
if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { if (extract_chan_data(x, &sngss7_info, &ftdmchan)) {
SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x);
break; } else {
} ftdm_mutex_lock(ftdmchan->mutex);
if (status[byte] & (1 << bit)) {
ftdm_mutex_lock(ftdmchan->mutex); switch (blockType) {
if (status[byte] & (1 << bit)) { /**********************************************************************/
switch (blockType) { case 0: /* maintenance oriented */
/**********************************************************************/ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
case 0: /* maintenance oriented */ break;
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); /**********************************************************************/
break; case 1: /* hardware failure oriented */
/**********************************************************************/ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
case 1: /* hardware failure oriented */ break;
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); /**********************************************************************/
break; case 2: /* reserved for national use */
/**********************************************************************/ break;
case 2: /* reserved for national use */ /**********************************************************************/
break; default:
/**********************************************************************/ break;
default: /**********************************************************************/
break; }
/**********************************************************************/
} }
}
/* bring the sig status down */ /* bring the sig status down */
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
/* unlock the channel again before we exit */ /* unlock the channel again before we exit */
ftdm_mutex_unlock(ftdmchan->mutex); ftdm_mutex_unlock(ftdmchan->mutex);
/* update the bit and byte counter*/ /* update the bit and byte counter*/
bit ++; bit ++;
if (bit == 8) { if (bit == 8) {
byte++; byte++;
bit = 0; bit = 0;
}
} }
} }
x++; x++;
@ -2616,48 +2615,51 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
loop_range++; loop_range++;
} }
else { else {
/* lock the channel */ if (extract_chan_data(x, &sngss7_info, &ftdmchan)) {
ftdm_mutex_lock(ftdmchan->mutex); SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x);
if (status[byte] & (1 << bit)) {
switch (blockType) {
/**********************************************************************/
case 0: /* maintenance oriented */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
break;
/**********************************************************************/
case 1: /* hardware failure oriented */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
break;
/**********************************************************************/
case 2: /* reserved for national use */
break;
/**********************************************************************/
default:
break;
/**********************************************************************/
} /* switch (blockType) */
} /* if (status[byte] & (1 << bit)) */
sigev.chan_id = ftdmchan->chan_id;
sigev.span_id = ftdmchan->span_id;
sigev.channel = ftdmchan;
/* bring the sig status down */
if (sngss7_channel_status_clear(sngss7_info)) {
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
} }
else {
/* unlock the channel again before we exit */ ftdm_mutex_lock(ftdmchan->mutex);
ftdm_mutex_unlock(ftdmchan->mutex);
/* update the bit and byte counter*/ if (status[byte] & (1 << bit)) {
bit ++; switch (blockType) {
if (bit == 8) { /**********************************************************************/
byte++; case 0: /* maintenance oriented */
bit = 0; sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
break;
/**********************************************************************/
case 1: /* hardware failure oriented */
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
break;
/**********************************************************************/
case 2: /* reserved for national use */
break;
/**********************************************************************/
default:
break;
/**********************************************************************/
} /* switch (blockType) */
} /* if (status[byte] & (1 << bit)) */
sigev.chan_id = ftdmchan->chan_id;
sigev.span_id = ftdmchan->span_id;
sigev.channel = ftdmchan;
/* bring the sig status down */
if (sngss7_channel_status_clear(sngss7_info)) {
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
}
ftdm_mutex_unlock(ftdmchan->mutex);
/* update the bit and byte counter*/
bit ++;
if (bit == 8) {
byte++;
bit = 0;
}
} }
} }
x++; x++;