From b349e38838d6df853661ceefdfa1a007d2d5b449 Mon Sep 17 00:00:00 2001 From: Andreas.Eversberg Date: Fri, 17 Sep 2010 09:07:29 +0000 Subject: [layer23] CM service is now accepted when ciphering has started Sylvain pointed out that CM SERVICE ACCEPT message is not requred, if ciphering has been completed. In this case, an RR_SYNC_IND is sent to mobility management, and treated there as CM SERVICE ACCEPT. --- src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h | 2 ++ src/host/layer23/src/mobile/gsm48_mm.c | 7 +++++++ src/host/layer23/src/mobile/gsm48_rr.c | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h index e8b44dc..5ab5f4f 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h +++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h @@ -40,6 +40,8 @@ #define RR_REL_CAUSE_LOST_SIGNAL 7 #define RR_REL_CAUSE_LINK_FAILURE 8 +#define RR_SYNC_CAUSE_CIPHERING 1 + #define L3_ALLOC_SIZE 256 #define L3_ALLOC_HEADROOM 64 diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c index dfc41d4..1b063a1 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -3117,6 +3117,13 @@ static int gsm48_mm_conn_go_dedic(struct osmocom_ms *ms) static int gsm48_mm_sync_ind_wait(struct osmocom_ms *ms, struct msgb *msg) { struct gsm48_mmlayer *mm = &ms->mmlayer; + struct gsm48_rr_hdr *rrh = (struct gsm48_rr_hdr *)msg->data; + + if (rrh->cause != RR_SYNC_CAUSE_CIPHERING) { + LOGP(DMM, LOGL_NOTICE, "Ignore sync indication, not waiting " + "for CM service\n"); + return -EINVAL; + } /* stop MM connection timer */ stop_mm_t3230(mm); diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 3d0245b..e2418cc 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -800,6 +800,7 @@ static int gsm48_rr_tx_cip_mode_cpl(struct osmocom_ms *ms, uint8_t cr) struct gsm_settings *set = &ms->settings; struct msgb *nmsg; struct gsm48_hdr *gh; + struct gsm48_rr_hdr *nrrh; uint8_t buf[11], *tlv; LOGP(DRR, LOGL_INFO, "CIPHERING MODE COMPLETE (cr %d)\n", cr); @@ -821,7 +822,15 @@ static int gsm48_rr_tx_cip_mode_cpl(struct osmocom_ms *ms, uint8_t cr) memcpy(tlv, buf, 2 + buf[1]); } - return gsm48_send_rsl(ms, RSL_MT_DATA_REQ, nmsg); + gsm48_send_rsl(ms, RSL_MT_DATA_REQ, nmsg); + + /* send RR_SYNC_IND(ciphering) */ + nmsg = gsm48_rr_msgb_alloc(GSM48_RR_SYNC_IND); + if (!nmsg) + return -ENOMEM; + nrrh = (struct gsm48_rr_hdr *)nmsg->data; + nrrh->cause = RR_SYNC_CAUSE_CIPHERING; + return gsm48_rr_upmsg(ms, nmsg); } /* receive ciphering mode command */ -- cgit v1.2.3-55-g7522