diff --git a/src/v5x_le_management.c b/src/v5x_le_management.c index c7e3e8f..e415d32 100644 --- a/src/v5x_le_management.c +++ b/src/v5x_le_management.c @@ -2396,26 +2396,26 @@ int v52_le_bcc_mdu_rcv(struct v5x_interface *v5if, uint8_t link_id, uint8_t ts, LOGV5UP(v5up, DV5MGMT, LOGL_INFO, "Unassigned channel %d for %s port at TS %d of link %d.\n", channel, (v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", ts, link_id); v5l->ts[ts].v5up = NULL; - v5up->ts[0] = NULL; + v5up->ts[channel - 1] = NULL; break; case MDU_BCC_allocation_reject_ind: case MDU_BCC_deallocation_reject_ind: - if (cause_len < 1) - break; - LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, "Failed to (un)assign channel %d for %s port at TS %d of link %d: %s.\n", - channel, (v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", ts, link_id, - get_value_string(v52_bcc_reject_cause_type_str, cause[0] & 0x7f)); + if (cause_len > 0) { + LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, "Failed to (un)assign channel %d for %s port at TS %d of link %d: %s.\n", + channel, (v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", ts, link_id, + get_value_string(v52_bcc_reject_cause_type_str, cause[0] & 0x7f)); + } if (cause_len > 1) LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, " -> Diagnostic: %s\n", osmo_hexdump(cause + 1, cause_len - 1)); v5l->ts[ts].v5up = NULL; - v5up->ts[0] = NULL; + v5up->ts[channel - 1] = NULL; break; case MDU_BCC_protocol_error_ind: - if (cause_len < 1) - break; - LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, "Failed to (un)assign channel %d for %s port at TS %d of link %d: %s.\n", - channel, (v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", ts, link_id, - get_value_string(v5x_cause_type_str, cause[0] & 0x7f)); + if (cause_len > 0) { + LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, "Failed to (un)assign channel %d for %s port at TS %d of link %d: %s.\n", + channel, (v5up->type == V5X_USER_TYPE_PSTN) ? "PSTN" : "ISDN", ts, link_id, + get_value_string(v5x_cause_type_str, cause[0] & 0x7f)); + } if (cause_len > 1) LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, " -> Diagnostic: %s\n", osmo_hexdump(cause + 1, cause_len - 1)); if (cause_len >= 3 && cause[1] == 0x20 && cause[2] == 0x47) { @@ -2423,7 +2423,7 @@ int v52_le_bcc_mdu_rcv(struct v5x_interface *v5if, uint8_t link_id, uint8_t ts, "please disable via VTY!\n"); } v5l->ts[ts].v5up = NULL; - v5up->ts[0] = NULL; + v5up->ts[channel - 1] = NULL; break; default: LOGV5UP(v5up, DV5MGMT, LOGL_ERROR, "Failed to (un)assign channel %d for %s port at TS %d of link %d.\n",