--- openbsc/src/libbsc/bsc_init.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 8fd72cf..cd5ee58 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -351,6 +351,8 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal, static int bootstrap_bts(struct gsm_bts *bts) { int i, n; + struct gsm_bts_trx *cur_trx; + struct gsm_bts_trx *trx;
if (bts->model->start && !bts->model->started) { int ret = bts->model->start(bts->network); @@ -394,6 +396,17 @@ static int bootstrap_bts(struct gsm_bts *bts) return -EINVAL; }
+ llist_for_each_entry(cur_trx, &bts->trx_list, list) { + llist_for_each_entry(trx, &bts->trx_list, list) { + if ((cur_trx->arfcn == trx->arfcn) && (cur_trx->nr != trx->nr)) { + LOGP(DNM, LOGL_ERROR, "BTS should not use duplicate ARFCNs. " + "Duplicate ARFCN = %d BTS = %d TRX = %d TRX = %d\n", + trx->arfcn, bts->nr, cur_trx->nr, trx->nr); + return -EINVAL; + } + } + } + if (bts->network->auth_policy == GSM_AUTH_POLICY_ACCEPT_ALL && !bts->si_common.rach_control.cell_bar) LOGP(DNM, LOGL_ERROR, "\nWARNING: You are running an 'accept-all' "
--- openbsc/include/openbsc/gsm_data.h | 1 + openbsc/src/libcommon/gsm_data.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 41fe328..d6a107f 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -424,6 +424,7 @@ void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr, void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat); struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); +struct gsm_bts_trx *gsm_bts_trx_by_arfcn(struct gsm_bts *bts, int arfcn);
/* generic E1 line operations for all ISDN-based BTS. */ extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index 5f7e32e..9e3d360 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -225,6 +225,17 @@ struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) return NULL; }
+struct gsm_bts_trx *gsm_bts_trx_by_arfcn(struct gsm_bts *bts, int arfcn) +{ + struct gsm_bts_trx *trx; + + llist_for_each_entry(trx, &bts->trx_list, list) { + if (trx->arfcn == arfcn) + return trx; + } + return NULL; +} + /* Search for a BTS in the given Location Area; optionally start searching * with start_bts (for continuing to search after the first result) */ struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
Hi Sylvain,
The arfcn should be a uint16_t like is it in the structure. Please try to be consitent in the usage of types.
Thank you for review. I just noticed that function gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr) has the same problem. So I think, I will fix both functions in a separate commit.
If bsc receives Delete_Ind message from bts, bsc should release allocated channel, which was specified in dropped imm_assign message. --- openbsc/src/libbsc/abis_rsl.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index f53ba84..773090a 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1539,6 +1539,40 @@ static int rsl_rx_ccch_load(struct msgb *msg) return 0; }
+/* CCCH is overloaded, IMM_ASSIGN was dropped */ +static int rsl_rx_delete_ind(struct gsm_bts_trx *trx, struct msgb *msg) +{ + struct abis_rsl_dchan_hdr *rqd_hdr = msgb_l2(msg); + struct gsm48_imm_ass *ia; + struct gsm_lchan *lchan; + struct gsm_bts_trx *cur_trx; + uint8_t chan_nr; + uint16_t arfcn; + + /* bts didn't send IMM_ASSIGN, so we should release allocated channel */ + if (msgb_l2len(msg) != MACBLOCK_SIZE + 6) + return -EIO; + + ia = (struct gsm48_imm_ass *) (rqd_hdr->data + 2); + + if (ia->msg_type == GSM48_MT_RR_IMM_ASS) { + chan_nr = ia->chan_desc.chan_nr; + arfcn = ia->chan_desc.h0.arfcn_high; + arfcn = (arfcn << 8) | ia->chan_desc.h0.arfcn_low; + cur_trx = gsm_bts_trx_by_arfcn(trx->bts, arfcn); + if (!cur_trx) + return -EINVAL; + lchan = lchan_lookup(cur_trx, chan_nr); + if (!lchan) + return -EINVAL; + if (lchan->state != LCHAN_S_ACTIVE) + return -EINVAL; + rsl_direct_rf_release(lchan); + } + + return 0; +} + static int abis_rsl_rx_cchan(struct msgb *msg) { struct e1inp_sign_link *sign_link = msg->dst; @@ -1557,7 +1591,9 @@ static int abis_rsl_rx_cchan(struct msgb *msg) rc = rsl_rx_ccch_load(msg); break; case RSL_MT_DELETE_IND: - /* CCCH overloaded, IMM_ASSIGN was dropped */ + /* CCCH is overloaded, IMM_ASSIGN was dropped */ + rc = rsl_rx_delete_ind(sign_link->trx, msg); + break; case RSL_MT_CBCH_LOAD_IND: /* current load on the CBCH */ LOGP(DRSL, LOGL_NOTICE, "Unimplemented Abis RSL TRX message "
On 20.02.2014 08:28, Ivan Kluchnikov wrote:
If bsc receives Delete_Ind message from bts, bsc should release allocated channel, which was specified in dropped imm_assign message. +/* CCCH is overloaded, IMM_ASSIGN was dropped */ +static int rsl_rx_delete_ind(struct gsm_bts_trx *trx, struct msgb *msg) +{
[...]
- if (ia->msg_type == GSM48_MT_RR_IMM_ASS) {
Why are you not checking again != GSM48_MT_RR_IMM_ASS_REJ? What's with the IMM.ASS.EXT messages?
Jacob
Hi Jacob,
There are two reasons, why I use == GSM48_MT_RR_IMM_ASS: - currently IMM.ASS.EXT messages are not used in openbsc - this code can handle only IMM.ASS messages, because IMM.ASS.EXT message allocates two channels and we should release these two channels in this case.
2014-02-20 13:24 GMT+04:00 Jacob Erlbeck jerlbeck@sysmocom.de:
On 20.02.2014 08:28, Ivan Kluchnikov wrote:
If bsc receives Delete_Ind message from bts, bsc should release allocated channel, which was specified in dropped imm_assign message. +/* CCCH is overloaded, IMM_ASSIGN was dropped */ +static int rsl_rx_delete_ind(struct gsm_bts_trx *trx, struct msgb *msg) +{
[...]
if (ia->msg_type == GSM48_MT_RR_IMM_ASS) {Why are you not checking again != GSM48_MT_RR_IMM_ASS_REJ? What's with the IMM.ASS.EXT messages?
Jacob
On Thu, Feb 20, 2014 at 02:11:03PM +0400, Ivan Kluchnikov wrote:
Hi Jacob,
There are two reasons, why I use == GSM48_MT_RR_IMM_ASS:
- currently IMM.ASS.EXT messages are not used in openbsc
- this code can handle only IMM.ASS messages, because IMM.ASS.EXT
IMM.ASS.EXT may be created by the BTS. So the argument above is based on a wrong assumption of yours.
2014-02-20 19:19 GMT+04:00 Holger Hans Peter Freyther holger@freyther.de:
IMM.ASS.EXT may be created by the BTS. So the argument above is based on a wrong assumption of yours.
Ok, actually my argument is based on assumption that currently IMM.ASS.EXT messages are not used in openbsc and osmo-bts. And I think, it is true. As I know, IMM.ASS.EXT messages are not created by osmo-bts. Do you know BTSs, which support creating IMM.ASS.EXT or it is just theoretical assumption?
On Fri, Feb 21, 2014 at 10:10 AM, Ivan Kluchnikov Ivan.Kluchnikov@fairwaves.ru wrote:
2014-02-20 19:19 GMT+04:00 Holger Hans Peter Freyther holger@freyther.de:
IMM.ASS.EXT may be created by the BTS. So the argument above is based on a wrong assumption of yours.
Ok, actually my argument is based on assumption that currently IMM.ASS.EXT messages are not used in openbsc and osmo-bts. And I think, it is true. As I know, IMM.ASS.EXT messages are not created by osmo-bts. Do you know BTSs, which support creating IMM.ASS.EXT or it is just theoretical assumption?
The idea is that OsmoBTS may start supporting this message, while being used with the current version of OpenBSC. Their codebase is not linked together. And thus we should handle this situation.
2014-02-21 10:17 GMT+04:00 Alexander Chemeris alexander.chemeris@gmail.com:
The idea is that OsmoBTS may start supporting this message, while being used with the current version of OpenBSC. Their codebase is not linked together. And thus we should handle this situation.
In this case, it is not a problem to enhance my code in future. But now openbsc just ignores IMM.ASS.EXT messages, like IMM.ASS.REJ messages.