summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-27 07:22:50 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-27 07:34:34 +0100
commit3a110ae60b58eeffe63296055d0431760e6bb1d0 (patch)
treeb8b30b6e2675d6996d9b82bb85153eaaa2f26dd7 /openbsc
parentbb84adc46552b18b248f47de4f19e181e0842af2 (diff)
[msc] Attempt to fix MT SMS with ciphering enabled.
The MSC is asking us to enable ciphering and then immediately sends a DTAP msg for SAPI=3. We handle this correctly by attempting to establish SAPI=3 but we never get an establishment confirm for this SAPI. Attempt to fix it by not sending any DTAP message when we receive the Cipher Mode Request and unblock the queue when the ciphering is confirmed. The unblocking currently works by taking all messages out of the queue and then submitting them again. This will attempt to establish the SAPI=3 and such automaticaly. And the MSC stopped sending me SMS so this needs to be verified at a later time.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/bssap.h1
-rw-r--r--openbsc/src/bsc_msc_ip.c1
-rw-r--r--openbsc/src/bssap.c26
3 files changed, 27 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/bssap.h b/openbsc/include/openbsc/bssap.h
index 2ca2cac72..a46e0a9cd 100644
--- a/openbsc/include/openbsc/bssap.h
+++ b/openbsc/include/openbsc/bssap.h
@@ -329,5 +329,6 @@ void bsc_send_queued(struct sccp_connection *conn);
void bts_queue_send(struct msgb *msg, int link_id);
void bts_send_queued(struct bss_sccp_connection_data*);
void bts_free_queued(struct bss_sccp_connection_data*);
+void bts_unblock_queue(struct bss_sccp_connection_data*);
#endif
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 73a31ffc3..e7db79cd9 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -286,6 +286,7 @@ static int handle_cipher_m_complete(struct msgb *msg)
/* handled this message */
+ bts_unblock_queue(msg->lchan->msc_data);
bsc_queue_connection_write(lchan_get_sccp(msg->lchan), resp);
return 1;
}
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index 1727be43b..c5ad80fb1 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -228,6 +228,7 @@ static int bssmap_handle_cipher_mode(struct sccp_connection *conn,
}
msg->lchan->msc_data->ciphering_handled = 1;
+ msg->lchan->msc_data->block_gsm = 1;
tlv_parse(&tp, &bss_att_tlvdef, msg->l4h + 1, payload_length - 1, 0, 0);
if (!TLVP_PRESENT(&tp, GSM0808_IE_ENCRYPTION_INFORMATION)) {
@@ -268,6 +269,9 @@ static int bssmap_handle_cipher_mode(struct sccp_connection *conn,
return gsm48_send_rr_ciph_mode(msg->lchan, include_imeisv);
reject:
+ if (msg->lchan->msc_data)
+ msg->lchan->msc_data->block_gsm = 0;
+
resp = bssmap_create_cipher_reject(reject_cause);
if (!resp) {
DEBUGP(DMSC, "Sending the cipher reject failed.\n");
@@ -1080,7 +1084,7 @@ void bts_queue_send(struct msgb *msg, int link_id)
{
struct bss_sccp_connection_data *data = msg->lchan->msc_data;
- if (data->gsm_queue_size == 0) {
+ if (!data->block_gsm && data->gsm_queue_size == 0) {
if (msg->lchan->sapis[link_id & 0x7] != LCHAN_SAPI_UNUSED) {
rsl_data_request(msg, link_id);
} else {
@@ -1131,6 +1135,26 @@ void bts_send_queued(struct bss_sccp_connection_data *data)
data->gsm_queue_size = 0;
}
+void bts_unblock_queue(struct bss_sccp_connection_data *data)
+{
+ struct msgb *msg;
+ LLIST_HEAD(head);
+
+ /* move the messages to a new list */
+ data->block_gsm = 0;
+ data->gsm_queue_size = 0;
+ while (!llist_empty(&data->gsm_queue)) {
+ msg = msgb_dequeue(&data->gsm_queue);
+ msgb_enqueue(&head, msg);
+ }
+
+ /* now queue them again to send RSL establish and such */
+ while (!llist_empty(&head)) {
+ msg = msgb_dequeue(&data->gsm_queue);
+ bts_queue_send(msg, (int) msg->smsh);
+ }
+}
+
void gsm0808_send_assignment_failure(struct gsm_lchan *lchan, u_int8_t cause, u_int8_t *rr_value)
{
struct msgb *resp;