diff --git a/include/mtp_data.h b/include/mtp_data.h index 8c34f20..5168eb1 100644 --- a/include/mtp_data.h +++ b/include/mtp_data.h @@ -46,6 +46,8 @@ struct mtp_link { int running; int sccp_up; + int last_sls; + /* misc data */ uint8_t test_ptrn[14]; diff --git a/src/bsc_sccp.c b/src/bsc_sccp.c index 69e2262..ea13c43 100644 --- a/src/bsc_sccp.c +++ b/src/bsc_sccp.c @@ -86,7 +86,7 @@ unsigned int sls_for_src_ref(struct sccp_source_reference *ref) con = find_con_by_src_ref(ref); if (!con) - return 13; + return -1; return con->sls; } diff --git a/src/main.c b/src/main.c index c922474..a4e502c 100644 --- a/src/main.c +++ b/src/main.c @@ -224,7 +224,7 @@ static void bsc_reset_timeout(void *_data) } ++bsc->reset_count; - mtp_link_submit_sccp_data(bsc->link.the_link, 13, msg->l2h, msgb_l2len(msg)); + mtp_link_submit_sccp_data(bsc->link.the_link, -1, msg->l2h, msgb_l2len(msg)); msgb_free(msg); bsc_schedule_timer(&bsc->reset_timeout, 20, 0); } @@ -351,7 +351,7 @@ static void handle_rlsd(struct sccp_connection_released *rlsd, int from_msc) &rlsd->source_local_reference); } } else { - unsigned int sls = 13; + unsigned int sls = -1; con = find_con_by_src_dest_ref(&rlsd->source_local_reference, &rlsd->destination_local_reference); if (con) { diff --git a/src/msc_conn.c b/src/msc_conn.c index 5d1b329..62459ec 100644 --- a/src/msc_conn.c +++ b/src/msc_conn.c @@ -168,7 +168,7 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd) /* we can not forward it right now */ if (bsc->forward_only && link->sccp_up) { - if (send_or_queue_bsc_msg(link, 13, msg) != 1) + if (send_or_queue_bsc_msg(link, -1, msg) != 1) msgb_free(msg); return 0; } diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index 91d3f07..e756440 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -510,6 +510,11 @@ int mtp_link_submit_sccp_data(struct mtp_link *link, int sls, const uint8_t *dat return -1; } + if (sls == -1) { + sls = link->last_sls; + link->last_sls = (link->last_sls + 1) % 16; + } + return mtp_int_submit(link, link->sccp_opc, sls, MTP_SI_MNT_SCCP, data, length); }