diff options
author | Harald Welte <laforge@netfilter.org> | 2009-10-23 20:32:07 +0200 |
---|---|---|
committer | Harald Welte <laforge@netfilter.org> | 2009-10-23 20:32:07 +0200 |
commit | 1e14f25d3a2dc65ce7cc43a832ead4d1b9225c83 (patch) | |
tree | 95e9220c3fb5398dab827a12d631624fed2aaf1c /openbsc | |
parent | 3a2865437b6f9cc9676ef1d069bb1edd1047b0b8 (diff) | |
parent | ca0fcbe1573b33924b3cba8349e5777688f2ef7a (diff) |
Merge branch 'master' into gprs
Conflicts:
openbsc/src/abis_nm.c
openbsc/src/bsc_init.c
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/abis_nm.h | 1 | ||||
-rw-r--r-- | openbsc/include/openbsc/debug.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_04_08.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_04_11.h | 3 | ||||
-rw-r--r-- | openbsc/include/openbsc/ipaccess.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/msgb.h | 1 | ||||
-rw-r--r-- | openbsc/include/openbsc/timer.h | 1 | ||||
-rwxr-xr-x | openbsc/src/abis_nm.c | 34 | ||||
-rw-r--r-- | openbsc/src/abis_rsl.c | 2 | ||||
-rw-r--r-- | openbsc/src/bsc_init.c | 187 | ||||
-rw-r--r-- | openbsc/src/db.c | 8 | ||||
-rw-r--r-- | openbsc/src/gsm_04_08.c | 8 | ||||
-rw-r--r-- | openbsc/src/gsm_04_11.c | 4 | ||||
-rw-r--r-- | openbsc/src/input/ipaccess.c | 6 | ||||
-rw-r--r-- | openbsc/src/msgb.c | 20 | ||||
-rw-r--r-- | openbsc/src/rrlp.c | 1 | ||||
-rw-r--r-- | openbsc/src/timer.c | 2 | ||||
-rw-r--r-- | openbsc/src/token_auth.c | 3 | ||||
-rw-r--r-- | openbsc/src/transaction.c | 2 |
19 files changed, 145 insertions, 144 deletions
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h index 25450091f..8765a7a00 100644 --- a/openbsc/include/openbsc/abis_nm.h +++ b/openbsc/include/openbsc/abis_nm.h @@ -482,6 +482,7 @@ enum abis_nm_avail_state { NM_AVSTATE_DEPENDENCY = 5, NM_AVSTATE_DEGRADED = 6, NM_AVSTATE_NOT_INSTALLED= 7, + NM_AVSTATE_OK = 0xff, }; /* Section 9.4.13: Channel Combination */ diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 73b45ff03..92d6bb309 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -32,7 +32,7 @@ #define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; char *hexdump(const unsigned char *buf, int len); -void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...); +void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); void debug_parse_category_mask(const char* mask); void debug_use_color(int use_color); void debug_timestamp(int enable); diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 485e240cd..8c944e6ac 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -726,7 +726,7 @@ int gsm48_mi_to_string(char *string, const int str_len, const u_int8_t *mi, cons int gsm48_send_rr_release(struct gsm_lchan *lchan); int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); int gsm48_send_rr_app_info(struct gsm_lchan *lchan, u_int8_t apdu_id, - u_int8_t apdu_len, u_int8_t *apdu); + u_int8_t apdu_len, const u_int8_t *apdu); int bsc_upqueue(struct gsm_network *net); diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h index bfa90b522..1851bba53 100644 --- a/openbsc/include/openbsc/gsm_04_11.h +++ b/openbsc/include/openbsc/gsm_04_11.h @@ -210,4 +210,7 @@ int gsm411_send_sms_lchan(struct gsm_lchan *lchan, struct gsm_sms *sms); struct gsm_sms *sms_alloc(void); void sms_free(struct gsm_sms *sms); +void _gsm411_sms_trans_free(struct gsm_trans *trans); +int gsm411_send_sms_subscr(struct gsm_subscriber *subscr, + struct gsm_sms *sms); #endif diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h index 87942f270..eb17167b5 100644 --- a/openbsc/include/openbsc/ipaccess.h +++ b/openbsc/include/openbsc/ipaccess.h @@ -1,6 +1,8 @@ #ifndef _IPACCESS_H #define _IPACCESS_H +#include "e1_input.h" + struct ipaccess_head { u_int8_t zero; u_int8_t len; diff --git a/openbsc/include/openbsc/msgb.h b/openbsc/include/openbsc/msgb.h index fbef296af..861202e51 100644 --- a/openbsc/include/openbsc/msgb.h +++ b/openbsc/include/openbsc/msgb.h @@ -57,6 +57,7 @@ extern struct msgb *msgb_alloc(u_int16_t size, const char *name); extern void msgb_free(struct msgb *m); extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); extern struct msgb *msgb_dequeue(struct llist_head *queue); +extern void msgb_reset(struct msgb *m); #define msgb_l2(m) ((void *)(m->l2h)) #define msgb_l3(m) ((void *)(m->l3h)) diff --git a/openbsc/include/openbsc/timer.h b/openbsc/include/openbsc/timer.h index ae67a5a1a..a1ad92cfc 100644 --- a/openbsc/include/openbsc/timer.h +++ b/openbsc/include/openbsc/timer.h @@ -67,5 +67,6 @@ int bsc_timer_pending(struct timer_list *timer); struct timeval *bsc_nearest_timer(); void bsc_prepare_timers(); int bsc_update_timers(); +int bsc_timer_check(void); #endif diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c index 67ea1749c..4693e23ca 100755 --- a/openbsc/src/abis_nm.c +++ b/openbsc/src/abis_nm.c @@ -587,6 +587,14 @@ const char *nm_adm_name(u_int8_t adm) } } +static void debugp_foh(struct abis_om_fom_hdr *foh) +{ + DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ", + obj_class_name(foh->obj_class), foh->obj_class, + foh->obj_inst.bts_nr, foh->obj_inst.trx_nr, + foh->obj_inst.ts_nr); +} + /* obtain the gsm_nm_state data structure for a given object instance */ static struct gsm_nm_state * objclass2nmstate(struct gsm_bts *bts, u_int8_t obj_class, @@ -775,7 +783,7 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb) } if (TLVP_PRESENT(&tp, NM_ATT_ADM_STATE)) { new_state.administrative = *TLVP_VAL(&tp, NM_ATT_ADM_STATE); - DEBUGPC(DNM, "ADM=%02s ", nm_adm_name(new_state.administrative)); + DEBUGPC(DNM, "ADM=%2s ", nm_adm_name(new_state.administrative)); } DEBUGPC(DNM, "\n"); @@ -823,10 +831,7 @@ static int abis_nm_rcvmsg_report(struct msgb *mb) struct abis_om_fom_hdr *foh = msgb_l3(mb); u_int8_t mt = foh->msg_type; - DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ", - obj_class_name(foh->obj_class), foh->obj_class, - foh->obj_inst.bts_nr, foh->obj_inst.trx_nr, - foh->obj_inst.ts_nr); + debugp_foh(foh); //nmh->cfg->report_cb(mb, foh); @@ -884,6 +889,10 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb) int nack = 0; int ret; + debugp_foh(foh); + + DEBUGPC(DNM, "SW Activate Request: "); + /* We NACK NSVC1 since we only use NSVC0 */ if (is_ipaccess_bts(mb->trx->bts) && foh->obj_class == NM_OC_GPRS_NSVC && @@ -989,10 +998,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb) if (is_in_arr(mt, nacks, ARRAY_SIZE(nacks))) { struct tlv_parsed tp; - DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ", - obj_class_name(foh->obj_class), foh->obj_class, - foh->obj_inst.bts_nr, foh->obj_inst.trx_nr, - foh->obj_inst.ts_nr); + debugp_foh(foh); if (nack_names[mt]) DEBUGPC(DNM, "%s NACK ", nack_names[mt]); @@ -1875,11 +1881,12 @@ int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8 struct abis_om_hdr *oh; struct msgb *msg = nm_msgb_alloc(); - DEBUGP(DNM, "Sending OPSTART obj_class=0x%02x obj_inst=(0x%02x, 0x%02x, 0x%02x)\n", - obj_class, i0, i1, i2); oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); fill_om_fom_hdr(oh, 0, NM_MT_OPSTART, obj_class, i0, i1, i2); + debugp_foh((struct abis_om_fom_hdr *) oh->data); + DEBUGPC(DNM, "Sending OPSTART\n"); + return abis_nm_sendmsg(bts, msg); } @@ -2498,10 +2505,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg) foh = (struct abis_om_fom_hdr *) (oh->data + 1 + idstrlen); abis_nm_tlv_parse(&tp, foh->data, oh->length-sizeof(*foh)); - DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ", - obj_class_name(foh->obj_class), foh->obj_class, - foh->obj_inst.bts_nr, foh->obj_inst.trx_nr, - foh->obj_inst.ts_nr); + debugp_foh(foh); DEBUGPC(DNM, "IPACCESS(0x%02x): ", foh->msg_type); diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c index 800f2027f..da12d9373 100644 --- a/openbsc/src/abis_rsl.c +++ b/openbsc/src/abis_rsl.c @@ -971,7 +971,7 @@ static int rsl_rx_meas_res(struct msgb *msg) } if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) { DEBUGPC(DMEAS, "L3\n"); - msg->l3h = TLVP_VAL(&tp, RSL_IE_L3_INFO); + msg->l3h = (u_int8_t *) TLVP_VAL(&tp, RSL_IE_L3_INFO); return gsm0408_rcvmsg(msg, 0); } else DEBUGPC(DMEAS, "\n"); diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c index 047757e7d..92808b2f9 100644 --- a/openbsc/src/bsc_init.c +++ b/openbsc/src/bsc_init.c @@ -405,95 +405,84 @@ int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj, struct gsm_bts_trx_ts *ts; struct gsm_bts_gprs_nsvc *nsvc; - /* This is currently only required on nanoBTS */ - - switch (evt) { - case EVT_STATECHG_OPER: - switch (obj_class) { - case NM_OC_SITE_MANAGER: - bts = container_of(obj, struct gsm_bts, site_mgr); - if (old_state->operational != 2 && new_state->operational == 2) { - abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff); - } - break; - case NM_OC_BTS: - bts = obj; - if (new_state->availability == NM_AVSTATE_DEPENDENCY) { - patch_nm_tables(bts); - abis_nm_set_bts_attr(bts, nanobts_attr_bts, - sizeof(nanobts_attr_bts)); - abis_nm_opstart(bts, NM_OC_BTS, - bts->bts_nr, 0xff, 0xff); - abis_nm_chg_adm_state(bts, NM_OC_BTS, - bts->bts_nr, 0xff, 0xff, - NM_STATE_UNLOCKED); - } - break; - case NM_OC_CHANNEL: - ts = obj; - trx = ts->trx; - if (new_state->availability == NM_AVSTATE_DEPENDENCY) { - enum abis_nm_chan_comb ccomb = - abis_nm_chcomb4pchan(ts->pchan); - abis_nm_set_channel_attr(ts, ccomb); - abis_nm_opstart(trx->bts, NM_OC_CHANNEL, - trx->bts->bts_nr, trx->nr, ts->nr); - abis_nm_chg_adm_state(trx->bts, NM_OC_CHANNEL, - trx->bts->bts_nr, trx->nr, ts->nr, - NM_STATE_UNLOCKED); - } - break; - case NM_OC_GPRS_NSE: - bts = container_of(obj, struct gsm_bts, gprs.nse); - if (new_state->availability == 5) { - abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_NSE, - bts->bts_nr, - 0xff, 0xff, - nanobts_attr_nse, - sizeof(nanobts_attr_nse)); - abis_nm_opstart(bts, NM_OC_GPRS_NSE, - bts->bts_nr, 0xff, 0xff); - abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSE, - bts->bts_nr, 0xff, 0xff, - NM_STATE_UNLOCKED); - } - break; - case NM_OC_GPRS_CELL: - bts = container_of(obj, struct gsm_bts, gprs.cell); - if (new_state->availability == 5) { - abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_CELL, - bts->bts_nr, 0, 0xff, - nanobts_attr_cell, - sizeof(nanobts_attr_cell)); - abis_nm_opstart(bts, NM_OC_GPRS_NSE, - bts->bts_nr, 0xff, 0xff); - abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSE, - bts->bts_nr, 0xff, 0xff, - NM_STATE_UNLOCKED); - } - break; - case NM_OC_GPRS_NSVC: - nsvc = obj; - bts = nsvc->bts; - if (new_state->availability == NM_AVSTATE_OFF_LINE) { - abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_NSVC, - bts->bts_nr, - nsvc->id, 0xff, - nanobts_attr_nsvc0, - sizeof(nanobts_attr_nsvc0)); - abis_nm_opstart(bts, NM_OC_GPRS_NSVC, - bts->bts_nr, nsvc->id, 0xff); - abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSVC, - bts->bts_nr, 0, 0xff, - NM_STATE_UNLOCKED); - } - break; - default: - break; + /* This event-driven BTS setup is currently only required on nanoBTS */ + + /* EVT_STATECHG_ADM is called after we call chg_adm_state() and would create + * endless loop */ + if (evt != EVT_STATECHG_OPER) + return 0; + + switch (obj_class) { + case NM_OC_SITE_MANAGER: + bts = container_of(obj, struct gsm_bts, site_mgr); + if (new_state->operational == 2 && + new_state->availability == NM_AVSTATE_OK) + abis_nm_opstart(bts, obj_class, 0xff, 0xff, 0xff); + break; + case NM_OC_BTS: + bts = obj; + if (new_state->availability == NM_AVSTATE_DEPENDENCY) { + patch_nm_tables(bts); + abis_nm_set_bts_attr(bts, nanobts_attr_bts, + sizeof(nanobts_attr_bts)); + abis_nm_chg_adm_state(bts, obj_class, + bts->bts_nr, 0xff, 0xff, + NM_STATE_UNLOCKED); + abis_nm_opstart(bts, obj_class, + bts->bts_nr, 0xff, 0xff); + } + break; + case NM_OC_CHANNEL: + ts = obj; + trx = ts->trx; + if (new_state->operational == 1 && + new_state->availability == NM_AVSTATE_DEPENDENCY) { + if (ts->nr == 0 && trx == trx->bts->c0) + abis_nm_set_channel_attr(ts, NM_CHANC_BCCHComb); + else + abis_nm_set_channel_attr(ts, NM_CHANC_TCHFull); + abis_nm_chg_adm_state(trx->bts, obj_class, + trx->bts->bts_nr, trx->nr, ts->nr, + NM_STATE_UNLOCKED); + abis_nm_opstart(trx->bts, obj_class, + trx->bts->bts_nr, trx->nr, ts->nr); + } + break; + case NM_OC_RADIO_CARRIER: + trx = obj; + if (new_state->operational == 1 && + new_state->availability == NM_AVSTATE_OFF_LINE) { + /* Patch ARFCN into radio attribute */ + nanobts_attr_radio[5] &= 0xf0; + nanobts_attr_radio[5] |= trx->arfcn >> 8; + nanobts_attr_radio[6] = trx->arfcn & 0xff; + abis_nm_set_radio_attr(trx, nanobts_attr_radio, + sizeof(nanobts_attr_radio)); + abis_nm_chg_adm_state(trx->bts, obj_class, + trx->bts->bts_nr, trx->nr, 0xff, + NM_STATE_UNLOCKED); + abis_nm_opstart(trx->bts, obj_class, trx->bts->bts_nr, + trx->nr, 0xff); + } + if (new_state->operational == 1 && + new_state->availability == NM_AVSTATE_OK) + abis_nm_opstart(trx->bts, obj_class, trx->bts->bts_nr, + trx->nr, 0xff); + break; + case NM_OC_BASEB_TRANSC: + trx = container_of(obj, struct gsm_bts_trx, bb_transc); + if (new_state->operational == 1 && + new_state->availability == NM_AVSTATE_DEPENDENCY) { + abis_nm_chg_adm_state(trx->bts, obj_class, + trx->bts->bts_nr, trx->nr, 0xff, + NM_STATE_UNLOCKED); + abis_nm_opstart(trx->bts, obj_class, + trx->bts->bts_nr, trx->nr, 0xff); + /* TRX software is active, tell it to initiate RSL Link */ + abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei); } break; default: - //DEBUGP(DMM, "Unhandled state change in %s:%d\n", __func__, __LINE__); break; } return 0; @@ -506,29 +495,8 @@ static int sw_activ_rep(struct msgb *mb) struct gsm_bts *bts = mb->trx->bts; struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr); - if (!trx) - return -ENODEV; switch (foh->obj_class) { - case NM_OC_BASEB_TRANSC: - /* TRX software is active, tell it to initiate RSL Link */ - abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei); - abis_nm_opstart(trx->bts, NM_OC_BASEB_TRANSC, - trx->bts->bts_nr, trx->nr, 0xff); - abis_nm_chg_adm_state(trx->bts, NM_OC_BASEB_TRANSC, - trx->bts->bts_nr, trx->nr, 0xff, - NM_STATE_UNLOCKED); - break; - case NM_OC_RADIO_CARRIER: - patch_nm_tables(trx->bts); - abis_nm_set_radio_attr(trx, nanobts_attr_radio, - sizeof(nanobts_attr_radio)); - abis_nm_opstart(trx->bts, NM_OC_RADIO_CARRIER, - trx->bts->bts_nr, trx->nr, 0xff); - abis_nm_chg_adm_state(trx->bts, NM_OC_RADIO_CARRIER, - trx->bts->bts_nr, trx->nr, 0xff, - NM_STATE_UNLOCKED); - break; } return 0; } @@ -636,7 +604,7 @@ static void nm_reconfig_trx(struct gsm_bts_trx *trx) case GSM_BAND_1900: trx->nominal_power = 23; break; - dedfault: + default: fprintf(stderr, "Unsupported nanoBTS GSM band %s\n", gsm_band_name(trx->bts->band)); break; @@ -984,9 +952,6 @@ static void patch_nm_tables(struct gsm_bts *bts) bs11_attr_radio[2] &= 0xf0; bs11_attr_radio[2] |= arfcn_high; bs11_attr_radio[3] = arfcn_low; - nanobts_attr_radio[5] &= 0xf0; - nanobts_attr_radio[5] |= arfcn_high; - nanobts_attr_radio[6] = arfcn_low; /* patch BSIC */ bs11_attr_bts[1] = bts->bsic; diff --git a/openbsc/src/db.c b/openbsc/src/db.c index 270d4d90b..b86348c55 100644 --- a/openbsc/src/db.c +++ b/openbsc/src/db.c @@ -439,9 +439,11 @@ int db_sync_equipment(struct gsm_equipment *equip) { dbi_result result; unsigned char *cm2, *cm3; + u_int8_t classmark1; + memcpy(&classmark1, &equip->classmark1, sizeof(classmark1)); printf("DB: Sync Equipment IMEI=%s, classmark1=%02x", - equip->imei, equip->classmark1); + equip->imei, classmark1); if (equip->classmark2_len) printf(", classmark2=%s", hexdump(equip->classmark2, equip->classmark2_len)); @@ -462,7 +464,7 @@ int db_sync_equipment(struct gsm_equipment *equip) "classmark2 = %s, " "classmark3 = %s " "WHERE imei = '%s' ", - equip->classmark1, cm2, cm3, equip->imei); + classmark1, cm2, cm3, equip->imei); free(cm2); free(cm3); @@ -853,7 +855,7 @@ int db_apdu_blob_store(struct gsm_subscriber *subscr, u_int8_t *apdu) { dbi_result result; - char *q_apdu; + unsigned char *q_apdu; dbi_conn_quote_binary_copy(conn, apdu, len, &q_apdu); diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index 9467d79a6..cd883a3fa 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -1128,9 +1128,7 @@ int gsm48_tx_mm_info(struct gsm_lchan *lchan) struct gsm48_hdr *gh; struct gsm_network *net = lchan->ts->trx->bts->network; u_int8_t *ptr8; - u_int16_t *ptr16; int name_len, name_pad; - int i; #if 0 time_t cur_t; struct tm* cur_time; @@ -1458,7 +1456,7 @@ static int gsm0408_rcv_mm(struct msgb *msg) } /* Receive a PAGING RESPONSE message from the MS */ -static int gsm48_rr_rx_pag_resp(struct msgb *msg) +static int gsm48_rx_rr_pag_resp(struct msgb *msg) { struct gsm_bts *bts = msg->lchan->ts->trx->bts; struct gsm48_hdr *gh = msgb_l3(msg); @@ -1613,7 +1611,7 @@ static int gsm0408_rcv_rr(struct msgb *msg) DEBUGP(DRR, "GRPS SUSPEND REQUEST\n"); break; case GSM48_MT_RR_PAG_RESP: - rc = gsm48_rr_rx_pag_resp(msg); + rc = gsm48_rx_rr_pag_resp(msg); break; case GSM48_MT_RR_CHAN_MODE_MODIF_ACK: DEBUGP(DRR, "CHANNEL MODE MODIFY ACK\n"); @@ -1645,7 +1643,7 @@ static int gsm0408_rcv_rr(struct msgb *msg) } int gsm48_send_rr_app_info(struct gsm_lchan *lchan, u_int8_t apdu_id, - u_int8_t apdu_len, u_int8_t *apdu) + u_int8_t apdu_len, const u_int8_t *apdu) { struct msgb *msg = gsm48_msgb_alloc(); struct gsm48_hdr *gh; diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c index 59020746f..6e59eafe4 100644 --- a/openbsc/src/gsm_04_11.c +++ b/openbsc/src/gsm_04_11.c @@ -674,7 +674,7 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans, * successfully receive the SMS. We need to investigate * the cause and take action depending on it */ - DEBUGP(DSMS, "RX SMS RP-ERROR, cause %d (%s)\n", cause, + DEBUGP(DSMS, "RX SMS RP-ERROR, cause %d:%d (%s)\n", cause_len, cause, get_value_string(rp_cause_strs, cause)); if (!trans->sms.is_mt) { @@ -1068,8 +1068,6 @@ static int subscr_sig_cb(unsigned int subsys, unsigned int signal, struct gsm_lchan *lchan; struct gsm_sms *sms; - u_int32_t token; - switch (signal) { case S_SUBSCR_ATTACHED: /* A subscriber has attached. Check if there are diff --git a/openbsc/src/input/ipaccess.c b/openbsc/src/input/ipaccess.c index 2ca10d9c8..745b824d9 100644 --- a/openbsc/src/input/ipaccess.c +++ b/openbsc/src/input/ipaccess.c @@ -237,7 +237,6 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, trx->rsl_link = e1inp_sign_link_create(e1i_ts, E1INP_SIGN_RSL, trx, trx->rsl_tei, 0); - e1inp_event(e1i_ts, EVT_E1_TEI_UP, trx->rsl_tei, 0); /* get rid of our old temporary bfd */ memcpy(newbfd, bfd, sizeof(*newbfd)); bsc_unregister_fd(bfd); @@ -251,6 +250,7 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, /* FIXME: this is per BTS */ static int oml_up = 0; +static int rsl_up = 0; /* * read one ipa message from the socket @@ -348,6 +348,10 @@ static int handle_ts1_read(struct bsc_fd *bfd) switch (link->type) { case E1INP_SIGN_RSL: + if (!rsl_up) { + e1inp_event(e1i_ts, EVT_E1_TEI_UP, link->tei, link->sapi); + rsl_up = 1; + } ret = abis_rsl_rcvmsg(msg); break; case E1INP_SIGN_OML: diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c index 52edf2dcd..edeb975a9 100644 --- a/openbsc/src/msgb.c +++ b/openbsc/src/msgb.c @@ -74,6 +74,26 @@ struct msgb *msgb_dequeue(struct llist_head *queue) return llist_entry(lh, struct msgb, list); } +void msgb_reset(struct msgb *msg) +{ + msg->len = 0; + msg->len = 0; + msg->data = msg->_data; + + msg->head = msg->data; + msg->data = msg->data; + /* reset tail pointer */ + msg->tail = msg->data; + + /* reset pointers */ + msg->bts_link = NULL; + msg->trx = NULL; + msg->lchan = NULL; + msg->l2h = NULL; + msg->l3h = NULL; + msg->smsh = NULL; +} + static __attribute__((constructor)) void on_dso_load_trau_msgb(void) { tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 1, "msgb"); diff --git a/openbsc/src/rrlp.c b/openbsc/src/rrlp.c index 61bb20244..523b53f0b 100644 --- a/openbsc/src/rrlp.c +++ b/openbsc/src/rrlp.c @@ -26,6 +26,7 @@ #include <openbsc/gsm_04_08.h> #include <openbsc/signal.h> #include <openbsc/gsm_subscriber.h> +#include <openbsc/chan_alloc.h> /* RRLP MS based position request */ static const u_int8_t ms_based_pos_req[] = { 0x40, 0x01, 0x78, 0xa8 }; diff --git a/openbsc/src/timer.c b/openbsc/src/timer.c index 6f974a2c3..ffeb4aba3 100644 --- a/openbsc/src/timer.c +++ b/openbsc/src/timer.c @@ -176,7 +176,7 @@ restart: int bsc_timer_check(void) { struct timer_list *timer; - int i; + int i = 0; llist_for_each_entry(timer, &timer_list, entry) { i++; diff --git a/openbsc/src/token_auth.c b/openbsc/src/token_auth.c index 695b55243..0931007ef 100644 --- a/openbsc/src/token_auth.c +++ b/openbsc/src/token_auth.c @@ -33,6 +33,9 @@ #define TOKEN_SMS_TEXT "HAR 2009 GSM. Register at http://har2009.gnumonks.org/ " \ "Your IMSI is %s, auth token is %08X, phone no is %s." +extern struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, + const char *text); + static char *build_sms_string(struct gsm_subscriber *subscr, u_int32_t token) { char *sms_str; diff --git a/openbsc/src/transaction.c b/openbsc/src/transaction.c index 950faa2f1..04eaa3c99 100644 --- a/openbsc/src/transaction.c +++ b/openbsc/src/transaction.c @@ -86,8 +86,6 @@ struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, void trans_free(struct gsm_trans *trans) { - struct gsm_bts *bts; - switch (trans->protocol) { case GSM48_PDISC_CC: _gsm48_cc_trans_free(trans); |