Fix of wong Classmark 2 when doing CM Service Request.

Same reason as the commit below... (3b2b3b09a)

Thanx again to Dieter for pointing this out.
This commit is contained in:
Andreas Eversberg 2011-08-06 17:56:06 +02:00
parent 3b2b3b09a9
commit 210de12ec4
3 changed files with 13 additions and 7 deletions

View File

@ -188,7 +188,8 @@ int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc,
uint16_t *mnc, uint16_t *lac);
int gsm48_encode_lai(struct gsm48_loc_area_id *lai, uint16_t mcc,
uint16_t mnc, uint16_t lac);
int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm);
int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm,
uint16_t arfcn);
int gsm48_rr_tx_rand_acc(struct osmocom_ms *ms, struct msgb *msg);
int gsm48_rr_los(struct osmocom_ms *ms);
int gsm48_rr_rach_conf(struct osmocom_ms *ms, uint32_t fn);

View File

@ -2753,6 +2753,8 @@ static int gsm48_mm_tx_cm_serv_req(struct osmocom_ms *ms, int rr_prim,
uint8_t cm_serv)
{
struct gsm48_mmlayer *mm = &ms->mmlayer;
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm322_cellsel *cs = &ms->cellsel;
struct gsm_subscriber *subscr = &ms->subscr;
struct gsm_settings *set = &ms->settings;
struct msgb *nmsg;
@ -2778,7 +2780,9 @@ static int gsm48_mm_tx_cm_serv_req(struct osmocom_ms *ms, int rr_prim,
nsr->cipher_key_seq = subscr->key_seq;
/* classmark 2 */
cm2lv[0] = sizeof(struct gsm48_classmark2);
gsm48_rr_enc_cm2(ms, (struct gsm48_classmark2 *)(cm2lv + 1));
gsm48_rr_enc_cm2(ms, (struct gsm48_classmark2 *)(cm2lv + 1),
(rr_prim == GSM48_RR_EST_REQ) ? cs->sel_arfcn
: rr->cd_now.arfcn);
/* MI */
if (mm->est_cause == RR_EST_CAUSE_EMERGENCY && set->emergency_imsi[0]) {
LOGP(DMM, LOGL_INFO, "-> Using IMSI %s for emergency\n",

View File

@ -1159,13 +1159,13 @@ static int gsm48_rr_enc_cm3(struct osmocom_ms *ms, uint8_t *buf, uint8_t *len)
}
/* encode classmark 2 */
int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm)
int gsm48_rr_enc_cm2(struct osmocom_ms *ms, struct gsm48_classmark2 *cm,
uint16_t arfcn)
{
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm_support *sup = &ms->support;
struct gsm_settings *set = &ms->settings;
cm->pwr_lev = gsm48_current_pwr_lev(set, rr->cd_now.arfcn);
cm->pwr_lev = gsm48_current_pwr_lev(set, arfcn);
cm->a5_1 = !set->a5_1;
cm->es_ind = sup->es_ind;
cm->rev_lev = sup->rev_lev;
@ -1189,6 +1189,7 @@ static int gsm48_rr_tx_cm_change(struct osmocom_ms *ms)
{
struct gsm_support *sup = &ms->support;
struct gsm_settings *set = &ms->settings;
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct msgb *nmsg;
struct gsm48_hdr *gh;
struct gsm48_cm_change *cc;
@ -1207,7 +1208,7 @@ static int gsm48_rr_tx_cm_change(struct osmocom_ms *ms)
/* classmark 2 */
cc->cm2_len = sizeof(cc->cm2);
gsm48_rr_enc_cm2(ms, &cc->cm2);
gsm48_rr_enc_cm2(ms, &cc->cm2, rr->cd_now.arfcn);
/* classmark 3 */
if (set->dcs || set->pcs || set->e_gsm || set->r_gsm || set->gsm_850
@ -3174,7 +3175,7 @@ static int gsm48_rr_dl_est(struct osmocom_ms *ms)
pr->key_seq = subscr->key_seq;
/* classmark 2 */
pr->cm2_len = sizeof(pr->cm2);
gsm48_rr_enc_cm2(ms, &pr->cm2);
gsm48_rr_enc_cm2(ms, &pr->cm2, rr->cd_now.arfcn);
/* mobile identity */
if (ms->subscr.tmsi != 0xffffffff
&& ms->subscr.mcc == cs->sel_mcc