Holger Hans Peter Freyther wrote:
> b.) If it can not happen, use LOGL_ERROR so we potentially notice
> if it does happen and then we can re-consider.
>   
hi holger,

the new patch will give an error message, if location updating is
received after CM service request, but it finishes location updating in
case of this unexpected behavior.

regards,

andreas

>From 988f078fb7b346837f4ae34a0e283249f8b5e6e6 Mon Sep 17 00:00:00 2001
From: Andreas Eversberg <[email protected]>
Date: Wed, 10 Jul 2013 08:58:03 +0200
Subject: [PATCH] Fix: Handle CM service request on already secured channel
 correctly

A CM service request must be acknowledged also, when encryption is already
enabled.

Without encryption enabled, the security status is GSM_SECURITY_NOTAVAIL,
which causes a CM service acknowledge. On initial CM service request, the
security status is GSM_SECURITY_SUCCEED, if encryption is enabled. This
will not lead to an acknowledge, because the cyphering command implies an
acknowlege. An additional CM service request requires an acknowledge, so
I added a new security status: GSM_SECURITY_ALREADY
---
 openbsc/include/openbsc/gsm_data.h | 1 +
 openbsc/src/libmsc/gsm_04_08.c     | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/openbsc/include/openbsc/gsm_data.h 
b/openbsc/include/openbsc/gsm_data.h
index d7db887..05e0490 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -21,6 +21,7 @@ enum gsm_security_event {
        GSM_SECURITY_NOAVAIL,
        GSM_SECURITY_AUTH_FAILED,
        GSM_SECURITY_SUCCEEDED,
+       GSM_SECURITY_ALREADY,
 };
 
 struct msgb;
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 58107e3..3725eb9 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -194,7 +194,7 @@ int gsm48_secure_channel(struct gsm_subscriber_connection 
*conn, int key_seq,
                status = GSM_SECURITY_NOAVAIL;
        } else if (conn->lchan->encr.alg_id > RSL_ENC_ALG_A5(0)) {
                DEBUGP(DMM, "Requesting to secure an already secure channel");
-               status = GSM_SECURITY_SUCCEEDED;
+               status = GSM_SECURITY_ALREADY;
        } else if (!ms_cm2_a5n_support(subscr->equipment.classmark2,
                                       net->a5_encryption)) {
                DEBUGP(DMM, "Subscriber equipment doesn't support requested 
encryption");
@@ -302,6 +302,11 @@ static int _gsm0408_authorize_sec_cb(unsigned int hooknum, 
unsigned int event,
                        release_loc_updating_req(conn);
                        break;
 
+               case GSM_SECURITY_ALREADY:
+                       LOGP(DMM, LOGL_ERROR, "We don't expect LOCATION "
+                               "UPDATING after CM SERVICE REQUEST\n");
+                       /* fall through */
+
                case GSM_SECURITY_NOAVAIL:
                case GSM_SECURITY_SUCCEEDED:
                        /* We're all good */
@@ -856,6 +861,7 @@ static int _gsm48_rx_mm_serv_req_sec_cb(
                        break;
 
                case GSM_SECURITY_NOAVAIL:
+               case GSM_SECURITY_ALREADY:
                        rc = gsm48_tx_mm_serv_ack(conn);
                        break;
 
-- 
1.8.1.5

Reply via email to