diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-05 13:57:45 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-05 13:57:45 +0100 |
commit | 893ea65f381acc877f852e48894f4575904b7cf9 (patch) | |
tree | 77b795c436019640d0cf33583d37337b2f7e7900 /openbsc/src/bssap.c | |
parent | 64b811f11321a13138ec48edcd6cafae23fcc7ed (diff) |
[bsc_msc_ip] Turn the MNC hack into a config option
* Make it possible to have a different MNC in the RSL traffic
than in the core network.
* Introduce the "core network code NUMBER" variable. If it is
set this network code will be used in traffic with the MSC.
* Use the core_network_code number when sending a packet to
the MSC
* Regenerate the LAI (this is where I could have a bug) when
sending packets to the BTS.
* Add size checks.
This is not tested, I might got something wrong.
Diffstat (limited to 'openbsc/src/bssap.c')
-rw-r--r-- | openbsc/src/bssap.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c index 6071b5dc2..8c02658da 100644 --- a/openbsc/src/bssap.c +++ b/openbsc/src/bssap.c @@ -552,12 +552,20 @@ int dtap_rcvmsg(struct gsm_lchan *lchan, struct msgb *msg, unsigned int length) memcpy(data, msg->l3h + sizeof(*header), length - sizeof(*header)); /* - * patch LAI entries... + * This is coming from the network. We need to regenerate the + * LAI for the Location Update Accept packet and maybe more + * as well. */ - struct gsm48_hdr *gh = (struct gsm48_hdr *)gsm48->l3h; - if (gh->msg_type == GSM48_MT_MM_LOC_UPD_ACCEPT) { - if (gh->data[2] == 0x80) - gh->data[2] = 0x08; + if (gsm48->trx->bts->network->core_network_code > 0 && + msgb_l3len(gsm48) >= sizeof(struct gsm48_loc_area_id) + 1) { + struct gsm48_hdr *gh = (struct gsm48_hdr *)gsm48->l3h; + if (gh->msg_type == GSM48_MT_MM_LOC_UPD_ACCEPT) { + struct gsm_network *net = gsm48->trx->bts->network; + struct gsm48_loc_area_id *lai = (struct gsm48_loc_area_id *) &gh->data[0]; + gsm0408_generate_lai(lai, net->country_code, + net->network_code, + gsm48->trx->bts->location_area_code); + } } bts_queue_send(gsm48, header->link_id); @@ -572,12 +580,17 @@ struct msgb *bssmap_create_layer3(struct msgb *msg_l3) struct msgb* msg; struct gsm48_loc_area_id *lai; struct gsm_bts *bts = msg_l3->lchan->ts->trx->bts; + int network_code = bts->network->network_code; msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "bssmap cmpl l3"); if (!msg) return NULL; + /* check if we need to overwrite the network code */ + if (bts->network->core_network_code > 0) + network_code = bts->network->core_network_code; + /* create the bssmap header */ msg->l3h = msgb_put(msg, 2); @@ -595,7 +608,7 @@ struct msgb *bssmap_create_layer3(struct msgb *msg_l3) lai = (struct gsm48_loc_area_id *) msgb_put(msg, sizeof(*lai)); gsm0408_generate_lai(lai, bts->network->country_code, - /*bts->network->network_code - 1*/ 8, bts->location_area_code); + network_code, bts->location_area_code); ci = (u_int16_t *) msgb_put(msg, 2); *ci = htons(bts->cell_identity); |