This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/10146 ) Change subject: cosmetic: dissolve bsc_api.c ...................................................................... cosmetic: dissolve bsc_api.c gsm0808_page() is just a thin wrapper for rsl_paging_cmd(), the only caller is page_ms() from paging.c. Directly call rsl_paging_cmd() instead. Move gsm0808_cipher_mode() to the only caller in osmo_bsc_bssap.c, make static. Change-Id: Ib7ce026b52d4ba3e53a8b2824e74ea92432c48c5 --- M include/osmocom/bsc/bsc_api.h M src/osmo-bsc/Makefile.am D src/osmo-bsc/bsc_api.c M src/osmo-bsc/osmo_bsc_bssap.c M src/osmo-bsc/paging.c M tests/handover/Makefile.am 6 files changed, 29 insertions(+), 82 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/include/osmocom/bsc/bsc_api.h b/include/osmocom/bsc/bsc_api.h index bc6c676..dcfcc45 100644 --- a/include/osmocom/bsc/bsc_api.h +++ b/include/osmocom/bsc/bsc_api.h @@ -20,10 +20,6 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t link_id, bool allow_sacch); int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate); -int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, - const uint8_t *key, int len, int include_imeisv); -int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, - unsigned int mi_len, uint8_t *mi, int chan_type); int gsm0808_clear(struct gsm_subscriber_connection *conn); bool msc_connected(struct gsm_subscriber_connection *conn); diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am index e9add36..2d479c1 100644 --- a/src/osmo-bsc/Makefile.am +++ b/src/osmo-bsc/Makefile.am @@ -35,7 +35,6 @@ acc_ramp.c \ arfcn_range_encode.c \ assignment_fsm.c \ - bsc_api.c \ bsc_ctrl_commands.c \ bsc_ctrl_lookup.c \ bsc_init.c \ diff --git a/src/osmo-bsc/bsc_api.c b/src/osmo-bsc/bsc_api.c deleted file mode 100644 index e5424c4..0000000 --- a/src/osmo-bsc/bsc_api.c +++ /dev/null @@ -1,75 +0,0 @@ -/* GSM 08.08 like API for OpenBSC. The bridge from MSC to BSC */ - -/* (C) 2010-2011 by Holger Hans Peter Freyther - * (C) 2010-2011 by On-Waves - * (C) 2009,2017 by Harald Welte <laforge at gnumonks.org> - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#include <osmocom/bsc/bsc_api.h> -#include <osmocom/bsc/gsm_data.h> -#include <osmocom/bsc/signal.h> -#include <osmocom/bsc/abis_rsl.h> -#include <osmocom/bsc/chan_alloc.h> -#include <osmocom/bsc/handover.h> -#include <osmocom/bsc/debug.h> -#include <osmocom/bsc/gsm_04_08_rr.h> -#include <osmocom/bsc/bsc_subscriber.h> -#include <osmocom/bsc/penalty_timers.h> -#include <osmocom/bsc/osmo_bsc_sigtran.h> -#include <osmocom/bsc/bsc_subscr_conn_fsm.h> -#include <osmocom/bsc/lchan_fsm.h> - -#include <osmocom/gsm/protocol/gsm_08_08.h> -#include <osmocom/gsm/gsm48.h> - -#include <osmocom/core/talloc.h> - -int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, unsigned int mi_len, - uint8_t *mi, int chan_type) -{ - return rsl_paging_cmd(bts, page_group, mi_len, mi, chan_type, false); -} - -/*! \brief We received a GSM 08.08 CIPHER MODE from the MSC */ -int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, - const uint8_t *key, int len, int include_imeisv) -{ - if (cipher > 0 && key == NULL) { - LOGP(DRSL, LOGL_ERROR, "%s: Need to have an encryption key.\n", - bsc_subscr_name(conn->bsub)); - return -1; - } - - if (len > MAX_A5_KEY_LEN) { - LOGP(DRSL, LOGL_ERROR, "%s: The key is too long: %d\n", - bsc_subscr_name(conn->bsub), len); - return -1; - } - - LOGP(DRSL, LOGL_DEBUG, "(subscr %s) Cipher Mode: cipher=%d key=%s include_imeisv=%d\n", - bsc_subscr_name(conn->bsub), cipher, osmo_hexdump_nospc(key, len), include_imeisv); - - conn->lchan->encr.alg_id = RSL_ENC_ALG_A5(cipher); - if (key) { - conn->lchan->encr.key_len = len; - memcpy(conn->lchan->encr.key, key, len); - } - - return gsm48_send_rr_ciph_mode(conn->lchan, include_imeisv); -} diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index c6fbe23..95bad7b 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -386,6 +386,34 @@ return -1; } +/*! We received a GSM 08.08 CIPHER MODE from the MSC */ +static int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, + const uint8_t *key, int len, int include_imeisv) +{ + if (cipher > 0 && key == NULL) { + LOGP(DRSL, LOGL_ERROR, "%s: Need to have an encryption key.\n", + bsc_subscr_name(conn->bsub)); + return -1; + } + + if (len > MAX_A5_KEY_LEN) { + LOGP(DRSL, LOGL_ERROR, "%s: The key is too long: %d\n", + bsc_subscr_name(conn->bsub), len); + return -1; + } + + LOGP(DRSL, LOGL_DEBUG, "(subscr %s) Cipher Mode: cipher=%d key=%s include_imeisv=%d\n", + bsc_subscr_name(conn->bsub), cipher, osmo_hexdump_nospc(key, len), include_imeisv); + + conn->lchan->encr.alg_id = RSL_ENC_ALG_A5(cipher); + if (key) { + conn->lchan->encr.key_len = len; + memcpy(conn->lchan->encr.key, key, len); + } + + return gsm48_send_rr_ciph_mode(conn->lchan, include_imeisv); +} + /* * GSM 08.08 § 3.4.7 cipher mode handling. We will have to pick * the cipher to be used for this. In case we are already using diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index bc1927e..0ef89c1 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -96,7 +96,7 @@ page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc, str_to_imsi(request->bsub->imsi)); - gsm0808_page(bts, page_group, mi_len, mi, request->chan_type); + rsl_paging_cmd(bts, page_group, mi_len, mi, request->chan_type, false); log_set_context(LOG_CTX_BSC_SUBSCR, NULL); } diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am index 3ce870b..5e9af04 100644 --- a/tests/handover/Makefile.am +++ b/tests/handover/Makefile.am @@ -43,7 +43,6 @@ $(top_builddir)/src/osmo-bsc/abis_rsl.o \ $(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \ $(top_builddir)/src/osmo-bsc/assignment_fsm.o \ - $(top_builddir)/src/osmo-bsc/bsc_api.o \ $(top_builddir)/src/osmo-bsc/bsc_init.o \ $(top_builddir)/src/osmo-bsc/bsc_rll.o \ $(top_builddir)/src/osmo-bsc/bsc_subscr_conn_fsm.o \ -- To view, visit https://gerrit.osmocom.org/10146 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ib7ce026b52d4ba3e53a8b2824e74ea92432c48c5 Gerrit-Change-Number: 10146 Gerrit-PatchSet: 6 Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180728/0dfb2aa9/attachment.htm>